Revision 49813
Added by Panagiotis Kanakakis over 6 years ago
ValidatorApiImpl.java | ||
---|---|---|
3 | 3 |
import eu.dnetlib.api.functionality.ValidatorServiceException; |
4 | 4 |
import eu.dnetlib.domain.functionality.validator.StoredJob; |
5 | 5 |
import eu.dnetlib.repo.manager.service.utils.OaiTools; |
6 |
import eu.dnetlib.repo.manager.shared.ValidationServiceException; |
|
6 | 7 |
import gr.uoa.di.driver.util.ServiceLocator; |
7 | 8 |
import eu.dnetlib.domain.functionality.validator.JobForValidation; |
8 | 9 |
import eu.dnetlib.domain.functionality.validator.RuleSet; |
... | ... | |
16 | 17 |
import org.springframework.beans.factory.annotation.Autowired; |
17 | 18 |
import org.springframework.stereotype.Component; |
18 | 19 |
import org.springframework.web.bind.annotation.PathVariable; |
20 |
import sun.rmi.runtime.Log; |
|
19 | 21 |
|
20 | 22 |
import javax.annotation.PostConstruct; |
21 | 23 |
import javax.annotation.Resource; |
... | ... | |
49 | 51 |
|
50 | 52 |
@PostConstruct |
51 | 53 |
private void loadRules(){ |
52 |
|
|
54 |
LOGGER.debug("PostConstruct method! Load rules!"); |
|
53 | 55 |
try { |
54 | 56 |
for (RuleSet ruleSet : getValidationService().getRuleSets()) { |
55 | 57 |
if (ruleSet.getVisibility() != null && ruleSet.getVisibility().contains("development")) { |
... | ... | |
78 | 80 |
|
79 | 81 |
@Override |
80 | 82 |
public void submitJobForValidation(JobForValidation jobForValidation) { |
83 |
LOGGER.debug("Submit job for validation with id : " + jobForValidation.getDatasourceId()); |
|
81 | 84 |
try { |
82 | 85 |
this.getValidationService().submitValidationJob(jobForValidation); |
83 | 86 |
} catch (ValidatorServiceException e) { |
... | ... | |
87 | 90 |
|
88 | 91 |
@Override |
89 | 92 |
public void reSubmitJobForValidation(String jobId) throws JSONException { |
90 |
|
|
93 |
LOGGER.debug("Resubmit validation job with id : " + jobId); |
|
91 | 94 |
StoredJob job = monitorApi.getJobSummary(jobId,"all"); |
92 | 95 |
Set<Integer> contentRules = new HashSet<Integer>(); |
93 | 96 |
Set<Integer> usageRules = new HashSet<Integer>(); |
... | ... | |
116 | 119 |
|
117 | 120 |
@Override |
118 | 121 |
public List<RuleSet> getRuleSets(@PathVariable("mode") String mode) { |
122 |
LOGGER.info("Getting rulesets for mode: " + mode); |
|
119 | 123 |
return rulesetMap.get(mode); |
120 | 124 |
} |
121 | 125 |
|
122 | 126 |
@Override |
123 | 127 |
public List<String> getSetsOfRepository(String url) { |
128 |
LOGGER.debug("Getting sets of repository with url : " + url); |
|
124 | 129 |
try { |
125 | 130 |
return OaiTools.getSetsOfRepo(url); |
126 | 131 |
} catch (Exception e) { |
... | ... | |
129 | 134 |
return null; |
130 | 135 |
} |
131 | 136 |
|
137 |
@Override |
|
138 |
public boolean identifyRepo(String url) { |
|
139 |
LOGGER.debug("Identify repository with url : " + url); |
|
140 |
try { |
|
141 |
return OaiTools.identifyRepository(url); |
|
142 |
} catch (Exception e) { |
|
143 |
LOGGER.error("Error while identifying repository with url: " + url, e); |
|
144 |
return false; |
|
145 |
} |
|
146 |
} |
|
147 |
|
|
148 |
@Override |
|
149 |
public RuleSet getRuleSet(String acronym) { |
|
150 |
LOGGER.debug("Getting ruleset with acronym : " + acronym); |
|
151 |
RuleSet ruleSet = null; |
|
152 |
try { |
|
153 |
for (List<RuleSet> ruleSets : this.rulesetMap.values()) { |
|
154 |
for (RuleSet rSet : ruleSets) |
|
155 |
if (rSet.getGuidelinesAcronym().equals(acronym)) { |
|
156 |
ruleSet = rSet; |
|
157 |
break; |
|
158 |
} |
|
159 |
} |
|
160 |
return ruleSet; |
|
161 |
} catch (Exception e) { |
|
162 |
LOGGER.error("Error getting ruleset", e); |
|
163 |
return null; |
|
164 |
} |
|
165 |
} |
|
166 |
|
|
132 | 167 |
} |
Also available in: Unified diff
1. New method ( delete repository interface ) on repo api.
2. New method ( get ruleset with acronym ) on validator api.
3. Log messages in every api.