1 /* 2 * Copyright (C) 2003-2012 eXo Platform SAS. 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU Affero General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU Affero General Public License for more details. 13 * 14 * You should have received a copy of the GNU Affero General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 package org.exoplatform.commons.api.settings.data; 18 19 import org.exoplatform.commons.api.settings.SettingValue; 20 21 /** 22 * Supports the setting event management that contains all information of event. 23 * @LevelAPI Experimental 24 */ 25 public class SettingData { 26 27 EventType eventType; 28 29 SettingContext settingContext; 30 31 SettingValue<?> settingValue; 32 33 /** 34 * Creates the setting data with the specified event type and context. 35 * The context could be USER/GLOBAL context or a specified scope or a specified setting property. 36 * @param eventType The event type that has been dispatched. 37 * @param settingContext The event setting context. 38 * @LevelAPI Experimental 39 */ 40 public SettingData(EventType eventType, SettingContext settingContext) { 41 super(); 42 this.eventType = eventType; 43 this.settingContext = settingContext; 44 } 45 46 /** 47 * Creates the setting data with the specified event type and setting properties. 48 * @param eventType The event type that has been dispatched. 49 * @param settingContext The event setting context. 50 * @param settingValue The event setting value. 51 * @LevelAPI Experimental 52 */ 53 public SettingData(EventType eventType, 54 SettingContext settingContext, 55 SettingValue<?> settingValue) { 56 super(); 57 this.eventType = eventType; 58 this.settingContext = settingContext; 59 this.settingValue = settingValue; 60 } 61 62 /** 63 * Gets an event type associated with the setting data. 64 * @return The event type. 65 * @LevelAPI Experimental 66 */ 67 public EventType getEventType() { 68 return eventType; 69 } 70 71 /** 72 * Sets an event type associated with the setting data. 73 * @LevelAPI Experimental 74 */ 75 public void setEventType(EventType eventType) { 76 this.eventType = eventType; 77 } 78 79 /** 80 * Gets a setting context associated with the setting data. 81 * @return The setting context. 82 * @LevelAPI Experimental 83 */ 84 public SettingContext getSettingContext() { 85 return settingContext; 86 } 87 88 /** 89 * Sets a setting context associated with the setting data. 90 * @LevelAPI Experimental 91 */ 92 public void setSettingContext(SettingContext settingContext) { 93 this.settingContext = settingContext; 94 } 95 96 /** 97 * Gets a setting value of setting property associated with the setting data. 98 * @return The setting value object, or "null" if context is at the Context or Scope level. 99 * @LevelAPI Experimental 100 */ 101 public SettingValue<?> getSettingValue() { 102 //TODO: return list of setting value in level Context and Scope 103 return settingValue; 104 } 105 106 /** 107 * Sets a setting value of setting property (SettingKey) associated with the setting data. 108 * @LevelAPI Experimental 109 */ 110 public void setSettingValue(SettingValue<?> settingValue) { 111 //TODO: not set setting value in level Context and Scope 112 this.settingValue = settingValue; 113 } 114 115 116 117 118 119 120 121 122 }