Compare commits
56 Commits
master
...
update-con
Author | SHA1 | Date |
---|---|---|
George Kalampokis | c84b0ab593 | |
George Kalampokis | 1f2084578d | |
George Kalampokis | 6b6d63c128 | |
George Kalampokis | b012f415a7 | |
George Kalampokis | 85b37dd16d | |
George Kalampokis | 1d1226dc5f | |
George Kalampokis | 93deb96f99 | |
George Kalampokis | 2c94cfa130 | |
George Kalampokis | 6542841c6c | |
George Kalampokis | 5916226a6f | |
George Kalampokis | af91a009db | |
George Kalampokis | 4434699f93 | |
George Kalampokis | a3da159564 | |
George Kalampokis | dea57b1cf8 | |
George Kalampokis | 4373d6db61 | |
George Kalampokis | 53d38088cd | |
George Kalampokis | d7653f374c | |
George Kalampokis | 198acac6b2 | |
George Kalampokis | f63d6b33ed | |
George Kalampokis | f5873ab9b0 | |
George Kalampokis | a9d6ab89f5 | |
George Kalampokis | 39cd57e4a9 | |
George Kalampokis | 9eec5daea1 | |
George Kalampokis | 65575048fe | |
George Kalampokis | df061051a3 | |
George Kalampokis | ee356c047d | |
George Kalampokis | 8a8993b235 | |
George Kalampokis | 734dc94f26 | |
George Kalampokis | 7741a82b28 | |
George Kalampokis | 1dd971c4aa | |
George Kalampokis | 4317feacd7 | |
George Kalampokis | 88568f6dcf | |
George Kalampokis | c6fea04fb4 | |
George Kalampokis | 41e8b40c40 | |
George Kalampokis | f9027c8cc3 | |
George Kalampokis | 1c275c4d2b | |
George Kalampokis | c0aac45f39 | |
George Kalampokis | a51aa3aeb5 | |
George Kalampokis | 2c00dab450 | |
George Kalampokis | 2666568fab | |
George Kalampokis | cf1b2489a3 | |
George Kalampokis | 5938e4d6f3 | |
George Kalampokis | 3fff5e1d2e | |
George Kalampokis | 9c9919fd85 | |
George Kalampokis | 063491ef21 | |
George Kalampokis | 57420c1403 | |
George Kalampokis | ed7cd0f852 | |
George Kalampokis | 4941a9fa95 | |
George Kalampokis | 765ddf752a | |
George Kalampokis | 6ddf8103f2 | |
George Kalampokis | 54173dc5b9 | |
George Kalampokis | f20cacc312 | |
George Kalampokis | ac4886b477 | |
George Kalampokis | 6e8794af1d | |
George Kalampokis | 4c651c6200 | |
George Kalampokis | 674cbbf384 |
11
.env
11
.env
|
@ -1,5 +1,6 @@
|
|||
PROFILE=docker
|
||||
|
||||
# Version of Elastic products
|
||||
ELK_VERSION=7.17.4
|
||||
STACK_VERSION=7.17.4
|
||||
TAG=6.3.0
|
||||
ENV=prod
|
||||
PROFILE=production
|
||||
AOT=aot
|
||||
ELASTIC_VERSION=6.3.0
|
||||
ELASTIC_PASSWORD=changeme
|
||||
|
|
|
@ -46,6 +46,3 @@ ELK.Docker/shared/data-elk/
|
|||
.settings/
|
||||
bin/
|
||||
*.classpath
|
||||
openDMP/dmp-backend/uploads/
|
||||
openDMP/dmp-backend/tmp/
|
||||
dmp-frontend/.angular/
|
||||
|
|
|
@ -16,5 +16,5 @@ FROM docker.elastic.co/logstash/logstash:${ELK_VERSION}
|
|||
|
||||
# Add your logstash plugins setup here
|
||||
# Example: RUN logstash-plugin install logstash-filter-json
|
||||
RUN logstash-plugin update logstash-input-beats
|
||||
RUN logstash-plugin update logstash-filter-grok
|
||||
#RUN logstash-plugin update logstash-input-beats
|
||||
#RUN logstash-plugin update logstash-filter-grok
|
||||
|
|
|
@ -2,18 +2,11 @@ input {
|
|||
pipeline { address => open_dmp_send_to_elastic }
|
||||
}
|
||||
|
||||
filter {
|
||||
}
|
||||
|
||||
output {
|
||||
elasticsearch {
|
||||
hosts => "elasticsearch:9200"
|
||||
index => "opendmp.logs"
|
||||
user => elastic
|
||||
password =>
|
||||
index =>"opendmp.logs"
|
||||
#manage_template => true
|
||||
#template => "/usr/share/logstash/templates/audit/openDMP.json"
|
||||
#template_name => "cite.elas.openDMP-audit*"
|
||||
#template_overwrite => true
|
||||
}
|
||||
}
|
||||
password => ""
|
||||
}
|
||||
}
|
||||
|
|
69
README.md
69
README.md
|
@ -1,69 +0,0 @@
|
|||
|
||||
**Important note: The deployment, troubleshooting, maintenance and operation of on-premises / self-served OpenDMP instances for development, testing or production use, shall be the sole responsibility of the adopter. No support is guaranteed by OpenDMP implentation team for issues that may be encountered during deployment, extension or operation of such installations.**
|
||||
|
||||
**Documentation is provided on a best-effort basis for the code and processes around the development, deployment and operation of OpenDMP. If you find any misalignment of the actual processes with the related documentation, please let us know so that the misalignment is addressed for the benefit of future adopters.**
|
||||
|
||||
|
||||
# Using Docker Compose with Argos
|
||||
|
||||
ARGOS is an open extensible service that simplifies the management, validation, monitoring and maintenance and of Data Management Plans. It allows actors (researchers, managers, supervisors etc) to create actionable DMPs that may be freely exchanged among infrastructures for carrying out specific aspects of the Data management process in accordance with the intentions and commitment of Data owners.
|
||||
|
||||
## Before running the docker compose commands, configurations must be set
|
||||
|
||||
### Database
|
||||
|
||||
First of all, database must be configured
|
||||
|
||||
The only file that has to be changed is **/dmp-db-scema/Docker/dmp-db.env**
|
||||
|
||||
```bash
|
||||
ADMIN_USER: Admin username (app)
|
||||
ADMIN_PASSWORD: Admin password (app)
|
||||
|
||||
POSTGRES_DB: database name
|
||||
POSTGRES_USER: Admin username (database)
|
||||
POSTGRES_PASSWORD: Admin password (database)
|
||||
```
|
||||
|
||||
### Backend
|
||||
|
||||
Secondly, a few more options should be asigned
|
||||
|
||||
The file **/dmp-backend/web/src/main/resources/config/application-docker.properties** contains all the necessary properties
|
||||
|
||||
Values to be modified:
|
||||
```bash
|
||||
database.url: the url that is used to connect to database (JDBC based)
|
||||
database.username: database admin username
|
||||
database.password: database admin password
|
||||
|
||||
elasticsearch.*(optional): setup elastic, check Elasticsearch(optional) section below
|
||||
|
||||
google.login.clientId(optional): google as login provider
|
||||
```
|
||||
**NOTE:** if you want to configure and integrate other providers, check this reference [Setup configurable login](https://code-repo.d4science.org/MaDgiK-CITE/argos/wiki/Page-2A:-Setup-configurable-login)
|
||||
|
||||
If you provide google.login.clientId, then the same value should be set in the field named **loginProviders.googleConfiguration.clientId** which belongs to **/dmp-frontend/src/assets/config/config.json**
|
||||
|
||||
## You are ready to build and run the entire application using Docker-compose
|
||||
|
||||
1. Go to the project's root directory
|
||||
2. Type in the **Terminal** `docker volume create --name=dmpdata`
|
||||
3. Type in the **Terminal** `docker-compose up -d --build`
|
||||
4. After it's complete your application is running on [http://localhost:8080](http://localhost:8080)
|
||||
|
||||
### Elasticsearch(optional)
|
||||
If you want to set up elasticsearch, you will need the password for the **elastic** user
|
||||
|
||||
After your application is running, type in the **Terminal** `docker exec -it elasticsearch /bin/sh`
|
||||
|
||||
Run the command `cat data/passwords.txt` in the shell and save its output
|
||||
|
||||
Finally, run `exit` to get back to your terminal
|
||||
|
||||
The elastic's password that you get has to be set in the **elasticsearch.password** property in the backend configuration
|
||||
|
||||
Rerun the application
|
||||
|
||||
1. Type in the **Terminal** `docker-compose down`
|
||||
2. Type in the **Terminal** `docker-compose up -d --build`
|
|
@ -1 +1 @@
|
|||
PROFILE=docker
|
||||
PROFILE=staging
|
|
@ -1,22 +1,22 @@
|
|||
FROM maven:3-jdk-11 AS MAVEN_BUILD
|
||||
FROM maven:3-jdk-8-alpine AS MAVEN_BUILD
|
||||
|
||||
|
||||
|
||||
COPY pom.xml /build/
|
||||
COPY data /build/data/
|
||||
COPY elastic /build/elastic/
|
||||
#COPY logging /build/logging/
|
||||
COPY logging /build/logging/
|
||||
COPY queryable /build/queryable/
|
||||
COPY web /build/web/
|
||||
|
||||
|
||||
|
||||
WORKDIR /build/
|
||||
RUN mvn package -q
|
||||
RUN mvn package
|
||||
|
||||
|
||||
|
||||
FROM amazoncorretto:11
|
||||
FROM openjdk:8-jre-alpine
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=MAVEN_BUILD /build/web/target/web-1.0-SNAPSHOT.jar /app.jar
|
||||
|
|
|
@ -12,4 +12,4 @@ RUN mvn package
|
|||
FROM adoptopenjdk/openjdk11:alpine-jre
|
||||
WORKDIR /app
|
||||
COPY --from=MAVEN_BUILD /build/web/target/web-1.0-SNAPSHOT.jar /app/app.jar
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=${PROF}", "-Dspring.config.additional-location=/files/config/", "-cp", "/app/app.jar", "-Dloader.path=/files/repo-jars", "org.springframework.boot.loader.PropertiesLauncher"]
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=${PROF}", "-Dspring.config.additional-location=/files/config/", "-jar","/app/app.jar"]
|
||||
|
|
|
@ -25,10 +25,5 @@
|
|||
<artifactId>elastic</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.20</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,9 +1,9 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
|
||||
public abstract class Criteria<T> {
|
||||
@ApiModelProperty(value = "like", name = "like", dataType = "String", allowEmptyValue = true, example = "\"\"")
|
||||
private String like;
|
||||
|
||||
public String getLike() {
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import eu.eudat.data.entities.DMPProfile;
|
||||
|
||||
public class DataManagementPlanBlueprintCriteria extends Criteria<DMPProfile> {
|
||||
|
||||
private Integer status;
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.entities.DMPProfile;
|
||||
import eu.eudat.data.entities.Grant;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -11,7 +10,6 @@ import java.util.UUID;
|
|||
public class DataManagementPlanCriteria extends Criteria<DMP> {
|
||||
private Date periodStart;
|
||||
private Date periodEnd;
|
||||
private DMPProfile profile;
|
||||
private List<eu.eudat.data.entities.Grant> grants;
|
||||
private boolean allVersions;
|
||||
private List<UUID> groupIds;
|
||||
|
@ -39,13 +37,6 @@ public class DataManagementPlanCriteria extends Criteria<DMP> {
|
|||
this.periodEnd = periodEnd;
|
||||
}
|
||||
|
||||
public DMPProfile getProfile() {
|
||||
return profile;
|
||||
}
|
||||
public void setProfile(DMPProfile profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
public List<Grant> getGrants() {
|
||||
return grants;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
|
||||
import eu.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.eudat.data.entities.DatasetProfile;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DatasetProfileCriteria extends Criteria<DescriptionTemplate> {
|
||||
public class DatasetProfileCriteria extends Criteria<DatasetProfile> {
|
||||
|
||||
public enum DatasetProfileFilter {
|
||||
DMPs((short) 0), Datasets((short) 1);
|
||||
|
@ -25,7 +25,7 @@ public class DatasetProfileCriteria extends Criteria<DescriptionTemplate> {
|
|||
case 1:
|
||||
return Datasets;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported DescriptionTemplate filter");
|
||||
throw new RuntimeException("Unsupported DatasetProfile filter");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import eu.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.eudat.data.entities.DatasetProfile;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
public class DatasetProfileWizardCriteria extends Criteria<DescriptionTemplate> {
|
||||
public class DatasetProfileWizardCriteria extends Criteria<DatasetProfile> {
|
||||
private UUID id;
|
||||
|
||||
public UUID getId() {
|
||||
|
|
|
@ -42,8 +42,6 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
|
|||
query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd()));
|
||||
if (criteria.getPeriodStart() != null)
|
||||
query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
|
||||
if (criteria.getProfile() != null)
|
||||
query.where((builder, root) -> builder.equal(root.get("profile"), criteria.getProfile()));
|
||||
if (criteria.getGrants() != null && !criteria.getGrants().isEmpty())
|
||||
query.where(((builder, root) -> root.get("grant").in(criteria.getGrants())));
|
||||
if (!criteria.getAllVersions())
|
||||
|
@ -77,7 +75,7 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
|
|||
query.where((builder, root) -> root.join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id").in(criteria.getCollaborators()));
|
||||
}
|
||||
if (criteria.getDatasetTemplates() != null && !criteria.getDatasetTemplates().isEmpty()) {
|
||||
query.where((builder, root) -> root.join("associatedDmps", JoinType.LEFT).get("datasetprofile").get("id").in(criteria.getDatasetTemplates()));
|
||||
query.where((builder, root) -> root.join("associatedDmps", JoinType.LEFT).get("id").in(criteria.getDatasetTemplates()));
|
||||
}
|
||||
if (criteria.getGrantStatus() != null) {
|
||||
if (criteria.getGrantStatus().equals(GrantStateType.FINISHED.getValue().shortValue()))
|
||||
|
@ -89,7 +87,7 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
|
|||
}
|
||||
|
||||
if (criteria.hasDoi()) {
|
||||
query.where((builder, root) -> builder.not(builder.isNull(root.join("dois").get("id"))));
|
||||
query.where((builder, root) -> builder.not(builder.isNull(root.get("doi"))));
|
||||
}
|
||||
query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue()));
|
||||
return query;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.dao.criteria.DataManagementPlanBlueprintCriteria;
|
||||
import eu.eudat.data.dao.criteria.DataManagementPlanProfileCriteria;
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.entities.DMPProfile;
|
||||
|
@ -16,6 +15,4 @@ public interface DMPProfileDao extends DatabaseAccessLayer<DMPProfile, UUID> {
|
|||
|
||||
QueryableList<DMPProfile> getWithCriteria(DataManagementPlanProfileCriteria criteria);
|
||||
|
||||
QueryableList<DMPProfile> getWithCriteriaBlueprint(DataManagementPlanBlueprintCriteria criteria);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.criteria.DataManagementPlanBlueprintCriteria;
|
||||
import eu.eudat.data.dao.criteria.DataManagementPlanProfileCriteria;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.DMPProfile;
|
||||
|
@ -66,20 +65,4 @@ public class DMPProfileDaoImpl extends DatabaseAccess<DMPProfile> implements DMP
|
|||
query.where(((builder, root) -> builder.notEqual(root.get("status"), DMPProfile.Status.DELETED.getValue())));
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DMPProfile> getWithCriteriaBlueprint(DataManagementPlanBlueprintCriteria criteria){
|
||||
QueryableList<DMPProfile> query = getDatabaseService().getQueryable(DMPProfile.class);
|
||||
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
|
||||
if (criteria.getStatus() != null) {
|
||||
if (criteria.getStatus() == DMPProfile.Status.FINALIZED.getValue()) {
|
||||
query.where((builder, root) -> builder.equal(root.get("status"), DMPProfile.Status.FINALIZED.getValue()));
|
||||
} else if (criteria.getStatus() == DMPProfile.Status.SAVED.getValue()) {
|
||||
query.where((builder, root) -> builder.equal(root.get("status"), DMPProfile.Status.SAVED.getValue()));
|
||||
}
|
||||
}
|
||||
query.where(((builder, root) -> builder.notEqual(root.get("status"), DMPProfile.Status.DELETED.getValue())));
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ import eu.eudat.queryable.QueryableList;
|
|||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
import eu.eudat.types.grant.GrantStateType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -25,6 +27,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
|
||||
@Component("datasetDao")
|
||||
public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDao {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DatasetDaoImpl.class);
|
||||
|
||||
@Autowired
|
||||
public DatasetDaoImpl(DatabaseService<Dataset> databaseService) { super(databaseService); }
|
||||
|
@ -80,7 +83,7 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
|
|||
query.where((builder, root) -> root.get("profile").get("id").in(criteria.getDatasetTemplates()));
|
||||
|
||||
if (criteria.hasDoi()) {
|
||||
query.where((builder, root) -> builder.not(builder.isNull(root.join("dmp").join("dois").get("id"))));
|
||||
query.where((builder, root) -> builder.not(builder.isNull(root.get("dmp").get("doi"))));
|
||||
}
|
||||
query.where((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.DELETED.getValue()));
|
||||
query.where((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.CANCELED.getValue()));
|
||||
|
@ -99,6 +102,7 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
|
|||
|
||||
@Override
|
||||
public Dataset createOrUpdate(Dataset item) {
|
||||
logger.info("I'm Here " + item.getLabel());
|
||||
return getDatabaseService().createOrUpdate(item, Dataset.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package eu.eudat.data.dao.entities;
|
|||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.DatasetExternalDataset;
|
||||
import eu.eudat.data.entities.DatasetProfile;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
|
|
@ -2,23 +2,18 @@ package eu.eudat.data.dao.entities;
|
|||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.dao.criteria.DatasetProfileCriteria;
|
||||
import eu.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.eudat.data.entities.DescriptionTemplateType;
|
||||
import eu.eudat.data.entities.DatasetProfile;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface DatasetProfileDao extends DatabaseAccessLayer<DescriptionTemplate, UUID> {
|
||||
public interface DatasetProfileDao extends DatabaseAccessLayer<DatasetProfile, UUID> {
|
||||
|
||||
QueryableList<DescriptionTemplate> getWithCriteria(DatasetProfileCriteria criteria);
|
||||
QueryableList<DatasetProfile> getWithCriteria(DatasetProfileCriteria criteria);
|
||||
|
||||
QueryableList<DescriptionTemplate> getAll();
|
||||
QueryableList<DatasetProfile> getAll();
|
||||
|
||||
QueryableList<DescriptionTemplate> getAuthenticated(QueryableList<DescriptionTemplate> query, UUID principal, List<Integer> roles);
|
||||
|
||||
List<DescriptionTemplate> getAllIds();
|
||||
|
||||
Long countWithType(DescriptionTemplateType type);
|
||||
QueryableList<DatasetProfile> getAuthenticated(QueryableList<DatasetProfile> query, UUID principal, List<Integer> roles);
|
||||
|
||||
}
|
|
@ -3,8 +3,8 @@ package eu.eudat.data.dao.entities;
|
|||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.criteria.DatasetProfileCriteria;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.eudat.data.entities.DescriptionTemplateType;
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.entities.DatasetProfile;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
|
@ -15,22 +15,21 @@ import org.springframework.stereotype.Component;
|
|||
import javax.persistence.criteria.Join;
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Component("datasetProfileDao")
|
||||
public class DatasetProfileDaoImpl extends DatabaseAccess<DescriptionTemplate> implements DatasetProfileDao {
|
||||
public class DatasetProfileDaoImpl extends DatabaseAccess<DatasetProfile> implements DatasetProfileDao {
|
||||
|
||||
@Autowired
|
||||
public DatasetProfileDaoImpl(DatabaseService<DescriptionTemplate> databaseService) {
|
||||
public DatasetProfileDaoImpl(DatabaseService<DatasetProfile> databaseService) {
|
||||
super(databaseService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DescriptionTemplate> getWithCriteria(DatasetProfileCriteria criteria) {
|
||||
QueryableList<DescriptionTemplate> query = getDatabaseService().getQueryable(DescriptionTemplate.class);
|
||||
public QueryableList<DatasetProfile> getWithCriteria(DatasetProfileCriteria criteria) {
|
||||
QueryableList<DatasetProfile> query = getDatabaseService().getQueryable(DatasetProfile.class);
|
||||
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
|
||||
if (!criteria.getAllVersions())
|
||||
|
@ -63,9 +62,9 @@ public class DatasetProfileDaoImpl extends DatabaseAccess<DescriptionTemplate> i
|
|||
query.where(((builder, root) -> root.get("id").in(criteria.getIds())));
|
||||
}
|
||||
if (criteria.getFinalized()) {
|
||||
query.where(((builder, root) -> builder.equal(root.get("status"), DescriptionTemplate.Status.FINALIZED.getValue())));
|
||||
query.where(((builder, root) -> builder.equal(root.get("status"), DatasetProfile.Status.FINALIZED.getValue())));
|
||||
} else {
|
||||
query.where(((builder, root) -> builder.notEqual(root.get("status"), DescriptionTemplate.Status.DELETED.getValue())));
|
||||
query.where(((builder, root) -> builder.notEqual(root.get("status"), DatasetProfile.Status.DELETED.getValue())));
|
||||
}
|
||||
if (criteria.getPeriodStart() != null)
|
||||
query.where((builder, root) -> builder.greaterThanOrEqualTo(root.get("created"), criteria.getPeriodStart()));
|
||||
|
@ -73,48 +72,43 @@ public class DatasetProfileDaoImpl extends DatabaseAccess<DescriptionTemplate> i
|
|||
}
|
||||
|
||||
@Override
|
||||
public DescriptionTemplate createOrUpdate(DescriptionTemplate item) {
|
||||
return this.getDatabaseService().createOrUpdate(item, DescriptionTemplate.class);
|
||||
public DatasetProfile createOrUpdate(DatasetProfile item) {
|
||||
return this.getDatabaseService().createOrUpdate(item, DatasetProfile.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DescriptionTemplate find(UUID id) {
|
||||
return getDatabaseService().getQueryable(DescriptionTemplate.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
|
||||
public DatasetProfile find(UUID id) {
|
||||
return getDatabaseService().getQueryable(DatasetProfile.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DescriptionTemplate> getAll() {
|
||||
return getDatabaseService().getQueryable(DescriptionTemplate.class);
|
||||
public QueryableList<DatasetProfile> getAll() {
|
||||
return getDatabaseService().getQueryable(DatasetProfile.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DescriptionTemplate> getAllIds(){
|
||||
return getDatabaseService().getQueryable(DescriptionTemplate.class).withFields(Collections.singletonList("id")).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(DescriptionTemplate item) {
|
||||
public void delete(DatasetProfile item) {
|
||||
this.getDatabaseService().delete(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DescriptionTemplate> asQueryable() {
|
||||
return this.getDatabaseService().getQueryable(DescriptionTemplate.class);
|
||||
public QueryableList<DatasetProfile> asQueryable() {
|
||||
return this.getDatabaseService().getQueryable(DatasetProfile.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<DescriptionTemplate> createOrUpdateAsync(DescriptionTemplate item) {
|
||||
public CompletableFuture<DatasetProfile> createOrUpdateAsync(DatasetProfile item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DescriptionTemplate find(UUID id, String hint) {
|
||||
public DatasetProfile find(UUID id, String hint) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DescriptionTemplate> getAuthenticated(QueryableList<DescriptionTemplate> query, UUID principal, List<Integer> roles) {
|
||||
public QueryableList<DatasetProfile> getAuthenticated(QueryableList<DatasetProfile> query, UUID principal, List<Integer> roles) {
|
||||
if (roles != null && !roles.isEmpty()) {
|
||||
query.where((builder, root) -> {
|
||||
Join userJoin = root.join("users", JoinType.LEFT);
|
||||
|
@ -126,9 +120,4 @@ public class DatasetProfileDaoImpl extends DatabaseAccess<DescriptionTemplate> i
|
|||
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long countWithType(DescriptionTemplateType type) {
|
||||
return this.getDatabaseService().getQueryable(DescriptionTemplate.class).where((builder, root) -> builder.equal(root.get("type"), type)).count();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.entities.DatasetProfile;
|
||||
import eu.eudat.data.entities.DatasetService;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
|
@ -2,6 +2,8 @@ package eu.eudat.data.dao.entities;
|
|||
|
||||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.DatasetExternalDataset;
|
||||
import eu.eudat.data.entities.DatasetProfile;
|
||||
import eu.eudat.data.entities.DatasetService;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.entities.DescriptionTemplateType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface DescriptionTemplateTypeDao extends DatabaseAccessLayer<DescriptionTemplateType, UUID> {
|
||||
DescriptionTemplateType findFromName(String name);
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.DescriptionTemplateType;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Component("descriptionTemplateTypeDao")
|
||||
public class DescriptionTemplateTypeDaoImpl extends DatabaseAccess<DescriptionTemplateType> implements DescriptionTemplateTypeDao {
|
||||
|
||||
@Autowired
|
||||
public DescriptionTemplateTypeDaoImpl(DatabaseService<DescriptionTemplateType> databaseService) {
|
||||
super(databaseService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DescriptionTemplateType findFromName(String name){
|
||||
try {
|
||||
return this.getDatabaseService().getQueryable(DescriptionTemplateType.class).where((builder, root) -> builder.and(builder.equal(root.get("name"), name), builder.notEqual(root.get("status"), DescriptionTemplateType.Status.DELETED.getValue()))).getSingle();
|
||||
}
|
||||
catch(Exception e){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public DescriptionTemplateType createOrUpdate(DescriptionTemplateType item) {
|
||||
return this.getDatabaseService().createOrUpdate(item, DescriptionTemplateType.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DescriptionTemplateType find(UUID id) {
|
||||
return getDatabaseService().getQueryable(DescriptionTemplateType.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(DescriptionTemplateType item) {
|
||||
this.getDatabaseService().delete(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DescriptionTemplateType> asQueryable() {
|
||||
return this.getDatabaseService().getQueryable(DescriptionTemplateType.class).where((builder, root) -> builder.notEqual((root.get("status")), DescriptionTemplateType.Status.DELETED.getValue()));
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<DescriptionTemplateType> createOrUpdateAsync(DescriptionTemplateType item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DescriptionTemplateType find(UUID id, String hint) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.entities.DMPDatasetProfile;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface DmpDatasetProfileDao extends DatabaseAccessLayer<DMPDatasetProfile, UUID> {
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.Content;
|
||||
import eu.eudat.data.entities.DMPDatasetProfile;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Service("dmpDatasetProfileDao")
|
||||
public class DmpDatasetProfileDaoImpl extends DatabaseAccess<DMPDatasetProfile> implements DmpDatasetProfileDao {
|
||||
@Autowired
|
||||
public DmpDatasetProfileDaoImpl(DatabaseService<DMPDatasetProfile> databaseService) {
|
||||
super(databaseService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DMPDatasetProfile createOrUpdate(DMPDatasetProfile item) {
|
||||
return this.getDatabaseService().createOrUpdate(item, DMPDatasetProfile.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public CompletableFuture<DMPDatasetProfile> createOrUpdateAsync(DMPDatasetProfile item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DMPDatasetProfile find(UUID id) {
|
||||
return this.getDatabaseService().getQueryable(DMPDatasetProfile.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DMPDatasetProfile find(UUID id, String hint) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(DMPDatasetProfile item) {
|
||||
this.getDatabaseService().delete(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DMPDatasetProfile> asQueryable() {
|
||||
return this.getDatabaseService().getQueryable(DMPDatasetProfile.class);
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.entities.EntityDoi;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface EntityDoiDao extends DatabaseAccessLayer<EntityDoi, UUID> {
|
||||
EntityDoi findFromDoi(String doi);
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.EntityDoi;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Component("EntityDoiDao")
|
||||
public class EntityDoiDaoImpl extends DatabaseAccess<EntityDoi> implements EntityDoiDao {
|
||||
|
||||
@Autowired
|
||||
public EntityDoiDaoImpl(DatabaseService<EntityDoi> databaseService){
|
||||
super(databaseService);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EntityDoi createOrUpdate(EntityDoi item) {
|
||||
return this.getDatabaseService().createOrUpdate(item, EntityDoi.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<EntityDoi> createOrUpdateAsync(EntityDoi item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityDoi find(UUID id) {
|
||||
return this.getDatabaseService().getQueryable(EntityDoi.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityDoi findFromDoi(String doi) {
|
||||
return this.getDatabaseService().getQueryable(EntityDoi.class).where((builder, root) -> builder.equal(root.get("doi"), doi)).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityDoi find(UUID id, String hint) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(EntityDoi item) {
|
||||
this.getDatabaseService().delete(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<EntityDoi> asQueryable() {
|
||||
return this.getDatabaseService().getQueryable(EntityDoi.class);
|
||||
}
|
||||
}
|
|
@ -3,9 +3,7 @@ package eu.eudat.data.dao.entities;
|
|||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.entities.FileUpload;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface FileUploadDao extends DatabaseAccessLayer<FileUpload, UUID> {
|
||||
List<FileUpload> getFileUploads(UUID entityId);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import eu.eudat.queryable.QueryableList;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
|
@ -34,11 +33,6 @@ public class FileUploadDaoImpl extends DatabaseAccess<FileUpload> implements Fil
|
|||
return getDatabaseService().getQueryable(FileUpload.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FileUpload> getFileUploads(UUID entityId) {
|
||||
return this.getDatabaseService().getQueryable(FileUpload.class).where((builder, root) -> builder.equal(root.get("entityId"), entityId)).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileUpload find(UUID id, String hint) {
|
||||
return null;
|
||||
|
|
|
@ -11,7 +11,6 @@ import eu.eudat.types.grant.GrantStateType;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import schemasMicrosoftComOfficeOffice.LeftDocument;
|
||||
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import java.util.Date;
|
||||
|
|
|
@ -25,12 +25,7 @@ import java.util.stream.Collectors;
|
|||
name = "fullyDetailed",
|
||||
attributeNodes = {
|
||||
@NamedAttributeNode("grant"), @NamedAttributeNode("profile"),
|
||||
@NamedAttributeNode(value = "users", subgraph = "users"), @NamedAttributeNode("organisations"), @NamedAttributeNode("researchers")
|
||||
},
|
||||
subgraphs = {
|
||||
@NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")})
|
||||
}
|
||||
),
|
||||
@NamedAttributeNode("users"), @NamedAttributeNode("organisations"), @NamedAttributeNode("researchers")}),
|
||||
@NamedEntityGraph(
|
||||
name = "dmpRecentActivity",
|
||||
attributeNodes = {
|
||||
|
@ -112,8 +107,12 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
/*@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"AssociatedDmps\"", columnDefinition = "xml", nullable = true)
|
||||
private String associatedDmps;*/
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "dmp")
|
||||
private Set<DMPDatasetProfile> associatedDmps;
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"DMPDatasetProfile\"",
|
||||
joinColumns = {@JoinColumn(name = "\"dmp\"", referencedColumnName = "\"ID\"")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "\"datasetprofile\"", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private Set<DatasetProfile> associatedDmps;
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
|
@ -182,8 +181,8 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date publishedAt;
|
||||
|
||||
@OneToMany(mappedBy = "entityId", fetch = FetchType.LAZY)
|
||||
private Set<EntityDoi> dois;
|
||||
@Column(name = "\"DOI\"")
|
||||
private String doi;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"Project\"")
|
||||
|
@ -270,10 +269,10 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
this.grant = grant;
|
||||
}
|
||||
|
||||
public Set<DMPDatasetProfile> getAssociatedDmps() {
|
||||
public Set<DatasetProfile> getAssociatedDmps() {
|
||||
return associatedDmps;
|
||||
}
|
||||
public void setAssociatedDmps(Set<DMPDatasetProfile> associatedDmps) {
|
||||
public void setAssociatedDmps(Set<DatasetProfile> associatedDmps) {
|
||||
this.associatedDmps = associatedDmps;
|
||||
}
|
||||
|
||||
|
@ -340,12 +339,12 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
this.publishedAt = publishedAt;
|
||||
}
|
||||
|
||||
public Set<EntityDoi> getDois() {
|
||||
return dois;
|
||||
}
|
||||
public void setDois(Set<EntityDoi> dois) {
|
||||
this.dois = dois;
|
||||
}
|
||||
public String getDoi() {
|
||||
return doi;
|
||||
}
|
||||
public void setDoi(String doi) {
|
||||
this.doi = doi;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
|
@ -381,7 +380,7 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
if (entity.getStatus().equals(DMPStatus.FINALISED.getValue())) this.setFinalizedAt(new Date());
|
||||
if (entity.isPublic) this.setPublishedAt(new Date());
|
||||
if (entity.getUsers() != null) this.users = entity.getUsers();
|
||||
this.dois = entity.getDois();
|
||||
if (entity.getDoi() != null && entity.getDoi().trim().isEmpty()) this.doi = entity.doi;
|
||||
this.extraProperties = entity.getExtraProperties();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"DMPDatasetProfile\"")
|
||||
public class DMPDatasetProfile implements DataEntity<DMPDatasetProfile, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"dmp\"")
|
||||
private DMP dmp;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"datasetprofile\"")
|
||||
private DescriptionTemplate datasetprofile;
|
||||
|
||||
@Column(name = "\"data\"")
|
||||
private String data;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public DMP getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
public void setDmp(DMP dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
public DescriptionTemplate getDatasetprofile() {
|
||||
return datasetprofile;
|
||||
}
|
||||
public void setDatasetprofile(DescriptionTemplate datasetprofile) {
|
||||
this.datasetprofile = datasetprofile;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DMPDatasetProfile entity) {
|
||||
this.dmp = entity.getDmp();
|
||||
this.datasetprofile = entity.getDatasetprofile();
|
||||
this.data = entity.getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DMPDatasetProfile buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -100,9 +100,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
|||
@JoinColumn(name = "\"DMP\"", nullable = false)
|
||||
private DMP dmp;
|
||||
|
||||
@Column(name = "\"DmpSectionIndex\"")
|
||||
private Integer dmpSectionIndex;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
|
@ -113,7 +110,7 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
|||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
//@Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||
@JoinColumn(name = "\"Profile\"")
|
||||
private DescriptionTemplate profile;
|
||||
private DatasetProfile profile;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml")
|
||||
|
@ -235,12 +232,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
|||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
public Integer getDmpSectionIndex() {
|
||||
return dmpSectionIndex;
|
||||
}
|
||||
public void setDmpSectionIndex(Integer dmpSectionIndex) {
|
||||
this.dmpSectionIndex = dmpSectionIndex;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
|
@ -258,10 +249,10 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
|||
}
|
||||
|
||||
|
||||
public DescriptionTemplate getProfile() {
|
||||
public DatasetProfile getProfile() {
|
||||
return profile;
|
||||
}
|
||||
public void setProfile(DescriptionTemplate profile) {
|
||||
public void setProfile(DatasetProfile profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
|
@ -337,7 +328,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
|||
this.setRegistries(entity.getRegistries());
|
||||
|
||||
this.setDmp(entity.getDmp());
|
||||
this.setDmpSectionIndex(entity.getDmpSectionIndex());
|
||||
this.setStatus(entity.getStatus());
|
||||
this.setProfile(entity.getProfile());
|
||||
this.setModified(new Date());
|
||||
|
|
|
@ -14,8 +14,8 @@ import java.util.UUID;
|
|||
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"DescriptionTemplate\"")
|
||||
public class DescriptionTemplate implements DataEntity<DescriptionTemplate,UUID>{
|
||||
@Table(name = "\"DatasetProfile\"")
|
||||
public class DatasetProfile implements DataEntity<DatasetProfile,UUID>{
|
||||
|
||||
public enum Status {
|
||||
SAVED((short) 0), FINALIZED((short) 1), DELETED((short) 99);
|
||||
|
@ -79,21 +79,19 @@ public class DescriptionTemplate implements DataEntity<DescriptionTemplate,UUID>
|
|||
@Column(name = "\"Version\"", nullable = false)
|
||||
private Short version;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
private Set<DMP> dmps;
|
||||
@ManyToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"DMPDatasetProfile\"",
|
||||
joinColumns = {@JoinColumn(name = "\"datasetprofile\"", referencedColumnName = "\"ID\"")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "\"dmp\"", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private List<DMP> dmps;
|
||||
|
||||
@Column(name = "\"Language\"", nullable = false)
|
||||
private String language;
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "\"Type\"", nullable = false)
|
||||
private DescriptionTemplateType type;
|
||||
|
||||
@OneToMany(mappedBy = "descriptionTemplate", fetch = FetchType.LAZY)
|
||||
@OneToMany(mappedBy = "datasetProfile", fetch = FetchType.LAZY)
|
||||
private Set<UserDatasetProfile> users;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "datasetprofile")
|
||||
private Set<DMPDatasetProfile> associatedDmps;
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
|
@ -158,31 +156,26 @@ public class DescriptionTemplate implements DataEntity<DescriptionTemplate,UUID>
|
|||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public DescriptionTemplateType getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(DescriptionTemplateType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Set<UserDatasetProfile> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(Set<UserDatasetProfile> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + ", version=" + version + ", language=" + language + ", type=" + type +"]";
|
||||
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + ", version=" + version + ", language=" + language + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DescriptionTemplate entity) {
|
||||
public void update(DatasetProfile entity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -191,7 +184,7 @@ public class DescriptionTemplate implements DataEntity<DescriptionTemplate,UUID>
|
|||
}
|
||||
|
||||
@Override
|
||||
public DescriptionTemplate buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
public DatasetProfile buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
|
||||
return this;
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"DescriptionTemplateType\"")
|
||||
public class DescriptionTemplateType implements DataEntity<DescriptionTemplateType, UUID> {
|
||||
|
||||
public enum Status {
|
||||
SAVED((short) 0), FINALIZED((short) 1), DELETED((short) 99);
|
||||
|
||||
private short value;
|
||||
|
||||
private Status(short value) {
|
||||
this.value = value;
|
||||
}
|
||||
public short getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Status fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return SAVED;
|
||||
case 1:
|
||||
return FINALIZED;
|
||||
case 99:
|
||||
return DELETED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Description Template Type Status");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Name\"", nullable = false)
|
||||
private String name;
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DescriptionTemplateType entity) {
|
||||
this.name = entity.name;
|
||||
this.status = entity.status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DescriptionTemplateType buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
this.id = UUID.fromString((String) tuple.get(0).get(!base.isEmpty() ? base + "." + "id" : "id"));
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,121 +0,0 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"EntityDoi\"")
|
||||
public class EntityDoi implements DataEntity<EntityDoi, UUID> {
|
||||
public enum EntityType {
|
||||
DMP
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.PostgreSQLEnumType")
|
||||
@Column(name = "\"EntityType\"", nullable = false)
|
||||
private EntityType entityType;
|
||||
|
||||
@Column(name = "\"RepositoryId\"", nullable = false)
|
||||
private String repositoryId;
|
||||
|
||||
@Column(name = "\"Doi\"", nullable = false)
|
||||
private String doi;
|
||||
|
||||
@Column(name = "\"CreatedAt\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date createdAt;
|
||||
|
||||
@Column(name = "\"UpdatedAt\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date updatedAt;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"EntityId\"", nullable = false)
|
||||
private DMP entityId;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public EntityType getEntityType() {
|
||||
return entityType;
|
||||
}
|
||||
public void setEntityType(EntityType entityType) {
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
public String getRepositoryId() {
|
||||
return repositoryId;
|
||||
}
|
||||
public void setRepositoryId(String repositoryId) {
|
||||
this.repositoryId = repositoryId;
|
||||
}
|
||||
|
||||
public String getDoi() {
|
||||
return doi;
|
||||
}
|
||||
public void setDoi(String doi) {
|
||||
this.doi = doi;
|
||||
}
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Date getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
public void setUpdatedAt(Date updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public DMP getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
public void setEntityId(DMP entityId) {
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(EntityDoi doi) {
|
||||
this.entityType = doi.getEntityType();
|
||||
this.repositoryId = doi.getRepositoryId();
|
||||
this.doi = doi.getDoi();
|
||||
this.createdAt = doi.getCreatedAt();
|
||||
this.updatedAt = doi.getUpdatedAt();
|
||||
this.entityId = doi.getEntityId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityDoi buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
String currentBase = base.isEmpty() ? "" : base + ".";
|
||||
if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id");
|
||||
if (fields.contains(currentBase + "entityId"))
|
||||
this.entityId = tuple.stream().map(x -> new DMP().buildFromTuple(Arrays.asList(x), fields , base.isEmpty() ? "entityId" : base + "." + "entityId")).collect(Collectors.toList()).get(0);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -22,8 +22,8 @@ public class UserDatasetProfile implements DataEntity<UserDatasetProfile, UUID>
|
|||
private UserInfo user;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"descriptionTemplate\"")
|
||||
private DescriptionTemplate descriptionTemplate;
|
||||
@JoinColumn(name = "\"datasetProfile\"")
|
||||
private DatasetProfile datasetProfile;
|
||||
|
||||
@Column(name = "role")
|
||||
private Integer role;
|
||||
|
@ -44,12 +44,12 @@ public class UserDatasetProfile implements DataEntity<UserDatasetProfile, UUID>
|
|||
this.user = user;
|
||||
}
|
||||
|
||||
public DescriptionTemplate getDatasetProfile() {
|
||||
return descriptionTemplate;
|
||||
public DatasetProfile getDatasetProfile() {
|
||||
return datasetProfile;
|
||||
}
|
||||
|
||||
public void setDatasetProfile(DescriptionTemplate descriptionTemplate) {
|
||||
this.descriptionTemplate = descriptionTemplate;
|
||||
public void setDatasetProfile(DatasetProfile datasetProfile) {
|
||||
this.datasetProfile = datasetProfile;
|
||||
}
|
||||
|
||||
public Integer getRole() {
|
||||
|
|
|
@ -3,14 +3,12 @@ package eu.eudat.data.query.definition;
|
|||
import eu.eudat.data.dao.criteria.Criteria;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public abstract class Query<C extends Criteria<T>, T extends DataEntity> implements CriteriaQuery<C, T> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(Query.class);
|
||||
private C criteria;
|
||||
@ApiModelProperty(value = "query", name = "query", dataType = "String", hidden = true)
|
||||
private QueryableList<T> query;
|
||||
|
||||
public static class QueryBuilder<C extends Criteria<T>, T extends DataEntity, Q extends Query<C, T>> {
|
||||
|
|
|
@ -6,16 +6,12 @@ import eu.eudat.data.query.definition.helpers.ColumnOrderings;
|
|||
import eu.eudat.data.query.definition.helpers.SelectionFields;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
public abstract class TableQuery<C extends Criteria<T>, T extends DataEntity<T, K>, K> extends Query<C, T> implements TableCriteriaQuery<C, T> {
|
||||
private ColumnOrderings orderings;
|
||||
@ApiModelProperty(hidden = true)
|
||||
private SelectionFields selection;
|
||||
@ApiModelProperty(value = "length", name = "length", dataType = "Integer", example = "2")
|
||||
private Integer length;
|
||||
@ApiModelProperty(value = "offset", name = "offset", dataType = "Integer", example = "0")
|
||||
private Integer offset;
|
||||
|
||||
public Integer getLength() {
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package eu.eudat.data.query.definition.helpers;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ColumnOrderings {
|
||||
|
||||
@ApiModelProperty(value = "fields", name = "fields", dataType = "List<String>", example = "[]")
|
||||
private List<String> fields;
|
||||
|
||||
public List<String> getFields() {
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package eu.eudat.data.query.definition.helpers;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class SelectionFields {
|
||||
|
||||
@ApiModelProperty(value = "fields", name = "fields", dataType = "String[]", example = "[]")
|
||||
private String[] fields;
|
||||
|
||||
public String[] getFields() {
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
package eu.eudat.data.query.items.dmpblueprint;
|
||||
|
||||
import eu.eudat.data.dao.criteria.DataManagementPlanBlueprintCriteria;
|
||||
import eu.eudat.data.entities.DMPProfile;
|
||||
import eu.eudat.data.query.PaginationService;
|
||||
import eu.eudat.data.query.definition.TableQuery;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class DataManagementPlanBlueprintTableRequest extends TableQuery<DataManagementPlanBlueprintCriteria, DMPProfile, UUID> {
|
||||
|
||||
@Override
|
||||
public QueryableList<DMPProfile> applyCriteria() {
|
||||
QueryableList<DMPProfile> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||
if (this.getCriteria().getStatus() != null)
|
||||
query.where((builder, root) -> builder.equal(root.get("status"), this.getCriteria().getStatus()));
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DMPProfile> applyPaging(QueryableList<DMPProfile> items) {
|
||||
return PaginationService.applyPaging(items, this);
|
||||
}
|
||||
}
|
|
@ -1,24 +1,25 @@
|
|||
package eu.eudat.data.query.items.item.datasetprofile;
|
||||
|
||||
import eu.eudat.data.dao.criteria.DatasetProfileCriteria;
|
||||
import eu.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.eudat.data.entities.DatasetProfile;
|
||||
import eu.eudat.data.query.PaginationService;
|
||||
import eu.eudat.data.query.definition.Query;
|
||||
import eu.eudat.data.query.definition.TableQuery;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class DatasetProfileAutocompleteRequest extends TableQuery<DatasetProfileCriteria, DescriptionTemplate, UUID> {
|
||||
public class DatasetProfileAutocompleteRequest extends TableQuery<DatasetProfileCriteria,DatasetProfile, UUID> {
|
||||
@Override
|
||||
public QueryableList<DescriptionTemplate> applyCriteria() {
|
||||
QueryableList<DescriptionTemplate> query = this.getQuery();
|
||||
public QueryableList<DatasetProfile> applyCriteria() {
|
||||
QueryableList<DatasetProfile> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DescriptionTemplate> applyPaging(QueryableList<DescriptionTemplate> items) {
|
||||
public QueryableList<DatasetProfile> applyPaging(QueryableList<DatasetProfile> items) {
|
||||
return PaginationService.applyPaging(items, this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package eu.eudat.data.query.items.item.datasetprofile;
|
||||
|
||||
import eu.eudat.data.dao.criteria.DatasetProfileWizardCriteria;
|
||||
import eu.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.eudat.data.entities.DatasetProfile;
|
||||
import eu.eudat.data.query.definition.Query;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
public class DatasetProfileWizardAutocompleteRequest extends Query<DatasetProfileWizardCriteria, DescriptionTemplate> {
|
||||
import java.util.UUID;
|
||||
|
||||
public class DatasetProfileWizardAutocompleteRequest extends Query<DatasetProfileWizardCriteria,DatasetProfile> {
|
||||
@Override
|
||||
public QueryableList<DescriptionTemplate> applyCriteria() {
|
||||
public QueryableList<DatasetProfile> applyCriteria() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
package eu.eudat.data.query.items.table.datasetprofile;
|
||||
|
||||
import eu.eudat.data.dao.criteria.DatasetProfileCriteria;
|
||||
import eu.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.eudat.data.entities.DatasetProfile;
|
||||
import eu.eudat.data.query.definition.TableQuery;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class DatasetProfileTableRequestItem extends TableQuery<DatasetProfileCriteria, DescriptionTemplate, UUID> {
|
||||
public class DatasetProfileTableRequestItem extends TableQuery<DatasetProfileCriteria, DatasetProfile, UUID> {
|
||||
@Override
|
||||
public QueryableList<DescriptionTemplate> applyCriteria() {
|
||||
QueryableList<DescriptionTemplate> query = this.getQuery();
|
||||
public QueryableList<DatasetProfile> applyCriteria() {
|
||||
QueryableList<DatasetProfile> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DescriptionTemplate> applyPaging(QueryableList<DescriptionTemplate> items) {
|
||||
public QueryableList<DatasetProfile> applyPaging(QueryableList<DatasetProfile> items) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -231,9 +231,7 @@ public class Dataset implements ElasticEntity<Dataset> {
|
|||
if (this.group != null) {
|
||||
builder.field("group", this.group.toString());
|
||||
}
|
||||
if (this.grant != null) {
|
||||
builder.field("grant", this.grant.toString());
|
||||
}
|
||||
builder.field("grant", this.grant.toString());
|
||||
if (collaborators != null) {
|
||||
builder.startArray("collaborators");
|
||||
this.collaborators.forEach(x -> {
|
||||
|
@ -302,9 +300,7 @@ public class Dataset implements ElasticEntity<Dataset> {
|
|||
this.status = Short.valueOf((String) fields.get("status"));
|
||||
this.dmp = UUID.fromString((String) fields.get("dmp"));
|
||||
this.group = UUID.fromString((String) fields.get("group"));
|
||||
if (fields.get("grant") != null) {
|
||||
this.grant = UUID.fromString((String) fields.get("grant"));
|
||||
}
|
||||
this.grant = UUID.fromString((String) fields.get("grant"));
|
||||
if (fields.get("created") != null)
|
||||
this.created = Date.from(Instant.parse((String) fields.get("created")));
|
||||
if (fields.get("modified") != null)
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
package eu.eudat.elastic.entities;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DatasetTempalate implements ElasticEntity<DatasetTempalate> {
|
||||
private UUID id;
|
||||
private String name;
|
||||
private Map<String, Object> data;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
|
@ -30,25 +26,11 @@ public class DatasetTempalate implements ElasticEntity<DatasetTempalate> {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public Map<String, Object> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Map<String, Object> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
||||
builder.startObject();
|
||||
builder.field("id", this.id.toString());
|
||||
builder.field("name", this.name);
|
||||
if(this.data != null) {
|
||||
builder.field("data", new ObjectMapper().writeValueAsString(this.data));
|
||||
}
|
||||
else{
|
||||
builder.field("data", "");
|
||||
}
|
||||
builder.endObject();
|
||||
return builder;
|
||||
}
|
||||
|
@ -57,12 +39,6 @@ public class DatasetTempalate implements ElasticEntity<DatasetTempalate> {
|
|||
public DatasetTempalate fromElasticEntity(Map<String, Object> fields) {
|
||||
this.id = UUID.fromString((String) fields.get("id"));
|
||||
this.name = (String) fields.get("name");
|
||||
try {
|
||||
this.data = new ObjectMapper().readValue((String) fields.get("data"), new TypeReference<Map<String, Object>>() {});
|
||||
}
|
||||
catch (Exception e){
|
||||
this.data = new HashMap<>();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class Dmp implements ElasticEntity<Dmp> {
|
|||
private Date modified;
|
||||
private Date finalizedAt;
|
||||
private Date publishedAt;
|
||||
private List<Doi> dois;
|
||||
private String doi;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
|
@ -203,12 +203,12 @@ public class Dmp implements ElasticEntity<Dmp> {
|
|||
this.publishedAt = publishedAt;
|
||||
}
|
||||
|
||||
public List<Doi> getDois() {
|
||||
return dois;
|
||||
public String getDoi() {
|
||||
return doi;
|
||||
}
|
||||
|
||||
public void setDois(List<Doi> dois) {
|
||||
this.dois = dois;
|
||||
public void setDoi(String doi) {
|
||||
this.doi = doi;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -280,17 +280,7 @@ public class Dmp implements ElasticEntity<Dmp> {
|
|||
builder.field(MapKey.MODIFIED.getName(), this.modified);
|
||||
builder.field(MapKey.FINALIZEDAT.getName(), this.finalizedAt);
|
||||
builder.field(MapKey.PUBLISHEDAT.getName(), this.publishedAt);
|
||||
if (this.dois != null && !this.dois.isEmpty()) {
|
||||
builder.startArray(MapKey.DOIS.getName());
|
||||
this.dois.forEach(doi -> {
|
||||
try {
|
||||
doi.toElasticEntity(builder);
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
});
|
||||
builder.endArray();
|
||||
}
|
||||
builder.field(MapKey.DOI.getName(), this.doi);
|
||||
builder.endObject();
|
||||
return builder;
|
||||
}
|
||||
|
@ -323,9 +313,7 @@ public class Dmp implements ElasticEntity<Dmp> {
|
|||
if (fields.get(MapKey.DATASETS.getName()) != null) {
|
||||
this.datasets = ((List<HashMap<String, Object>>) fields.get(MapKey.DATASETS.getName())).stream().map(map -> new Dataset().fromElasticEntity(map)).collect(Collectors.toList());
|
||||
}
|
||||
if (fields.containsKey(MapKey.GRANT.getName()) && fields.get(MapKey.GRANT.getName()) != null) {
|
||||
this.grant = UUID.fromString((String) fields.get(MapKey.GRANT.getName()));
|
||||
}
|
||||
this.grant = UUID.fromString((String) fields.get(MapKey.GRANT.getName()));
|
||||
if (fields.get(MapKey.GRANTSTATUS.getName()) != null) {
|
||||
this.grantStatus = Short.valueOf(fields.get(MapKey.GRANTSTATUS.getName()).toString());
|
||||
}
|
||||
|
@ -341,8 +329,8 @@ public class Dmp implements ElasticEntity<Dmp> {
|
|||
if (fields.get(MapKey.PUBLISHEDAT.getName()) != null) {
|
||||
this.publishedAt = Date.from(Instant.parse(fields.get(MapKey.PUBLISHEDAT.getName()).toString()));
|
||||
}
|
||||
if (fields.get(MapKey.DOIS.getName()) != null) {
|
||||
this.dois = ((List<HashMap<String, Object>>) fields.get(MapKey.DOIS.getName())).stream().map(map -> new Doi().fromElasticEntity(map)).collect(Collectors.toList());
|
||||
if (fields.get(MapKey.DOI.getName()) != null) {
|
||||
this.doi = fields.get(MapKey.DOI.getName()).toString();
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
@ -367,7 +355,7 @@ public class Dmp implements ElasticEntity<Dmp> {
|
|||
MODIFIED ("modified"),
|
||||
FINALIZEDAT ("finalizedAt"),
|
||||
PUBLISHEDAT ("publishedAt"),
|
||||
DOIS ("dois");
|
||||
DOI ("doi");
|
||||
|
||||
private final String name;
|
||||
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
package eu.eudat.elastic.entities;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Doi implements ElasticEntity<Doi>{
|
||||
private UUID id;
|
||||
private String repositoryId;
|
||||
private String doi;
|
||||
private UUID dmp;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRepositoryId() {
|
||||
return repositoryId;
|
||||
}
|
||||
public void setRepositoryId(String repositoryId) {
|
||||
this.repositoryId = repositoryId;
|
||||
}
|
||||
|
||||
public String getDoi() {
|
||||
return doi;
|
||||
}
|
||||
public void setDoi(String doi) {
|
||||
this.doi = doi;
|
||||
}
|
||||
|
||||
public UUID getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
public void setDmp(UUID dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
||||
builder.startObject();
|
||||
builder.field("id", this.id.toString());
|
||||
builder.field("repositoryId", this.repositoryId);
|
||||
builder.field("doi", this.doi);
|
||||
builder.field("dmp", this.dmp.toString());
|
||||
builder.endObject();
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Doi fromElasticEntity(Map<String, Object> fields) {
|
||||
if (fields == null || fields.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
this.id = UUID.fromString((String) fields.get("id"));
|
||||
this.repositoryId = (String) fields.get("repositoryId");
|
||||
this.doi = (String) fields.get("doi");
|
||||
this.dmp = UUID.fromString((String) fields.get("dmp"));
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -146,7 +146,7 @@ public class DatasetRepository extends ElasticRepository<Dataset, DatasetCriteri
|
|||
|
||||
}
|
||||
|
||||
NestedQueryBuilder nestedQueryBuilder = QueryBuilders.nestedQuery("datasets", boolQuery, ScoreMode.Avg).innerHit(new InnerHitBuilder().setFetchSourceContext(new FetchSourceContext(true, new String[]{"datasets.tags"}, null)).setSize(this.environment.getProperty("elasticsearch.innerHitsSize", Integer.class)));
|
||||
NestedQueryBuilder nestedQueryBuilder = QueryBuilders.nestedQuery("datasets", boolQuery, ScoreMode.Avg).innerHit(new InnerHitBuilder().setFetchSourceContext(new FetchSourceContext(true, new String[]{"datasets.tags"}, null)));
|
||||
searchSourceBuilder.query(nestedQueryBuilder)/*.from(criteria.getOffset())*/.fetchSource("datasets.tags", null);
|
||||
/*if (criteria.getSize() > 0) {
|
||||
searchSourceBuilder.size(criteria.getSize());
|
||||
|
@ -206,7 +206,7 @@ public class DatasetRepository extends ElasticRepository<Dataset, DatasetCriteri
|
|||
|
||||
}
|
||||
|
||||
NestedQueryBuilder nestedQueryBuilder = QueryBuilders.nestedQuery("datasets", boolQuery, ScoreMode.None).innerHit(new InnerHitBuilder().setFetchSourceContext(new FetchSourceContext(true, new String[]{"datasets.id"}, null)).setSize(this.environment.getProperty("elasticsearch.innerHitsSize", Integer.class)));
|
||||
NestedQueryBuilder nestedQueryBuilder = QueryBuilders.nestedQuery("datasets", boolQuery, ScoreMode.None).innerHit(new InnerHitBuilder().setFetchSourceContext(new FetchSourceContext(true, new String[]{"datasets.id"}, null)));
|
||||
searchSourceBuilder.query(nestedQueryBuilder)/*.from(criteria.getOffset()).size(criteria.getSize())*/.fetchSource("datasets.id", null);
|
||||
sortBuilders.forEach(searchSourceBuilder::sort);
|
||||
searchRequest.source(searchSourceBuilder);
|
||||
|
@ -261,7 +261,6 @@ public class DatasetRepository extends ElasticRepository<Dataset, DatasetCriteri
|
|||
}
|
||||
|
||||
if (criteria.getDatasetTemplates() != null && criteria.getDatasetTemplates().size() > 0) {
|
||||
criteria.setDatasetTemplates(criteria.getDatasetTemplates().stream().filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
boolQuery = boolQuery.should(QueryBuilders.termsQuery("datasets.template", criteria.getDatasetTemplates().stream().map(UUID::toString).collect(Collectors.toList())));
|
||||
}
|
||||
|
||||
|
@ -270,17 +269,14 @@ public class DatasetRepository extends ElasticRepository<Dataset, DatasetCriteri
|
|||
}
|
||||
|
||||
if (criteria.getDmps() != null && criteria.getDmps().size() > 0) {
|
||||
criteria.setDmps(criteria.getDmps().stream().filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
boolQuery = boolQuery.should(QueryBuilders.termsQuery("datasets.dmp", criteria.getDmps().stream().map(UUID::toString).collect(Collectors.toList())));
|
||||
}
|
||||
|
||||
if (criteria.getGroupIds() != null && criteria.getGroupIds().size() > 0) {
|
||||
criteria.setGroupIds(criteria.getGroupIds().stream().filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
boolQuery = boolQuery.should(QueryBuilders.termsQuery("datasets.group", criteria.getGroupIds().stream().map(UUID::toString).collect(Collectors.toList())));
|
||||
}
|
||||
|
||||
if (criteria.getGrants() != null && criteria.getGrants().size() > 0) {
|
||||
criteria.setGrants(criteria.getGrants().stream().filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
boolQuery = boolQuery.should(QueryBuilders.termsQuery("datasets.grant", criteria.getGrants().stream().map(UUID::toString).collect(Collectors.toList())));
|
||||
}
|
||||
|
||||
|
@ -289,7 +285,6 @@ public class DatasetRepository extends ElasticRepository<Dataset, DatasetCriteri
|
|||
}
|
||||
|
||||
if (criteria.getCollaborators() != null && criteria.getCollaborators().size() > 0) {
|
||||
criteria.setCollaborators(criteria.getCollaborators().stream().filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
boolQuery = boolQuery.should(QueryBuilders.termsQuery("datasets.collaborators.id.keyword", criteria.getCollaborators().stream().map(UUID::toString).collect(Collectors.toList())));
|
||||
}
|
||||
|
||||
|
@ -300,12 +295,10 @@ public class DatasetRepository extends ElasticRepository<Dataset, DatasetCriteri
|
|||
}
|
||||
|
||||
if (criteria.getOrganiztions() != null && criteria.getOrganiztions().size() > 0) {
|
||||
criteria.setOrganiztions(criteria.getOrganiztions().stream().filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
boolQuery = boolQuery.should(QueryBuilders.termsQuery("datasets.organizations.id", criteria.getOrganiztions()));
|
||||
}
|
||||
|
||||
if (criteria.getTags() != null && criteria.getTags().size() > 0) {
|
||||
criteria.setTags(criteria.getTags().stream().filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
boolQuery = boolQuery.should(QueryBuilders.termsQuery("datasets.tags.name", criteria.getTags().stream().map(Tag::getName).collect(Collectors.toList())));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.io.IOException;
|
|||
*/
|
||||
public abstract class ElasticRepository<T extends ElasticEntity,C extends Criteria> implements Repository<T,C> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ElasticRepository.class);
|
||||
private final ObjectMapper mapper;
|
||||
private RestHighLevelClient client;
|
||||
|
||||
public RestHighLevelClient getClient() {
|
||||
|
@ -30,13 +31,12 @@ public abstract class ElasticRepository<T extends ElasticEntity,C extends Criter
|
|||
}
|
||||
} catch (IOException e) {
|
||||
logger.warn("Unable to connect to Elastic Services");
|
||||
logger.error(e.getMessage(), e);
|
||||
this.client = null;
|
||||
}
|
||||
this.mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
public <T> T transformFromString(String value, Class<T> tClass) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
T item = null;
|
||||
try {
|
||||
item = mapper.readValue(value, tClass);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.5.2</version>
|
||||
<version>2.6.6</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@ -27,166 +27,168 @@
|
|||
<java.version>1.8</java.version>
|
||||
|
||||
<dmp-backend-commons.version>0.0.1-SNAPSHOT</dmp-backend-commons.version>
|
||||
<org.springframework.version>5.3.8</org.springframework.version>
|
||||
<!--<org.springframework.version>5.3.8</org.springframework.version>-->
|
||||
<!-- <org.springframeweu.eudat.logic.securityrity.version>3.2.10.RELEASE</org.springframeweu.eudat.logic.securityrity.version> -->
|
||||
<org.springframework.security.version>5.3.10.RELEASE</org.springframework.security.version>
|
||||
<!-- <org.springframework.security.version>5.3.10.RELEASE</org.springframework.security.version>-->
|
||||
<!--<com.sun.jersey.version>1.19.1</com.sun.jersey.version>-->
|
||||
<!--
|
||||
<org.apache.tomcat.tomcat-jdbc.version>7.0.35</org.apache.tomcat.tomcat-jdbc.version>
|
||||
-->
|
||||
<!--
|
||||
<org.apache.tomcat.tomcat-jdbc.version>7.0.35</org.apache.tomcat.tomcat-jdbc.version>
|
||||
-->
|
||||
<!--<com.fasterxml.jackson>2.9.0</com.fasterxml.jackson>-->
|
||||
|
||||
<hibernate.version>5.5.3.Final</hibernate.version>
|
||||
<!-- <hibernate.version>5.5.3.Final</hibernate.version>-->
|
||||
|
||||
<commons-codec.version>1.9</commons-codec.version>
|
||||
<org.junit.version>4.11</org.junit.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<!-- <commons-codec.version>1.9</commons-codec.version>-->
|
||||
<!-- <org.junit.version>4.11</org.junit.version>-->
|
||||
<!-- <log4j.version>1.2.17</log4j.version>-->
|
||||
<log4j2.version>2.15.0</log4j2.version>
|
||||
<slf4j.version>1.7.15</slf4j.version>
|
||||
<!-- <slf4j.version>1.7.12</slf4j.version>-->
|
||||
<!--<jetty.version>11.0.5
|
||||
</jetty.version>--> <!-- Adapt this to a version found on http://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-maven-plugin/ -->
|
||||
<logback.version>1.2.3</logback.version>
|
||||
<!-- <javax.inject.version>1</javax.inject.version>-->
|
||||
<!-- <logback.version>1.2.3</logback.version>-->
|
||||
<!-- <javax.inject.version>1</javax.inject.version>-->
|
||||
<!--<javax.servlet.servlet-api.version>3.0.1</javax.servlet.servlet-api.version>-->
|
||||
<apache.poi.version>5.2.2</apache.poi.version>
|
||||
<jackson.version>2.12.3</jackson.version>
|
||||
<elasticsearch.version>7.6.2</elasticsearch.version>
|
||||
<jaxb.version>2.3.0</jaxb.version>
|
||||
<caffeine.version>2.9.0</caffeine.version>
|
||||
<google.api.version>1.33.4</google.api.version>
|
||||
<json.path.version>2.4.0</json.path.version>
|
||||
<postgresql.version>42.2.22</postgresql.version>
|
||||
<social.facebook.version>2.0.3.RELEASE</social.facebook.version>
|
||||
<social.linkedin.version>1.0.2.RELEASE</social.linkedin.version>
|
||||
<social.twitter.version>1.1.2.RELEASE</social.twitter.version>
|
||||
<apache.commons.lang3.version>3.12.0</apache.commons.lang3.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20160810</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- Core Spring Boot Dependencies -->
|
||||
<!--<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch -->
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>7.7.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore-nio</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.12</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore-nio</artifactId>
|
||||
<version>4.4.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.4.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<version>7.6.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-c3p0</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- jdbc Driver -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${postgresql.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Elasticsearch -->
|
||||
<!-- https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch -->
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>${elasticsearch.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<version>${elasticsearch.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Autocomplete cache -->
|
||||
<dependency>
|
||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||
<artifactId>caffeine</artifactId>
|
||||
<version>${caffeine.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Used for Google login ONLY -->
|
||||
<!-- https://mvnrepository.com/artifact/com.google.api-client/google-api-client -->
|
||||
<dependency>
|
||||
<groupId>com.google.api-client</groupId>
|
||||
<artifactId>google-api-client</artifactId>
|
||||
<version>1.23.0</version>
|
||||
<version>${google.api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- facebook Login -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.social</groupId>
|
||||
<artifactId>spring-social-facebook</artifactId>
|
||||
<version>${social.facebook.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- linkedin Login -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.social</groupId>
|
||||
<artifactId>spring-social-linkedin</artifactId>
|
||||
<version>${social.linkedin.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- twitter login-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.social</groupId>
|
||||
<artifactId>spring-social-twitter</artifactId>
|
||||
<version>${social.twitter.version}</version>
|
||||
</dependency>
|
||||
<!-- Used for Remote Fetcher -->
|
||||
<!-- https://mvnrepository.com/artifact/com.jayway.jsonpath/json-path -->
|
||||
<dependency>
|
||||
<groupId>com.jayway.jsonpath</groupId>
|
||||
<artifactId>json-path</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>${json.path.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>2.12.3</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackeu.eudat.corecore/jackeu.eudat.corecore -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.12.3</version>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackeu.eudat.corecore/jackson-databind -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.12.3</version>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- g/a spring -->
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackeu.eudat.corecore/jackson-databind -->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Various libs -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.5</version>
|
||||
<version>${apache.commons.lang3.version}</version>
|
||||
</dependency>
|
||||
<!-- Docx export -->
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.1</version>
|
||||
<version>${apache.poi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>4.1.1</version>
|
||||
<version>${apache.poi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.xmlgraphics/fop -->
|
||||
<!-- Used for the HTML to DocX export -->
|
||||
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.convereu.eudat.corecore -->
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlgraphics</groupId>
|
||||
<artifactId>fop</artifactId>
|
||||
<version>2.3</version>
|
||||
<groupId>fr.opensagres.xdocreport</groupId>
|
||||
<artifactId>org.apache.poi.xwpf.converter.core</artifactId>
|
||||
<version>1.0.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -194,77 +196,38 @@
|
|||
<artifactId>jsoup</artifactId>
|
||||
<version>1.14.3</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.pdf -->
|
||||
<dependency>
|
||||
<groupId>fr.opensagres.xdocreport</groupId>
|
||||
<artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
|
||||
<version>1.0.6</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.convereu.eudat.corecore -->
|
||||
<dependency>
|
||||
<groupId>fr.opensagres.xdocreport</groupId>
|
||||
<artifactId>org.apache.poi.xwpf.converter.core</artifactId>
|
||||
<version>1.0.6</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/fr.opensagres.xdocreport.itext.extension -->
|
||||
<dependency>
|
||||
<groupId>fr.opensagres.xdocreport</groupId>
|
||||
<artifactId>fr.opensagres.xdocreport.itext.extension</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-jpamodelgen</artifactId>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>transport</artifactId>
|
||||
<version>7.6.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</dependency>-->
|
||||
|
||||
<!-- XML Binding for (mainly) the templates -->
|
||||
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<version>${jaxb.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-core -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
<version>2.3.0</version>
|
||||
<version>${jaxb.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<version>${jaxb.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api -->
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
|
||||
<!-- Model Validation -->
|
||||
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
|
@ -272,37 +235,11 @@
|
|||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- The client -->
|
||||
<dependency>
|
||||
<groupId>io.prometheus</groupId>
|
||||
<artifactId>simpleclient</artifactId>
|
||||
<version>0.11.0</version>
|
||||
</dependency>
|
||||
<!-- Hotspot JVM metrics-->
|
||||
<dependency>
|
||||
<groupId>io.prometheus</groupId>
|
||||
<artifactId>simpleclient_hotspot</artifactId>
|
||||
<version>0.11.0</version>
|
||||
</dependency>
|
||||
<!-- Exposition HTTPServer-->
|
||||
<dependency>
|
||||
<groupId>io.prometheus</groupId>
|
||||
<artifactId>simpleclient_httpserver</artifactId>
|
||||
<version>0.11.0</version>
|
||||
</dependency>
|
||||
<!-- Pushgateway exposition-->
|
||||
<dependency>
|
||||
<groupId>io.prometheus</groupId>
|
||||
<artifactId>simpleclient_pushgateway</artifactId>
|
||||
<version>0.11.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Prometheus Analytics -->
|
||||
<!-- https://mvnrepository.com/artifact/io.micrometer/micrometer-registry-prometheus -->
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||
<version>1.7.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -327,18 +264,6 @@
|
|||
<packaging.type>jar</packaging.type>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>intellij-properties-launcher</id>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-loader</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</profile>
|
||||
<profile>
|
||||
<id>production</id>
|
||||
<properties>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package eu.eudat.queryable.collector;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import javax.persistence.Tuple;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -68,7 +66,8 @@ public class ProjectionField {
|
|||
list.add(current.parent.key);
|
||||
current = current.parent;
|
||||
}
|
||||
return String.join(".", Lists.reverse(list));
|
||||
Collections.reverse(list);
|
||||
return String.join(".", list);
|
||||
}
|
||||
|
||||
private Object createObject(List<Tuple> tuples, String field) {
|
||||
|
|
|
@ -42,9 +42,12 @@ public class QueryableHibernateList<T extends DataEntity> implements QueryableLi
|
|||
private String hint;
|
||||
private Map<String, Join> joinsMap = new HashMap<>();
|
||||
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
public QueryableHibernateList(EntityManager manager, Class<T> tClass) {
|
||||
this.manager = manager;
|
||||
this.tClass = tClass;
|
||||
this.mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
public QueryableHibernateList<T> setManager(EntityManager manager) {
|
||||
|
@ -246,7 +249,6 @@ public class QueryableHibernateList<T extends DataEntity> implements QueryableLi
|
|||
if (!this.fields.isEmpty()) this.selectFields();
|
||||
if (distinct) this.query.distinct(true);
|
||||
//if (!this.fields.isEmpty()) this.query.multiselect(this.parseFields(this.fields));
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
if (!this.fields.isEmpty()) return this.toListWithFields().stream().map(m -> mapper.convertValue(m, this.tClass)).collect(Collectors.toList());
|
||||
return this.toListWithOutFields();
|
||||
}
|
||||
|
|
|
@ -26,16 +26,13 @@
|
|||
<artifactId>queryable</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>eu.eudat</groupId>
|
||||
<artifactId>elastic</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gr.cite.opendmp</groupId>
|
||||
<artifactId>repositorydepositbase</artifactId>
|
||||
<version>1.0.4</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
|
@ -46,10 +43,6 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
||||
|
||||
|
@ -57,7 +50,6 @@
|
|||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.12.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
|
||||
|
@ -78,125 +70,45 @@
|
|||
<dependency>
|
||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||
<artifactId>caffeine</artifactId>
|
||||
<version>2.9.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/junit/junit -->
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.7.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.2.22</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
|
||||
<!-- facebook Login -->
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>org.springframework.social</groupId>
|
||||
<artifactId>spring-social-facebook</artifactId>
|
||||
<version>2.0.3.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<!-- linkedin Login -->
|
||||
<!– linkedin Login –>
|
||||
<dependency>
|
||||
<groupId>org.springframework.social</groupId>
|
||||
<artifactId>spring-social-linkedin</artifactId>
|
||||
<version>1.0.2.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<!-- tweeter login-->
|
||||
<!– tweeter login–>
|
||||
<dependency>
|
||||
<groupId>org.springframework.social</groupId>
|
||||
<artifactId>spring-social-twitter</artifactId>
|
||||
<version>1.1.2.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
</dependency>-->
|
||||
<!--<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml-core</artifactId>
|
||||
<version>${opensaml.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml-saml-api</artifactId>
|
||||
<version>${opensaml.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml-saml-impl</artifactId>
|
||||
<version>${opensaml.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml-soap-api</artifactId>
|
||||
<version>${opensaml.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml-xmlsec-api</artifactId>
|
||||
<version>${opensaml.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml-security-api</artifactId>
|
||||
<version>${opensaml.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml-security-impl</artifactId>
|
||||
<version>${opensaml.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml-profile-api</artifactId>
|
||||
<version>${opensaml.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>xmltooling</artifactId>
|
||||
<version>1.4.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.soap</groupId>
|
||||
<artifactId>jakarta.xml.soap-api</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.messaging.saaj</groupId>
|
||||
<artifactId>saaj-impl</artifactId>
|
||||
<version>3.0.0-M2</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -226,46 +138,11 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>1.5.9.RELEASE</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<mainClass>eu.eudat.EuDatApplication</mainClass>
|
||||
<classpathPrefix>dependency-jars/</classpathPrefix>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>
|
||||
${project.build.directory}/dependency-jars/
|
||||
</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<start-class>eu.eudat.EuDatApplication</start-class>
|
||||
<opensaml.version>4.0.1</opensaml.version>
|
||||
</properties>
|
||||
</project>
|
|
@ -8,7 +8,7 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
|
|||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {"eu.eudat", "eu.eudat.depositinterface"})
|
||||
@SpringBootApplication
|
||||
@EnableAsync
|
||||
public class EuDatApplication extends SpringBootServletInitializer {
|
||||
private static final Logger logger = LoggerFactory.getLogger(EuDatApplication.class);
|
||||
|
|
|
@ -4,15 +4,11 @@ import org.apache.http.HttpHost;
|
|||
import org.apache.http.auth.AuthScope;
|
||||
import org.apache.http.auth.UsernamePasswordCredentials;
|
||||
import org.apache.http.client.CredentialsProvider;
|
||||
import org.apache.http.conn.ssl.NoopHostnameVerifier;
|
||||
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
|
||||
import org.apache.http.impl.client.BasicCredentialsProvider;
|
||||
import org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager;
|
||||
import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
|
||||
import org.apache.http.nio.reactor.IOReactorException;
|
||||
import org.apache.http.nio.reactor.IOReactorExceptionHandler;
|
||||
import org.apache.http.ssl.SSLContextBuilder;
|
||||
import org.apache.http.ssl.SSLContexts;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -22,17 +18,7 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.KeyStore;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateFactory;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 7/5/2018.
|
||||
|
@ -70,46 +56,12 @@ public class ElasticSearchConfiguration {
|
|||
}
|
||||
});
|
||||
|
||||
RestHighLevelClient client;
|
||||
if(this.environment.getProperty("elasticsearch.usingssl", Boolean.class)){
|
||||
|
||||
// Path caCertificatePath = Paths.get(this.environment.getProperty("elasticsearch.certPath"));
|
||||
// CertificateFactory factory =
|
||||
// CertificateFactory.getInstance("X.509");
|
||||
// Certificate trustedCa;
|
||||
// try (InputStream is = Files.newInputStream(caCertificatePath)) {
|
||||
// trustedCa = factory.generateCertificate(is);
|
||||
// }
|
||||
// KeyStore trustStore = KeyStore.getInstance("pkcs12");
|
||||
// trustStore.load(null, null);
|
||||
// trustStore.setCertificateEntry("ca", trustedCa);
|
||||
//
|
||||
// TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
||||
// tmf.init(trustStore);
|
||||
//
|
||||
// SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
// sslContext.init(null, tmf.getTrustManagers(), null);
|
||||
|
||||
SSLContextBuilder sslBuilder = SSLContexts.custom()
|
||||
.loadTrustMaterial(null, (x509Certificates, s) -> true);
|
||||
final SSLContext sslContext = sslBuilder.build();
|
||||
client = new RestHighLevelClient(
|
||||
RestClient.builder(
|
||||
new HttpHost(this.environment.getProperty("elasticsearch.host"),
|
||||
Integer.parseInt(this.environment.getProperty("elasticsearch.port")), "https"))
|
||||
.setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder
|
||||
.setDefaultCredentialsProvider(credentialsProvider).setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE).setSSLContext(sslContext))
|
||||
.setRequestConfigCallback(requestConfigBuilder -> requestConfigBuilder.setConnectTimeout(5000).setSocketTimeout(120000))
|
||||
);
|
||||
}
|
||||
else {
|
||||
client = new RestHighLevelClient(
|
||||
RestClient.builder(
|
||||
new HttpHost(this.environment.getProperty("elasticsearch.host"),
|
||||
Integer.parseInt(this.environment.getProperty("elasticsearch.port")), "http"))
|
||||
.setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder
|
||||
.setDefaultCredentialsProvider(credentialsProvider).setConnectionManager(new PoolingNHttpClientConnectionManager(ioReactor))));
|
||||
}
|
||||
RestHighLevelClient client = new RestHighLevelClient(
|
||||
RestClient.builder(
|
||||
new HttpHost(this.environment.getProperty("elasticsearch.host"),
|
||||
Integer.parseInt(this.environment.getProperty("elasticsearch.port")), "http"))
|
||||
.setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder
|
||||
.setDefaultCredentialsProvider(credentialsProvider).setConnectionManager(new PoolingNHttpClientConnectionManager(ioReactor))));
|
||||
return client;
|
||||
}catch (IOReactorException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
package eu.eudat.configurations;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.Module;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import eu.eudat.criteria.entities.Criteria;
|
||||
import eu.eudat.criteria.serialzier.CriteriaSerializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Configuration
|
||||
public class JacksonConfiguration {
|
||||
@Bean
|
||||
public ObjectMapper buildObjectMapper() {
|
||||
|
||||
ArrayList<Module> modules = new ArrayList<>();
|
||||
SimpleModule criteriaSerializerModule = new SimpleModule();
|
||||
criteriaSerializerModule.addDeserializer(Criteria.class, new CriteriaSerializer());
|
||||
modules.add(criteriaSerializerModule);
|
||||
|
||||
return new ObjectMapper()
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||
.registerModules(modules);
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ import java.util.Properties;
|
|||
*/
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@Profile({ "production", "staging", "docker" })
|
||||
@Profile({ "production", "staging" })
|
||||
@ComponentScan(basePackages = {"eu.eudat.data.entities"})
|
||||
public class ProductionDatabaseConfiguration {
|
||||
|
||||
|
|
|
@ -1,37 +1,43 @@
|
|||
package eu.eudat.configurations;
|
||||
|
||||
import eu.eudat.controllers.interceptors.RequestInterceptor;
|
||||
import eu.eudat.logic.handlers.PrincipalArgumentResolver;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.logic.services.operations.authentication.AuthenticationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@EnableAsync
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
public class WebMVCConfiguration extends WebMvcConfigurerAdapter {
|
||||
public class WebMVCConfiguration implements WebMvcConfigurer {
|
||||
|
||||
private ApiContext apiContext;
|
||||
|
||||
private AuthenticationService verifiedUserAuthenticationService;
|
||||
private AuthenticationService nonVerifiedUserAuthenticationService;
|
||||
private final AuthenticationService verifiedUserAuthenticationService;
|
||||
private final AuthenticationService nonVerifiedUserAuthenticationService;
|
||||
|
||||
@Autowired
|
||||
public WebMVCConfiguration(ApiContext apiContext, AuthenticationService verifiedUserAuthenticationService, AuthenticationService nonVerifiedUserAuthenticationService) {
|
||||
private final Environment environment;
|
||||
|
||||
public WebMVCConfiguration(ApiContext apiContext, AuthenticationService verifiedUserAuthenticationService, AuthenticationService nonVerifiedUserAuthenticationService, Environment environment) {
|
||||
this.apiContext = apiContext;
|
||||
this.verifiedUserAuthenticationService = verifiedUserAuthenticationService;
|
||||
this.nonVerifiedUserAuthenticationService = nonVerifiedUserAuthenticationService;
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/api/**").allowedOrigins(this.environment.getProperty("dmp.domain"));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Override
|
||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||
argumentResolvers.add(new PrincipalArgumentResolver(verifiedUserAuthenticationService, nonVerifiedUserAuthenticationService));
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
|
||||
@Service("dynamicFunderConfiguration")
|
||||
@Profile({ "production", "staging", "docker" })
|
||||
@Profile({ "production", "staging" })
|
||||
public class DynamicFunderConfigurationProdImpl implements DynamicFunderConfiguration {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DynamicFunderConfigurationProdImpl.class);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
* Created by ikalyvas on 3/23/2018.
|
||||
*/
|
||||
@Service("dynamicGrantConfiguration")
|
||||
@Profile({ "production", "staging", "docker" })
|
||||
@Profile({ "production", "staging" })
|
||||
public class DynamicGrantConfigurationProdImpl implements DynamicGrantConfiguration {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DynamicGrantConfigurationProdImpl.class);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
|
||||
@Service("dynamicProjectConfiguration")
|
||||
@Profile({ "production", "staging", "docker" })
|
||||
@Profile({ "production", "staging" })
|
||||
public class DynamicProjectConfigurationProdImpl implements DynamicProjectConfiguration{
|
||||
private static final Logger logger = LoggerFactory.getLogger(DynamicProjectConfigurationProdImpl.class);
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package eu.eudat.configurations.file;
|
||||
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties({TmpProperties.class, PermProperties.class})
|
||||
public class FileTimeConfiguration {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package eu.eudat.configurations.file;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "perm")
|
||||
public class PermProperties {
|
||||
|
||||
private TimeProperties time;
|
||||
|
||||
public TimeProperties getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(TimeProperties time) {
|
||||
this.time = time;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package eu.eudat.configurations.file;
|
||||
|
||||
public class StartTimeProperties {
|
||||
private Integer month;
|
||||
private String dayOfWeekName;
|
||||
private Integer dayOfWeek;
|
||||
|
||||
private Integer dayOfMonth;
|
||||
private Integer hour;
|
||||
private Integer minute;
|
||||
|
||||
public Integer getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(Integer month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public String getDayOfWeekName() {
|
||||
return dayOfWeekName;
|
||||
}
|
||||
|
||||
public void setDayOfWeekName(String dayOfWeekName) {
|
||||
this.dayOfWeekName = dayOfWeekName;
|
||||
}
|
||||
|
||||
public Integer getDayOfWeek() {
|
||||
return dayOfWeek;
|
||||
}
|
||||
|
||||
public void setDayOfWeek(Integer dayOfWeek) {
|
||||
this.dayOfWeek = dayOfWeek;
|
||||
}
|
||||
|
||||
public Integer getDayOfMonth() {
|
||||
return dayOfMonth;
|
||||
}
|
||||
|
||||
public void setDayOfMonth(Integer dayOfMonth) {
|
||||
this.dayOfMonth = dayOfMonth;
|
||||
}
|
||||
|
||||
public Integer getHour() {
|
||||
return hour;
|
||||
}
|
||||
|
||||
public void setHour(Integer hour) {
|
||||
this.hour = hour;
|
||||
}
|
||||
|
||||
public Integer getMinute() {
|
||||
return minute;
|
||||
}
|
||||
|
||||
public void setMinute(Integer minute) {
|
||||
this.minute = minute;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package eu.eudat.configurations.file;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
public class TimeProperties {
|
||||
private Integer interval;
|
||||
private ChronoUnit timeUnit;
|
||||
private StartTimeProperties startTime;
|
||||
|
||||
public Integer getInterval() {
|
||||
return interval;
|
||||
}
|
||||
|
||||
public void setInterval(Integer interval) {
|
||||
this.interval = interval;
|
||||
}
|
||||
|
||||
public ChronoUnit getTimeUnit() {
|
||||
return timeUnit;
|
||||
}
|
||||
|
||||
public void setTimeUnit(ChronoUnit timeUnit) {
|
||||
this.timeUnit = timeUnit;
|
||||
}
|
||||
|
||||
public StartTimeProperties getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(StartTimeProperties startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package eu.eudat.configurations.file;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "tmp")
|
||||
public class TmpProperties {
|
||||
|
||||
private TimeProperties time;
|
||||
|
||||
public TimeProperties getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(TimeProperties time) {
|
||||
this.time = time;
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.logic.managers.MaterialManager;
|
||||
import eu.eudat.logic.managers.MetricsManager;
|
||||
import eu.eudat.types.MetricNames;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/material/about/"})
|
||||
public class AboutController {
|
||||
|
||||
private Environment environment;
|
||||
private MaterialManager materialManager;
|
||||
|
||||
@Autowired
|
||||
public AboutController(Environment environment, MaterialManager materialManager, MetricsManager metricsManager) {
|
||||
this.environment = environment;
|
||||
this.materialManager = materialManager;
|
||||
}
|
||||
|
||||
@RequestMapping(path = "{lang}", method = RequestMethod.GET )
|
||||
public ResponseEntity<byte[]> getAbout(@PathVariable(name = "lang") String lang) throws IOException {
|
||||
try (Stream<Path> paths = Files.walk(Paths.get(Objects.requireNonNull(this.environment.getProperty("about.path"))))) {
|
||||
return this.materialManager.getResponseEntity(lang, paths);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.eudat.data.entities.UserDatasetProfile;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
||||
|
@ -17,6 +16,7 @@ import eu.eudat.models.data.admin.composite.DatasetProfile;
|
|||
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
|
||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
|
@ -32,12 +32,12 @@ import javax.validation.Valid;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static eu.eudat.types.Authorities.ADMIN;
|
||||
import static eu.eudat.types.Authorities.DATASET_PROFILE_MANAGER;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/admin/"})
|
||||
public class Admin extends BaseController {
|
||||
|
||||
|
@ -57,42 +57,41 @@ public class Admin extends BaseController {
|
|||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/addDmp"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<Object> addDmp(@Valid @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN ,DATASET_PROFILE_MANAGER}) Principal principal) throws Exception {
|
||||
public ResponseEntity<Object> addDmp(@Valid @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN ,DATASET_PROFILE_MANAGER}) Principal principal) {
|
||||
//this.getLoggerService().info(principal, "Admin Added Dataset Profile");
|
||||
DatasetProfile shortenProfile = profile.toShort();
|
||||
DescriptionTemplate modelDefinition = AdminManager.generateViewStyleDefinition(shortenProfile, getApiContext());
|
||||
modelDefinition.setType(getApiContext().getOperationsContext().getDatabaseRepository().getDescriptionTemplateTypeDao().findFromName(profile.getType()));
|
||||
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(shortenProfile, getApiContext());
|
||||
modelDefinition.setGroupId(UUID.randomUUID());
|
||||
modelDefinition.setVersion((short) 0);
|
||||
|
||||
DescriptionTemplate descriptionTemplate = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
||||
eu.eudat.data.entities.DatasetProfile datasetProfile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
||||
UserDatasetProfile userDatasetProfile = new UserDatasetProfile();
|
||||
userDatasetProfile.setDatasetProfile(descriptionTemplate);
|
||||
userDatasetProfile.setDatasetProfile(datasetProfile);
|
||||
UserInfo userInfo = getApiContext().getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
||||
userDatasetProfile.setUser(userInfo);
|
||||
userDatasetProfile.setRole(0);
|
||||
getApiContext().getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile);
|
||||
datasetProfileManager.storeDatasetProfileUsers(descriptionTemplate, profile);
|
||||
datasetProfileManager.storeDatasetProfileUsers(datasetProfile, profile);
|
||||
|
||||
metricsManager.increaseValue(MetricNames.DATASET_TEMPLATE, 1, MetricsManager.datasetTemplateStatus.get(descriptionTemplate.getStatus()) );
|
||||
metricsManager.increaseValue(MetricNames.DATASET_TEMPLATE, 1, MetricsManager.datasetTemplateStatus.get(datasetProfile.getStatus()) );
|
||||
return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/addDmp/{id}"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<UUID>> updateDmp(@PathVariable String id, @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) throws Exception {
|
||||
public ResponseEntity<ResponseItem<UUID>> updateDmp(@PathVariable String id, @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) {
|
||||
DatasetProfile shortenProfile = profile.toShort();
|
||||
DescriptionTemplate modelDefinition = AdminManager.generateViewStyleDefinition(shortenProfile, getApiContext());
|
||||
DescriptionTemplate datasetprofile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(shortenProfile, getApiContext());
|
||||
eu.eudat.data.entities.DatasetProfile datasetprofile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||
datasetprofile.setDefinition(modelDefinition.getDefinition());
|
||||
Short oldStatus = datasetprofile.getStatus();
|
||||
datasetprofile.setStatus(modelDefinition.getStatus());
|
||||
datasetprofile.setLabel(modelDefinition.getLabel());
|
||||
datasetprofile.setDescription(modelDefinition.getDescription());
|
||||
datasetprofile.setLanguage(modelDefinition.getLanguage());
|
||||
DescriptionTemplate descriptionTemplate = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(datasetprofile);
|
||||
datasetProfileManager.storeDatasetProfileUsers(descriptionTemplate, profile);
|
||||
if (descriptionTemplate.getStatus() == 1 && oldStatus == 0) {
|
||||
eu.eudat.data.entities.DatasetProfile datasetProfile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(datasetprofile);
|
||||
datasetProfileManager.storeDatasetProfileUsers(datasetProfile, profile);
|
||||
if (datasetProfile.getStatus() == 1 && oldStatus == 0) {
|
||||
metricsManager.increaseValue(MetricNames.DATASET_TEMPLATE, 1, MetricNames.ACTIVE);
|
||||
}
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.NO_MESSAGE));
|
||||
|
@ -102,7 +101,7 @@ public class Admin extends BaseController {
|
|||
@RequestMapping(method = RequestMethod.POST, value = {"/newVersion/{id}"}, produces = "application/json")
|
||||
public ResponseEntity newVersionDatasetProfile(@PathVariable String id, @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) throws Exception {
|
||||
try {
|
||||
DescriptionTemplate modelDefinition = this.datasetProfileManager.createNewVersionDatasetProfile(id, profile);
|
||||
eu.eudat.data.entities.DatasetProfile modelDefinition = this.datasetProfileManager.createNewVersionDatasetProfile(id, profile);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId());
|
||||
} catch (DatasetProfileNewVersionException exception) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage()));
|
||||
|
@ -124,8 +123,8 @@ public class Admin extends BaseController {
|
|||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/preview"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<PagedDatasetProfile>> getPreview(@RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) throws Exception {
|
||||
DescriptionTemplate modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
|
||||
public ResponseEntity<ResponseItem<PagedDatasetProfile>> getPreview(@RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) {
|
||||
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
|
||||
eu.eudat.models.data.user.composite.DatasetProfile datasetProfile = userManager.generateDatasetProfileModel(modelDefinition);
|
||||
PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile();
|
||||
pagedDatasetProfile.buildPagedDatasetProfile(datasetProfile);
|
||||
|
@ -145,7 +144,7 @@ public class Admin extends BaseController {
|
|||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DatasetProfile>> inactivate(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) {
|
||||
try {
|
||||
DescriptionTemplate ret = AdminManager.inactivate(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao(), this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao(), id);
|
||||
eu.eudat.data.entities.DatasetProfile ret = AdminManager.inactivate(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao(), this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao(), id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
} catch (DatasetProfileWithDatasetsExeption exception) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().status(ApiMessageCode.UNSUCCESS_DELETE).message(exception.getMessage()));
|
||||
|
@ -156,45 +155,36 @@ public class Admin extends BaseController {
|
|||
@RequestMapping(method = RequestMethod.GET, value = {"/getXml/{id}"}, produces = "application/json")
|
||||
public ResponseEntity getDatasetProfileXml(@PathVariable String id, @RequestHeader("Content-Type") String contentType, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) throws IllegalAccessException, IOException, InstantiationException {
|
||||
if (contentType.equals("application/xml")) {
|
||||
DescriptionTemplate profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||
eu.eudat.data.entities.DatasetProfile profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||
eu.eudat.models.data.user.composite.DatasetProfile datasetProfile = userManager.generateDatasetProfileModel(profile);
|
||||
datasetProfile.setStatus(profile.getStatus());
|
||||
datasetProfile.setDescription(profile.getDescription());
|
||||
datasetProfile.setLanguage(profile.getLanguage());
|
||||
datasetProfile.setType(profile.getType().getName());
|
||||
return this.datasetProfileManager.getDocument(datasetProfile, profile.getLabel());
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().status(ApiMessageCode.ERROR_MESSAGE).message("NOT AUTHORIZE"));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/upload", "/upload/{id}"})
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/upload"})
|
||||
public ResponseEntity<Object> setDatasetProfileXml(@RequestParam("file") MultipartFile file,
|
||||
@PathVariable(value = "id", required = false) String id,
|
||||
@ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) throws Exception {
|
||||
@ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) throws IllegalAccessException, IOException {
|
||||
eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile datasetProfileModel = this.datasetProfileManager.createDatasetProfileFromXml(file);
|
||||
eu.eudat.models.data.admin.composite.DatasetProfile datasetProfileEntity = datasetProfileModel.toAdminCompositeModel(file.getOriginalFilename());
|
||||
DescriptionTemplate modelDefinition;
|
||||
if (id == null) {
|
||||
modelDefinition = AdminManager.generateViewStyleDefinition(datasetProfileEntity, getApiContext());
|
||||
DescriptionTemplate descriptionTemplate = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
||||
UserDatasetProfile userDatasetProfile = new UserDatasetProfile();
|
||||
userDatasetProfile.setDatasetProfile(descriptionTemplate);
|
||||
UserInfo userInfo = getApiContext().getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
||||
userDatasetProfile.setUser(userInfo);
|
||||
userDatasetProfile.setRole(0);
|
||||
getApiContext().getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile);
|
||||
} else {
|
||||
modelDefinition = datasetProfileManager.createNewVersionDatasetProfile(id, datasetProfileEntity);
|
||||
}
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<DescriptionTemplate>>()
|
||||
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(datasetProfileEntity, getApiContext());
|
||||
eu.eudat.data.entities.DatasetProfile datasetProfile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
||||
UserDatasetProfile userDatasetProfile = new UserDatasetProfile();
|
||||
userDatasetProfile.setDatasetProfile(datasetProfile);
|
||||
UserInfo userInfo = getApiContext().getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
||||
userDatasetProfile.setUser(userInfo);
|
||||
userDatasetProfile.setRole(0);
|
||||
getApiContext().getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<eu.eudat.data.entities.DatasetProfile>>()
|
||||
.status(ApiMessageCode.SUCCESS_MESSAGE).message(""));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getSemantics"}, produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<List<String>>> getSemantics(@RequestParam(value = "query", required = false) String query, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) {
|
||||
List<String> semantics = this.datasetProfileManager.getSemantics(query);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<String>>().status(ApiMessageCode.SUCCESS_MESSAGE).payload(semantics));
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getRDACommonStandards"}, produces = "application/json")
|
||||
public ResponseEntity getRDACommonStandards(@ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<String>>().status(ApiMessageCode.SUCCESS_MESSAGE).payload(configLoader.getRdaProperties()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.util.List;
|
|||
* Created by ikalyvas on 3/28/2018.
|
||||
*/
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/common"})
|
||||
public class CommonController {
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
import javax.transaction.Transactional;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "api/contactEmail")
|
||||
public class ContactEmail {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ContactEmail.class);
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "api/currency")
|
||||
public class CurrencyController {
|
||||
|
||||
|
|
|
@ -2,10 +2,7 @@ package eu.eudat.controllers;
|
|||
|
||||
import eu.eudat.data.dao.criteria.RequestItem;
|
||||
import eu.eudat.data.entities.DMPProfile;
|
||||
import eu.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.eudat.data.query.items.dmpblueprint.DataManagementPlanBlueprintTableRequest;
|
||||
import eu.eudat.data.query.items.table.dmpprofile.DataManagementPlanProfileTableRequest;
|
||||
import eu.eudat.exceptions.dmpblueprint.DmpBlueprintUsedException;
|
||||
import eu.eudat.logic.managers.DataManagementProfileManager;
|
||||
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
|
@ -13,7 +10,6 @@ import eu.eudat.models.data.helpermodels.Tuple;
|
|||
import eu.eudat.models.data.helpers.common.AutoCompleteLookupItem;
|
||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.listingmodels.DataManagementPlanBlueprintListingModel;
|
||||
import eu.eudat.models.data.listingmodels.DataManagementPlanProfileListingModel;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
|
@ -30,13 +26,11 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
|
||||
import static eu.eudat.types.Authorities.ADMIN;
|
||||
import static eu.eudat.types.Authorities.DATASET_PROFILE_MANAGER;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/21/2018.
|
||||
*/
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/dmpprofile"})
|
||||
public class DMPProfileController extends BaseController {
|
||||
|
||||
|
@ -56,14 +50,6 @@ public class DMPProfileController extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMPProfile>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created"));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/blueprint"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DMPProfile>> createOrUpdateBlueprint(@RequestBody DataManagementPlanBlueprintListingModel dataManagementPlan, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
|
||||
this.dataManagementProfileManager.createOrUpdateBlueprint(dataManagementPlan, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMPProfile>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created"));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getSingle/{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataManagementPlanProfileListingModel>> getSingle(@PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException {
|
||||
|
@ -71,13 +57,6 @@ public class DMPProfileController extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanProfileListingModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlanProfileListingModel));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getSingleBlueprint/{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataManagementPlanBlueprintListingModel>> getSingleBlueprint(@PathVariable String id, Principal principal) {
|
||||
DataManagementPlanBlueprintListingModel dataManagementPlanBlueprintListingModel = this.dataManagementProfileManager.getSingleBlueprint(id, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanBlueprintListingModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlanBlueprintListingModel));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/getPaged"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataTableData<DataManagementPlanProfileListingModel>>> getPaged(@Valid @RequestBody DataManagementPlanProfileTableRequest dataManagementPlanProfileTableRequest, Principal principal) throws Exception {
|
||||
|
@ -85,51 +64,24 @@ public class DMPProfileController extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DataManagementPlanProfileListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/getPagedBlueprint"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataTableData<DataManagementPlanBlueprintListingModel>>> getPagedBlueprint(@Valid @RequestBody DataManagementPlanBlueprintTableRequest dataManagementPlanBlueprintTableRequest, Principal principal) throws Exception {
|
||||
DataTableData<DataManagementPlanBlueprintListingModel> dataTable = this.dataManagementProfileManager.getPagedBlueprint(dataManagementPlanBlueprintTableRequest, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DataManagementPlanBlueprintListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/clone/{id}"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<DataManagementPlanBlueprintListingModel>> clone(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
|
||||
DataManagementPlanBlueprintListingModel dmpBlueprint = this.dataManagementProfileManager.getSingleBlueprint(id, principal);
|
||||
dmpBlueprint.setLabel(dmpBlueprint.getLabel() + " new ");
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanBlueprintListingModel>().payload(dmpBlueprint));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = {"{id}"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Void>> inactivate(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
|
||||
try {
|
||||
this.dataManagementProfileManager.inactivate(id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Void>().status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
} catch (DmpBlueprintUsedException exception) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Void>().status(ApiMessageCode.UNSUCCESS_DELETE).message(exception.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getXml/{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity getXml( @RequestHeader("Content-Type") String contentType, @PathVariable String id, Principal principal) throws IOException {
|
||||
ResponseEntity getXml( @RequestHeader("Content-Type") String contentType, @PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException, IOException {
|
||||
if (contentType.equals("application/xml")) {
|
||||
DataManagementPlanBlueprintListingModel dataManagementPlanBlueprintListingModel = this.dataManagementProfileManager.getSingleBlueprint(id, principal);
|
||||
return this.dataManagementProfileManager.getDocument(dataManagementPlanBlueprintListingModel);
|
||||
DataManagementPlanProfileListingModel dataManagementPlanProfileListingModel = this.dataManagementProfileManager.getSingle(id, principal);
|
||||
return this.dataManagementProfileManager.getDocument(dataManagementPlanProfileListingModel,dataManagementPlanProfileListingModel.getLabel());
|
||||
}else {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DataManagementPlanBlueprintListingModel>().status(ApiMessageCode.ERROR_MESSAGE).message("NOT AUTHORIZE"));
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DataManagementPlanProfileListingModel>().status(ApiMessageCode.ERROR_MESSAGE).message("NOT AUTHORIZE"));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/upload"})
|
||||
public ResponseEntity<Object> setDatasetProfileXml(@RequestParam("file") MultipartFile file,
|
||||
@ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
|
||||
eu.eudat.logic.utilities.documents.xml.dmpXml.dmpBlueprintModel.DmpBlueprint dmpBlueprintModel = this.dataManagementProfileManager.createDmpProfileFromXml(file);
|
||||
DataManagementPlanBlueprintListingModel dmpBlueprint = dmpBlueprintModel.toDmpProfileCompositeModel(file.getOriginalFilename());
|
||||
this.dataManagementProfileManager.createOrUpdateBlueprint(dmpBlueprint, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<DescriptionTemplate>>()
|
||||
@ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws IllegalAccessException,IOException,Exception{
|
||||
eu.eudat.logic.utilities.documents.xml.dmpXml.dmpProfileModel.DmpProfile dmpProfileModel = this.dataManagementProfileManager.createDmpProfileFromXml(file);
|
||||
DataManagementPlanProfileListingModel dataManagementPlan = dmpProfileModel.toDmpProfileCompositeModel(file.getOriginalFilename());
|
||||
this.dataManagementProfileManager.createOrUpdate(dataManagementPlan, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<eu.eudat.data.entities.DatasetProfile>>()
|
||||
.status(ApiMessageCode.SUCCESS_MESSAGE).message(""));
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,12 @@ import eu.eudat.data.entities.DMP;
|
|||
import eu.eudat.data.entities.Dataset;
|
||||
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
||||
import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest;
|
||||
import eu.eudat.data.query.items.table.dmp.DataManagmentPlanPublicTableRequest;
|
||||
import eu.eudat.exceptions.datamanagementplan.DMPNewVersionException;
|
||||
import eu.eudat.exceptions.datamanagementplan.DMPWithDatasetsDeleteException;
|
||||
import eu.eudat.exceptions.security.UnauthorisedException;
|
||||
import eu.eudat.logic.managers.DataManagementPlanManager;
|
||||
import eu.eudat.logic.managers.DatasetManager;
|
||||
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
||||
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
|
@ -60,7 +62,6 @@ import static org.springframework.http.MediaType.*;
|
|||
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/dmps/"})
|
||||
public class DMPs extends BaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DMPs.class);
|
||||
|
@ -150,7 +151,7 @@ public class DMPs extends BaseController {
|
|||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/publicOverview/{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataManagementPlanOverviewModel>> getOverviewSinglePublic(@PathVariable String id, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||
ResponseEntity getOverviewSinglePublic(@PathVariable String id, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||
// try {
|
||||
DataManagementPlanOverviewModel dataManagementPlan = this.dataManagementPlanManager.getOverviewSingle(id, principal, true);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanOverviewModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlan));
|
||||
|
@ -182,21 +183,7 @@ public class DMPs extends BaseController {
|
|||
public @ResponseBody
|
||||
ResponseEntity getRDAJsonDocument(@PathVariable String id, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) {
|
||||
try {
|
||||
FileEnvelope rdaJsonDocument = this.dataManagementPlanManager.getRDAJsonDocument(id, principal);
|
||||
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
responseHeaders.setContentLength(rdaJsonDocument.getFile().length());
|
||||
responseHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
responseHeaders.set("Content-Disposition", "attachment;filename=" + rdaJsonDocument.getFilename());
|
||||
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
|
||||
|
||||
InputStream resource = new FileInputStream(rdaJsonDocument.getFile());
|
||||
byte[] content = org.apache.poi.util.IOUtils.toByteArray(resource);
|
||||
resource.close();
|
||||
Files.deleteIfExists(rdaJsonDocument.getFile().toPath());
|
||||
|
||||
return new ResponseEntity<>(content, responseHeaders, HttpStatus.OK);
|
||||
return this.dataManagementPlanManager.getRDAJsonDocument(id, principal);
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.status(HttpStatus.EXPECTATION_FAILED).body(new ResponseItem<>().message(e.getMessage()).status(ApiMessageCode.ERROR_MESSAGE));
|
||||
}
|
||||
|
@ -260,7 +247,7 @@ public class DMPs extends BaseController {
|
|||
@RequestMapping(method = RequestMethod.POST, value = {"/clone/{id}"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<UUID>> clone(@PathVariable UUID id, @RequestBody eu.eudat.models.data.dmp.DataManagementPlanNewVersionModel dataManagementPlan, Principal principal) throws Exception {
|
||||
UUID cloneId = this.dataManagementPlanManager.clone(id, dataManagementPlan, principal);
|
||||
UUID cloneId = this.dataManagementPlanManager.clone(dataManagementPlan, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.SUCCESS_MESSAGE).payload(cloneId));
|
||||
}
|
||||
|
||||
|
@ -333,6 +320,21 @@ public class DMPs extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* DOI Generation
|
||||
* */
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/createZenodoDoi/{id}"})
|
||||
public ResponseEntity<ResponseItem<String>> createZenodoDoi(@PathVariable String id, Principal principal) {
|
||||
try {
|
||||
String zenodoDOI = this.dataManagementPlanManager.createZenodoDoi(UUID.fromString(id), principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<String>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully created DOI for Data Datamanagement Plan in question.").payload(zenodoDOI));
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<String>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to create DOI for the Data Management Plan: " + e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Data Index
|
||||
* */
|
||||
|
|
|
@ -22,11 +22,10 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api"})
|
||||
public class DashBoardController extends BaseController {
|
||||
|
||||
private DashBoardManager dashBoardManager;
|
||||
private final DashBoardManager dashBoardManager;
|
||||
@Autowired
|
||||
public DashBoardController(ApiContext apiContext, DashBoardManager dashBoardManager) {
|
||||
super(apiContext);
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.util.List;
|
|||
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/external/datarepos"})
|
||||
public class DataRepositories extends BaseController {
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.data.dao.criteria.RequestItem;
|
||||
import eu.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.eudat.logic.managers.AdminManager;
|
||||
import eu.eudat.logic.managers.DatasetProfileManager;
|
||||
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||
|
@ -9,11 +8,8 @@ import eu.eudat.logic.services.ApiContext;
|
|||
import eu.eudat.models.data.components.commons.datafield.AutoCompleteData;
|
||||
import eu.eudat.models.data.externaldataset.ExternalAutocompleteFieldModel;
|
||||
import eu.eudat.models.data.helpers.common.AutoCompleteLookupItem;
|
||||
import eu.eudat.models.data.helpers.common.AutoCompleteOptionsLookupItem;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.properties.PropertiesModel;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -21,15 +17,12 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static eu.eudat.types.Authorities.ADMIN;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api"})
|
||||
public class DatasetProfileController extends BaseController {
|
||||
|
||||
|
@ -57,7 +50,7 @@ public class DatasetProfileController extends BaseController {
|
|||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/datasetprofile/clone/{id}"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>> clone(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN})Principal principal) {
|
||||
DescriptionTemplate profile = this.datasetProfileManager.clone(id);
|
||||
eu.eudat.data.entities.DatasetProfile profile = this.datasetProfileManager.clone(id);
|
||||
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
||||
datasetprofile.setLabel(profile.getLabel() + " new ");
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().payload(datasetprofile));
|
||||
|
@ -65,19 +58,11 @@ public class DatasetProfileController extends BaseController {
|
|||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/search/autocomplete"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<Object> getDataForAutocomplete(@RequestBody RequestItem<AutoCompleteLookupItem> lookupItem) throws XPathExpressionException {
|
||||
DescriptionTemplate descriptionTemplate = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(lookupItem.getCriteria().getProfileID()));
|
||||
eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field modelfield = this.datasetProfileManager.queryForField(descriptionTemplate.getDefinition(), lookupItem.getCriteria().getFieldID());
|
||||
eu.eudat.data.entities.DatasetProfile datasetProfile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(lookupItem.getCriteria().getProfileID()));
|
||||
eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field modelfield = this.datasetProfileManager.queryForField(datasetProfile.getDefinition(), lookupItem.getCriteria().getFieldID());
|
||||
AutoCompleteData data = (AutoCompleteData) modelfield.getData();
|
||||
List<ExternalAutocompleteFieldModel> items = this.datasetProfileManager.getAutocomplete(data, lookupItem.getCriteria().getLike());
|
||||
return ResponseEntity.status(HttpStatus.OK).body(items);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/search/autocompleteOptions"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<Object> getDataForAutocompleteOptions(@RequestBody RequestItem<AutoCompleteOptionsLookupItem> lookupItem) {
|
||||
AutoCompleteData data = new AutoCompleteData();
|
||||
data.setAutoCompleteSingleDataList(lookupItem.getCriteria().getAutoCompleteSingleDataList());
|
||||
List<ExternalAutocompleteFieldModel> items = this.datasetProfileManager.getAutocomplete(data, lookupItem.getCriteria().getLike());
|
||||
return ResponseEntity.status(HttpStatus.OK).body(items);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import eu.eudat.logic.managers.DatasetProfileManager;
|
|||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.datasetprofile.DatasetProfileAutocompleteItem;
|
||||
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
|
||||
import eu.eudat.models.data.datasetprofile.DatasetProfileWithPrefillingPropertyModel;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -18,7 +17,6 @@ import java.util.List;
|
|||
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api"})
|
||||
public class DatasetProfiles extends BaseController {
|
||||
|
||||
|
@ -43,12 +41,5 @@ public class DatasetProfiles extends BaseController {
|
|||
List<DatasetProfileListingModel> datasetProfileTableData = this.datasetProfileManager.getAll(tableRequestItem);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<DatasetProfileListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(datasetProfileTableData));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/datasetprofiles/getAllWithPrefilling"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<List<DatasetProfileWithPrefillingPropertyModel>>> getAllWithPrefilling(@RequestBody DatasetProfileTableRequestItem tableRequestItem) {
|
||||
List<DatasetProfileWithPrefillingPropertyModel> datasetProfileTableData = this.datasetProfileManager.getAllWithPrefilling(tableRequestItem);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<DatasetProfileWithPrefillingPropertyModel>>().status(ApiMessageCode.NO_MESSAGE).payload(datasetProfileTableData));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.data.entities.Dataset;
|
||||
import eu.eudat.data.entities.DescriptionTemplate;
|
||||
import eu.eudat.data.query.items.item.dataset.DatasetWizardAutocompleteRequest;
|
||||
import eu.eudat.data.query.items.item.datasetprofile.DatasetProfileWizardAutocompleteRequest;
|
||||
import eu.eudat.data.query.items.table.dataset.DatasetPublicTableRequest;
|
||||
|
@ -60,7 +59,6 @@ import static eu.eudat.types.Authorities.ANONYMOUS;
|
|||
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/datasets/"})
|
||||
public class Datasets extends BaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(Datasets.class);
|
||||
|
@ -118,7 +116,7 @@ public class Datasets extends BaseController {
|
|||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/publicOverview/{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DatasetOverviewModel>> getOverviewSinglePublic(@PathVariable String id, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||
ResponseEntity getOverviewSinglePublic(@PathVariable String id, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||
// try {
|
||||
DatasetOverviewModel dataset = this.datasetManager.getOverviewSingle(id, principal, true);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetOverviewModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataset));
|
||||
|
@ -203,7 +201,7 @@ public class Datasets extends BaseController {
|
|||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/get/{id}"}, produces = "application/json")
|
||||
public ResponseEntity<ResponseItem<PagedDatasetProfile>> getSingle(@PathVariable String id) {
|
||||
DescriptionTemplate profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||
eu.eudat.data.entities.DatasetProfile profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||
eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = userManager.generateDatasetProfileModel(profile);
|
||||
PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile();
|
||||
pagedDatasetProfile.buildPagedDatasetProfile(datasetprofile);
|
||||
|
@ -257,8 +255,7 @@ public class Datasets extends BaseController {
|
|||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DatasetWizardModel>> createOrUpdate(@RequestBody DatasetWizardModel profile, Principal principal) throws Exception {
|
||||
DatasetWizardModel dataset = new DatasetWizardModel().fromDataModel(this.datasetManager.createOrUpdate(profile, principal));
|
||||
dataset.setTags(profile.getTags());
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetWizardModel>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created").payload(dataset));
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetWizardModel>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created").payload(dataset));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.logic.managers.DepositManager;
|
||||
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.doi.DepositCode;
|
||||
import eu.eudat.models.data.doi.DepositRequest;
|
||||
import eu.eudat.models.data.doi.Doi;
|
||||
import eu.eudat.models.data.doi.RepositoryConfig;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import eu.eudat.types.Authorities;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/deposit/"})
|
||||
public class DepositController extends BaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DepositController.class);
|
||||
|
||||
private DepositManager depositManager;
|
||||
|
||||
@Autowired
|
||||
public DepositController(ApiContext apiContext, DepositManager depositManager){
|
||||
super(apiContext);
|
||||
this.depositManager = depositManager;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/repos"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<List<RepositoryConfig>>> getAvailableRepos(@ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) {
|
||||
List<RepositoryConfig> ids = this.depositManager.getAvailableRepos();
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<RepositoryConfig>>().status(ApiMessageCode.NO_MESSAGE).payload(ids));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/getAccessToken"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<String>> getAccessToken(@RequestBody DepositCode depositCode, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||
String accessToken = this.depositManager.authenticate(depositCode.getRepositoryId(), depositCode.getCode());
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<String>().status(ApiMessageCode.NO_MESSAGE).payload(accessToken));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/createDoi"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Doi>> createDoi(@RequestBody DepositRequest depositRequest, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) {
|
||||
try {
|
||||
Doi doi = this.depositManager.deposit(depositRequest, principal);
|
||||
if(doi != null){
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Doi>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully created DOI for Data Datamanagement Plan in question.").payload(doi));
|
||||
}
|
||||
else{
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Doi>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to create DOI for the Data Management Plan"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Doi>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to create DOI for the Data Management Plan: " + e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/logo/{repositoryId}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<String>> getLogo(@PathVariable("repositoryId") String repositoryId, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) {
|
||||
try {
|
||||
String encodedLogo = this.depositManager.getRepositoryLogo(repositoryId);
|
||||
if(encodedLogo != null){
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<String>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully loaded " + repositoryId + "'s logo.").payload(encodedLogo));
|
||||
}
|
||||
else{
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new ResponseItem<String>().status(ApiMessageCode.ERROR_MESSAGE).message(repositoryId + " has no logo").payload(null));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<String>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to load " + repositoryId + "'s logo: " + e.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.exceptions.descriptiontemplate.DescriptionTemplatesWithTypeException;
|
||||
import eu.eudat.logic.managers.DescriptionTemplateTypeManager;
|
||||
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.descriptiontemplatetype.DescriptionTemplateTypeModel;
|
||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import eu.eudat.types.Authorities;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.UUID;
|
||||
|
||||
import static eu.eudat.types.Authorities.ADMIN;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/descriptionTemplateType/"})
|
||||
public class DescriptionTemplateTypeController extends BaseController {
|
||||
|
||||
private DescriptionTemplateTypeManager descriptionTemplateTypeManager;
|
||||
|
||||
@Autowired
|
||||
public DescriptionTemplateTypeController(ApiContext apiContext, DescriptionTemplateTypeManager descriptionTemplateTypeManager){
|
||||
super(apiContext);
|
||||
this.descriptionTemplateTypeManager = descriptionTemplateTypeManager;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"create"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DescriptionTemplateTypeModel>> create(@RequestBody DescriptionTemplateTypeModel type, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
|
||||
try {
|
||||
this.descriptionTemplateTypeManager.create(type);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DescriptionTemplateTypeModel>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created"));
|
||||
}
|
||||
catch(DescriptionTemplatesWithTypeException e){
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DescriptionTemplateTypeModel>().status(ApiMessageCode.ERROR_MESSAGE).message(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"update"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DescriptionTemplateTypeModel>> update(@RequestBody DescriptionTemplateTypeModel type, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
|
||||
try {
|
||||
this.descriptionTemplateTypeManager.update(type);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DescriptionTemplateTypeModel>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Updated"));
|
||||
}
|
||||
catch(DescriptionTemplatesWithTypeException e){
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DescriptionTemplateTypeModel>().status(ApiMessageCode.ERROR_MESSAGE).message(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"get"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataTableData<DescriptionTemplateTypeModel>>> get(@ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||
DataTableData<DescriptionTemplateTypeModel> dataTable = this.descriptionTemplateTypeManager.get();
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DescriptionTemplateTypeModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"get/{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DescriptionTemplateTypeModel>> getSingle(@PathVariable(value = "id") UUID id, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||
try {
|
||||
DescriptionTemplateTypeModel typeModel = this.descriptionTemplateTypeManager.getSingle(id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DescriptionTemplateTypeModel>().status(ApiMessageCode.NO_MESSAGE).payload(typeModel));
|
||||
}
|
||||
catch(DescriptionTemplatesWithTypeException e){
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new ResponseItem<DescriptionTemplateTypeModel>().status(ApiMessageCode.ERROR_MESSAGE).message(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = {"/delete/{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DescriptionTemplateTypeModel>> delete(@PathVariable(value = "id") UUID id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
|
||||
try{
|
||||
this.descriptionTemplateTypeManager.delete(id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DescriptionTemplateTypeModel>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Deleted"));
|
||||
}
|
||||
catch(DescriptionTemplatesWithTypeException e){
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DescriptionTemplateTypeModel>().status(ApiMessageCode.UNSUCCESS_DELETE).message(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -16,7 +16,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
import javax.transaction.Transactional;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "api/emailConfirmation")
|
||||
public class EmailConfirmation {
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
import javax.transaction.Transactional;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "api/emailMergeConfirmation")
|
||||
public class EmailMergeConfirmation {
|
||||
|
||||
|
@ -32,16 +31,16 @@ public class EmailMergeConfirmation {
|
|||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/{emailToken}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<String>> emailConfirmation(@PathVariable(value = "emailToken") String token) {
|
||||
ResponseEntity<ResponseItem> emailConfirmation(@PathVariable(value = "emailToken") String token) {
|
||||
try {
|
||||
String emailToBeMerged = this.emailConfirmationManager.confirmEmail(token);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<String>().payload(emailToBeMerged).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
this.emailConfirmationManager.confirmEmail(token);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
} catch
|
||||
(HasConfirmedEmailException | TokenExpiredException ex) {
|
||||
if (ex instanceof TokenExpiredException) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<String>().status(ApiMessageCode.NO_MESSAGE));
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE));
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.FOUND).body(new ResponseItem<String>().status(ApiMessageCode.WARN_MESSAGE));
|
||||
return ResponseEntity.status(HttpStatus.FOUND).body(new ResponseItem().status(ApiMessageCode.WARN_MESSAGE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.exceptions.emailconfirmation.HasConfirmedEmailException;
|
||||
import eu.eudat.exceptions.emailconfirmation.TokenExpiredException;
|
||||
import eu.eudat.logic.managers.UnlinkEmailConfirmationManager;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.models.data.userinfo.UserUnlinkRequestModel;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "api/emailUnlinkConfirmation")
|
||||
public class EmailUnlinkConfirmation {
|
||||
|
||||
private UnlinkEmailConfirmationManager unlinkEmailConfirmationManager;
|
||||
|
||||
@Autowired
|
||||
public EmailUnlinkConfirmation(UnlinkEmailConfirmationManager unlinkEmailConfirmationManager){
|
||||
this.unlinkEmailConfirmationManager = unlinkEmailConfirmationManager;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/{emailToken}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem> emailConfirmation(@PathVariable(value = "emailToken") String token) {
|
||||
try {
|
||||
this.unlinkEmailConfirmationManager.confirmEmail(token);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
} catch (TokenExpiredException | HasConfirmedEmailException ex) {
|
||||
if (ex instanceof TokenExpiredException) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
else {
|
||||
return ResponseEntity.status(HttpStatus.FOUND).body(new ResponseItem().status(ApiMessageCode.WARN_MESSAGE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem> sendUnlinkConfirmationEmail(@RequestBody UserUnlinkRequestModel requestModel, Principal principal) {
|
||||
try {
|
||||
this.unlinkEmailConfirmationManager.sendConfirmationEmail(requestModel.getEmail(), principal, requestModel.getUserId(), requestModel.getProvider());
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
} catch (Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).message("Could not send unlink email."));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,7 +24,6 @@ import java.util.UUID;
|
|||
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api"})
|
||||
public class ExternalDatasets extends BaseController {
|
||||
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.logic.managers.MaterialManager;
|
||||
import eu.eudat.logic.managers.MetricsManager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/material/faq/"})
|
||||
public class FaqController {
|
||||
|
||||
private Environment environment;
|
||||
private MaterialManager materialManager;
|
||||
|
||||
@Autowired
|
||||
public FaqController(Environment environment, MaterialManager materialManager, MetricsManager metricsManager) {
|
||||
this.environment = environment;
|
||||
this.materialManager = materialManager;
|
||||
}
|
||||
|
||||
@RequestMapping(path = "{lang}", method = RequestMethod.GET )
|
||||
public ResponseEntity<byte[]> getFaq(@PathVariable(name = "lang") String lang) throws IOException {
|
||||
try (Stream<Path> paths = Files.walk(Paths.get(Objects.requireNonNull(this.environment.getProperty("faq.path"))))) {
|
||||
return this.materialManager.getResponseEntity(lang, paths);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.data.entities.FileUpload;
|
||||
|
@ -12,14 +12,15 @@ import eu.eudat.logic.services.operations.DatabaseRepository;
|
|||
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
|
||||
import eu.eudat.logic.utilities.json.JsonSearcher;
|
||||
import eu.eudat.models.HintedModelFactory;
|
||||
import eu.eudat.models.data.components.commons.datafield.UploadData;
|
||||
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import eu.eudat.types.Authorities;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
@ -32,25 +33,28 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import javax.transaction.Transactional;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.HashSet;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/file/"})
|
||||
public class FileController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(FileController.class);
|
||||
|
||||
private DatasetProfileManager datasetProfileManager;
|
||||
private final Environment environment;
|
||||
private DatabaseRepository databaseRepository;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
@Autowired
|
||||
public FileController(DatasetProfileManager datasetProfileManager, Environment environment, ApiContext apiContext) {
|
||||
this.datasetProfileManager = datasetProfileManager;
|
||||
this.environment = environment;
|
||||
this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository();
|
||||
this.objectMapper = apiContext.getUtilitiesService().getGenericObjectMapper();
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/upload"})
|
||||
|
@ -62,57 +66,48 @@ public class FileController {
|
|||
|
||||
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = this.datasetProfileManager.getDatasetProfile(datasetProfileId);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
String json = mapper.writeValueAsString(datasetprofile.getSections());;
|
||||
JsonNode propertiesJson = mapper.readTree(json);
|
||||
String json = objectMapper.writeValueAsString(datasetprofile.getSections());
|
||||
JsonNode propertiesJson = objectMapper.readTree(json);
|
||||
Set<JsonNode> fieldNodes = new HashSet<>();
|
||||
fieldNodes.addAll(JsonSearcher.findNodes(propertiesJson, "id", fieldId, false));
|
||||
|
||||
// AtomicReference<String> exceptionMessage = null;
|
||||
AtomicBoolean acceptedFile = new AtomicBoolean(false);
|
||||
fieldNodes.forEach(node -> {
|
||||
Boolean acceptedFile = false;
|
||||
for (JsonNode node : fieldNodes) {
|
||||
JsonNode data = node.get("data");
|
||||
if (data != null && !data.toString().equals("\"\"") && !data.toString().equals("null")) {
|
||||
String stringValue = data.toString().replaceAll("=", ":");
|
||||
JSONObject dataObj = new JSONObject(stringValue);
|
||||
Map<String, Object> dataMap = ((JSONObject) dataObj).toMap();
|
||||
if(dataMap.get("maxFileSizeInMB") != null && !dataMap.get("maxFileSizeInMB").toString().equals("\"\"") && !dataMap.get("maxFileSizeInMB").toString().equals("null")) {
|
||||
if (file.getSize() <= Integer.parseInt(dataMap.get("maxFileSizeInMB").toString())*1048576) {
|
||||
acceptedFile.set(true);
|
||||
try {
|
||||
UploadData uploadData = objectMapper.treeToValue(data, UploadData.class);
|
||||
if (uploadData != null) {
|
||||
if (uploadData.getMaxFileSizeInMB() != null) {
|
||||
if (file.getSize() <= (uploadData.getMaxFileSizeInMB() * Math.pow(1024, 2))) {
|
||||
acceptedFile = true;
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// exceptionMessage.set("The file is too large. Max file upload is " + dataMap.get("maxFileSizeInMB").toString() + " MB.");
|
||||
// }
|
||||
}
|
||||
|
||||
if(acceptedFile.get() && data.get("types") != null && !data.get("types").toString().equals("\"\"") && !data.get("types").toString().equals("null")) {
|
||||
acceptedFile.set(false);
|
||||
|
||||
JSONArray types = new JSONArray(data.get("types").toString());
|
||||
|
||||
types.iterator().forEachRemaining(element -> {
|
||||
Map<String, Object> typesMap = ((JSONObject) element).toMap();
|
||||
if(typesMap.get("value") != null && !typesMap.get("value").toString().equals("\"\"") && !typesMap.get("value").toString().equals("null")) {
|
||||
if(file.getContentType().equals(typesMap.get("value").toString())) {
|
||||
acceptedFile.set(true);
|
||||
if (acceptedFile && uploadData.getTypes() != null && !uploadData.getTypes().isEmpty()) {
|
||||
acceptedFile = false;
|
||||
for (UploadData.Option option : uploadData.getTypes()) {
|
||||
if (option.getValue() != null) {
|
||||
if (file.getContentType().equals(option.getValue())) {
|
||||
acceptedFile = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
logger.error(e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
// if(!acceptedFile.get()) {
|
||||
// exceptionMessage.set("The file type is not accepted.");
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
if(!acceptedFile.get()) {
|
||||
if (!acceptedFile) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<String>().status(ApiMessageCode.ERROR_MESSAGE).message("The uploaded file is too large or has an unaccepted type"));
|
||||
}
|
||||
|
||||
|
||||
File convFile = new File(this.environment.getProperty("temp.temp") + uuid);
|
||||
convFile.createNewFile();
|
||||
FileOutputStream fos = new FileOutputStream(convFile);
|
||||
fos.write(file.getBytes());
|
||||
fos.close();
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/funders/"})
|
||||
public class Funders extends BaseController {
|
||||
private FunderManager funderManager;
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.logic.managers.MaterialManager;
|
||||
import eu.eudat.logic.managers.MetricsManager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/material/glossary/"})
|
||||
public class GlossaryController {
|
||||
|
||||
private Environment environment;
|
||||
private MaterialManager materialManager;
|
||||
|
||||
@Autowired
|
||||
public GlossaryController(Environment environment, MaterialManager materialManager, MetricsManager metricsManager) {
|
||||
this.environment = environment;
|
||||
this.materialManager = materialManager;
|
||||
}
|
||||
|
||||
@RequestMapping(path = "{lang}", method = RequestMethod.GET )
|
||||
public ResponseEntity<byte[]> getGlossary(@PathVariable(name = "lang") String lang) throws IOException {
|
||||
try (Stream<Path> paths = Files.walk(Paths.get(Objects.requireNonNull(this.environment.getProperty("glossary.path"))))) {
|
||||
return this.materialManager.getResponseEntity(lang, paths);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -28,7 +28,6 @@ import static eu.eudat.types.Authorities.ANONYMOUS;
|
|||
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/grants/"})
|
||||
public class Grants extends BaseController {
|
||||
private GrantManager grantManager;
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.util.List;
|
|||
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/external/journals"})
|
||||
public class JournalsController extends BaseController {
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.io.*;
|
|||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/language/"})
|
||||
public class LanguageController {
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.List;
|
|||
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/external/licenses"})
|
||||
public class Licenses extends BaseController {
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/lock/"})
|
||||
public class LockController {
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ import java.security.GeneralSecurityException;
|
|||
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "api/auth")
|
||||
public class Login {
|
||||
private static final Logger logger = LoggerFactory.getLogger(Login.class);
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.exceptions.datasetprofile.DatasetProfileNewVersionException;
|
||||
import eu.eudat.logic.managers.DatasetProfileManager;
|
||||
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.admin.composite.DatasetProfile;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import static eu.eudat.types.Authorities.ADMIN;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/management/"})
|
||||
public class ManagementController extends BaseController {
|
||||
|
||||
private DatasetProfileManager datasetProfileManager;
|
||||
|
||||
@Autowired
|
||||
public ManagementController(ApiContext apiContext, DatasetProfileManager datasetProfileManager){
|
||||
super(apiContext);
|
||||
this.datasetProfileManager = datasetProfileManager;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/addSemantics"})
|
||||
public ResponseEntity addSemanticsInDatasetProfiles(@ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
|
||||
try {
|
||||
this.datasetProfileManager.addSemanticsInDatasetProfiles();
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Void>().status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
} catch (Exception exception) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Void>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/addRdaInSemantics"})
|
||||
public ResponseEntity addRdaInSemanticsInDatasetProfiles(@ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
|
||||
try {
|
||||
this.datasetProfileManager.addRdaInSemanticsInDatasetProfiles();
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Void>().status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
} catch (Exception exception) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Void>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,6 @@ import java.util.List;
|
|||
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api"})
|
||||
public class Organisations extends BaseController {
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue