Revision 56766
Added by Ioannis Diplas over 4 years ago
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java | ||
---|---|---|
80 | 80 |
ValidatorService validatorService; |
81 | 81 |
|
82 | 82 |
|
83 |
private Map<String, Vocabulary> vocabularyMap = new ConcurrentHashMap<String, Vocabulary>();
|
|
83 |
private Map<String, Vocabulary> vocabularyMap = new ConcurrentHashMap<>(); |
|
84 | 84 |
|
85 | 85 |
private Map<String, String> countriesMap = new HashMap<>(); |
86 | 86 |
private Map<String, String> inverseCountriesMap = new HashMap<>(); |
87 | 87 |
|
88 |
private static Map<String,List<String>> dataSourceClass = new HashMap<String,List<String>>(){{ |
|
89 |
put("opendoar",new ArrayList<String>(){{ add("pubsrepository::institutional"); |
|
90 |
add("pubsrepository::thematic"); |
|
91 |
add("pubsrepository::unknown"); |
|
92 |
add("pubsrepository::mock"); |
|
93 |
}}); |
|
94 |
put("re3data",new ArrayList<String>(){{ add("datarepository::unknown"); |
|
95 |
}}); |
|
96 |
put("journal",new ArrayList<String>(){{ add("pubsrepository::journal"); |
|
97 |
}}); |
|
98 |
put("aggregator",new ArrayList<String>(){{ add("aggregator::pubsrepository::institutional"); |
|
99 |
add("aggregator::pubsrepository::journals"); |
|
100 |
add("aggregator::datarepository"); |
|
101 |
add("aggregator::pubsrepository::unknown"); |
|
102 |
}}); |
|
103 |
}}; |
|
88 |
private static Map<String,List<String>> dataSourceClass = new HashMap<>(); |
|
104 | 89 |
|
105 |
private static Map<String,String> invertedDataSourceClass = new HashMap<String,String>(){{ |
|
106 |
put("pubsrepository::institutional","opendoar"); |
|
107 |
put("pubsrepository::thematic","opendoar"); |
|
108 |
put("pubsrepository::unknown","opendoar"); |
|
109 |
put("pubsrepository::mock","opendoar"); |
|
90 |
private static Map<String,String> invertedDataSourceClass = new HashMap<>(); |
|
110 | 91 |
|
111 |
put("datarepository::unknown","re3data"); |
|
112 | 92 |
|
113 |
put("pubsrepository::journal","journal"); |
|
114 | 93 |
|
115 |
put("aggregator::pubsrepository::institutional","aggregator"); |
|
116 |
put("aggregator::pubsrepository::journals","aggregator"); |
|
117 |
put("aggregator::datarepository","aggregator"); |
|
118 |
put("aggregator::pubsrepository::unknown","aggregator"); |
|
119 |
|
|
120 |
}}; |
|
121 |
|
|
122 |
|
|
123 |
|
|
124 | 94 |
@PostConstruct |
125 | 95 |
private void init() { |
126 | 96 |
LOGGER.debug("Initialization method of repository api!"); |
127 | 97 |
LOGGER.debug("Updated version!"); |
128 | 98 |
|
99 |
dataSourceClass.put("opendoar",Arrays.asList("pubsrepository::institutional","pubsrepository::thematic","pubsrepository::unknown","pubsrepository::mock")); |
|
100 |
dataSourceClass.put("re3data", Collections.singletonList("datarepository::unknown")); |
|
101 |
dataSourceClass.put("journal", Collections.singletonList("pubsrepository::journal")); |
|
102 |
dataSourceClass.put("aggregator",Arrays.asList("aggregator::pubsrepository::institutional","aggregator::pubsrepository::journals","aggregator::datarepository", "aggregator::pubsrepository::unknown")); |
|
103 |
|
|
104 |
invertedDataSourceClass.put("pubsrepository::institutional","opendoar"); |
|
105 |
invertedDataSourceClass.put("pubsrepository::thematic","opendoar"); |
|
106 |
invertedDataSourceClass.put("pubsrepository::unknown","opendoar"); |
|
107 |
invertedDataSourceClass.put("pubsrepository::mock","opendoar"); |
|
108 |
invertedDataSourceClass.put("datarepository::unknown","re3data"); |
|
109 |
invertedDataSourceClass.put("pubsrepository::journal","journal"); |
|
110 |
invertedDataSourceClass.put("aggregator::pubsrepository::institutional","aggregator"); |
|
111 |
invertedDataSourceClass.put("aggregator::pubsrepository::journals","aggregator"); |
|
112 |
invertedDataSourceClass.put("aggregator::datarepository","aggregator"); |
|
113 |
invertedDataSourceClass.put("aggregator::pubsrepository::unknown","aggregator"); |
|
114 |
|
|
115 |
|
|
129 | 116 |
httpHeaders = new HttpHeaders(); |
130 | 117 |
httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8); |
131 | 118 |
|
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/PiWikServiceImpl.java | ||
---|---|---|
96 | 96 |
|
97 | 97 |
@Override |
98 | 98 |
public List<PiwikInfo> getPiwikSitesForRepos(OrderByField orderByField, OrderByType orderByType, int from, int quantity, String searchField) { |
99 |
LOGGER.debug("Getting piwik sites for repos! "); |
|
100 | 99 |
try{ |
101 | 100 |
String finalizedQuery = GET_PIWIK_SITES + " where ("+ |
102 | 101 |
" repositoryid ilike ? " + |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/ValidatorServiceImpl.java | ||
---|---|---|
81 | 81 |
} |
82 | 82 |
} |
83 | 83 |
} catch (ValidatorServiceException e) { |
84 |
e.printStackTrace();
|
|
84 |
LOGGER.error(e);
|
|
85 | 85 |
} |
86 | 86 |
|
87 | 87 |
} |
... | ... | |
98 | 98 |
emailUtils.reportException(e); |
99 | 99 |
throw e; |
100 | 100 |
} catch (Exception e) { |
101 |
e.printStackTrace();
|
|
101 |
LOGGER.error(e);
|
|
102 | 102 |
} |
103 | 103 |
return jobForValidation; |
104 | 104 |
} |
... | ... | |
108 | 108 |
public ResponseEntity<Object> reSubmitJobForValidation(String email, |
109 | 109 |
String jobId) throws JSONException, ValidatorServiceException { |
110 | 110 |
LOGGER.debug("Resubmit validation job with id : " + jobId); |
111 |
StoredJob job = monitorApi.getJobSummary(jobId,"all"); |
|
111 |
StoredJob job = monitorApi.getJobSummary(jobId, "all");
|
|
112 | 112 |
Set<Integer> contentRules = new HashSet<Integer>(); |
113 | 113 |
Set<Integer> usageRules = new HashSet<Integer>(); |
114 | 114 |
|
... | ... | |
120 | 120 |
break; |
121 | 121 |
} |
122 | 122 |
} |
123 |
|
|
124 |
for (int ruleId : job.getRules()) { |
|
125 |
if (ruleSet.getContentRulesIds().contains(ruleId)) |
|
126 |
contentRules.add(ruleId); |
|
127 |
else if (ruleSet.getUsageRulesIds().contains(ruleId)) |
|
128 |
usageRules.add(ruleId); |
|
123 |
if (ruleSet != null){ |
|
124 |
for (int ruleId : job.getRules()) { |
|
125 |
if (ruleSet.getContentRulesIds().contains(ruleId)) |
|
126 |
contentRules.add(ruleId); |
|
127 |
else if (ruleSet.getUsageRulesIds().contains(ruleId)) |
|
128 |
usageRules.add(ruleId); |
|
129 |
} |
|
129 | 130 |
} |
130 | 131 |
if (!contentRules.isEmpty()) |
131 | 132 |
job.setSelectedContentRules(contentRules); |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/MonitorServiceImpl.java | ||
---|---|---|
91 | 91 |
try { |
92 | 92 |
return getValidationService().getStoredJobsTotalNumberNew(user, jobType, validationStatus); |
93 | 93 |
} catch (ValidatorServiceException e) { |
94 |
e.printStackTrace();
|
|
94 |
LOGGER.error(e);
|
|
95 | 95 |
} |
96 | 96 |
return 0; |
97 | 97 |
} |
... | ... | |
103 | 103 |
try { |
104 | 104 |
return getValidationService().getStoredJob(Integer.parseInt(jobId), groupBy); |
105 | 105 |
} catch (ValidatorServiceException e) { |
106 |
e.printStackTrace();
|
|
106 |
LOGGER.error(e);
|
|
107 | 107 |
} |
108 | 108 |
return null; |
109 | 109 |
} |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/DashboardServiceImpl.java | ||
---|---|---|
86 | 86 |
|
87 | 87 |
} catch (Exception e) { |
88 | 88 |
logger.error("Something baad happened!", e); |
89 |
e.printStackTrace(); |
|
90 | 89 |
} |
91 | 90 |
|
92 | 91 |
return repositorySummaryInfoList; |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/utils/Converter.java | ||
---|---|---|
116 | 116 |
try { |
117 | 117 |
return formatter.parse(date); |
118 | 118 |
} catch (ParseException e) { |
119 |
e.printStackTrace();
|
|
119 |
LOGGER.error(e);
|
|
120 | 120 |
} |
121 | 121 |
return null; |
122 | 122 |
} |
... | ... | |
287 | 287 |
repositoryMap.put("identities",identities); |
288 | 288 |
repositoryMap.put("subjects",""); |
289 | 289 |
|
290 |
//TODO check fields |
|
291 |
/* jsonObject.put("certificates",repository.getCertificates()); |
|
292 |
jsonObject.put("citationguidelineurl",repository.getCitationGuidelineUrl()); |
|
293 |
jsonObject.put("databaseaccessrestriction",repository.getDatabaseAccessRestriction()); |
|
294 |
jsonObject.put("databaseaccesstype",repository.getDatabaseAccessType()); |
|
295 |
jsonObject.put("datauploadrestriction",repository.getDataUploadRestriction()); |
|
296 |
jsonObject.put("datauploadtype",repository.getDataUploadType()); |
|
297 |
jsonObject.put("missionstatementurl",repository.getMissionStatementUrl()); |
|
298 |
jsonObject.put("od_contenttypes",repository.getOdContentTypes()); |
|
299 |
jsonObject.put("officialname",repository.getOfficialname()); |
|
300 |
jsonObject.put("pidsystems",repository.getPidSystems()); |
|
301 |
jsonObject.put("provenanceaction",repository.getProvenanceActionClass()); |
|
302 |
jsonObject.put("qualitymanagementkind",repository.getQualityManagementKind()); |
|
303 |
jsonObject.put("releaseenddate",convertDateToString(repository.getReleaseEndDate())); |
|
304 |
jsonObject.put("releasestartdate",convertDateToString(repository.getReleaseStartDate())); |
|
305 |
jsonObject.put("serviceprovider",repository.getServiceProvider()); |
|
306 |
jsonObject.put("versioning",repository.getVersioning()); |
|
307 |
//datasource.get("platform"); |
|
308 |
//datasource.get("subjects");*/ |
|
309 |
|
|
310 | 290 |
return mapper.writeValueAsString(repositoryMap); |
311 | 291 |
} |
312 | 292 |
|
... | ... | |
363 | 343 |
br.close(); |
364 | 344 |
} catch (IOException e) { |
365 | 345 |
LOGGER.debug("Error opening file!"); |
366 |
e.printStackTrace();
|
|
346 |
LOGGER.error(e);
|
|
367 | 347 |
} |
368 | 348 |
return list; |
369 | 349 |
} |
... | ... | |
396 | 376 |
return aggregationDetails; |
397 | 377 |
} |
398 | 378 |
|
399 |
public static AggregationDetails getLastCollectionFromJson(JSONObject datasourceInfo) throws JSONException { |
|
400 | 379 |
|
401 |
if( datasourceInfo.get("lastCollection").equals(null)) |
|
402 |
return null; |
|
403 |
|
|
404 |
return jsonToAggregationDetails(datasourceInfo.getJSONObject("lastCollection")); |
|
405 |
} |
|
406 |
|
|
407 |
public static AggregationDetails getLastTransformationFromJson(JSONObject datasourceInfo) throws JSONException { |
|
408 |
|
|
409 |
if( datasourceInfo.get("lastTransformation").equals(null)) |
|
410 |
return null; |
|
411 |
|
|
412 |
return jsonToAggregationDetails(datasourceInfo.getJSONObject("lastTransformation")); |
|
413 |
} |
|
414 |
|
|
415 | 380 |
public static List<Timezone> toTimezones(List<String> timezones) { |
416 | 381 |
|
417 | 382 |
List<Timezone> tmz = new ArrayList<>(); |
... | ... | |
422 | 387 |
return tmz; |
423 | 388 |
} |
424 | 389 |
|
425 |
public static String getOpenaireId(String repositoryId) {
|
|
390 |
private static String getOpenaireId(String repositoryId) {
|
|
426 | 391 |
if (repositoryId != null && repositoryId.contains("::")) |
427 | 392 |
return repositoryId.split("::")[0] + "::" + DigestUtils.md5Hex(repositoryId.split("::")[1]); |
428 | 393 |
return null; |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/shared/broker/BrowseEntry.java | ||
---|---|---|
7 | 7 |
*/ |
8 | 8 |
public class BrowseEntry implements Comparable<BrowseEntry>, IsSerializable{ |
9 | 9 |
|
10 |
public String value;
|
|
11 |
public Long size;
|
|
10 |
private String value;
|
|
11 |
private Long size;
|
|
12 | 12 |
|
13 | 13 |
public BrowseEntry() { |
14 | 14 |
} |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/shared/Term.java | ||
---|---|---|
7 | 7 |
*/ |
8 | 8 |
public class Term implements IsSerializable { |
9 | 9 |
|
10 |
public String englishName;
|
|
11 |
public String nativeName;
|
|
12 |
public String encoding;
|
|
13 |
public String code;
|
|
10 |
private String englishName;
|
|
11 |
private String nativeName;
|
|
12 |
private String encoding;
|
|
13 |
private String code;
|
|
14 | 14 |
|
15 | 15 |
public Term(String englishName, String nativeName, String encoding, String code) { |
16 | 16 |
this.englishName = englishName; |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/shared/Timezone.java | ||
---|---|---|
3 | 3 |
import com.google.gwt.user.client.rpc.IsSerializable; |
4 | 4 |
|
5 | 5 |
public class Timezone implements IsSerializable { |
6 |
public String name;
|
|
7 |
public double offset;
|
|
6 |
private String name;
|
|
7 |
private double offset;
|
|
8 | 8 |
|
9 | 9 |
public Timezone(){ |
10 | 10 |
} |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/shared/DatasourceVocabularies.java | ||
---|---|---|
10 | 10 |
*/ |
11 | 11 |
public class DatasourceVocabularies implements IsSerializable { |
12 | 12 |
|
13 |
Map<String, String> countries; |
|
14 |
List<Timezone> timezones; |
|
15 |
Map<String, String> datasourceClasses; |
|
16 |
List<String> typologies; |
|
17 |
Map<String, String> compatibilityLevels; |
|
13 |
private Map<String, String> countries;
|
|
14 |
private List<Timezone> timezones;
|
|
15 |
private Map<String, String> datasourceClasses;
|
|
16 |
private List<String> typologies;
|
|
17 |
private Map<String, String> compatibilityLevels;
|
|
18 | 18 |
|
19 | 19 |
public DatasourceVocabularies() { |
20 | 20 |
} |
modules/uoa-repository-manager-service/trunk/pom.xml | ||
---|---|---|
177 | 177 |
<version>2.7.0</version> |
178 | 178 |
</dependency> |
179 | 179 |
|
180 |
<!-- https://mvnrepository.com/artifact/cz.habarta.typescript-generator/typescript-generator-maven-plugin --> |
|
181 |
<!--<dependency> |
|
182 |
<groupId>cz.habarta.typescript-generator</groupId> |
|
183 |
<artifactId>typescript-generator-maven-plugin</artifactId> |
|
184 |
<version>1.29.366</version> |
|
185 |
</dependency>--> |
|
186 | 180 |
<!-- https://mvnrepository.com/artifact/postgresql/postgresql --> |
187 | 181 |
<dependency> |
188 | 182 |
<groupId>postgresql</groupId> |
... | ... | |
194 | 188 |
<dependency> |
195 | 189 |
<groupId>org.apache.tomcat</groupId> |
196 | 190 |
<artifactId>tomcat-catalina</artifactId> |
197 |
<version>LATEST</version>
|
|
191 |
<version>9.0.22</version>
|
|
198 | 192 |
</dependency> |
199 | 193 |
|
200 | 194 |
<dependency> |
201 | 195 |
<groupId>commons-fileupload</groupId> |
202 | 196 |
<artifactId>commons-fileupload</artifactId> |
203 |
<version>LATEST</version>
|
|
197 |
<version>1.4</version>
|
|
204 | 198 |
</dependency> |
205 | 199 |
|
206 | 200 |
<dependency> |
... | ... | |
304 | 298 |
<failOnMissingWebXml>false</failOnMissingWebXml> |
305 | 299 |
</configuration> |
306 | 300 |
</plugin> |
307 |
|
|
308 |
|
|
309 |
<!--<plugin>--> |
|
310 |
<!--<groupId>com.googlecode.maven-download-plugin</groupId>--> |
|
311 |
<!--<artifactId>download-maven-plugin</artifactId>--> |
|
312 |
<!--<version>1.3.0</version>--> |
|
313 |
<!--<executions>--> |
|
314 |
<!--<execution>--> |
|
315 |
<!--<phase>process-resources</phase>--> |
|
316 |
<!--<goals>--> |
|
317 |
<!--<goal>wget</goal>--> |
|
318 |
<!--</goals>--> |
|
319 |
<!--<configuration>--> |
|
320 |
<!--<url>--> |
|
321 |
<!--https://github.com/ostranme/swagger-ui-themes/archive/v3.0.0.zip--> |
|
322 |
<!--</url>--> |
|
323 |
<!--<unpack>true</unpack>--> |
|
324 |
<!--<outputDirectory>${project.build.directory}</outputDirectory>--> |
|
325 |
<!--</configuration>--> |
|
326 |
<!--</execution>--> |
|
327 |
<!--</executions>--> |
|
328 |
<!--</plugin>--> |
|
329 |
|
|
330 |
|
|
331 |
|
|
332 |
<!-- |
|
333 |
<plugin> |
|
334 |
<groupId>org.apache.maven.plugins</groupId> |
|
335 |
<artifactId>maven-antrun-plugin</artifactId> |
|
336 |
<version>1.8</version> |
|
337 |
<executions> |
|
338 |
<execution> |
|
339 |
<phase>prepare-package</phase> |
|
340 |
<goals> |
|
341 |
<goal>run</goal> |
|
342 |
</goals> |
|
343 |
<configuration> |
|
344 |
<tasks> |
|
345 |
<sequential> |
|
346 |
<echo>Add theme</echo> |
|
347 |
<replace token="</head>" |
|
348 |
value="<link href='webjars/springfox-swagger-ui/themes/2.x/theme-feeling-blue.css' rel="stylesheet"/></head>" |
|
349 |
dir="${settings.localRepository}/io/springfox/springfox-swagger-ui/2.7.0/META-INF/resources"> |
|
350 |
<include name="swagger-ui.html"/> |
|
351 |
</replace> |
|
352 |
</sequential> |
|
353 |
</tasks> |
|
354 |
</configuration> |
|
355 |
</execution> |
|
356 |
</executions> |
|
357 |
</plugin> |
|
358 |
--> |
|
359 |
|
|
360 |
<!--<plugin> |
|
361 |
<groupId>cz.habarta.typescript-generator</groupId> |
|
362 |
<artifactId>typescript-generator-maven-plugin</artifactId> |
|
363 |
<version>1.29.366</version> |
|
364 |
<executions> |
|
365 |
<execution> |
|
366 |
<id>generate1</id> |
|
367 |
<goals> |
|
368 |
<goal>generate</goal> |
|
369 |
</goals> |
|
370 |
<configuration> |
|
371 |
<jsonLibrary>jackson2</jsonLibrary> |
|
372 |
<outputFileType>implementationFile</outputFileType> |
|
373 |
<mapClasses>asClasses</mapClasses> |
|
374 |
<classPatterns> |
|
375 |
<pattern>eu.dnetlib.domain.data.*</pattern> |
|
376 |
</classPatterns> |
|
377 |
<outputFile>target/typeScriptClasses.ts</outputFile> |
|
378 |
<outputKind>module</outputKind> |
|
379 |
</configuration> |
|
380 |
</execution> |
|
381 |
</executions> |
|
382 |
</plugin>--> |
|
383 | 301 |
</plugins> |
384 | 302 |
<finalName>uoa-repository-manager-service</finalName> |
385 | 303 |
<resources> |
Also available in: Unified diff
Cleaning up the code