104 |
104 |
LOGGER.debug("Getting repositories of country: " + country + " with type: " + mode + " and includeUnknownCountries: " + includeUnknownCountries);
|
105 |
105 |
|
106 |
106 |
Tuple<List<Repository>, List<Repository>> retTuple = new Tuple<List<Repository>, List<Repository>>();
|
107 |
|
List<Repository> reposList = this.repoAPI.getRepositoriesPerCountry(mode).get(country);
|
|
107 |
//List<Repository> reposList = this.repoAPI.getRepositoriesPerCountry(mode).get(country);
|
|
108 |
List<Repository> reposList = repositoryApi.getRepositoriesByCountry(country,mode);
|
108 |
109 |
if (reposList == null) {
|
109 |
110 |
retTuple.setFirst(new ArrayList<Repository>());
|
110 |
111 |
// if (!includeUnknownCountries) {
|
... | ... | |
251 |
252 |
|
252 |
253 |
Map<String, String> countriesMap = new TreeMap<String, String>();
|
253 |
254 |
|
254 |
|
/* if (existingOnly) {
|
|
255 |
if (existingOnly) {
|
255 |
256 |
LOGGER.debug("using the repositories map");
|
256 |
257 |
countries.addAll(this.repoAPI.getRepositoriesByCountry(mode).keySet());
|
257 |
258 |
} else {
|
258 |
259 |
LOGGER.debug("using \"dnet:countries\" vocabulary");
|
259 |
260 |
countries.addAll(this.getVocabulary("dnet:countries").getEnglishNames());
|
260 |
|
}*/
|
261 |
|
countries.addAll(repositoryApi.getDnetCountries());
|
|
261 |
}
|
|
262 |
// countries.addAll(repositoryApi.getDnetCountries());
|
262 |
263 |
for (String country : countries) {
|
263 |
264 |
countriesMap.put(country, WordUtils.capitalizeFully(country));
|
264 |
265 |
}
|
... | ... | |
267 |
268 |
|
268 |
269 |
} catch (Exception e) {
|
269 |
270 |
LOGGER.error("Error while getting getting countries", e);
|
270 |
|
/*if (e instanceof RepositoryServiceException) {
|
|
271 |
if (e instanceof RepositoryServiceException) {
|
271 |
272 |
throw (RepositoryServiceException) e;
|
272 |
|
} else {*/
|
|
273 |
} else {
|
273 |
274 |
// emailUtils.reportException(e);
|
274 |
275 |
throw new RepositoryServiceException("login.generalError", RepositoryServiceException.ErrorCode.GENERAL_ERROR);
|
275 |
|
// }
|
|
276 |
}
|
276 |
277 |
}
|
277 |
278 |
}
|
278 |
279 |
|
... | ... | |
285 |
286 |
public List<Timezone> getTimezones() throws RepositoryServiceException {
|
286 |
287 |
try {
|
287 |
288 |
LOGGER.debug("Getting timezones from file");
|
288 |
|
return repositoryApi.getTimezones();
|
289 |
|
//return LocalVocabularies.timezones;
|
|
289 |
// return repositoryApi.getTimezones();
|
|
290 |
return LocalVocabularies.timezones;
|
290 |
291 |
} catch (Exception e) {
|
291 |
292 |
LOGGER.error("Error while getting timezones from file", e);
|
292 |
293 |
emailUtils.reportException(e);
|
... | ... | |
299 |
300 |
public List<String> getTypologies() throws RepositoryServiceException {
|
300 |
301 |
try {
|
301 |
302 |
LOGGER.debug("Getting typologies from file");
|
302 |
|
return repositoryApi.getTypologies();
|
303 |
|
//return LocalVocabularies.typologies;
|
|
303 |
// return repositoryApi.getTypologies();
|
|
304 |
return LocalVocabularies.typologies;
|
304 |
305 |
} catch (Exception e) {
|
305 |
306 |
LOGGER.error("Error while getting typologies from file", e);
|
306 |
307 |
emailUtils.reportException(e);
|
... | ... | |
381 |
382 |
|
382 |
383 |
try {
|
383 |
384 |
LOGGER.debug("Storing repository with name: " + repo.getOfficialName());
|
384 |
|
|
385 |
385 |
List<RepositoryInterface> interfacesToRegister = new ArrayList<RepositoryInterface>();
|
386 |
386 |
|
387 |
387 |
//TODO update map
|
... | ... | |
411 |
411 |
repo.setNamespacePrefix(repo.getNamespacePrefix().concat("_"));
|
412 |
412 |
}
|
413 |
413 |
}
|
414 |
|
|
415 |
|
this.repoAPI.storeRepository(repo, mode, interfacesToRegister);
|
416 |
|
|
417 |
|
} catch (Exception e) {
|
|
414 |
repositoryApi.addRepository(repo);
|
|
415 |
} catch (JSONException e) {
|
418 |
416 |
LOGGER.error("Error while Storing repository with name: " + repo.getOfficialName(), e);
|
419 |
|
if (e instanceof RepositoryServiceException) {
|
420 |
|
throw (RepositoryServiceException) e;
|
421 |
|
} else {
|
422 |
|
emailUtils.reportException(e);
|
423 |
|
throw new RepositoryServiceException("login.generalError", RepositoryServiceException.ErrorCode.GENERAL_ERROR);
|
424 |
|
}
|
|
417 |
e.printStackTrace();
|
425 |
418 |
}
|
426 |
419 |
}
|
427 |
420 |
|