| 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 |
|
|
| 18 |
|
|
| 19 |
|
@author |
| 20 |
|
@version |
| 21 |
|
@since |
| 22 |
|
|
| 23 |
|
@API(status = STABLE, since = "1.0") |
| 24 |
|
@Service |
| |
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 4 |
Complexity Density: 0.4 |
|
| 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 |
|
|
| 35 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 36 |
1 |
@API(status = STABLE, since = "1.0")... |
| 37 |
|
public ConfigurationService() { |
| 38 |
1 |
LOGGER.log("instance class", LogLevel.INFO); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
@param |
| 46 |
|
@throws |
| 47 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 48 |
1 |
@API(status = STABLE, since = "1.0")... |
| 49 |
|
public void resetModuleToDefault(final String module) |
| 50 |
|
throws DAOException { |
| 51 |
1 |
List<ConfigurationDO> configurationEntries = configurationDAO.getAllModuleEntries(module); |
| 52 |
1 |
for (ConfigurationDO entry : configurationEntries) { |
| 53 |
10 |
configurationDAO.restoreKeyToDefault(entry); |
| 54 |
|
} |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
@param |
| 61 |
|
@param |
| 62 |
|
@param |
| 63 |
|
@return |
| 64 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 65 |
1 |
@API(status = STABLE, since = "1.0")... |
| 66 |
|
public List<ConfigurationDO> filterMandatoryFieldsOfConfigSet( |
| 67 |
|
final String module, final String version, final String configSet) { |
| 68 |
1 |
List<ConfigurationDO> mandantoryEntries = new ArrayList<>(); |
| 69 |
1 |
List<ConfigurationDO> configurationEntries |
| 70 |
|
= configurationDAO.getAllConfigurationSetEntries(module, version, configSet); |
| 71 |
1 |
for (ConfigurationDO entry : configurationEntries) { |
| 72 |
3 |
if (entry.isMandatory()) { |
| 73 |
1 |
mandantoryEntries.add(entry); |
| 74 |
|
} |
| 75 |
|
} |
| 76 |
1 |
return mandantoryEntries; |
| 77 |
|
} |
| 78 |
|
} |