1. Project Clover database Wed Jan 17 2024 23:40:18 CST
  2. Package org.europa.together.service

File ConfigurationService.java

 

Coverage histogram

../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

2
10
3
1
77
46
4
0.4
3.33
3
1.33

Classes

Class Line # Actions
ConfigurationService 25 10 0% 4 0
1.0100%
 

Contributing tests

No tests hitting this source file were found.

Source view

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  1 toggle @API(status = STABLE, since = "1.0")
37    public ConfigurationService() {
38  1 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    */
 
47  1 toggle @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    * Filter all mandatory entries of a ConfigSet.
58    *
59    * @param module as String
60    * @param version as String
61    * @param configSet as String
62    * @return mandatoryEntries as List
63    */
 
64  1 toggle @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    }