1 |
30461
|
nikon.gasp
|
package gr.uoa.di.validatorweb.actions.registration.dnet;
|
2 |
|
|
|
3 |
|
|
import eu.dnetlib.domain.data.Repository;
|
4 |
|
|
import eu.dnetlib.domain.data.RepositoryInterface;
|
5 |
|
|
import eu.dnetlib.domain.enabling.Vocabulary;
|
6 |
|
|
import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader;
|
7 |
|
|
import gr.uoa.di.validatorweb.actions.BaseValidatorAction;
|
8 |
|
|
import gr.uoa.di.validatorweb.api.RepoExtAPI;
|
9 |
|
|
import gr.uoa.di.validatorweb.configs.Constants;
|
10 |
|
|
import gr.uoa.di.validatorweb.configs.Timezone;
|
11 |
|
|
|
12 |
|
|
import java.util.ArrayList;
|
13 |
|
|
import java.util.List;
|
14 |
|
|
import java.util.Locale;
|
15 |
|
|
import java.util.Map;
|
16 |
|
|
import java.util.UUID;
|
17 |
|
|
|
18 |
|
|
import org.apache.log4j.Logger;
|
19 |
|
|
import org.apache.struts2.interceptor.SessionAware;
|
20 |
|
|
|
21 |
|
|
import se.kb.oai.pmh.Identification;
|
22 |
|
|
import se.kb.oai.pmh.OaiPmhServer;
|
23 |
|
|
import se.kb.oai.pmh.ResumptionToken;
|
24 |
|
|
import se.kb.oai.pmh.Set;
|
25 |
|
|
import se.kb.oai.pmh.SetsList;
|
26 |
|
|
|
27 |
|
|
import com.opensymphony.xwork2.Action;
|
28 |
|
|
import com.unboundid.util.Base64;
|
29 |
|
|
|
30 |
|
|
public class RepoEditing extends BaseValidatorAction implements SessionAware {
|
31 |
|
|
|
32 |
|
|
private static final long serialVersionUID = 4471755337821603525L;
|
33 |
|
|
|
34 |
|
|
private static Logger logger = Logger.getLogger(RepoEditing.class);
|
35 |
|
|
|
36 |
|
|
private VocabularyLoader vocabularyLoader = null;
|
37 |
|
|
private Map<String, Object> session;
|
38 |
|
|
private List<String> adminEmails;
|
39 |
|
|
private Repository repo;
|
40 |
|
|
private List<RepositoryInterface> interfaces, interfacesNew, interfacesOld, interfacesToRegister = null;
|
41 |
|
|
private PubFileInterface pubFileIface;
|
42 |
|
|
|
43 |
|
|
private String customTypology;
|
44 |
|
|
private String mode;
|
45 |
|
|
private String id;
|
46 |
|
|
private Boolean deleteInterfaces;
|
47 |
|
|
private Boolean updateInterfaces;
|
48 |
|
|
private Boolean updatePubFilesInterface;
|
49 |
|
|
private Boolean updateRepoInfo;
|
50 |
|
|
private Boolean saveNewInterfaces;
|
51 |
|
|
|
52 |
|
|
public String aggregatorName;
|
53 |
|
|
|
54 |
|
|
private boolean usingOpenDoar;
|
55 |
|
|
|
56 |
|
|
private List<String> typologies;
|
57 |
|
|
private List<String> countries;
|
58 |
|
|
private List<Timezone> timezones;
|
59 |
|
|
|
60 |
|
|
public String execute() {
|
61 |
|
|
this.clearErrorsAndMessages();
|
62 |
|
|
String action = "";
|
63 |
|
|
repo.setRegisteredBy((String) session.get(Constants.loggedInField));
|
64 |
|
|
repo.setInterfaces(this.interfaces);
|
65 |
|
|
|
66 |
|
|
if (updateRepoInfo != null) {
|
67 |
|
|
action = "updateRepoInfo";
|
68 |
|
|
logger.debug("inside repoInf");
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
if (deleteInterfaces != null) {
|
72 |
|
|
action = "deleteInterfaces";
|
73 |
|
|
logger.debug("inside delete");
|
74 |
|
|
}
|
75 |
|
|
if (updateInterfaces != null) {
|
76 |
|
|
action = "updateInterfaces";
|
77 |
|
|
logger.debug("inside updInte");
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
logger.debug("editing action: " + action);
|
82 |
|
|
logger.debug("mode: " + mode);
|
83 |
|
|
logger.debug("usingOpenDoar:" + usingOpenDoar);
|
84 |
|
|
logger.debug("repoId " + id);
|
85 |
|
|
String importResult = null;
|
86 |
|
|
if (updateRepoInfo != null) {
|
87 |
|
|
try {
|
88 |
|
|
logger.debug("updating repo information");
|
89 |
|
|
if (this.isModeOpenAIRE()) {
|
90 |
|
|
importResult = getRepoAPI().updateRepositoryInformation(repo);
|
91 |
|
|
}
|
92 |
|
|
if (importResult != null)
|
93 |
|
|
this.addActionMessage(importResult);
|
94 |
|
|
} catch (Exception e) {
|
95 |
|
|
logger.error("error storing " + repo.getOfficialName() + "in openaire db", e);
|
96 |
|
|
if (importResult == null)
|
97 |
|
|
this.addActionError(this.getText("generic.error"));
|
98 |
|
|
else
|
99 |
|
|
this.addActionError(importResult);
|
100 |
|
|
reportException(e);
|
101 |
|
|
return "exception";
|
102 |
|
|
}
|
103 |
|
|
} else if (deleteInterfaces != null) {
|
104 |
|
|
try {
|
105 |
|
|
logger.debug("deleting selected interfaces");
|
106 |
|
|
importResult = this.getRepoAPI().deleteRepositoryInterfaces(id, repo.getInterfaces());
|
107 |
|
|
this.addActionMessage(importResult);
|
108 |
|
|
} catch (Exception e) {
|
109 |
|
|
logger.error("error deleting selected interfaces for repo: " + repo.getId() + "in openaire db", e);
|
110 |
|
|
this.addActionError(this.getText("generic.error"));
|
111 |
|
|
reportException(e);
|
112 |
|
|
return "exception";
|
113 |
|
|
}
|
114 |
|
|
} else if (updatePubFilesInterface != null) {
|
115 |
|
|
try {
|
116 |
|
|
if (pubFileIface != null && pubFileIface.getAllow()) {
|
117 |
|
|
RepositoryInterface fileIface = new RepositoryInterface();
|
118 |
|
|
fileIface.setBaseUrl("none");
|
119 |
|
|
fileIface.setContentDescription("file::hybrid");
|
120 |
|
|
fileIface.setCompliance("files");
|
121 |
|
|
fileIface.setTypology("pubsrepository::unknown");
|
122 |
|
|
fileIface.setRemovable(true);
|
123 |
|
|
fileIface.setId("api_________::" + repo.getId() + "::" + "files");
|
124 |
|
|
fileIface.getAccessParams().put("methodology", pubFileIface.getMethodology());
|
125 |
|
|
// fileIface.getExtraFields().put("allow", "yes");
|
126 |
|
|
if (pubFileIface.getMethodology().equals("files_from_api")) {
|
127 |
|
|
fileIface.setAccessProtocol(pubFileIface.getProtocol());
|
128 |
|
|
|
129 |
|
|
fileIface.getAccessParams().put("url", pubFileIface.getUrl());
|
130 |
|
|
fileIface.getAccessParams().put("username", pubFileIface.getUsername());
|
131 |
|
|
fileIface.getAccessParams().put("password", pubFileIface.getPassword());
|
132 |
|
|
fileIface.getExtraFields().put("file_naming_convention", pubFileIface.getConvention());
|
133 |
|
|
} else if (pubFileIface.getMethodology().equals("files_from_metadata")) {
|
134 |
|
|
fileIface.setAccessProtocol("files_from_metadata");
|
135 |
|
|
fileIface.getAccessParams().put("xpath",pubFileIface.getXpath());
|
136 |
|
|
}
|
137 |
|
|
|
138 |
|
|
//
|
139 |
|
|
logger.debug("source: " + pubFileIface.getMethodology());
|
140 |
|
|
logger.debug("protocol: " + pubFileIface.getProtocol());
|
141 |
|
|
logger.debug("username: " + pubFileIface.getUsername());
|
142 |
|
|
logger.debug("password: " + pubFileIface.getPassword());
|
143 |
|
|
logger.debug("url: " + pubFileIface.getUrl());
|
144 |
|
|
logger.debug("convention: " + pubFileIface.getConvention());
|
145 |
|
|
getRepoAPI().updatePubFileInterface(repo.getId(), fileIface);
|
146 |
|
|
}
|
147 |
|
|
}catch (Exception e) {
|
148 |
|
|
logger.error("error deleting selected interfaces for repo: " + repo.getId() + "in openaire db", e);
|
149 |
|
|
if (importResult == null)
|
150 |
|
|
this.addActionError(this.getText("generic.error"));
|
151 |
|
|
else
|
152 |
|
|
this.addActionError(importResult);
|
153 |
|
|
reportException(e);
|
154 |
|
|
return "exception";
|
155 |
|
|
}
|
156 |
|
|
}
|
157 |
|
|
|
158 |
|
|
else if (updateInterfaces != null) {
|
159 |
|
|
try {
|
160 |
|
|
logger.debug("updating selected interfaces");
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
// logger.debug("updated interfaces size: " + repo.getInterfaces().size());
|
164 |
|
|
// for (RepositoryInterface iFace : repo.getInterfaces()) {
|
165 |
|
|
// this.printInterface(iFace);
|
166 |
|
|
// }
|
167 |
|
|
//
|
168 |
|
|
// logger.debug("old interfaces size: " + interfacesOld.size());
|
169 |
|
|
// for (RepositoryInterface iFace : interfacesOld) {
|
170 |
|
|
// this.printInterface(iFace);
|
171 |
|
|
// }
|
172 |
|
|
|
173 |
|
|
repo.setRegisteredBy((String) session.get(Constants.loggedInField));
|
174 |
|
|
|
175 |
|
|
if (interfacesNew.isEmpty()) {
|
176 |
|
|
logger.debug("interfaces empty");
|
177 |
|
|
} else {
|
178 |
|
|
interfacesToRegister = this.getRepoAPI().updateRepositoryInterfaces(repo.getId(), interfacesNew, interfacesOld, mode);
|
179 |
|
|
}
|
180 |
|
|
} catch (Exception e) {
|
181 |
|
|
logger.error("error updating interfaces for repo: " + repo.getId() + "in openaire db", e);
|
182 |
|
|
if (importResult == null)
|
183 |
|
|
this.addActionError(this.getText("generic.error"));
|
184 |
|
|
else
|
185 |
|
|
this.addActionError(importResult);
|
186 |
|
|
reportException(e);
|
187 |
|
|
return "exception";
|
188 |
|
|
}
|
189 |
|
|
} else if (saveNewInterfaces != null) {
|
190 |
|
|
try {
|
191 |
|
|
logger.debug("saving new interfaces");
|
192 |
|
|
repo.setRegisteredBy((String) session.get(Constants.loggedInField));
|
193 |
|
|
|
194 |
|
|
if (interfacesNew.isEmpty()) {
|
195 |
|
|
logger.debug("interfaces empty");
|
196 |
|
|
} else {
|
197 |
|
|
interfacesToRegister = this.getRepoAPI().insertRepositoryInterfaces(repo.getId(), interfacesNew, mode);
|
198 |
|
|
}
|
199 |
|
|
} catch (Exception e) {
|
200 |
|
|
logger.error("error saving new interfaces for repo: " + repo.getId() + "in openaire db", e);
|
201 |
|
|
if (importResult == null)
|
202 |
|
|
this.addActionError(this.getText("generic.error"));
|
203 |
|
|
else
|
204 |
|
|
this.addActionError(importResult);
|
205 |
|
|
reportException(e);
|
206 |
|
|
return "exception";
|
207 |
|
|
}
|
208 |
|
|
}
|
209 |
|
|
|
210 |
|
|
try {
|
211 |
|
|
|
212 |
|
|
if (interfacesToRegister != null) {
|
213 |
|
|
logger.debug("Registering new interfaces.. Size: " + interfacesToRegister.size());
|
214 |
|
|
for (RepositoryInterface iFace : interfacesToRegister)
|
215 |
|
|
if (!this.getOpenAIREValidator().userOverridesRepoRegistration((String) session.get(Constants.loggedInField))) {
|
216 |
|
|
logger.debug("User is not regRepoOverrrider");
|
217 |
|
|
// FOR TESTING
|
218 |
|
|
this.adminEmails.clear();
|
219 |
|
|
this.adminEmails.add((String) session.get(Constants.loggedInField));
|
220 |
|
|
// FOR TESTING
|
221 |
|
|
logger.debug("initiating preregistration validations on repo :" + iFace.getBaseUrl() + "for set: " + iFace.getAccessSet() + " and compliance: " + iFace.getDesiredCompatibilityLevel());
|
222 |
|
|
String activationId = UUID.randomUUID().toString();
|
223 |
|
|
// this.getOpenAIREValidator().storeJobForRegistration(iFace.getBaseUrl(), repo.getOfficialName(), activationId, (String) session.get(Constants.loggedInField), this.adminEmails, iFace.getAccessSet(), iFace.getDesiredCompatibilityLevel(), repo.getId(), iFace.getId());
|
224 |
|
|
// this.getOpenAIREValidator().preRegistrationValidations(iFace.getBaseUrl(), repo.getOfficialName(), activationId, (String) session.get(Constants.loggedInField), this.adminEmails, iFace.getAccessSet(), iFace.getDesiredCompatibilityLevel(), repo.getId(), iFace.getId());
|
225 |
|
|
logger.debug("current ComplianceEname: "+ iFace.getCompliance());
|
226 |
|
|
logger.debug("current ComplianceCode: "+ getComplianceCode(iFace.getCompliance()));
|
227 |
|
|
logger.debug("desired Compliance: "+ iFace.getDesiredCompatibilityLevel());
|
228 |
|
|
// if (iFace.getCompliance() != null && !getComplianceCode(iFace.getCompliance()).equalsIgnoreCase("openaire3.0")) {
|
229 |
|
|
// List<String> rec = new ArrayList<String>();
|
230 |
|
|
// rec.add((String) session.get(Constants.loggedInField));
|
231 |
|
|
// String msgUpgrade = "";
|
232 |
|
|
// msgUpgrade = "\n\n Please consider to upgrade to OpenAIRE Guidelines v3. Link: https://guidelines.openaire.eu/wiki/OpenAIRE_Guidelines:_For_Literature_repositories";
|
233 |
|
|
// }
|
234 |
|
|
this.addActionMessage(this.getText("repoRegistration.validationStarted"));
|
235 |
|
|
this.addActionMessage("Administrator email:" + this.adminEmails.get(0));
|
236 |
|
|
this.addActionMessage((this.getText("general.unblock") + " " + this.getEmailer().getFrom()));
|
237 |
|
|
List<String> recipients = new ArrayList<String>();
|
238 |
|
|
recipients.addAll(this.adminEmails);
|
239 |
|
|
this.getEmailer().sendMail(recipients, "Request to Join OpenAIRE - Confirmation", "A request has been sent to add '" + repo.getOfficialName() + "' to the OpenAIRE compliant list of repositories/journals. If you have any questions you can communicate with the user that made the request using this email: " + (String) session.get(Constants.loggedInField), false, null);
|
240 |
|
|
recipients.clear();
|
241 |
|
|
recipients.add((String) session.get(Constants.loggedInField));
|
242 |
|
|
this.getEmailer().sendMail(recipients, "Request to Join OpenAIRE - Confirmation", "A request has been sent to add '" + repo.getOfficialName() + "' to the OpenAIRE compliant list of repositories/journals. The neccessary compatibility tests will begin shortly", true, null);
|
243 |
|
|
} else {
|
244 |
|
|
logger.debug("User is regRepoOverrider");
|
245 |
|
|
List<String> recipients = new ArrayList<String>();
|
246 |
|
|
recipients.add((String) session.get(Constants.loggedInField));
|
247 |
|
|
this.getEmailer().sendMail(recipients, "Request to Join OpenAIRE", "A request has been sent to add '" + repo.getOfficialName() + "' to the OpenAIRE compliant list of repositories/journals. Since you are logged-in as administrator, registration tests are bypassed.", false, null);
|
248 |
|
|
|
249 |
|
|
this.addActionMessage((this.getText("repoRegistration.overriden.successful")));
|
250 |
|
|
getRepoAPI().updateRepositoryInterfaceCompliance(repo.getOfficialName(), repo.getId(), iFace.getId(), iFace.getDesiredCompatibilityLevel(),iFace.getAccessSet(),iFace.getBaseUrl(), iFace.getExtraFields().get("oldId"));
|
251 |
|
|
}
|
252 |
|
|
|
253 |
|
|
}
|
254 |
|
|
} catch (Exception e) {
|
255 |
|
|
logger.error("error registering repo " + repo.getOfficialName(), e);
|
256 |
|
|
this.addActionError(this.getText("generic.error"));
|
257 |
|
|
reportException(e);
|
258 |
|
|
return "exception";
|
259 |
|
|
}
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
return Action.SUCCESS;
|
263 |
|
|
|
264 |
|
|
}
|
265 |
|
|
|
266 |
|
|
private String getComplianceCode(String complianceName) {
|
267 |
|
|
Vocabulary compatibilityLevels = vocabularyLoader.getVocabulary("dnet:compatibilityLevel", Locale.ENGLISH, Locale.ROOT);
|
268 |
|
|
|
269 |
|
|
return compatibilityLevels.getEncoding(complianceName);
|
270 |
|
|
}
|
271 |
|
|
|
272 |
|
|
public void validate() {
|
273 |
|
|
this.clearErrorsAndMessages();
|
274 |
|
|
typologies = Constants.typologies;
|
275 |
|
|
countries = vocabularyLoader.getVocabulary("dnet:countries", Locale.ENGLISH, Locale.ROOT).getEnglishNames();
|
276 |
|
|
timezones = Constants.timezones;
|
277 |
|
|
|
278 |
|
|
if (saveNewInterfaces != null) {
|
279 |
|
|
this.adminEmails = new ArrayList<String>();
|
280 |
|
|
for (RepositoryInterface iFace : interfacesNew) {
|
281 |
|
|
logger.debug("checking baseurl: " + iFace.getBaseUrl());
|
282 |
|
|
Identification identify;
|
283 |
|
|
OaiPmhServer harvester = new OaiPmhServer(iFace.getBaseUrl());
|
284 |
|
|
try {
|
285 |
|
|
identify = harvester.identify();
|
286 |
|
|
} catch (Exception e) {
|
287 |
|
|
logger.error("error getting mails from url: " + iFace.getBaseUrl(), e);
|
288 |
|
|
this.addFieldError("baseUrl", "BaseUrl: " + iFace.getBaseUrl() + " is invalid.");
|
289 |
|
|
// this.addActionError(this.getText("invalidBaseUrl"));
|
290 |
|
|
return;
|
291 |
|
|
}
|
292 |
|
|
try {
|
293 |
|
|
SetsList setList = harvester.listSets();
|
294 |
|
|
ResumptionToken token = setList.getResumptionToken();
|
295 |
|
|
List<Set> sets = new ArrayList<Set>();
|
296 |
|
|
sets.addAll(setList.asList());
|
297 |
|
|
while (token != null) {
|
298 |
|
|
setList = harvester.listSets(token);
|
299 |
|
|
token = setList.getResumptionToken();
|
300 |
|
|
sets.addAll(setList.asList());
|
301 |
|
|
}
|
302 |
|
|
|
303 |
|
|
List<String> ret = new ArrayList<String>();
|
304 |
|
|
for (Set set : sets) {
|
305 |
|
|
ret.add(set.getSpec().trim());
|
306 |
|
|
}
|
307 |
|
|
if (!ret.contains(iFace.getAccessSet()))
|
308 |
|
|
this.addFieldError("validationSet", "Set: " + iFace.getAccessSet() + " is not exposed by the repository. \n Please make sure that 'ListSets' verb is configured correctly on your server as well as that the exposed sets list includes this set.");
|
309 |
|
|
} catch (Exception e) {
|
310 |
|
|
logger.error("error getting sets from url: " + iFace.getBaseUrl(), e);
|
311 |
|
|
continue;
|
312 |
|
|
}
|
313 |
|
|
this.adminEmails.addAll(RepoExtAPI.removeMailTo(identify.getAdminEmails()));
|
314 |
|
|
}
|
315 |
|
|
}
|
316 |
|
|
/*
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
if (mode.equals("journal")){
|
320 |
|
|
logger.debug("issn length: " + repo.getIssn().length());
|
321 |
|
|
if (RepoExtAPI.FieldInEmpty(repo.getIssn()))
|
322 |
|
|
this.addFieldError("issn", this.getText("compulsoryField"));
|
323 |
|
|
if (repo.getIssn().length() != 8)
|
324 |
|
|
this.addFieldError("issn", "Length has to be 8 characters");
|
325 |
|
|
if (!RepoExtAPI.FieldInEmpty(repo.getEissn()) && repo.getEissn().length() != 8)
|
326 |
|
|
this.addFieldError("eissn", "Length has to be 8 characters");
|
327 |
|
|
if (!RepoExtAPI.FieldInEmpty(repo.getLissn()) && repo.getLissn().length() != 8)
|
328 |
|
|
this.addFieldError("lissn", "Length has to be 8 characters");
|
329 |
|
|
|
330 |
|
|
}
|
331 |
|
|
if (!RepoExtAPI.FieldInEmpty(customTypology)) {
|
332 |
|
|
repo.setTypology(customTypology);
|
333 |
|
|
}
|
334 |
|
|
if (RepoExtAPI.FieldInEmpty(repo.getTypology())) {
|
335 |
|
|
this.addFieldError("typology", this.getText("compulsoryField"));
|
336 |
|
|
}
|
337 |
|
|
if (RepoExtAPI.FieldInEmpty(repo.getOfficialName())) {
|
338 |
|
|
this.addFieldError("officialName", this.getText("compulsoryField"));
|
339 |
|
|
}
|
340 |
|
|
if (RepoExtAPI.FieldInEmpty(repo.getEnglishName())) {
|
341 |
|
|
this.addFieldError("englishName", this.getText("compulsoryField"));
|
342 |
|
|
}
|
343 |
|
|
if (RepoExtAPI.FieldInEmpty(repo.getCountryName())) {
|
344 |
|
|
this.addFieldError("countryName", this.getText("compulsoryField"));
|
345 |
|
|
}
|
346 |
|
|
if (RepoExtAPI.FieldInEmpty(repo.getWebsiteUrl())) {
|
347 |
|
|
this.addFieldError("websiteUrl", this.getText("compulsoryField"));
|
348 |
|
|
}
|
349 |
|
|
if (RepoExtAPI.FieldInEmpty(repo.getOrganization())) {
|
350 |
|
|
this.addFieldError("organization", this.getText("compulsoryField"));
|
351 |
|
|
}
|
352 |
|
|
if (RepoExtAPI.FieldInEmpty(repo.getContactEmail())) {
|
353 |
|
|
this.addFieldError("contactEmail", this.getText("compulsoryField"));
|
354 |
|
|
}
|
355 |
|
|
if (RepoExtAPI.FieldInEmpty(repo.getLatitude().toString())) {
|
356 |
|
|
this.addFieldError("latitude", this.getText("compulsoryField"));
|
357 |
|
|
}
|
358 |
|
|
if (RepoExtAPI.FieldInEmpty(repo.getLongitude().toString())) {
|
359 |
|
|
this.addFieldError("longitude", this.getText("compulsoryField"));
|
360 |
|
|
}
|
361 |
|
|
|
362 |
|
|
this.adminEmails = new ArrayList<String>();
|
363 |
|
|
for (RepositoryInterface iFace : this.interfaces) {
|
364 |
|
|
if(!iFace.isDeleteApi()) {
|
365 |
|
|
logger.debug("checking baseurl: " + iFace.getBaseUrl());
|
366 |
|
|
Identification identify;
|
367 |
|
|
OaiPmhServer harvester = new OaiPmhServer(iFace.getBaseUrl());
|
368 |
|
|
try {
|
369 |
|
|
identify = harvester.identify();
|
370 |
|
|
} catch (Exception e) {
|
371 |
|
|
logger.error("error getting mails from url: " + iFace.getBaseUrl(), e);
|
372 |
|
|
this.addFieldError("baseUrl", "BaseUrl: " + iFace.getBaseUrl() + " is invalid.");
|
373 |
|
|
// this.addActionError(this.getText("invalidBaseUrl"));
|
374 |
|
|
return;
|
375 |
|
|
}
|
376 |
|
|
try {
|
377 |
|
|
SetsList setList = harvester.listSets();
|
378 |
|
|
ResumptionToken token = setList.getResumptionToken();
|
379 |
|
|
List<Set> sets = new ArrayList<Set>();
|
380 |
|
|
sets.addAll(setList.asList());
|
381 |
|
|
while (token != null) {
|
382 |
|
|
setList = harvester.listSets(token);
|
383 |
|
|
token = setList.getResumptionToken();
|
384 |
|
|
sets.addAll(setList.asList());
|
385 |
|
|
}
|
386 |
|
|
|
387 |
|
|
List<String> ret = new ArrayList<String>();
|
388 |
|
|
for (Set set : sets) {
|
389 |
|
|
ret.add(set.getSpec().trim());
|
390 |
|
|
}
|
391 |
|
|
if (!ret.contains(iFace.getAccessSet()))
|
392 |
|
|
this.addFieldError("validationSet", "Set: " + iFace.getAccessSet() + " is not exposed by the repository. \n Please make sure that 'ListSets' verb is configured correctly on your server as well as that the exposed sets list includes this set.");
|
393 |
|
|
} catch (Exception e) {
|
394 |
|
|
logger.error("error getting sets from url: " + iFace.getBaseUrl(), e);
|
395 |
|
|
continue;
|
396 |
|
|
}
|
397 |
|
|
this.adminEmails.addAll(RepoExtAPI.removeMailTo(identify.getAdminEmails()));
|
398 |
|
|
}
|
399 |
|
|
}
|
400 |
|
|
logger.debug("admin mails ok");
|
401 |
|
|
if (this.adminEmails.size() == 0) {
|
402 |
|
|
logger.debug("adminMail: " + repo.getContactEmail());
|
403 |
|
|
this.adminEmails.add(repo.getContactEmail());
|
404 |
|
|
// this.addActionError(this.getText("noAdminEmail"));
|
405 |
|
|
// return;
|
406 |
|
|
}
|
407 |
|
|
logger.debug("admin mail ok");
|
408 |
|
|
|
409 |
|
|
// try {
|
410 |
|
|
// String aggName = null;
|
411 |
|
|
// if((aggName = getRepoAPI().getNameOfAggregator(officialName)) != null) {
|
412 |
|
|
// this.addActionError(this.getText("registration.noAggregated")+": "+aggName);
|
413 |
|
|
// return;
|
414 |
|
|
// }
|
415 |
|
|
// } catch(Exception e) {
|
416 |
|
|
// this.addActionError(this.getText("uknownError"));
|
417 |
|
|
// reportException(e);
|
418 |
|
|
// logger.error("", e);
|
419 |
|
|
// return;
|
420 |
|
|
// }
|
421 |
|
|
*/
|
422 |
|
|
}
|
423 |
|
|
|
424 |
|
|
public List<String> getAdminEmails() {
|
425 |
|
|
return adminEmails;
|
426 |
|
|
}
|
427 |
|
|
|
428 |
|
|
public void setAdminEmails(List<String> adminEmails) {
|
429 |
|
|
this.adminEmails = adminEmails;
|
430 |
|
|
}
|
431 |
|
|
|
432 |
|
|
public List<String> getTypologies() {
|
433 |
|
|
return typologies;
|
434 |
|
|
}
|
435 |
|
|
|
436 |
|
|
public void setTypologies(List<String> typologies) {
|
437 |
|
|
this.typologies = typologies;
|
438 |
|
|
}
|
439 |
|
|
|
440 |
|
|
public List<String> getCountries() {
|
441 |
|
|
return countries;
|
442 |
|
|
}
|
443 |
|
|
|
444 |
|
|
public void setCountries(List<String> countries) {
|
445 |
|
|
this.countries = countries;
|
446 |
|
|
}
|
447 |
|
|
|
448 |
|
|
public List<Timezone> getTimezones() {
|
449 |
|
|
return timezones;
|
450 |
|
|
}
|
451 |
|
|
|
452 |
|
|
public void setTimezones(List<Timezone> timezones) {
|
453 |
|
|
this.timezones = timezones;
|
454 |
|
|
}
|
455 |
|
|
|
456 |
|
|
public void setCustomTypology(String customTypology) {
|
457 |
|
|
this.customTypology = customTypology;
|
458 |
|
|
}
|
459 |
|
|
|
460 |
|
|
public String getCustomTypology() {
|
461 |
|
|
return customTypology;
|
462 |
|
|
}
|
463 |
|
|
|
464 |
|
|
@Override
|
465 |
|
|
public void setSession(Map<String, Object> session) {
|
466 |
|
|
this.session = session;
|
467 |
|
|
}
|
468 |
|
|
|
469 |
|
|
public void setUsingOpenDoar(boolean usingOpenDoar) {
|
470 |
|
|
this.usingOpenDoar = usingOpenDoar;
|
471 |
|
|
}
|
472 |
|
|
|
473 |
|
|
public boolean isUsingOpenDoar() {
|
474 |
|
|
return usingOpenDoar;
|
475 |
|
|
}
|
476 |
|
|
|
477 |
|
|
public String getAggregatorName() {
|
478 |
|
|
return aggregatorName;
|
479 |
|
|
}
|
480 |
|
|
|
481 |
|
|
public void setAggregatorName(String aggregatorName) {
|
482 |
|
|
this.aggregatorName = aggregatorName;
|
483 |
|
|
}
|
484 |
|
|
|
485 |
|
|
public VocabularyLoader getVocabularyLoader() {
|
486 |
|
|
return vocabularyLoader;
|
487 |
|
|
}
|
488 |
|
|
|
489 |
|
|
public void setVocabularyLoader(VocabularyLoader vocabularyLoader) {
|
490 |
|
|
this.vocabularyLoader = vocabularyLoader;
|
491 |
|
|
}
|
492 |
|
|
|
493 |
|
|
public Repository getRepo() {
|
494 |
|
|
return repo;
|
495 |
|
|
}
|
496 |
|
|
|
497 |
|
|
public void setRepo(Repository repo) {
|
498 |
|
|
this.repo = repo;
|
499 |
|
|
}
|
500 |
|
|
|
501 |
|
|
public String getMode() {
|
502 |
|
|
return mode;
|
503 |
|
|
}
|
504 |
|
|
|
505 |
|
|
public void setMode(String mode) {
|
506 |
|
|
this.mode = mode;
|
507 |
|
|
}
|
508 |
|
|
|
509 |
|
|
public List<RepositoryInterface> getInterfaces() {
|
510 |
|
|
return interfaces;
|
511 |
|
|
}
|
512 |
|
|
|
513 |
|
|
public void setInterfaces(List<RepositoryInterface> interfaces) {
|
514 |
|
|
this.interfaces = interfaces;
|
515 |
|
|
}
|
516 |
|
|
|
517 |
|
|
public String getId() {
|
518 |
|
|
return id;
|
519 |
|
|
}
|
520 |
|
|
|
521 |
|
|
public void setId(String id) {
|
522 |
|
|
this.id = id;
|
523 |
|
|
}
|
524 |
|
|
|
525 |
|
|
public PubFileInterface getPubFileIface() {
|
526 |
|
|
return pubFileIface;
|
527 |
|
|
}
|
528 |
|
|
|
529 |
|
|
public void setPubFileIface(PubFileInterface pubFileIface) {
|
530 |
|
|
this.pubFileIface = pubFileIface;
|
531 |
|
|
}
|
532 |
|
|
|
533 |
|
|
public Boolean getDeleteInterfaces() {
|
534 |
|
|
return deleteInterfaces;
|
535 |
|
|
}
|
536 |
|
|
|
537 |
|
|
public void setDeleteInterfaces(Boolean deleteInterfaces) {
|
538 |
|
|
this.deleteInterfaces = deleteInterfaces;
|
539 |
|
|
}
|
540 |
|
|
|
541 |
|
|
public Boolean getUpdateInterfaces() {
|
542 |
|
|
return updateInterfaces;
|
543 |
|
|
}
|
544 |
|
|
|
545 |
|
|
public void setUpdateInterfaces(Boolean updateInterfaces) {
|
546 |
|
|
this.updateInterfaces = updateInterfaces;
|
547 |
|
|
}
|
548 |
|
|
|
549 |
|
|
public Boolean getUpdateRepoInfo() {
|
550 |
|
|
return updateRepoInfo;
|
551 |
|
|
}
|
552 |
|
|
|
553 |
|
|
public void setUpdateRepoInfo(Boolean updateRepoInfo) {
|
554 |
|
|
this.updateRepoInfo = updateRepoInfo;
|
555 |
|
|
}
|
556 |
|
|
|
557 |
|
|
public Boolean getUpdatePubFilesInterface() {
|
558 |
|
|
return updatePubFilesInterface;
|
559 |
|
|
}
|
560 |
|
|
|
561 |
|
|
public void setUpdatePubFilesInterface(Boolean updatePubFilesInterface) {
|
562 |
|
|
this.updatePubFilesInterface = updatePubFilesInterface;
|
563 |
|
|
}
|
564 |
|
|
|
565 |
|
|
public List<RepositoryInterface> getInterfacesOld() {
|
566 |
|
|
return interfacesOld;
|
567 |
|
|
}
|
568 |
|
|
|
569 |
|
|
public void setInterfacesOld(List<RepositoryInterface> interfacesOld) {
|
570 |
|
|
this.interfacesOld = interfacesOld;
|
571 |
|
|
}
|
572 |
|
|
|
573 |
|
|
public List<RepositoryInterface> getInterfacesNew() {
|
574 |
|
|
return interfacesNew;
|
575 |
|
|
}
|
576 |
|
|
|
577 |
|
|
public void setInterfacesNew(List<RepositoryInterface> interfacesNew) {
|
578 |
|
|
this.interfacesNew = interfacesNew;
|
579 |
|
|
}
|
580 |
|
|
|
581 |
|
|
|
582 |
|
|
private void printInterface(RepositoryInterface iFace) {
|
583 |
|
|
logger.debug("baseUrl: " + iFace.getBaseUrl());
|
584 |
|
|
logger.debug("format: " + iFace.getAccessFormat());
|
585 |
|
|
logger.debug("typology: " + iFace.getTypology());
|
586 |
|
|
logger.debug("set: " + iFace.getAccessSet());
|
587 |
|
|
logger.debug("des_comp_level: " + iFace.getDesiredCompatibilityLevel());
|
588 |
|
|
logger.debug("cur_comp_level: " + iFace.getCompliance());
|
589 |
|
|
logger.debug("protocol: " + iFace.getAccessProtocol());
|
590 |
|
|
logger.debug("api_id: " + iFace.getId());
|
591 |
|
|
logger.debug("removable: " + iFace.isRemovable());
|
592 |
|
|
logger.debug("deleteApi: " + iFace.isDeleteApi());
|
593 |
|
|
}
|
594 |
|
|
|
595 |
|
|
public Boolean getSaveNewInterfaces() {
|
596 |
|
|
return saveNewInterfaces;
|
597 |
|
|
}
|
598 |
|
|
|
599 |
|
|
public void setSaveNewInterfaces(Boolean saveNewInterfaces) {
|
600 |
|
|
this.saveNewInterfaces = saveNewInterfaces;
|
601 |
|
|
}
|
602 |
|
|
|
603 |
|
|
}
|