KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > cowsultants > itracker > ejb > client > interfaces > SystemConfiguration


1 /*
2  * This software was designed and created by Jason Carroll.
3  * Copyright (c) 2002, 2003, 2004 Jason Carroll.
4  * The author can be reached at jcarroll@cowsultants.com
5  * ITracker website: http://www.cowsultants.com
6  * ITracker forums: http://www.cowsultants.com/phpBB/index.php
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it only under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  */

18
19 package cowsultants.itracker.ejb.client.interfaces;
20
21 import java.util.*;
22 import javax.ejb.EJBLocalObject JavaDoc;
23
24 import cowsultants.itracker.ejb.client.models.*;
25
26 public interface SystemConfiguration extends EJBLocalObject JavaDoc {
27     public static final String JavaDoc JNDI_NAME = "ejb/SystemConfiguration";
28
29     public Properties getProperties();
30
31     public String JavaDoc getProperty(String JavaDoc name);
32     public String JavaDoc getProperty(String JavaDoc name, String JavaDoc defaultValue);
33     public boolean getBooleanProperty(String JavaDoc name, boolean defaultValue);
34     public int getIntegerProperty(String JavaDoc name, int defaultValue);
35     public long getLongProperty(String JavaDoc name, long defaultValue);
36
37     public ConfigurationModel getConfigurationItem(Integer JavaDoc id);
38     /**
39       * Returns all the configuration items of a particular type. The name values
40       * for all the items will not be initialized.
41       * @param type the type of configuration items to retrieve
42       * @return an array of ConfigurationModels
43       */

44     public ConfigurationModel[] getConfigurationItemsByType(int type);
45     /**
46       * Returns all the configuration items of a particular type. In addition, all
47       * of the configuration items name values will be initialized to the values
48       * for the supplied locale.
49       * @param type the type of configuration items to retrieve
50       * @param locale the locale to use when setting the configuration items name values
51       * @return an array of ConfigurationModels
52       */

53     public ConfigurationModel[] getConfigurationItemsByType(int type, Locale locale);
54     /**
55       * This method will create a new ConfigurationBean for persistance in the database.
56       * @param model the model to create the bean from
57       * @returns and updated model with the information from the newly created bean
58       */

59     public ConfigurationModel createConfigurationItem(ConfigurationModel model);
60     /**
61       * This method updates a configuration item in the database. It does not include any updates
62       * to language items that would be used to display the localized value of the item.
63       * @param model a ConfigurationModel of the item to update
64       * @return a ConfigurationModel with the updated item
65       */

66     public ConfigurationModel updateConfigurationItem(ConfigurationModel model);
67     public ConfigurationModel[] updateConfigurationItems(ConfigurationModel[] models, int type);
68
69     public boolean configurationItemExists(ConfigurationModel model);
70     public boolean configurationItemUpToDate(ConfigurationModel model);
71
72     /**
73       * This method will remove the configuration item with the supplied id.
74       * @param id the id of the configuration information to remove
75       */

76     public void removeConfigurationItem(Integer JavaDoc id);
77     /**
78       * This method will remove all configuration items that match the supplied type. This
79       * will remove all items of that type such as all system status values.
80       * @param type the type of configuration information to remove
81       */

82     public void removeConfigurationItems(int type);
83     /**
84       * This method will remove all configuration items that match the supplied models
85       * type and value. This effectively eliminates all previous versions of the item.
86       * It is normally called prior to a create to remove any older copies of this item.
87       * @param model the model to determine the type and value from
88       */

89     public void removeConfigurationItems(ConfigurationModel model);
90
91     /**
92       * This method will reset any caches in the system of configuration items for all configuration
93       * item types.
94       */

95     public void resetConfigurationCache();
96     /**
97       * This method will reset any caches in the system of configuration items for the specified
98       * configuration item type.
99       * @param type the type of configuration item to reset in any caches
100       */

101     public void resetConfigurationCache(int type);
102
103
104     /**
105       * This method will return the requested custom field.
106       * @param id the id of the requested field
107       * @return a CustomFieldModel with the requested field, or null if not found
108       */

109     public CustomFieldModel getCustomField(Integer JavaDoc id);
110     /**
111       * This method will return all the custom fields defined in the system.
112       * @return an array of CustomFieldModels
113       */

114     public CustomFieldModel[] getCustomFields();
115     /**
116       * This method will return all the custom fields defined in the system. It will
117       * also initialize all of the field labels using the supplied locale.
118       * @param locale the locale to use to initialize the labels
119       * @return an array of CustomFieldModels
120       */

121     public CustomFieldModel[] getCustomFields(Locale locale);
122     /**
123       * This method will create a new CustomField for persistance in the database. If the
124       * field includes a set of option values, those will be created also.
125       * @param model the model to create the field from
126       * @returns and updated model with the information from the newly created field
127       */

128     public CustomFieldModel createCustomField(CustomFieldModel model);
129     /**
130       * This method updates a custom field in the database. It does not include any updates
131       * to language items that would be used to display the localized label for the field.
132       * If any options are included, the list will be used to replace any existing options.
133       * @param model a CustomFieldModel of the item to update
134       * @return a CustomFieldModel with the updated item
135       */

136     public CustomFieldModel updateCustomField(CustomFieldModel model);
137     /**
138       * Removes a single custom field from the database.
139       * @param customFieldValueId the id of the custom field to remove
140       */

141     public void removeCustomField(Integer JavaDoc customFieldId);
142     /**
143       * This method will return the requested custom field value.
144       * @param id the id of the requested field value
145       * @return a CustomFieldModel with the requested field value, or null if not found
146       */

147     public CustomFieldValueModel getCustomFieldValue(Integer JavaDoc id);
148     /**
149       * This method will create a new CustomFieldValue for persistance in the database.
150       * @param model the model to create the field from
151       * @returns and updated model with the information from the newly created field
152       */

153     public CustomFieldValueModel createCustomFieldValue(CustomFieldValueModel model);
154     /**
155       * This method updates a custom field value in the database. It does not include any updates
156       * to language items that would be used to display the localized label for the field value.
157       * @param model a CustomFieldValueModel of the item to update
158       * @return a CustomFieldValueModel with the updated item
159       */

160     public CustomFieldValueModel updateCustomFieldValue(CustomFieldValueModel model);
161     /**
162       * This method updates a set of custom field values in the database. If the array of values
163       * is null or zero length, it will remove all existing values from the custom field. Otherwise
164       * it will update the value and sort order of all the values. If the array of models contains
165       * more or less values than the current custom field, it will not remove theose values, or create
166       * new values.
167       * @param customFieldId the id of the custom field to update
168       * @param models an array of CustomFieldValueModels to update
169       * @return a array of CustomFieldValueModels with the updated items
170       */

171     public CustomFieldValueModel[] updateCustomFieldValues(Integer JavaDoc customFieldId, CustomFieldValueModel[] models);
172     /**
173       * Removes a single custom field value from the database.
174       * @param customFieldValueId the id of the custom field value to remove
175       */

176     public void removeCustomFieldValue(Integer JavaDoc customFieldValueId);
177     /**
178       * Removes all custom field values from the database for a single custom field.
179       * @param customFieldId the id of the custom field to remove the values for
180       */

181     public void removeCustomFieldValues(Integer JavaDoc customFieldId);
182
183     /**
184       * This method will return the translation for a particular key in a locale.
185       * @param key the key to look up
186       * @param locale the localue to translate the key for
187       * @return a LanguageModel with the translation
188       */

189     public LanguageModel getLanguageItemByKey(String JavaDoc key, Locale locale);
190     /**
191       * This method will return all the translations for a particular key.
192       * @param key the key to look up
193       * @return an array of LanguageModels with the translations for the key
194       */

195     public LanguageModel[] getLanguageItemsByKey(String JavaDoc key);
196     /**
197       * Updates a translations for a particular key and locale.
198       * @param model A LanguageModel for the key to update
199       * @return a LanguageModel with the updated translation
200       */

201     public LanguageModel updateLanguageItem(LanguageModel model);
202     /**
203       * This method will remove all language items with the supplied key regardless
204       * of locale.
205       * @param key the key to remove
206       */

207     public void removeLanguageKey(String JavaDoc key);
208     public void removeLanguageItem(LanguageModel model);
209
210     /**
211       * This method will return the current configuration of the system.
212       * @return a SystemConfigurationModel with the current configuration of the system
213       */

214     public SystemConfigurationModel getSystemConfiguration(Locale locale);
215
216     /**
217       * Returns all of the keys currently defined in the base locale sorted and grouped in a
218       * logical manner.
219       */

220     public String JavaDoc[] getSortedKeys();
221
222     public HashMap getDefinedKeys(String JavaDoc locale);
223     public NameValuePairModel[] getDefinedKeysAsArray(String JavaDoc locale);
224     public int getNumberDefinedKeys(String JavaDoc locale);
225     public HashMap getAvailableLanguages();
226     public LanguageModel[] getLanguage(Locale locale);
227     public void updateLanguage(Locale locale, LanguageModel[] models);
228     public void updateLanguage(Locale locale, LanguageModel[] models, ConfigurationModel config);
229
230     /**
231       * This method will load the specified locale. It will look for the appropriate properties file,
232       * and then load all of the resources into the database.
233       * @param locale the locale to load
234       * @param forceReload if true, it will reload the languages from the property file even if it is listed
235       * as being up to date
236       */

237     public boolean initializeLocale(String JavaDoc locale, boolean forceReload);
238
239     /**
240       * This method will load the some default system configuration data into the database. The values
241       * it loads are determined from the base ITracker.properties file so the language intiialization
242       * <b>must</b> be performed before this method is called.
243       */

244     public void initializeConfiguration();
245 }
246
Popular Tags