Revision 62318
Added by Antonis Lempesis almost 2 years ago
RepositoryServiceImpl.java | ||
---|---|---|
72 | 72 |
@Value("${services.provide.usageStatisticsNumbersBaseURL}") |
73 | 73 |
private String usageStatisticsNumbersBaseURL; |
74 | 74 |
|
75 |
private Converter converter; |
|
75 | 76 |
|
76 | 77 |
private static final Map<String, List<String>> dataSourceClass = new HashMap<>(); |
77 | 78 |
private static final Map<String, String> invertedDataSourceClass = new HashMap<>(); |
... | ... | |
91 | 92 |
AuthoritiesUpdater authoritiesUpdater, |
92 | 93 |
VocabularyLoader vocabularyLoader, |
93 | 94 |
RestTemplate restTemplate, |
95 |
Converter converter, |
|
94 | 96 |
@Lazy EmailUtils emailUtils, |
95 | 97 |
@Lazy ValidatorService validatorService, |
96 | 98 |
@Lazy PiWikService piWikService) { |
... | ... | |
100 | 102 |
this.authoritiesUpdater = authoritiesUpdater; |
101 | 103 |
this.vocabularyLoader = vocabularyLoader; |
102 | 104 |
this.piWikService = piWikService; |
105 |
this.converter = converter; |
|
103 | 106 |
this.emailUtils = emailUtils; |
104 | 107 |
this.validatorService = validatorService; |
105 | 108 |
this.restTemplate = restTemplate; |
... | ... | |
177 | 180 |
requestFilter.setId(repoId); |
178 | 181 |
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class); |
179 | 182 |
|
180 |
repos.addAll(Converter.jsonToRepositoryList(new JSONObject(rs)));
|
|
183 |
repos.addAll(converter.toRepositoryList(new JSONObject(rs)));
|
|
181 | 184 |
} |
182 | 185 |
|
183 | 186 |
for (Repository r : repos) |
... | ... | |
363 | 366 |
if (jsonArray.length() == 0) |
364 | 367 |
throw new ResourceNotFoundException(); |
365 | 368 |
|
366 |
repo = Converter.jsonToRepositorySnippetObject(jsonArray.getJSONObject(0));
|
|
369 |
repo = converter.toRepositorySnippet(jsonArray.getJSONObject(0));
|
|
367 | 370 |
return repo; |
368 | 371 |
} |
369 | 372 |
|
... | ... | |
382 | 385 |
if (jsonArray.length() == 0) |
383 | 386 |
throw new ResourceNotFoundException(); |
384 | 387 |
|
385 |
repo = Converter.jsonToRepositoryObject(jsonArray.getJSONObject(0));
|
|
388 |
repo = converter.toRepository(jsonArray.getJSONObject(0));
|
|
386 | 389 |
return updateRepositoryInfo(repo); |
387 | 390 |
} |
388 | 391 |
|
... | ... | |
396 | 399 |
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class); |
397 | 400 |
JSONArray aggregationInfo = new JSONObject(rs).getJSONArray("aggregationInfo"); |
398 | 401 |
|
399 |
List<AggregationDetails> aggregationHistory = new ArrayList<>(Converter.getAggregationHistoryFromJson(aggregationInfo));
|
|
402 |
List<AggregationDetails> aggregationHistory = new ArrayList<>(converter.toAggregationHistory(aggregationInfo));
|
|
400 | 403 |
|
401 | 404 |
return aggregationHistory; |
402 | 405 |
} |
... | ... | |
441 | 444 |
requestFilter.setOfficialname(name); |
442 | 445 |
|
443 | 446 |
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class); |
444 |
List<Repository> repos = Converter.jsonToRepositoryList(new JSONObject(rs));
|
|
447 |
List<Repository> repos = converter.toRepositoryList(new JSONObject(rs));
|
|
445 | 448 |
for (Repository r : repos) |
446 | 449 |
updateRepositoryInfo(r); |
447 | 450 |
return repos; |
... | ... | |
457 | 460 |
.build().expand(id).encode(); |
458 | 461 |
|
459 | 462 |
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class); |
460 |
return Converter.jsonToRepositoryInterfaceList(new JSONObject(rs));
|
|
463 |
return converter.toRepositoryInterfaceList(new JSONObject(rs));
|
|
461 | 464 |
|
462 | 465 |
} |
463 | 466 |
|
... | ... | |
526 | 529 |
.build() |
527 | 530 |
.encode(); |
528 | 531 |
|
529 |
String json_repository = Converter.repositoryObjectToJson(repository);
|
|
532 |
String json_repository = converter.toJson(repository);
|
|
530 | 533 |
LOGGER.debug("JSON to add(update) -> " + json_repository); |
531 | 534 |
|
532 | 535 |
HttpEntity<String> httpEntity = new HttpEntity<>(json_repository, httpHeaders); |
... | ... | |
552 | 555 |
.build() |
553 | 556 |
.encode(); |
554 | 557 |
|
555 |
String json_repository = Converter.repositoryObjectToJson(repository);
|
|
558 |
String json_repository = converter.toJson(repository);
|
|
556 | 559 |
|
557 | 560 |
LOGGER.debug("JSON to update -> " + json_repository); |
558 | 561 |
|
... | ... | |
585 | 588 |
.fromHttpUrl(baseAddress + "/ds/add/") |
586 | 589 |
.build() |
587 | 590 |
.encode(); |
588 |
String json_repository = Converter.repositoryObjectToJson(repository);
|
|
591 |
String json_repository = converter.toJson(repository);
|
|
589 | 592 |
HttpEntity<String> httpEntity = new HttpEntity<String>(json_repository, httpHeaders); |
590 | 593 |
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class); |
591 | 594 |
|
... | ... | |
619 | 622 |
String comment, RepositoryInterface repositoryInterface) throws Exception { |
620 | 623 |
Repository e = this.getRepositoryById(repoId); |
621 | 624 |
repositoryInterface = createRepositoryInterface(e, repositoryInterface, datatype); |
622 |
String json_interface = Converter.repositoryInterfaceObjectToJson(e, repositoryInterface);
|
|
625 |
String json_interface = converter.toJson(e, repositoryInterface);
|
|
623 | 626 |
|
624 | 627 |
UriComponents uriComponents = UriComponentsBuilder |
625 | 628 |
.fromHttpUrl(baseAddress + "/ds/api/add/") |
... | ... | |
725 | 728 |
@Override |
726 | 729 |
public List<String> getDnetCountries() { |
727 | 730 |
LOGGER.debug("Getting dnet-countries!"); |
728 |
return Converter.readFile("countries.txt");
|
|
731 |
return converter.readFile("countries.txt");
|
|
729 | 732 |
} |
730 | 733 |
|
731 | 734 |
@Override |
732 | 735 |
public List<String> getTypologies() { |
733 |
return Converter.readFile("typologies.txt");
|
|
736 |
return converter.readFile("typologies.txt");
|
|
734 | 737 |
} |
735 | 738 |
|
736 | 739 |
@Override |
737 | 740 |
public List<Timezone> getTimezones() { |
738 |
List<String> timezones = Converter.readFile("timezones.txt");
|
|
739 |
return Converter.toTimezones(timezones);
|
|
741 |
List<String> timezones = converter.readFile("timezones.txt");
|
|
742 |
return converter.toTimezones(timezones);
|
|
740 | 743 |
} |
741 | 744 |
|
742 | 745 |
@Override |
Also available in: Unified diff
tidied up the Converter