1 |
1 |
package eu.dnetlib.validator.service.impls.listeners;
|
2 |
2 |
|
3 |
|
import java.util.ArrayList;
|
4 |
3 |
import java.util.List;
|
5 |
4 |
import java.util.Map;
|
6 |
5 |
|
7 |
6 |
import org.apache.log4j.Logger;
|
|
7 |
import org.springframework.http.*;
|
8 |
8 |
import org.springframework.transaction.annotation.Propagation;
|
9 |
9 |
import org.springframework.transaction.annotation.Transactional;
|
10 |
10 |
|
... | ... | |
14 |
14 |
import eu.dnetlib.validator.engine.execution.CompletedTask;
|
15 |
15 |
import eu.dnetlib.validator.engine.execution.JobListener;
|
16 |
16 |
import gr.uoa.di.driver.util.ServiceLocator;
|
|
17 |
import org.springframework.util.LinkedMultiValueMap;
|
|
18 |
import org.springframework.util.MultiValueMap;
|
|
19 |
import org.springframework.web.client.RestTemplate;
|
17 |
20 |
|
18 |
21 |
public class RegistrationListener implements JobListener{
|
19 |
22 |
|
20 |
|
private Emailer emailer = null;
|
21 |
|
private String valBaseUrl = null;
|
|
23 |
// private String valBaseUrl = null;
|
|
24 |
private String providerUrl = null;
|
22 |
25 |
private JobsDAO jobsDao;
|
23 |
|
private ServiceLocator<DatasourceManagerService> dmService = null;
|
24 |
|
|
25 |
|
private static final int BASE_SCORE = 50;
|
26 |
|
|
|
26 |
|
27 |
27 |
private int jobId;
|
28 |
|
private String activationId, userMail, officialName, baseUrl, datasourceId, interfaceId, interfaceIdOld, validationSet, desiredCompLevel, repoType;
|
|
28 |
// private String activationId;
|
|
29 |
private String userMail;
|
|
30 |
// private String officialName;
|
|
31 |
// private String baseUrl;
|
|
32 |
private String datasourceId;
|
|
33 |
private String interfaceId;
|
|
34 |
// private String interfaceIdOld;
|
|
35 |
// private String validationSet;
|
|
36 |
// private String desiredCompLevel;
|
|
37 |
// private String repoType;
|
29 |
38 |
|
30 |
|
private String msgSubject;
|
31 |
|
|
32 |
39 |
private boolean updateExisting;
|
33 |
|
|
34 |
|
private List<String> adminEmails;
|
35 |
40 |
|
36 |
|
private boolean job1Success = false;
|
37 |
|
private boolean job2Success = false;
|
38 |
|
|
39 |
|
private boolean critFailDone = false;
|
40 |
|
|
41 |
41 |
private int totalJobs;
|
42 |
42 |
private int jobsFinished = 0;
|
43 |
43 |
|
44 |
44 |
private int score_content = 0, score_usage = 0;
|
45 |
|
|
|
45 |
|
46 |
46 |
private static Logger logger = Logger.getLogger(RegistrationListener.class);
|
47 |
|
|
48 |
|
|
|
47 |
|
49 |
48 |
public RegistrationListener() {
|
50 |
|
logger.debug("Creating a pre-registration listener for job "+jobId + " on repo "+baseUrl);
|
|
49 |
logger.error("Creating new registration listener");
|
51 |
50 |
}
|
52 |
51 |
|
53 |
|
public synchronized void jobSuccess(int jobId, int score_content, int score_usage) {
|
54 |
|
logger.debug("Preregistration job "+jobId+" finished");
|
55 |
|
this.score_content = score_content;
|
56 |
|
this.score_usage = score_usage;
|
57 |
|
this.jobId=jobId;
|
58 |
|
if (score_content >= BASE_SCORE)
|
59 |
|
job1Success = true;
|
60 |
|
if (score_usage >= BASE_SCORE)
|
61 |
|
job2Success = true;
|
62 |
|
if (job1Success == job2Success == true) {
|
63 |
|
this.criticalSuccess();
|
64 |
|
} else {
|
65 |
|
if(!critFailDone)
|
66 |
|
this.criticalFailure();
|
67 |
|
critFailDone = true;
|
68 |
|
}
|
69 |
|
}
|
70 |
|
|
71 |
|
|
72 |
|
public synchronized void jobFailure(int jobId, String error) {
|
73 |
|
logger.debug("Pregistration job "+jobId+" failed with exception: "+error);
|
74 |
|
this.jobId=jobId;
|
75 |
|
if(!critFailDone)
|
76 |
|
this.criticalFailure();
|
77 |
|
critFailDone = true;
|
78 |
|
}
|
79 |
|
|
80 |
|
private void criticalSuccess() {
|
81 |
|
try {
|
82 |
|
String msgOpenaireV2 = "OpenAIRE v2, please consider to upgrade to OpenAIRE Guidelines v3. Link: https://guidelines.openaire.eu/wiki/OpenAIRE_Guidelines:_For_Literature_repositories";
|
83 |
|
String msgDriver = "OpenAIRE Basic (ex DRIVER) Guidelines, please consider to upgrade to OpenAIRE Guidelines v3. Link: https://guidelines.openaire.eu/wiki/OpenAIRE_Guidelines:_For_Literature_repositories";
|
84 |
|
String msgOpenaireV3 = "OpenAIRE Guidelines v3 (for literature)";
|
85 |
|
String msgOpenaireV2_data = "OpenAIRE Guidelines v2 (for data archives)";
|
86 |
|
String msgVersion = msgOpenaireV3;
|
87 |
|
String msg100 = "\n\nWe also encourage you to display the following logo at your repository's/journal's homepage to indicate that it is 100% OpenAIRE compliant: " + valBaseUrl + "/jsps/images/compliant.png";
|
88 |
|
String msgInformUser = "An email has been send to the repository's/journal's administrators to inform them about this registration";
|
89 |
|
String msgInformAdmins = "The " + repoType + " was registered by user: " + userMail + " , who is not listed as repository's/journal's administrator. If you have any concerns, please visit " + valBaseUrl + " to edit your repository's/journal's information. Please Sign in or Register with this email address.";
|
90 |
|
String msgGuidelines = "OpenAIRE Guidelines v3 (for literature)";
|
91 |
|
logger.debug("Critical Success of pre-registration validations on repo: "+baseUrl+" and set: " + validationSet + " with scores ("+score_content+", "+score_usage+")");
|
92 |
|
|
93 |
|
if (this.desiredCompLevel.equalsIgnoreCase("openaire2.0")) {
|
94 |
|
msgVersion = msgOpenaireV2;
|
95 |
|
msgGuidelines = "OpenAIRE For Literature Repositories (OpenAIRE 2.0)";
|
96 |
|
} else if (this.desiredCompLevel.equalsIgnoreCase("driver")) {
|
97 |
|
msgVersion = msgDriver;
|
98 |
|
msgGuidelines = "OpenAIRE For Literature Repositories (Basic - ex DRIVER)";
|
99 |
|
} else if (this.desiredCompLevel.equalsIgnoreCase("openaire2.0_data")) {
|
100 |
|
msgVersion = msgOpenaireV2_data;
|
101 |
|
msgGuidelines = "OpenAIRE For Data Archives (OpenAIRE 2.0)";
|
102 |
|
} else if (this.desiredCompLevel.equalsIgnoreCase("openaire3.0")) {
|
103 |
|
msgVersion = msgOpenaireV3;
|
104 |
|
msgGuidelines = "OpenAIRE For Literature Repositories (OpenAIRE 3.0)";
|
105 |
|
}
|
106 |
|
if (score_content == 100 && score_usage == 100)
|
107 |
|
emailer.sendMail(this.adminEmails, getMsgSubject() + "- Test Results [" + this.officialName + "]", "Congratulations!! Your " + repoType + " has successfully passed the test to become compliant with " + msgVersion + "." + msg100, false, null);
|
108 |
|
else
|
109 |
|
emailer.sendMail(this.adminEmails, getMsgSubject() + "- Test Results [" + this.officialName + "]", "Congratulations!! Your " + repoType + " has successfully passed the test to become compliant with " + msgVersion + ".", false, null);
|
110 |
|
|
111 |
|
this.updateRepositoryInterfaceCompliance(officialName, datasourceId, interfaceId, desiredCompLevel, validationSet, baseUrl, interfaceIdOld);
|
112 |
|
|
113 |
|
// mail to user informing him of the success
|
114 |
|
List<String> rec = new ArrayList<String>();
|
115 |
|
rec.add(this.userMail);
|
116 |
|
if (adminEmails.contains(userMail)) {
|
117 |
|
emailer.sendMail(rec, getMsgSubject() + "- Results [" + this.officialName + "]", "The compatibility test of your " + repoType + " was successful. Nevertheless, some erros might still exist. We strongly recommend reviewing the results and correcting any errors found:\n" + valBaseUrl + "/prepareSummary.action?jobId=" + this.jobId + "\n", false, null);
|
118 |
|
}
|
119 |
|
else {
|
120 |
|
emailer.sendMail(rec, getMsgSubject() + "- Results [" + this.officialName + "]", "The compatibility test of your " + repoType + " was successful. Nevertheless, some erros might still exist. We strongly recommend reviewing the results and correcting any errors found:\n" + valBaseUrl + "/prepareSummary.action?jobId=" + this.jobId + "\n\n" + msgInformUser, false, null);
|
121 |
|
rec.clear();
|
122 |
|
rec.addAll(adminEmails);
|
123 |
|
emailer.sendMail(rec, getMsgSubject() + "- Results [" + this.officialName + "]", "The compatibility test of your " + repoType + " was successful. Nevertheless, some erros might still exist. We strongly recommend reviewing the results and correcting any errors found:\n" + valBaseUrl + "/prepareSummary.action?jobId=" + this.jobId + "\n\n" + msgInformAdmins, false, null);
|
124 |
|
}
|
125 |
|
|
126 |
|
// mail to specials informing them of the new repository
|
127 |
|
// registration
|
128 |
|
rec.clear();
|
129 |
|
if (this.isUpdateExisting())
|
130 |
|
emailer.sendMail(rec, getMsgSubject() + "- Results (success) [" + this.officialName + "]", "An OpenAIRE compliant " + repoType + " has been updated." + "\n\nOfficial Name: " + this.officialName + "\n\nBase URL: " + this.baseUrl + "\n\nValidation Set: " + this.validationSet + "\n\nGuidelines: " + msgGuidelines, true, null);
|
131 |
|
else
|
132 |
|
emailer.sendMail(rec, getMsgSubject() + "- Results (success) [" + this.officialName + "]", "A new " + repoType + " is ready to be added in the OpenAIRE compliant list." + "\n\nOfficial Name: " + this.officialName + "\n\nBase URL: " + this.baseUrl + "\n\nValidation Set: " + this.validationSet + "\n\nGuidelines: " + msgGuidelines, true, null);
|
133 |
|
|
134 |
|
} catch (Exception e) {
|
135 |
|
logger.error("", e);
|
136 |
|
}
|
137 |
|
}
|
138 |
|
|
139 |
|
private void criticalFailure() {
|
140 |
|
try {
|
141 |
|
String msgGuidelines = "OpenAIRE For Literature Repositories (OpenAIRE 3.0)";
|
142 |
|
if (this.desiredCompLevel.equalsIgnoreCase("openaire2.0")) {
|
143 |
|
msgGuidelines = "OpenAIRE For Literature Repositories (OpenAIRE 2.0)";
|
144 |
|
} else if (this.desiredCompLevel.equalsIgnoreCase("driver")) {
|
145 |
|
msgGuidelines = "OpenAIRE For Literature Repositories (Basic - ex DRIVER)";
|
146 |
|
} else if (this.desiredCompLevel.equalsIgnoreCase("openaire2.0_data")) {
|
147 |
|
msgGuidelines = "OpenAIRE For Data Archives (OpenAIRE 2.0)";
|
148 |
|
} else if (this.desiredCompLevel.equalsIgnoreCase("openaire3.0")) {
|
149 |
|
msgGuidelines = "OpenAIRE For Literature Repositories (OpenAIRE 3.0)";
|
150 |
|
}
|
151 |
|
logger.debug("Critical Failure of pre-registration validations on repo "+baseUrl);
|
152 |
|
// mail to inform user of failure
|
153 |
|
List<String> rec = new ArrayList<String>();
|
154 |
|
rec.add(this.userMail);
|
155 |
|
emailer.sendMail(rec, getMsgSubject() + "- Results [" + this.officialName + "]", "The compatibility test of your " + repoType + " on repo: "+baseUrl+" and set: " + validationSet + " was unsuccessful and the join process has failed. \n" + "Your Scores: " + score_content + "/100 and " + score_usage + "/100 . Score required to pass: >50 \n" +" Please review the results and correct any errors: \n" + valBaseUrl + "/prepareSummary.action?jobId=" + this.jobId + "\n", false, null);
|
156 |
|
emailer.sendMail(new ArrayList<String>(), getMsgSubject() + "- Results (failure) [" + this.officialName + "]", "The compatibility test on "+officialName+" was unsuccessful and the join process has failed. "+ "\n\nOfficial Name: " + this.officialName + "\n\nBase URL: " + this.baseUrl + "\n\nValidation Set: " + this.validationSet + "\n\nGuidelines: " + msgGuidelines + "\n\nReview the validation results here: \n" + valBaseUrl + "/prepareSummary.action?jobId=" + this.jobId + "\n", true, null);
|
157 |
|
|
158 |
|
this.updateRepositoryInterfaceCompliance(officialName, datasourceId, interfaceId, "notCompatible", validationSet, baseUrl, interfaceIdOld);
|
159 |
|
|
160 |
|
} catch (Exception e) {
|
161 |
|
logger.error("", e);
|
162 |
|
}
|
163 |
|
}
|
164 |
|
|
165 |
52 |
@Override
|
166 |
53 |
@Transactional(propagation = Propagation.REQUIRED)
|
167 |
54 |
public synchronized void finished(int jobId, Map<String, Object> jobContext) {
|
|
55 |
|
168 |
56 |
try{
|
169 |
57 |
jobsFinished++;
|
170 |
58 |
if (jobContext.containsKey("score_content")) {
|
... | ... | |
184 |
72 |
logger.error("Error while finalizing successfull registration job");
|
185 |
73 |
}
|
186 |
74 |
}
|
187 |
|
|
|
75 |
|
188 |
76 |
@Override
|
189 |
77 |
@Transactional(propagation = Propagation.REQUIRED)
|
190 |
78 |
public synchronized void failed(int jobId, Map<String, Object> jobContext, Throwable t) {
|
|
79 |
|
191 |
80 |
try{
|
192 |
81 |
jobsDao.setTotalJobFinished(jobId, t.getMessage(), true);
|
193 |
|
this.jobFailure((Integer) jobContext.get("jobSubmittedId"),t.getMessage());
|
|
82 |
this.jobFailure((Integer) jobContext.get("jobSubmittedId"),t.getMessage());
|
194 |
83 |
} catch (Exception e) {
|
195 |
84 |
logger.error("Error while finalizing failed registration job");
|
196 |
85 |
}
|
197 |
86 |
}
|
198 |
|
|
199 |
|
public boolean updateRepositoryInterfaceCompliance(String officialName,
|
200 |
|
String datasourceId, String interfaceId, String desiredCompliance, String set, String baseUrl, String oldId)
|
201 |
|
throws Exception {
|
202 |
|
boolean ret = true;
|
203 |
|
try {
|
204 |
|
if (desiredCompliance.equalsIgnoreCase("openaire2.0_data"))
|
205 |
|
desiredCompliance = "openaire2.0";
|
206 |
|
logger.debug("updating repository " + officialName + " compliance to : " + desiredCompliance);
|
207 |
|
if (oldId == null) {
|
208 |
|
dmService.getService().updateLevelOfCompliance(datasourceId, interfaceId, desiredCompliance);
|
209 |
|
}
|
210 |
|
else {
|
211 |
|
logger.debug("Checking if old interface should be updated");
|
212 |
|
if (!desiredCompliance.equalsIgnoreCase("UNKNOWN") && (!desiredCompliance.equalsIgnoreCase("notCompatible"))) {
|
213 |
|
logger.debug("updating old interface with new set/url");
|
214 |
|
dmService.getService().updateBaseUrl(datasourceId, oldId, baseUrl);
|
215 |
|
if(set.equalsIgnoreCase("none"))
|
216 |
|
dmService.getService().deleteAccessParamOrExtraField(datasourceId, oldId, "set");
|
217 |
|
else
|
218 |
|
dmService.getService().updateAccessParam(datasourceId, oldId, "set", set, false);
|
219 |
|
logger.debug("deleting new interface");
|
220 |
|
dmService.getService().deleteInterface(datasourceId, interfaceId);
|
221 |
|
|
222 |
|
}
|
223 |
|
logger.debug("updating repository " + officialName + " compliance to : " + desiredCompliance);
|
224 |
|
}
|
225 |
|
java.util.Date utilDate = new java.util.Date();
|
226 |
|
java.sql.Timestamp date = new java.sql.Timestamp(utilDate.getTime());
|
227 |
|
|
228 |
|
String updateQuery = "UPDATE datasources SET activationid = " + null + "," +
|
229 |
|
" dateofvalidation = '" + date + "'" +
|
230 |
|
" WHERE id = '" + datasourceId + "'";
|
231 |
|
|
232 |
|
if (dmService.getService().updateSQL(datasourceId, updateQuery, false))
|
233 |
|
logger.debug("updated successfully");
|
234 |
|
else
|
235 |
|
logger.error("error while updating: " + updateQuery);
|
236 |
|
|
237 |
|
} catch (Exception e) {
|
238 |
|
logger.error("error connecting to dms to set a repo interface as openaire compliant " + officialName, e);
|
239 |
|
ret = false;
|
240 |
|
throw e;
|
241 |
|
}
|
242 |
|
return ret;
|
243 |
|
}
|
244 |
|
|
245 |
|
public String getMsgSubject() {
|
246 |
|
if (isUpdateExisting())
|
247 |
|
msgSubject = "Request to update an OpenAIRE " + repoType + " ";
|
248 |
|
else
|
249 |
|
msgSubject = "Request to Join OpenAIRE ";
|
250 |
|
return msgSubject;
|
251 |
|
}
|
252 |
87 |
|
253 |
|
|
254 |
|
public boolean isUpdateExisting() {
|
255 |
|
return updateExisting;
|
|
88 |
@Override
|
|
89 |
public synchronized void currentResults(List<CompletedTask> tasks, int jobId,
|
|
90 |
Object object, Map<String, Object> recordContext, Throwable t) {
|
|
91 |
// We don't care about partial results.
|
256 |
92 |
}
|
257 |
93 |
|
258 |
|
public void setUpdateExisting(boolean updateExisting) {
|
259 |
|
this.updateExisting = updateExisting;
|
|
94 |
@Override
|
|
95 |
public synchronized void currentResults(List<CompletedTask> tasks, int jobId,
|
|
96 |
Object object, Map<String, Object> recordContext) {
|
|
97 |
// We don't care about partial results.
|
260 |
98 |
}
|
261 |
|
|
262 |
|
public Emailer getEmailer() {
|
263 |
|
return emailer;
|
264 |
|
}
|
265 |
99 |
|
266 |
|
public void setEmailer(Emailer emailer) {
|
267 |
|
this.emailer = emailer;
|
268 |
|
}
|
|
100 |
public synchronized void jobSuccess(int jobId, int score_content, int score_usage) {
|
|
101 |
logger.info("Preregistration job "+jobId+" finished");
|
269 |
102 |
|
270 |
|
public String getValBaseUrl() {
|
271 |
|
return valBaseUrl;
|
272 |
|
}
|
|
103 |
this.score_content = score_content;
|
|
104 |
this.score_usage = score_usage;
|
|
105 |
this.jobId=jobId;
|
273 |
106 |
|
274 |
|
public void setValBaseUrl(String valBaseUrl) {
|
275 |
|
this.valBaseUrl = valBaseUrl;
|
|
107 |
this.success();
|
276 |
108 |
}
|
277 |
109 |
|
278 |
|
public String getActivationId() {
|
279 |
|
return activationId;
|
280 |
|
}
|
|
110 |
public synchronized void jobFailure(int jobId, String error) {
|
|
111 |
logger.info("Pregistration job "+jobId+" failed with exception: "+error);
|
281 |
112 |
|
|
113 |
this.jobId=jobId;
|
282 |
114 |
|
283 |
|
public void setActivationId(String activationId) {
|
284 |
|
this.activationId = activationId;
|
|
115 |
this.error();
|
285 |
116 |
}
|
|
117 |
|
|
118 |
private void success() {
|
|
119 |
try {
|
|
120 |
logger.debug("Sending results to provide @ " + providerUrl +"/validator/complete");
|
|
121 |
HttpHeaders headers = new HttpHeaders();
|
|
122 |
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
286 |
123 |
|
|
124 |
MultiValueMap<String, String> map= new LinkedMultiValueMap<String, String>();
|
|
125 |
map.add("interfaceId", this.interfaceId);
|
|
126 |
map.add("repoId",this.datasourceId);
|
|
127 |
map.add("jobId",Integer.toString(this.jobId));
|
|
128 |
map.add("issuerEmail",this.userMail);
|
|
129 |
map.add("isUpdate",Boolean.toString(this.updateExisting));
|
287 |
130 |
|
288 |
|
public String getUserMail() {
|
289 |
|
return userMail;
|
290 |
|
}
|
|
131 |
// isUsccess: the job finished succesfully, regardless of validation scores.
|
291 |
132 |
|
|
133 |
map.add("isSuccess","true");
|
|
134 |
map.add("scoreUsage", Integer.toString(score_usage));
|
|
135 |
map.add("scoreContent",Integer.toString(score_content));
|
292 |
136 |
|
293 |
|
public void setUserMail(String userMail) {
|
294 |
|
this.userMail = userMail;
|
295 |
|
}
|
|
137 |
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(map, headers);
|
|
138 |
RestTemplate restTemplate = new RestTemplate();
|
296 |
139 |
|
|
140 |
ResponseEntity<String> response = restTemplate.postForEntity( providerUrl + "/validator/complete", request , String.class );
|
297 |
141 |
|
298 |
|
public String getOfficialName() {
|
299 |
|
return officialName;
|
|
142 |
// this.updateRepositoryInterfaceCompliance(officialName, datasourceId, interfaceId, desiredCompLevel, validationSet, baseUrl, interfaceIdOld);
|
|
143 |
|
|
144 |
} catch (Exception e) {
|
|
145 |
logger.error("", e);
|
|
146 |
}
|
300 |
147 |
}
|
301 |
148 |
|
|
149 |
private void error() {
|
|
150 |
try {
|
|
151 |
logger.debug("Sending results to provide @ " + providerUrl + "/validator/complete");
|
|
152 |
HttpHeaders headers = new HttpHeaders();
|
|
153 |
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
302 |
154 |
|
303 |
|
public void setOfficialName(String officialName) {
|
304 |
|
this.officialName = officialName;
|
305 |
|
}
|
|
155 |
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
|
|
156 |
map.add("interfaceId", this.interfaceId);
|
|
157 |
map.add("repoId", this.datasourceId);
|
|
158 |
map.add("jobId", this.jobId + "");
|
|
159 |
map.add("issuerEmail", this.userMail);
|
|
160 |
map.add("isUpdate", this.updateExisting + "");
|
306 |
161 |
|
|
162 |
// The job failed to complete. Validator error or Repository is completely dead and cannot be validated.
|
|
163 |
map.add("isSuccess", "false");
|
|
164 |
map.add("scoreUsage", score_usage + "");
|
|
165 |
map.add("scoreContent", score_content + "");
|
307 |
166 |
|
308 |
|
public String getBaseUrl() {
|
309 |
|
return baseUrl;
|
310 |
|
}
|
|
167 |
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(map, headers);
|
|
168 |
RestTemplate restTemplate = new RestTemplate();
|
311 |
169 |
|
|
170 |
ResponseEntity<String> response = restTemplate.postForEntity(providerUrl + "/validator/complete", request, String.class);
|
312 |
171 |
|
313 |
|
public void setBaseUrl(String baseUrl) {
|
314 |
|
this.baseUrl = baseUrl;
|
|
172 |
// this.updateRepositoryInterfaceCompliance(officialName, datasourceId, interfaceId, "notCompatible", validationSet, baseUrl, interfaceIdOld);
|
|
173 |
} catch (Exception e) {
|
|
174 |
logger.error("", e);
|
|
175 |
}
|
315 |
176 |
}
|
316 |
177 |
|
317 |
|
public String getDatasourceId() {
|
318 |
|
return datasourceId;
|
319 |
|
}
|
320 |
178 |
|
321 |
|
public void setDatasourceId(String datasourceId) {
|
322 |
|
this.datasourceId = datasourceId;
|
323 |
|
}
|
|
179 |
|
|
180 |
// public boolean updateRepositoryInterfaceCompliance(String officialName,
|
|
181 |
// String datasourceId, String interfaceId, String desiredCompliance, String set, String baseUrl, String oldId)
|
|
182 |
// throws Exception {
|
|
183 |
// boolean ret = true;
|
|
184 |
// try {
|
|
185 |
// if (desiredCompliance.equalsIgnoreCase("openaire2.0_data"))
|
|
186 |
// desiredCompliance = "openaire2.0";
|
|
187 |
// logger.debug("updating repository " + officialName + " compliance to : " + desiredCompliance);
|
|
188 |
// if (oldId == null) {
|
|
189 |
// dmService.getService().updateLevelOfCompliance(datasourceId, interfaceId, desiredCompliance);
|
|
190 |
// }
|
|
191 |
// else {
|
|
192 |
// logger.debug("Checking if old interface should be updated");
|
|
193 |
// if (!desiredCompliance.equalsIgnoreCase("UNKNOWN") && (!desiredCompliance.equalsIgnoreCase("notCompatible"))) {
|
|
194 |
// logger.debug("updating old interface with new set/url");
|
|
195 |
// dmService.getService().updateBaseUrl(datasourceId, oldId, baseUrl);
|
|
196 |
// if(set.equalsIgnoreCase("none"))
|
|
197 |
// dmService.getService().deleteAccessParamOrExtraField(datasourceId, oldId, "set");
|
|
198 |
// else
|
|
199 |
// dmService.getService().updateAccessParam(datasourceId, oldId, "set", set, false);
|
|
200 |
// logger.debug("deleting new interface");
|
|
201 |
// dmService.getService().deleteInterface(datasourceId, interfaceId);
|
|
202 |
//
|
|
203 |
// }
|
|
204 |
// logger.debug("updating repository " + officialName + " compliance to : " + desiredCompliance);
|
|
205 |
// }
|
|
206 |
// java.util.Date utilDate = new java.util.Date();
|
|
207 |
// java.sql.Timestamp date = new java.sql.Timestamp(utilDate.getTime());
|
|
208 |
//
|
|
209 |
// String updateQuery = "UPDATE datasources SET activationid = " + null + "," +
|
|
210 |
// " dateofvalidation = '" + date + "'" +
|
|
211 |
// " WHERE id = '" + datasourceId + "'";
|
|
212 |
//
|
|
213 |
// if (dmService.getService().updateSQL(datasourceId, updateQuery, false))
|
|
214 |
// logger.debug("updated successfully");
|
|
215 |
// else
|
|
216 |
// logger.error("error while updating: " + updateQuery);
|
|
217 |
//
|
|
218 |
// } catch (Exception e) {
|
|
219 |
// logger.error("error connecting to dms to set a repo interface as openaire compliant " + officialName, e);
|
|
220 |
// ret = false;
|
|
221 |
// throw e;
|
|
222 |
// }
|
|
223 |
// return ret;
|
|
224 |
// }
|
|
225 |
//
|
324 |
226 |
|
325 |
|
public String getInterfaceId() {
|
326 |
|
return interfaceId;
|
|
227 |
public String getProviderUrl() {
|
|
228 |
return providerUrl;
|
327 |
229 |
}
|
328 |
230 |
|
329 |
|
public void setInterfaceId(String interfaceId) {
|
330 |
|
this.interfaceId = interfaceId;
|
|
231 |
public void setProviderUrl(String providerUrl) {
|
|
232 |
this.providerUrl = providerUrl;
|
331 |
233 |
}
|
332 |
234 |
|
333 |
|
public String getValidationSet() {
|
334 |
|
return validationSet;
|
|
235 |
public JobsDAO getJobsDao() {
|
|
236 |
return jobsDao;
|
335 |
237 |
}
|
336 |
238 |
|
337 |
|
public void setValidationSet(String validationSet) {
|
338 |
|
this.validationSet = validationSet;
|
|
239 |
public void setJobsDao(JobsDAO jobsDao) {
|
|
240 |
this.jobsDao = jobsDao;
|
339 |
241 |
}
|
340 |
242 |
|
341 |
|
public List<String> getAdminEmails() {
|
342 |
|
return adminEmails;
|
|
243 |
public int getJobId() {
|
|
244 |
return jobId;
|
343 |
245 |
}
|
344 |
246 |
|
345 |
|
|
346 |
|
public void setAdminEmails(List<String> adminEmails) {
|
347 |
|
this.adminEmails = adminEmails;
|
|
247 |
public void setJobId(int jobId) {
|
|
248 |
this.jobId = jobId;
|
348 |
249 |
}
|
349 |
250 |
|
350 |
|
|
351 |
|
@Override
|
352 |
|
public synchronized void currentResults(List<CompletedTask> tasks, int jobId,
|
353 |
|
Object object, Map<String, Object> recordContext, Throwable t) {
|
354 |
|
// TODO Auto-generated method stub
|
355 |
|
|
|
251 |
public String getUserMail() {
|
|
252 |
return userMail;
|
356 |
253 |
}
|
357 |
254 |
|
358 |
|
@Override
|
359 |
|
public synchronized void currentResults(List<CompletedTask> tasks, int jobId,
|
360 |
|
Object object, Map<String, Object> recordContext) {
|
361 |
|
// TODO Auto-generated method stub
|
362 |
|
|
|
255 |
public void setUserMail(String userMail) {
|
|
256 |
this.userMail = userMail;
|
363 |
257 |
}
|
364 |
258 |
|
365 |
|
|
366 |
|
public String getDesiredCompLevel() {
|
367 |
|
return desiredCompLevel;
|
|
259 |
public String getDatasourceId() {
|
|
260 |
return datasourceId;
|
368 |
261 |
}
|
369 |
262 |
|
370 |
|
public void setDesiredCompLevel(String desiredCompLevel) {
|
371 |
|
this.desiredCompLevel = desiredCompLevel;
|
|
263 |
public void setDatasourceId(String datasourceId) {
|
|
264 |
this.datasourceId = datasourceId;
|
372 |
265 |
}
|
373 |
266 |
|
374 |
|
public String getRepoType() {
|
375 |
|
return repoType;
|
|
267 |
public String getInterfaceId() {
|
|
268 |
return interfaceId;
|
376 |
269 |
}
|
377 |
270 |
|
378 |
|
public void setRepoType(String repoType) {
|
379 |
|
this.repoType = repoType;
|
|
271 |
public void setInterfaceId(String interfaceId) {
|
|
272 |
this.interfaceId = interfaceId;
|
380 |
273 |
}
|
381 |
274 |
|
382 |
|
public String getInterfaceIdOld() {
|
383 |
|
return interfaceIdOld;
|
|
275 |
public boolean isUpdateExisting() {
|
|
276 |
return updateExisting;
|
384 |
277 |
}
|
385 |
278 |
|
386 |
|
public void setInterfaceIdOld(String interfaceIdOld) {
|
387 |
|
this.interfaceIdOld = interfaceIdOld;
|
|
279 |
public void setUpdateExisting(boolean updateExisting) {
|
|
280 |
this.updateExisting = updateExisting;
|
388 |
281 |
}
|
389 |
282 |
|
390 |
283 |
public int getTotalJobs() {
|
... | ... | |
394 |
287 |
public void setTotalJobs(int totalJobs) {
|
395 |
288 |
this.totalJobs = totalJobs;
|
396 |
289 |
}
|
397 |
|
|
398 |
|
public ServiceLocator<DatasourceManagerService> getDmService() {
|
399 |
|
return dmService;
|
400 |
|
}
|
401 |
|
|
402 |
|
public void setDmService(ServiceLocator<DatasourceManagerService> dmService) {
|
403 |
|
this.dmService = dmService;
|
404 |
|
}
|
405 |
|
|
406 |
|
public JobsDAO getJobsDao() {
|
407 |
|
return jobsDao;
|
408 |
|
}
|
409 |
|
|
410 |
|
public void setJobsDao(JobsDAO jobsDao) {
|
411 |
|
this.jobsDao = jobsDao;
|
412 |
|
}
|
413 |
|
|
414 |
290 |
}
|