| 1 | package org.europa.together.service; | |
| 2 | ||
| 3 | import java.util.ArrayList; | |
| 4 | import java.util.List; | |
| 5 | import org.apiguardian.api.API; | |
| 6 | import static org.apiguardian.api.API.Status.STABLE; | |
| 7 | import org.europa.together.application.LogbackLogger; | |
| 8 | import org.europa.together.business.ConfigurationDAO; | |
| 9 | import org.europa.together.business.Logger; | |
| 10 | import org.europa.together.domain.ConfigurationDO; | |
| 11 | import org.europa.together.domain.LogLevel; | |
| 12 | import org.europa.together.exceptions.DAOException; | |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | import org.springframework.stereotype.Service; | |
| 15 | ||
| 16 | /** | |
| 17 | * Service implementation for the ConfigutarionDAO. | |
| 18 | * | |
| 19 | * @author elmar.dott@gmail.com | |
| 20 | * @version 1.0 | |
| 21 | * @since 1.0 | |
| 22 | */ | |
| 23 | @API(status = STABLE, since = "1.0") | |
| 24 | @Service | |
| 25 | public final class ConfigurationService { | |
| 26 | ||
| 27 | private static final long serialVersionUID = 205L; | |
| 28 | private static final Logger LOGGER = new LogbackLogger(ConfigurationService.class); | |
| 29 | ||
| 30 | @Autowired | |
| 31 | private ConfigurationDAO configurationDAO; | |
| 32 | ||
| 33 | /** | |
| 34 | * Constructor. | |
| 35 | */ | |
| 36 | @API(status = STABLE, since = "1.0") | |
| 37 | public ConfigurationService() { | |
| 38 | LOGGER.log("instance class", LogLevel.INFO); | |
| 39 | } | |
| 40 | ||
| 41 | /** | |
| 42 | * Reset all configuration key entries for a module back to the default | |
| 43 | * values. | |
| 44 | * | |
| 45 | * @param module as String | |
| 46 | * @throws org.europa.together.exceptions.DAOException in case of error | |
| 47 | */ | |
| 48 | @API(status = STABLE, since = "1.0") | |
| 49 | public void resetModuleToDefault(final String module) | |
| 50 | throws DAOException { | |
| 51 | List<ConfigurationDO> configurationEntries = configurationDAO.getAllModuleEntries(module); | |
| 52 | for (ConfigurationDO entry : configurationEntries) { | |
| 53 |
1
1. resetModuleToDefault : removed call to org/europa/together/business/ConfigurationDAO::restoreKeyToDefault → KILLED |
configurationDAO.restoreKeyToDefault(entry); |
| 54 | } | |
| 55 | } | |
| 56 | ||
| 57 | /** | |
| 58 | * Filter all mandatory entries of a ConfigSet. | |
| 59 | * | |
| 60 | * @param module as String | |
| 61 | * @param version as String | |
| 62 | * @param configSet as String | |
| 63 | * @return mandatoryEntries as List | |
| 64 | */ | |
| 65 | @API(status = STABLE, since = "1.0") | |
| 66 | public List<ConfigurationDO> filterMandatoryFieldsOfConfigSet( | |
| 67 | final String module, final String version, final String configSet) { | |
| 68 | List<ConfigurationDO> mandantoryEntries = new ArrayList<>(); | |
| 69 | List<ConfigurationDO> configurationEntries | |
| 70 | = configurationDAO.getAllConfigurationSetEntries(module, version, configSet); | |
| 71 | for (ConfigurationDO entry : configurationEntries) { | |
| 72 |
1
1. filterMandatoryFieldsOfConfigSet : negated conditional → KILLED |
if (entry.isMandatory()) { |
| 73 | mandantoryEntries.add(entry); | |
| 74 | } | |
| 75 | } | |
| 76 |
1
1. filterMandatoryFieldsOfConfigSet : replaced return value with Collections.emptyList for org/europa/together/service/ConfigurationService::filterMandatoryFieldsOfConfigSet → KILLED |
return mandantoryEntries; |
| 77 | } | |
| 78 | } | |
Mutations | ||
| 53 |
1.1 |
|
| 72 |
1.1 |
|
| 76 |
1.1 |