| Class | Line # | Actions | |||||
|---|---|---|---|---|---|---|---|
| ConfigurationDAO | 28 | 0 | - | 0 | 0 |
| 1 | package org.europa.together.business; | |
| 2 | ||
| 3 | import java.util.List; | |
| 4 | import org.apiguardian.api.API; | |
| 5 | import static org.apiguardian.api.API.Status.STABLE; | |
| 6 | import org.europa.together.domain.ConfigurationDO; | |
| 7 | import org.europa.together.exceptions.DAOException; | |
| 8 | import org.springframework.stereotype.Component; | |
| 9 | ||
| 10 | /** | |
| 11 | * The ConfigurationDAO provides all functionality for an application wide | |
| 12 | * configuration. An configuration entry is a simple key=value pair in context | |
| 13 | * of a module. The domain object supports features for versioning the | |
| 14 | * entries.<br> | |
| 15 | * | |
| 16 | * Domain Object: ID, CONF_KEY, CONF_VALUE, DEFAULT_VALUE, CONF_SET, MODUL_NAME, | |
| 17 | * MODUL_VERSION, DEPRECATED, COMMENT<br> | |
| 18 | * | |
| 19 | * The keys are stored as SHA-256 hash, to protect the database against direct | |
| 20 | * editing. | |
| 21 | * | |
| 22 | * @author elmar.dott@gmail.com | |
| 23 | * @version 1.2 | |
| 24 | * @since 1.0 | |
| 25 | */ | |
| 26 | @API(status = STABLE, since = "1.0", consumers = "ConfigurationHbmDAO") | |
| 27 | @Component | |
| 28 | public interface ConfigurationDAO extends GenericDAO<ConfigurationDO, String> { | |
| 29 | ||
| 30 | /** | |
| 31 | * Identifier for the given feature. | |
| 32 | */ | |
| 33 | @API(status = STABLE, since = "1.2") | |
| 34 | String FEATURE_ID = "CM-05"; | |
| 35 | ||
| 36 | /** | |
| 37 | * Get the whole configuration object by a given key, module and the version | |
| 38 | * of the module. | |
| 39 | * | |
| 40 | * @param key as String | |
| 41 | * @param module as String | |
| 42 | * @param version as String | |
| 43 | * @return configuration as Object | |
| 44 | */ | |
| 45 | @API(status = STABLE, since = "1.0") | |
| 46 | ConfigurationDO getConfigurationByKey(String key, String module, String version); | |
| 47 | ||
| 48 | /** | |
| 49 | * Return a List with all configuration objects of a ConfigurationSet.A | |
| 50 | * ConfigurationSet is a collection of all configuration entries of one | |
| 51 | * version for a service like email inside a module. | |
| 52 | * | |
| 53 | * @param module as String | |
| 54 | * @param version as String | |
| 55 | * @param configSet as Sting | |
| 56 | * @return ConfigurationSet as List<Configuration> | |
| 57 | */ | |
| 58 | @API(status = STABLE, since = "1.0") | |
| 59 | List<ConfigurationDO> | |
| 60 | getAllConfigurationSetEntries(String module, String version, String configSet); | |
| 61 | ||
| 62 | /** | |
| 63 | * Get all configuration entries for a module. | |
| 64 | * | |
| 65 | * @param module as String | |
| 66 | * @return ConfigurationSet as List<Configuration> | |
| 67 | */ | |
| 68 | @API(status = STABLE, since = "1.0") | |
| 69 | List<ConfigurationDO> getAllModuleEntries(String module); | |
| 70 | ||
| 71 | /** | |
| 72 | * Return a List of all deprecated ConfigurationDO. | |
| 73 | * | |
| 74 | * @return deprecated as List<Configuration> | |
| 75 | */ | |
| 76 | @API(status = STABLE, since = "1.0") | |
| 77 | List<ConfigurationDO> getAllDeprecatedEntries(); | |
| 78 | ||
| 79 | /** | |
| 80 | * In the case that for a module exist more versions than one. For example | |
| 81 | * after some upgrades, this method supports a history function of the | |
| 82 | * previous configuration. | |
| 83 | * | |
| 84 | * @param module as String | |
| 85 | * @param key as String | |
| 86 | * @param configSet as String | |
| 87 | * @return history as List<Configuration> | |
| 88 | */ | |
| 89 | @API(status = STABLE, since = "1.0") | |
| 90 | List<ConfigurationDO> getHistoryOfAEntry(String module, String key, String configSet); | |
| 91 | ||
| 92 | /** | |
| 93 | * Return the value of a key from a module. The hashing of the key will be | |
| 94 | * done in this function, so the usage is more easy. The identifier for a | |
| 95 | * configuration entry is a combination of the key itself, the module-name | |
| 96 | * and the module-version were the DAO stored who use the module. e. g.: | |
| 97 | * E-Mail Configuration is implemented in core, since version 1.0 | |
| 98 | * | |
| 99 | * In the case a entry exist but the value is empty, then the default value | |
| 100 | * will used. | |
| 101 | * | |
| 102 | * @param key as String | |
| 103 | * @param module as String | |
| 104 | * @param version as String | |
| 105 | * @return value as String | |
| 106 | */ | |
| 107 | @API(status = STABLE, since = "1.0") | |
| 108 | String getValueByKey(String key, String module, String version); | |
| 109 | ||
| 110 | /** | |
| 111 | * Restore a single entry to his default value. | |
| 112 | * | |
| 113 | * @param entry as Configuration | |
| 114 | * @throws org.europa.together.exceptions.DAOException in case of error | |
| 115 | */ | |
| 116 | @API(status = STABLE, since = "1.0") | |
| 117 | void restoreKeyToDefault(ConfigurationDO entry) | |
| 118 | throws DAOException; | |
| 119 | ||
| 120 | /** | |
| 121 | * Update a List of existing configuration entries. | |
| 122 | * | |
| 123 | * @param configuration as List<Configuration> | |
| 124 | * @throws org.europa.together.exceptions.DAOException in case of error | |
| 125 | */ | |
| 126 | @API(status = STABLE, since = "1.0") | |
| 127 | void updateConfigurationEntries(List<ConfigurationDO> configuration) | |
| 128 | throws DAOException; | |
| 129 | } |