removed dependencies and refactored code
This commit is contained in:
parent
de76e89349
commit
bfb9d865cb
151
pom.xml
151
pom.xml
|
@ -17,14 +17,14 @@
|
|||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<spring.boot.version>2.7.18</spring.boot.version>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -32,52 +32,47 @@
|
|||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jdbc</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
@ -112,26 +107,65 @@
|
|||
<version>1.12.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>eu.dnetlib</groupId>-->
|
||||
<!-- <artifactId>uoa-clients</artifactId>-->
|
||||
<!-- <version>[2.0.0-SNAPSHOT,)</version>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>javax.servlet</groupId>-->
|
||||
<!-- <artifactId>javax.servlet-api</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>com.google.gwt</groupId>-->
|
||||
<!-- <artifactId>gwt-user</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- for Validator Service -->
|
||||
<!-- JAX-WS API -->
|
||||
<dependency>
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>uoa-clients</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT,)</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-user</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<groupId>javax.xml.ws</groupId>
|
||||
<artifactId>jaxws-api</artifactId>
|
||||
<version>2.3.1</version> <!-- or the latest version -->
|
||||
</dependency>
|
||||
|
||||
<!-- JAX-WS Runtime Implementation (e.g., Metro) -->
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.ws</groupId>
|
||||
<artifactId>jaxws-rt</artifactId>
|
||||
<version>2.3.7</version> <!-- or the latest version -->
|
||||
</dependency>
|
||||
<!-- for Validator Service -->
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>eu.dnetlib</groupId>-->
|
||||
<!-- <artifactId>dnet-runtime</artifactId>-->
|
||||
<!-- <version>1.0.2-SNAPSHOT</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-core</artifactId>
|
||||
<version>3.1.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>dnet-runtime</artifactId>
|
||||
<version>1.0.2-SNAPSHOT</version>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-bindings-soap</artifactId>
|
||||
<version>3.1.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-transports-http</artifactId>
|
||||
<version>3.1.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
||||
<version>3.1.5</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>uoa-hcm</artifactId>
|
||||
|
@ -160,16 +194,16 @@
|
|||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib-nodep</artifactId>
|
||||
<version>3.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>cglib</groupId>-->
|
||||
<!-- <artifactId>cglib-nodep</artifactId>-->
|
||||
<!-- <version>3.3.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>se.kb</groupId>
|
||||
|
@ -184,13 +218,6 @@
|
|||
<version>2.7.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
<artifactId>jersey-client</artifactId>
|
||||
<version>2.42</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- TODO - Do we need this? We already have: "com.google.code.gson:gson" -->
|
||||
<dependency>
|
||||
|
@ -218,12 +245,6 @@
|
|||
<version>42.7.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mitre</groupId>
|
||||
<artifactId>openid-connect-client</artifactId>
|
||||
|
@ -261,24 +282,7 @@
|
|||
<version>2.10.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.thetransactioncompany</groupId>
|
||||
<artifactId>cors-filter</artifactId>
|
||||
<version>3.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.ws</groupId>
|
||||
<artifactId>jaxws-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/javax.jws/javax.jws-api -->
|
||||
<dependency>
|
||||
<groupId>javax.jws</groupId>
|
||||
<artifactId>javax.jws-api</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
|
@ -312,13 +316,13 @@
|
|||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-bom</artifactId>
|
||||
<version>2021.2.3</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.session</groupId>-->
|
||||
<!-- <artifactId>spring-session-bom</artifactId>-->
|
||||
<!-- <version>2021.2.3</version>-->
|
||||
<!-- <type>pom</type>-->
|
||||
<!-- <scope>import</scope>-->
|
||||
<!-- </dependency>-->
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
@ -349,7 +353,6 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
|
|
|
@ -2,10 +2,11 @@ package eu.dnetlib.repo.manager;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
@SpringBootApplication(exclude = SolrAutoConfiguration.class)
|
||||
@EnableJpaRepositories
|
||||
@EnableScheduling
|
||||
public class Application {
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package eu.dnetlib.repo.manager.clients.ws;
|
||||
|
||||
import eu.dnetlib.api.DriverService;
|
||||
import eu.dnetlib.domain.ServiceIdentity;
|
||||
import eu.dnetlib.domain.enabling.Notification;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public abstract class BaseDriverWebService<S extends DriverService> implements
|
||||
DriverWebService<S> {
|
||||
private static Logger logger = Logger.getLogger(BaseDriverWebService.class);
|
||||
|
||||
protected S service = null;
|
||||
|
||||
public void setService(S service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String identify() {
|
||||
ServiceIdentity identity = service.identify();
|
||||
|
||||
if (identity != null)
|
||||
return service.identify().toString();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void notify(String subscriptionId, String topic, String isId,
|
||||
String message) {
|
||||
logger.debug("Notification received: " + topic + ", message: "
|
||||
+ message);
|
||||
|
||||
try {
|
||||
Notification notification = new Notification(subscriptionId,
|
||||
message, topic, isId);
|
||||
|
||||
service.notify(notification);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error creating notification", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package eu.dnetlib.repo.manager.clients.ws;
|
||||
|
||||
import eu.dnetlib.api.DriverService;
|
||||
import eu.dnetlib.api.DriverServiceException;
|
||||
import eu.dnetlib.domain.ServiceIdentity;
|
||||
import eu.dnetlib.domain.enabling.Notification;
|
||||
import eu.dnetlib.utils.ServiceIdentityFactory;
|
||||
|
||||
public abstract class BaseWebServiceClient<WS extends DriverWebService<? extends DriverService>>
|
||||
implements DriverService {
|
||||
|
||||
protected WS webService = null;
|
||||
|
||||
@Override
|
||||
public final ServiceIdentity identify() {
|
||||
String identity = webService.identify();
|
||||
|
||||
if (identity != null)
|
||||
return ServiceIdentityFactory.parseIdentity(webService.identify());
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void notify(Notification notification)
|
||||
throws DriverServiceException {
|
||||
try {
|
||||
webService.notify(
|
||||
notification.getSubscriptionId(),
|
||||
notification.getTopic(),
|
||||
notification.getIsId(),
|
||||
notification.getMessage());
|
||||
} catch (Exception e) {
|
||||
throw new DriverServiceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public final WS getWebService() {
|
||||
return webService;
|
||||
}
|
||||
|
||||
public final void setWebService(WS webService) {
|
||||
this.webService = webService;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final void setWebService(Object webService) {
|
||||
this.webService = (WS) webService;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package eu.dnetlib.repo.manager.clients.ws;
|
||||
|
||||
import eu.dnetlib.api.DriverService;
|
||||
import eu.dnetlib.api.DriverServiceEndpoint;
|
||||
import eu.dnetlib.common.rmi.BaseService;
|
||||
|
||||
import javax.jws.WebService;
|
||||
|
||||
@WebService
|
||||
public interface DriverWebService<S extends DriverService> extends BaseService,
|
||||
DriverServiceEndpoint<S> {
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package eu.dnetlib.repo.manager.clients.ws.validator;
|
||||
|
||||
import eu.dnetlib.api.functionality.ValidatorService;
|
||||
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
||||
import eu.dnetlib.repo.manager.clients.ws.DriverWebService;
|
||||
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||
import eu.dnetlib.domain.functionality.validator.RuleSet;
|
||||
import eu.dnetlib.domain.functionality.validator.StoredJob;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebParam;
|
||||
import javax.jws.WebService;
|
||||
import java.util.List;
|
||||
|
||||
@WebService (targetNamespace ="http://services.dnetlib.eu/")
|
||||
public interface ValidatorWebService extends DriverWebService<ValidatorService> {
|
||||
|
||||
@WebMethod(operationName = "getStoredJob")
|
||||
StoredJob getStoredJob(@WebParam(name = "jobId") int jobId, @WebParam(name = "groupBy") String groupBy) throws ValidatorServiceException;
|
||||
|
||||
@WebMethod(operationName = "getJobSummary")
|
||||
List<StoredJob> getJobSummary(@WebParam(name = "baseUrl") List<String> baseUrl, @WebParam(name = "limit") int limit) throws ValidatorServiceException;
|
||||
|
||||
@WebMethod(operationName = "getStoredJobs")
|
||||
List<StoredJob> getStoredJobs(@WebParam(name = "userMail") String userMail, @WebParam(name = "jobType") String jobType, @WebParam(name = "offset") Integer offset, @WebParam(name = "limit") Integer limit, @WebParam(name = "dateFrom") String dateFrom, @WebParam(name = "dateTo") String dateTo) throws ValidatorServiceException;
|
||||
|
||||
@WebMethod(operationName = "getStoredJobsTotalNumber")
|
||||
int getStoredJobsTotalNumber(@WebParam(name = "userMail") String userMail, @WebParam(name = "jobType") String jobType) throws ValidatorServiceException;
|
||||
|
||||
@WebMethod(operationName = "getStoredJobsNew")
|
||||
List<StoredJob> getStoredJobsNew(@WebParam(name = "userMail") String userMail, @WebParam(name = "jobType") String jobType, @WebParam(name = "offset") Integer offset, @WebParam(name = "limit") Integer limit, @WebParam(name = "dateFrom") String dateFrom, @WebParam(name = "dateTo") String dateTo, @WebParam(name = "jobStatus") String jobStatus) throws ValidatorServiceException;
|
||||
|
||||
@WebMethod(operationName = "getStoredJobsTotalNumberNew")
|
||||
int getStoredJobsTotalNumberNew(@WebParam(name = "userMail") String userMail, @WebParam(name = "jobType") String jobType, @WebParam(name = "jobStatus") String jobStatus) throws ValidatorServiceException;
|
||||
|
||||
@WebMethod(operationName = "getRuleSets")
|
||||
List<RuleSet> getRuleSets() throws ValidatorServiceException;
|
||||
|
||||
@WebMethod(operationName = "submitValidationJob")
|
||||
void submitValidationJob(@WebParam(name = "job")JobForValidation job) throws ValidatorServiceException;
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package eu.dnetlib.repo.manager.clients.ws.validator;
|
||||
|
||||
import eu.dnetlib.api.functionality.ValidatorService;
|
||||
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
||||
import eu.dnetlib.repo.manager.clients.ws.BaseWebServiceClient;
|
||||
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||
import eu.dnetlib.domain.functionality.validator.RuleSet;
|
||||
import eu.dnetlib.domain.functionality.validator.StoredJob;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ValidatorWebServiceClient extends
|
||||
BaseWebServiceClient<ValidatorWebService> implements ValidatorService {
|
||||
|
||||
private Logger logger = Logger.getLogger(ValidatorWebServiceClient.class);
|
||||
|
||||
@Override
|
||||
public StoredJob getStoredJob(int jobId, String groupBy)
|
||||
throws ValidatorServiceException {
|
||||
return this.webService.getStoredJob(jobId, groupBy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoredJob> getJobSummary(List<String> baseUrl, int size)
|
||||
throws ValidatorServiceException {
|
||||
return this.webService.getJobSummary(baseUrl, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoredJob> getStoredJobs(String userMail, String jobType, Integer offset, Integer limit, String dateFrom, String dateTo)
|
||||
throws ValidatorServiceException {
|
||||
return this.webService.getStoredJobs(userMail, jobType, offset, limit, dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoredJob> getStoredJobsNew(String userMail, String jobType, Integer offset, Integer limit, String dateFrom, String dateTo, String jobStatus)
|
||||
throws ValidatorServiceException {
|
||||
return this.webService.getStoredJobsNew(userMail, jobType, offset, limit, dateFrom, dateTo, jobStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStoredJobsTotalNumber(String userMail, String jobType)
|
||||
throws ValidatorServiceException {
|
||||
return this.webService.getStoredJobsTotalNumber(userMail, jobType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStoredJobsTotalNumberNew(String userMail, String jobType, String jobStatus)
|
||||
throws ValidatorServiceException {
|
||||
return this.webService.getStoredJobsTotalNumberNew(userMail, jobType, jobStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RuleSet> getRuleSets() throws ValidatorServiceException {
|
||||
return this.webService.getRuleSets();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitValidationJob(JobForValidation job)
|
||||
throws ValidatorServiceException {
|
||||
this.webService.submitValidationJob(job);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package eu.dnetlib.repo.manager.clients.ws.validator;
|
||||
|
||||
import eu.dnetlib.api.functionality.ValidatorService;
|
||||
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
||||
import eu.dnetlib.repo.manager.clients.ws.BaseDriverWebService;
|
||||
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||
import eu.dnetlib.domain.functionality.validator.RuleSet;
|
||||
import eu.dnetlib.domain.functionality.validator.StoredJob;
|
||||
|
||||
import javax.jws.WebService;
|
||||
import java.util.List;
|
||||
|
||||
@WebService(
|
||||
targetNamespace ="http://services.dnetlib.eu/",
|
||||
serviceName = "ValidatorWebService",
|
||||
endpointInterface = "eu.dnetlib.repo.manager.clients.ws.validator.ValidatorWebService")
|
||||
public class ValidatorWebServiceImpl
|
||||
extends BaseDriverWebService<ValidatorService>
|
||||
implements ValidatorWebService {
|
||||
|
||||
@Override
|
||||
public StoredJob getStoredJob(int jobId, String groupBy)
|
||||
throws ValidatorServiceException {
|
||||
return service.getStoredJob(jobId, groupBy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoredJob> getJobSummary(List<String> baseUrl, int limit) throws ValidatorServiceException {
|
||||
return service.getJobSummary(baseUrl,limit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoredJob> getStoredJobs(String userMail, String jobType,
|
||||
Integer offset, Integer limit, String dateFrom, String dateTo) throws ValidatorServiceException {
|
||||
return service.getStoredJobs(userMail, jobType, offset, limit, dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoredJob> getStoredJobsNew(String userMail, String jobType,
|
||||
Integer offset, Integer limit, String dateFrom, String dateTo, String jobStatus) throws ValidatorServiceException {
|
||||
return service.getStoredJobsNew(userMail, jobType, offset, limit, dateFrom, dateTo, jobStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStoredJobsTotalNumber(String userMail, String jobType) throws ValidatorServiceException {
|
||||
return service.getStoredJobsTotalNumber(userMail, jobType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStoredJobsTotalNumberNew(String userMail, String jobType, String jobStatus) throws ValidatorServiceException {
|
||||
return service.getStoredJobsTotalNumberNew(userMail, jobType, jobStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RuleSet> getRuleSets() throws ValidatorServiceException {
|
||||
return service.getRuleSets();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitValidationJob(JobForValidation job)
|
||||
throws ValidatorServiceException {
|
||||
service.submitValidationJob(job);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,18 +1,10 @@
|
|||
package eu.dnetlib.repo.manager.config;
|
||||
|
||||
import eu.dnetlib.api.enabling.ISLookUpService;
|
||||
import eu.dnetlib.api.functionality.ValidatorService;
|
||||
import eu.dnetlib.clients.enabling.islookup.ws.ISLookUpClient;
|
||||
import eu.dnetlib.clients.functionality.validator.ws.ValidatorWebService;
|
||||
import eu.dnetlib.clients.functionality.validator.ws.ValidatorWebServiceClient;
|
||||
import eu.dnetlib.domain.enabling.Vocabulary;
|
||||
import gr.uoa.di.driver.enabling.ISLookUp;
|
||||
import gr.uoa.di.driver.enabling.islookup.ISLookUpImpl;
|
||||
import gr.uoa.di.driver.enabling.vocabulary.ISVocabularyLoader;
|
||||
import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader;
|
||||
import eu.dnetlib.repo.manager.clients.ws.validator.ValidatorWebService;
|
||||
import eu.dnetlib.repo.manager.clients.ws.validator.ValidatorWebServiceClient;
|
||||
import gr.uoa.di.driver.util.ServiceLocator;
|
||||
import gr.uoa.di.driver.util.StaticServiceLocator;
|
||||
import gr.uoa.di.driver.xml.VocabularyXmlConverter;
|
||||
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
@ -29,14 +21,14 @@ public class Config {
|
|||
@Value("${services.provide.validatorService.url}")
|
||||
private String validatorUrl;
|
||||
|
||||
@Bean(name = "vocabularyLoader")
|
||||
public VocabularyLoader createVocabularyLoader() throws Exception {
|
||||
ISVocabularyLoader loader = new ISVocabularyLoader();
|
||||
|
||||
loader.setLookUp(createVocabularyLookUp());
|
||||
|
||||
return loader;
|
||||
}
|
||||
// @Bean(name = "vocabularyLoader")
|
||||
// public VocabularyLoader createVocabularyLoader() throws Exception {
|
||||
// ISVocabularyLoader loader = new ISVocabularyLoader();
|
||||
//
|
||||
// loader.setLookUp(createVocabularyLookUp());
|
||||
//
|
||||
// return loader;
|
||||
// }
|
||||
|
||||
@Bean("validatorServiceLocator")
|
||||
public ServiceLocator<ValidatorService> createValidatorServiceLocator() {
|
||||
|
@ -56,29 +48,29 @@ public class Config {
|
|||
return locator;
|
||||
}
|
||||
|
||||
// @Bean(name="vocabularyLookUp")
|
||||
private ISLookUp<Vocabulary> createVocabularyLookUp() throws Exception {
|
||||
ISLookUpImpl<Vocabulary> lookUp = new ISLookUpImpl<>();
|
||||
// // @Bean(name="vocabularyLookUp")
|
||||
// private ISLookUp<Vocabulary> createVocabularyLookUp() throws Exception {
|
||||
// ISLookUpImpl<Vocabulary> lookUp = new ISLookUpImpl<>();
|
||||
//
|
||||
// lookUp.setLookupLocator(createIsLookupServiceLocator());
|
||||
// lookUp.setConverter(new VocabularyXmlConverter());
|
||||
//
|
||||
// return lookUp;
|
||||
// }
|
||||
|
||||
lookUp.setLookupLocator(createIsLookupServiceLocator());
|
||||
lookUp.setConverter(new VocabularyXmlConverter());
|
||||
|
||||
return lookUp;
|
||||
}
|
||||
|
||||
private ServiceLocator<ISLookUpService> createIsLookupServiceLocator() throws Exception {
|
||||
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
|
||||
|
||||
factory.setServiceClass(eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService.class);
|
||||
factory.setAddress(lookupURL);
|
||||
eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService client = (eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService) factory.create();
|
||||
|
||||
ISLookUpClient service = new ISLookUpClient();
|
||||
service.setWebService(client);
|
||||
|
||||
StaticServiceLocator<ISLookUpService> locator = new StaticServiceLocator<>();
|
||||
locator.setService(service);
|
||||
|
||||
return locator;
|
||||
}
|
||||
// private ServiceLocator<ISLookUpService> createIsLookupServiceLocator() throws Exception {
|
||||
// JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
|
||||
//
|
||||
// factory.setServiceClass(eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService.class);
|
||||
// factory.setAddress(lookupURL);
|
||||
// eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService client = (eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService) factory.create();
|
||||
//
|
||||
// ISLookUpClient service = new ISLookUpClient();
|
||||
// service.setWebService(client);
|
||||
//
|
||||
// StaticServiceLocator<ISLookUpService> locator = new StaticServiceLocator<>();
|
||||
// locator.setService(service);
|
||||
//
|
||||
// return locator;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1,19 +1,10 @@
|
|||
package eu.dnetlib.repo.manager.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||
import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
|
||||
|
||||
@Configuration
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true,proxyTargetClass = true)
|
||||
public class GlobalSecurityConfiguration extends GlobalMethodSecurityConfiguration {
|
||||
@EnableMethodSecurity(prePostEnabled = true, proxyTargetClass = true)
|
||||
public class GlobalSecurityConfiguration {
|
||||
|
||||
@Bean
|
||||
public CommonsMultipartResolver multipartResolver(){
|
||||
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
|
||||
multipartResolver.setMaxUploadSize(268435456);
|
||||
return multipartResolver;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.springframework.security.core.Authentication;
|
|||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -286,11 +285,11 @@ public class RepositoryController {
|
|||
/**
|
||||
* Subscribe to repo by email
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, path = "{id}/admins")
|
||||
@RequestMapping(method = RequestMethod.POST, path = "{id}/admins", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PreAuthorize("hasAnyAuthority('SUPER_ADMINISTRATOR', 'CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or @authorizationService.isMemberOf(#id)")
|
||||
public Response subscribeByEmail(@PathVariable("id") String id, @RequestBody String email) throws ResourceNotFoundException {
|
||||
public ResponseEntity<?> subscribeByEmail(@PathVariable("id") String id, @RequestBody String email) throws ResourceNotFoundException {
|
||||
authorizationService.addAdmin(id, email);
|
||||
return Response.status(HttpStatus.OK.value()).entity(JsonUtils.createResponse("Role has been assigned").toString()).type(javax.ws.rs.core.MediaType.APPLICATION_JSON).build();
|
||||
return ResponseEntity.ok(JsonUtils.createResponse("Role has been assigned").toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,8 +11,6 @@ import org.springframework.http.ResponseEntity;
|
|||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.util.Collection;
|
||||
|
||||
//@RestController
|
||||
|
@ -40,9 +38,9 @@ public class UserRoleController {
|
|||
**/
|
||||
@RequestMapping(method = RequestMethod.GET, path = "/role/{id}")
|
||||
// @PreAuthorize("hasAnyAuthority('REGISTERED_USER', 'SUPER_ADMINISTRATOR', 'CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR')")
|
||||
public Response getRole(@RequestParam(value = "type", defaultValue = "datasource") String type, @PathVariable("id") String id) {
|
||||
public ResponseEntity<?> getRole(@RequestParam(value = "type", defaultValue = "datasource") String type, @PathVariable("id") String id) {
|
||||
int roleId = aaiRegistryService.getCouId(type, id);
|
||||
return Response.status(HttpStatus.OK.value()).entity(JsonUtils.createResponse("Role id is: " + roleId).toString()).type(MediaType.APPLICATION_JSON).build();
|
||||
return ResponseEntity.ok(JsonUtils.createResponse("Role id is: " + roleId).toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,9 +48,9 @@ public class UserRoleController {
|
|||
**/
|
||||
@RequestMapping(method = RequestMethod.POST, path = "/role")
|
||||
@PreAuthorize("hasAnyAuthority('SUPER_ADMINISTRATOR')")
|
||||
public Response createRole(@RequestBody Role role) {
|
||||
public ResponseEntity<?> createRole(@RequestBody Role role) {
|
||||
aaiRegistryService.createRole(role);
|
||||
return Response.status(HttpStatus.OK.value()).entity(JsonUtils.createResponse("Role has been created").toString()).type(MediaType.APPLICATION_JSON).build();
|
||||
return ResponseEntity.ok(JsonUtils.createResponse("Role has been created").toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +58,7 @@ public class UserRoleController {
|
|||
*/
|
||||
@RequestMapping(method = RequestMethod.POST, path = "/subscribe/{type}/{id}")
|
||||
@PreAuthorize("hasAnyAuthority('SUPER_ADMINISTRATOR', 'CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR')")
|
||||
public Response subscribe(@PathVariable("type") String type, @PathVariable("id") String id) {
|
||||
public ResponseEntity<?> subscribe(@PathVariable("type") String type, @PathVariable("id") String id) {
|
||||
Integer coPersonId = aaiRegistryService.getCoPersonIdByIdentifier();
|
||||
if (coPersonId == null) {
|
||||
coPersonId = aaiRegistryService.getCoPersonIdsByEmail().get(0);
|
||||
|
@ -72,9 +70,10 @@ public class UserRoleController {
|
|||
// Add role to current authorities
|
||||
authoritiesUpdater.addRole(roleMappingService.repositoryIdToAuthority(id));
|
||||
|
||||
return Response.status(HttpStatus.OK.value()).entity(JsonUtils.createResponse("Role has been assigned").toString()).type(MediaType.APPLICATION_JSON).build();
|
||||
return ResponseEntity.ok(JsonUtils.createResponse("Role has been assigned").toString());
|
||||
} else {
|
||||
return Response.status(HttpStatus.NOT_FOUND.value()).entity(JsonUtils.createResponse("Role has not been found").toString()).type(MediaType.APPLICATION_JSON).build();
|
||||
|
||||
return new ResponseEntity<>(JsonUtils.createResponse("Role has not been found").toString(), HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,29 +1,47 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
|
||||
import eu.dnetlib.domain.DriverResource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Created by stefania on 3/8/16.
|
||||
*
|
||||
* The domain object for the Vocabulary resource data structure
|
||||
*
|
||||
*/
|
||||
public class Vocabulary {
|
||||
@SuppressWarnings("serial")
|
||||
public class Vocabulary extends DriverResource {
|
||||
private String name = null;
|
||||
private Map<String, String> nameMap = null;
|
||||
private Map<String, String> encodingMap = null;
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
public Vocabulary(String name, Map<String, String> nameMap) {
|
||||
this.setResourceType("VocabularyDSResourceType");
|
||||
this.setResourceKind("VocabularyDSResources");
|
||||
|
||||
public Vocabulary() {
|
||||
}
|
||||
|
||||
public Vocabulary(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
initializeMaps(nameMap);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
public Vocabulary(String name, Map<String, String> nameMap, Map<String, String> encodingMap) {
|
||||
this.setResourceType("VocabularyDSResourceType");
|
||||
this.setResourceKind("VocabularyDSResources");
|
||||
|
||||
this.name = name;
|
||||
this.nameMap = nameMap;
|
||||
this.encodingMap = encodingMap;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
public void initializeMaps(Map<String, String> nameMap) {
|
||||
this.nameMap = nameMap;
|
||||
this.encodingMap = new TreeMap<String, String>();
|
||||
for (String name : nameMap.keySet()) {
|
||||
encodingMap.put(nameMap.get(name), name);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -33,4 +51,23 @@ public class Vocabulary {
|
|||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getEncoding(String englishName) {
|
||||
return nameMap.get(englishName);
|
||||
}
|
||||
|
||||
public String getEnglishName(String encoding) {
|
||||
return encodingMap.get(encoding);
|
||||
}
|
||||
|
||||
public List<String> getEnglishNames() {
|
||||
return new ArrayList<String>(this.nameMap.keySet());
|
||||
}
|
||||
|
||||
public List<String> getEncodings() {
|
||||
return new ArrayList<String>(this.encodingMap.keySet());
|
||||
}
|
||||
|
||||
public Map<String, String> getAsMap() { return this.encodingMap; }
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,9 @@ import eu.dnetlib.repo.manager.domain.Term;
|
|||
import eu.dnetlib.repo.manager.domain.Tuple;
|
||||
import eu.dnetlib.repo.manager.domain.broker.*;
|
||||
import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||
import org.apache.commons.lang.NotImplementedException;
|
||||
import org.apache.commons.lang3.NotImplementedException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.*;
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
||||
import eu.dnetlib.domain.enabling.Vocabulary;
|
||||
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||
import eu.dnetlib.repo.manager.domain.*;
|
||||
import eu.dnetlib.repo.manager.domain.dto.User;
|
||||
|
@ -16,7 +15,6 @@ import eu.dnetlib.repo.manager.service.security.AuthorizationService;
|
|||
import eu.dnetlib.repo.manager.service.security.RoleMappingService;
|
||||
import eu.dnetlib.repo.manager.utils.Converter;
|
||||
import eu.dnetlib.repo.manager.utils.DateUtils;
|
||||
import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
||||
import org.slf4j.Logger;
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package eu.dnetlib.repo.manager.service;
|
||||
|
||||
import eu.dnetlib.repo.manager.domain.Vocabulary;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public interface VocabularyLoader {
|
||||
|
||||
public abstract Vocabulary getVocabulary(String vocabularyName, Locale locale, Locale defaultLocale);
|
||||
|
||||
}
|
|
@ -11,7 +11,7 @@ import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
|||
import org.mitre.openid.connect.model.UserInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
@ -34,10 +34,9 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||
private final AuthoritiesUpdater authoritiesUpdater;
|
||||
private final PendingUserRoleRepository pendingUserRoleRepository;
|
||||
|
||||
@Autowired
|
||||
AuthorizationServiceImpl(RoleMappingService roleMappingService, AaiRegistryService aaiRegistryService,
|
||||
AuthoritiesUpdater authoritiesUpdater,
|
||||
PendingUserRoleRepository pendingUserRoleRepository) {
|
||||
@Lazy PendingUserRoleRepository pendingUserRoleRepository) {
|
||||
this.roleMappingService = roleMappingService;
|
||||
this.aaiRegistryService = aaiRegistryService;
|
||||
this.authoritiesUpdater = authoritiesUpdater;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.dnetlib.repo.manager.service.vocabulary;
|
||||
|
||||
import eu.dnetlib.repo.manager.domain.Term;
|
||||
import eu.dnetlib.repo.manager.domain.Vocabulary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -17,14 +18,14 @@ public class DnetVocabulary {
|
|||
public DnetVocabulary() {
|
||||
}
|
||||
|
||||
public static eu.dnetlib.domain.enabling.Vocabulary toVocabulary(DnetVocabulary vocabulary) {
|
||||
public static Vocabulary toVocabulary(DnetVocabulary vocabulary) {
|
||||
Map<String, String> nameMap = new TreeMap<>();
|
||||
Map<String, String> encodingMap = new TreeMap<>();
|
||||
for (Term term : vocabulary.getTerms()) {
|
||||
nameMap.put(term.getEnglishName(), term.getCode());
|
||||
encodingMap.put(term.getCode(), term.getEnglishName());
|
||||
}
|
||||
return new eu.dnetlib.domain.enabling.Vocabulary(vocabulary.getName(), nameMap, encodingMap);
|
||||
return new Vocabulary(vocabulary.getName(), nameMap, encodingMap);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.dnetlib.repo.manager.service.vocabulary;
|
||||
|
||||
import eu.dnetlib.domain.enabling.Vocabulary;
|
||||
import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader;
|
||||
import eu.dnetlib.repo.manager.domain.Vocabulary;
|
||||
import eu.dnetlib.repo.manager.service.VocabularyLoader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
|
@ -8,16 +8,13 @@ import org.springframework.web.client.ResponseErrorHandler;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.springframework.http.HttpStatus.Series.CLIENT_ERROR;
|
||||
import static org.springframework.http.HttpStatus.Series.SERVER_ERROR;
|
||||
|
||||
@Component
|
||||
public class RestTemplateResponseErrorHandler implements ResponseErrorHandler {
|
||||
|
||||
@Override
|
||||
public boolean hasError(ClientHttpResponse httpResponse) throws IOException {
|
||||
HttpStatus.Series seriesError = httpResponse.getStatusCode().series();
|
||||
return ( (seriesError == CLIENT_ERROR) || (seriesError == SERVER_ERROR) );
|
||||
HttpStatus statusCode = httpResponse.getStatusCode();
|
||||
return ( (statusCode.is4xxClientError()) || (statusCode.is5xxServerError()) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +23,7 @@ public class RestTemplateResponseErrorHandler implements ResponseErrorHandler {
|
|||
HttpStatus statusCode = httpResponse.getStatusCode();
|
||||
if ( statusCode == HttpStatus.NOT_FOUND )
|
||||
throw new IOException();
|
||||
else if (statusCode.series() == SERVER_ERROR)
|
||||
else if (statusCode.is5xxServerError())
|
||||
throw new EndPointException();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue