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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
47 |
1 |
@API(status = STABLE, since = "1.0")... |
48 |
|
public void resetModuleToDefault(final String module) |
49 |
|
throws DAOException { |
50 |
1 |
List<ConfigurationDO> configurationEntries = configurationDAO.getAllModuleEntries(module); |
51 |
1 |
for (ConfigurationDO entry : configurationEntries) { |
52 |
10 |
configurationDAO.restoreKeyToDefault(entry); |
53 |
|
} |
54 |
|
} |
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
@param |
60 |
|
@param |
61 |
|
@param |
62 |
|
@return |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
64 |
1 |
@API(status = STABLE, since = "1.0")... |
65 |
|
public List<ConfigurationDO> filterMandatoryFieldsOfConfigSet( |
66 |
|
final String module, final String version, final String configSet) { |
67 |
1 |
List<ConfigurationDO> mandantoryEntries = new ArrayList<>(); |
68 |
1 |
List<ConfigurationDO> configurationEntries |
69 |
|
= configurationDAO.getAllConfigurationSetEntries(module, version, configSet); |
70 |
1 |
for (ConfigurationDO entry : configurationEntries) { |
71 |
3 |
if (entry.isMandatory()) { |
72 |
1 |
mandantoryEntries.add(entry); |
73 |
|
} |
74 |
|
} |
75 |
1 |
return mandantoryEntries; |
76 |
|
} |
77 |
|
} |