Cleaning up the code
This commit is contained in:
parent
8b1ad0b920
commit
ddf7152123
86
pom.xml
86
pom.xml
|
@ -177,12 +177,6 @@
|
|||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/cz.habarta.typescript-generator/typescript-generator-maven-plugin -->
|
||||
<!--<dependency>
|
||||
<groupId>cz.habarta.typescript-generator</groupId>
|
||||
<artifactId>typescript-generator-maven-plugin</artifactId>
|
||||
<version>1.29.366</version>
|
||||
</dependency>-->
|
||||
<!-- https://mvnrepository.com/artifact/postgresql/postgresql -->
|
||||
<dependency>
|
||||
<groupId>postgresql</groupId>
|
||||
|
@ -194,13 +188,13 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-catalina</artifactId>
|
||||
<version>LATEST</version>
|
||||
<version>9.0.22</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>LATEST</version>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -304,82 +298,6 @@
|
|||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
<!--<plugin>-->
|
||||
<!--<groupId>com.googlecode.maven-download-plugin</groupId>-->
|
||||
<!--<artifactId>download-maven-plugin</artifactId>-->
|
||||
<!--<version>1.3.0</version>-->
|
||||
<!--<executions>-->
|
||||
<!--<execution>-->
|
||||
<!--<phase>process-resources</phase>-->
|
||||
<!--<goals>-->
|
||||
<!--<goal>wget</goal>-->
|
||||
<!--</goals>-->
|
||||
<!--<configuration>-->
|
||||
<!--<url>-->
|
||||
<!--https://github.com/ostranme/swagger-ui-themes/archive/v3.0.0.zip-->
|
||||
<!--</url>-->
|
||||
<!--<unpack>true</unpack>-->
|
||||
<!--<outputDirectory>${project.build.directory}</outputDirectory>-->
|
||||
<!--</configuration>-->
|
||||
<!--</execution>-->
|
||||
<!--</executions>-->
|
||||
<!--</plugin>-->
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<sequential>
|
||||
<echo>Add theme</echo>
|
||||
<replace token="</head>"
|
||||
value="<link href='webjars/springfox-swagger-ui/themes/2.x/theme-feeling-blue.css' rel="stylesheet"/></head>"
|
||||
dir="${settings.localRepository}/io/springfox/springfox-swagger-ui/2.7.0/META-INF/resources">
|
||||
<include name="swagger-ui.html"/>
|
||||
</replace>
|
||||
</sequential>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
-->
|
||||
|
||||
<!--<plugin>
|
||||
<groupId>cz.habarta.typescript-generator</groupId>
|
||||
<artifactId>typescript-generator-maven-plugin</artifactId>
|
||||
<version>1.29.366</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate1</id>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<jsonLibrary>jackson2</jsonLibrary>
|
||||
<outputFileType>implementationFile</outputFileType>
|
||||
<mapClasses>asClasses</mapClasses>
|
||||
<classPatterns>
|
||||
<pattern>eu.dnetlib.domain.data.*</pattern>
|
||||
</classPatterns>
|
||||
<outputFile>target/typeScriptClasses.ts</outputFile>
|
||||
<outputKind>module</outputKind>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>-->
|
||||
</plugins>
|
||||
<finalName>uoa-repository-manager-service</finalName>
|
||||
<resources>
|
||||
|
|
|
@ -86,7 +86,6 @@ public class DashboardServiceImpl implements DashboardService {
|
|||
|
||||
} catch (Exception e) {
|
||||
logger.error("Something baad happened!", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return repositorySummaryInfoList;
|
||||
|
|
|
@ -91,7 +91,7 @@ public class MonitorServiceImpl implements MonitorService {
|
|||
try {
|
||||
return getValidationService().getStoredJobsTotalNumberNew(user, jobType, validationStatus);
|
||||
} catch (ValidatorServiceException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class MonitorServiceImpl implements MonitorService {
|
|||
try {
|
||||
return getValidationService().getStoredJob(Integer.parseInt(jobId), groupBy);
|
||||
} catch (ValidatorServiceException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,6 @@ public class PiWikServiceImpl implements PiWikService {
|
|||
|
||||
@Override
|
||||
public List<PiwikInfo> getPiwikSitesForRepos(OrderByField orderByField, OrderByType orderByType, int from, int quantity, String searchField) {
|
||||
LOGGER.debug("Getting piwik sites for repos! ");
|
||||
try{
|
||||
String finalizedQuery = GET_PIWIK_SITES + " where ("+
|
||||
" repositoryid ilike ? " +
|
||||
|
|
|
@ -80,44 +80,14 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
ValidatorService validatorService;
|
||||
|
||||
|
||||
private Map<String, Vocabulary> vocabularyMap = new ConcurrentHashMap<String, Vocabulary>();
|
||||
private Map<String, Vocabulary> vocabularyMap = new ConcurrentHashMap<>();
|
||||
|
||||
private Map<String, String> countriesMap = new HashMap<>();
|
||||
private Map<String, String> inverseCountriesMap = new HashMap<>();
|
||||
|
||||
private static Map<String,List<String>> dataSourceClass = new HashMap<String,List<String>>(){{
|
||||
put("opendoar",new ArrayList<String>(){{ add("pubsrepository::institutional");
|
||||
add("pubsrepository::thematic");
|
||||
add("pubsrepository::unknown");
|
||||
add("pubsrepository::mock");
|
||||
}});
|
||||
put("re3data",new ArrayList<String>(){{ add("datarepository::unknown");
|
||||
}});
|
||||
put("journal",new ArrayList<String>(){{ add("pubsrepository::journal");
|
||||
}});
|
||||
put("aggregator",new ArrayList<String>(){{ add("aggregator::pubsrepository::institutional");
|
||||
add("aggregator::pubsrepository::journals");
|
||||
add("aggregator::datarepository");
|
||||
add("aggregator::pubsrepository::unknown");
|
||||
}});
|
||||
}};
|
||||
private static Map<String,List<String>> dataSourceClass = new HashMap<>();
|
||||
|
||||
private static Map<String,String> invertedDataSourceClass = new HashMap<String,String>(){{
|
||||
put("pubsrepository::institutional","opendoar");
|
||||
put("pubsrepository::thematic","opendoar");
|
||||
put("pubsrepository::unknown","opendoar");
|
||||
put("pubsrepository::mock","opendoar");
|
||||
|
||||
put("datarepository::unknown","re3data");
|
||||
|
||||
put("pubsrepository::journal","journal");
|
||||
|
||||
put("aggregator::pubsrepository::institutional","aggregator");
|
||||
put("aggregator::pubsrepository::journals","aggregator");
|
||||
put("aggregator::datarepository","aggregator");
|
||||
put("aggregator::pubsrepository::unknown","aggregator");
|
||||
|
||||
}};
|
||||
private static Map<String,String> invertedDataSourceClass = new HashMap<>();
|
||||
|
||||
|
||||
|
||||
|
@ -126,6 +96,23 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
LOGGER.debug("Initialization method of repository api!");
|
||||
LOGGER.debug("Updated version!");
|
||||
|
||||
dataSourceClass.put("opendoar",Arrays.asList("pubsrepository::institutional","pubsrepository::thematic","pubsrepository::unknown","pubsrepository::mock"));
|
||||
dataSourceClass.put("re3data", Collections.singletonList("datarepository::unknown"));
|
||||
dataSourceClass.put("journal", Collections.singletonList("pubsrepository::journal"));
|
||||
dataSourceClass.put("aggregator",Arrays.asList("aggregator::pubsrepository::institutional","aggregator::pubsrepository::journals","aggregator::datarepository", "aggregator::pubsrepository::unknown"));
|
||||
|
||||
invertedDataSourceClass.put("pubsrepository::institutional","opendoar");
|
||||
invertedDataSourceClass.put("pubsrepository::thematic","opendoar");
|
||||
invertedDataSourceClass.put("pubsrepository::unknown","opendoar");
|
||||
invertedDataSourceClass.put("pubsrepository::mock","opendoar");
|
||||
invertedDataSourceClass.put("datarepository::unknown","re3data");
|
||||
invertedDataSourceClass.put("pubsrepository::journal","journal");
|
||||
invertedDataSourceClass.put("aggregator::pubsrepository::institutional","aggregator");
|
||||
invertedDataSourceClass.put("aggregator::pubsrepository::journals","aggregator");
|
||||
invertedDataSourceClass.put("aggregator::datarepository","aggregator");
|
||||
invertedDataSourceClass.put("aggregator::pubsrepository::unknown","aggregator");
|
||||
|
||||
|
||||
httpHeaders = new HttpHeaders();
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
}
|
||||
}
|
||||
} catch (ValidatorServiceException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
emailUtils.reportException(e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e);
|
||||
}
|
||||
return jobForValidation;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
public ResponseEntity<Object> reSubmitJobForValidation(String email,
|
||||
String jobId) throws JSONException, ValidatorServiceException {
|
||||
LOGGER.debug("Resubmit validation job with id : " + jobId);
|
||||
StoredJob job = monitorApi.getJobSummary(jobId,"all");
|
||||
StoredJob job = monitorApi.getJobSummary(jobId, "all");
|
||||
Set<Integer> contentRules = new HashSet<Integer>();
|
||||
Set<Integer> usageRules = new HashSet<Integer>();
|
||||
|
||||
|
@ -120,12 +120,13 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int ruleId : job.getRules()) {
|
||||
if (ruleSet.getContentRulesIds().contains(ruleId))
|
||||
contentRules.add(ruleId);
|
||||
else if (ruleSet.getUsageRulesIds().contains(ruleId))
|
||||
usageRules.add(ruleId);
|
||||
if (ruleSet != null){
|
||||
for (int ruleId : job.getRules()) {
|
||||
if (ruleSet.getContentRulesIds().contains(ruleId))
|
||||
contentRules.add(ruleId);
|
||||
else if (ruleSet.getUsageRulesIds().contains(ruleId))
|
||||
usageRules.add(ruleId);
|
||||
}
|
||||
}
|
||||
if (!contentRules.isEmpty())
|
||||
job.setSelectedContentRules(contentRules);
|
||||
|
|
|
@ -10,11 +10,11 @@ import java.util.Map;
|
|||
*/
|
||||
public class DatasourceVocabularies implements IsSerializable {
|
||||
|
||||
Map<String, String> countries;
|
||||
List<Timezone> timezones;
|
||||
Map<String, String> datasourceClasses;
|
||||
List<String> typologies;
|
||||
Map<String, String> compatibilityLevels;
|
||||
private Map<String, String> countries;
|
||||
private List<Timezone> timezones;
|
||||
private Map<String, String> datasourceClasses;
|
||||
private List<String> typologies;
|
||||
private Map<String, String> compatibilityLevels;
|
||||
|
||||
public DatasourceVocabularies() {
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
|||
*/
|
||||
public class Term implements IsSerializable {
|
||||
|
||||
public String englishName;
|
||||
public String nativeName;
|
||||
public String encoding;
|
||||
public String code;
|
||||
private String englishName;
|
||||
private String nativeName;
|
||||
private String encoding;
|
||||
private String code;
|
||||
|
||||
public Term(String englishName, String nativeName, String encoding, String code) {
|
||||
this.englishName = englishName;
|
||||
|
|
|
@ -3,8 +3,8 @@ package eu.dnetlib.repo.manager.shared;
|
|||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class Timezone implements IsSerializable {
|
||||
public String name;
|
||||
public double offset;
|
||||
private String name;
|
||||
private double offset;
|
||||
|
||||
public Timezone(){
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
|||
*/
|
||||
public class BrowseEntry implements Comparable<BrowseEntry>, IsSerializable{
|
||||
|
||||
public String value;
|
||||
public Long size;
|
||||
private String value;
|
||||
private Long size;
|
||||
|
||||
public BrowseEntry() {
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ public class Converter {
|
|||
try {
|
||||
return formatter.parse(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -287,26 +287,6 @@ public class Converter {
|
|||
repositoryMap.put("identities",identities);
|
||||
repositoryMap.put("subjects","");
|
||||
|
||||
//TODO check fields
|
||||
/* jsonObject.put("certificates",repository.getCertificates());
|
||||
jsonObject.put("citationguidelineurl",repository.getCitationGuidelineUrl());
|
||||
jsonObject.put("databaseaccessrestriction",repository.getDatabaseAccessRestriction());
|
||||
jsonObject.put("databaseaccesstype",repository.getDatabaseAccessType());
|
||||
jsonObject.put("datauploadrestriction",repository.getDataUploadRestriction());
|
||||
jsonObject.put("datauploadtype",repository.getDataUploadType());
|
||||
jsonObject.put("missionstatementurl",repository.getMissionStatementUrl());
|
||||
jsonObject.put("od_contenttypes",repository.getOdContentTypes());
|
||||
jsonObject.put("officialname",repository.getOfficialname());
|
||||
jsonObject.put("pidsystems",repository.getPidSystems());
|
||||
jsonObject.put("provenanceaction",repository.getProvenanceActionClass());
|
||||
jsonObject.put("qualitymanagementkind",repository.getQualityManagementKind());
|
||||
jsonObject.put("releaseenddate",convertDateToString(repository.getReleaseEndDate()));
|
||||
jsonObject.put("releasestartdate",convertDateToString(repository.getReleaseStartDate()));
|
||||
jsonObject.put("serviceprovider",repository.getServiceProvider());
|
||||
jsonObject.put("versioning",repository.getVersioning());
|
||||
//datasource.get("platform");
|
||||
//datasource.get("subjects");*/
|
||||
|
||||
return mapper.writeValueAsString(repositoryMap);
|
||||
}
|
||||
|
||||
|
@ -363,7 +343,7 @@ public class Converter {
|
|||
br.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.debug("Error opening file!");
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -396,21 +376,6 @@ public class Converter {
|
|||
return aggregationDetails;
|
||||
}
|
||||
|
||||
public static AggregationDetails getLastCollectionFromJson(JSONObject datasourceInfo) throws JSONException {
|
||||
|
||||
if( datasourceInfo.get("lastCollection").equals(null))
|
||||
return null;
|
||||
|
||||
return jsonToAggregationDetails(datasourceInfo.getJSONObject("lastCollection"));
|
||||
}
|
||||
|
||||
public static AggregationDetails getLastTransformationFromJson(JSONObject datasourceInfo) throws JSONException {
|
||||
|
||||
if( datasourceInfo.get("lastTransformation").equals(null))
|
||||
return null;
|
||||
|
||||
return jsonToAggregationDetails(datasourceInfo.getJSONObject("lastTransformation"));
|
||||
}
|
||||
|
||||
public static List<Timezone> toTimezones(List<String> timezones) {
|
||||
|
||||
|
@ -422,7 +387,7 @@ public class Converter {
|
|||
return tmz;
|
||||
}
|
||||
|
||||
public static String getOpenaireId(String repositoryId) {
|
||||
private static String getOpenaireId(String repositoryId) {
|
||||
if (repositoryId != null && repositoryId.contains("::"))
|
||||
return repositoryId.split("::")[0] + "::" + DigestUtils.md5Hex(repositoryId.split("::")[1]);
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue