Commit e0c302e6 authored by Ioannis Kalyvas's avatar Ioannis Kalyvas

no message

parent f2bfd402
Pipeline #2 failed with stages
......@@ -33,3 +33,4 @@ final/
temp/
*.jar
*.lst
dmp-frontend/.vscode/
package eu.eudat.data.converters;
import org.springframework.format.datetime.DateFormatter;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
/**
* Created by ikalyvas on 9/25/2018.
*/
@Converter
public class DateToUTCConverter implements AttributeConverter<Date, Date> {
@Override
public Date convertToDatabaseColumn(Date attribute) {
if(attribute == null) return null;
DateFormat formatterIST = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
formatterIST.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
String date = formatterIST.format(attribute);
return formatterIST.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
@Override
public Date convertToEntityAttribute(Date dbData) {
if(dbData == null) return null;
DateFormat formatterIST = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
formatterIST.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
String date = formatterIST.format(dbData);
return formatterIST.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
}
package eu.eudat.data.dao.criteria;
import eu.eudat.data.entities.Dataset;
import eu.eudat.types.project.ProjectStateType;
import java.util.List;
import java.util.UUID;
/**
* Created by ikalyvas on 10/2/2018.
*/
public class DatasetPublicCriteria extends Criteria<Dataset>{
public ProjectStateType projectStatus;
public List<UUID> projects;
public List<UUID> datasetProfile;
public List<String> dmpOrganisations;
public ProjectStateType getProjectStatus() {
return projectStatus;
}
public void setProjectStatus(ProjectStateType projectStatus) {
this.projectStatus = projectStatus;
}
public List<UUID> getProjects() {
return projects;
}
public void setProjects(List<UUID> projects) {
this.projects = projects;
}
public List<UUID> getDatasetProfile() {
return datasetProfile;
}
public void setDatasetProfile(List<UUID> datasetProfile) {
this.datasetProfile = datasetProfile;
}
public List<String> getDmpOrganisations() {
return dmpOrganisations;
}
public void setDmpOrganisations(List<String> dmpOrganisations) {
this.dmpOrganisations = dmpOrganisations;
}
}
......@@ -4,6 +4,7 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.jpa.hibernatequeryablelist.QueryableHibernateList;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
......
......@@ -5,6 +5,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Content;
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;
......@@ -27,6 +28,7 @@ public class ContentDaoImpl extends DatabaseAccess<Content> implements ContentDa
}
@Override
@Async
public CompletableFuture<Content> createOrUpdateAsync(Content item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
......
......@@ -10,6 +10,7 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.Arrays;
......@@ -78,6 +79,7 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
return this.getDatabaseService().getQueryable(DMP.class);
}
@Async
@Override
public CompletableFuture<DMP> createOrUpdateAsync(DMP item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.DMPProfile;
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;
......@@ -22,6 +23,7 @@ public class DMPProfileDaoImpl extends DatabaseAccess<DMPProfile> implements DMP
super(databaseService);
}
@Async
@Override
public CompletableFuture<DMPProfile> createOrUpdateAsync(DMPProfile item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.DataRepository;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
......@@ -38,6 +39,7 @@ public class DataRepositoryDaoImpl extends DatabaseAccess<DataRepository> implem
}
@Override
@Async
public CompletableFuture<DataRepository> createOrUpdateAsync(DataRepository item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
......
......@@ -9,6 +9,7 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.Arrays;
......@@ -76,6 +77,7 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
return this.getDatabaseService().getQueryable(Dataset.class);
}
@Async
public CompletableFuture<Dataset> createOrUpdateAsync(Dataset item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
......
......@@ -6,6 +6,7 @@ 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;
import org.springframework.stereotype.Component;
import java.util.UUID;
......@@ -33,6 +34,7 @@ public class DatasetExternalDatasetDaoImpl extends DatabaseAccess<DatasetExterna
}
@Override
@Async
public DatasetExternalDataset find(UUID id) {
return getDatabaseService().getQueryable(DatasetExternalDataset.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
......
......@@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
......@@ -52,6 +53,7 @@ public class DatasetProfileDaoImpl extends DatabaseAccess<DatasetProfile> implem
return this.getDatabaseService().getQueryable(DatasetProfile.class);
}
@Async
@Override
public CompletableFuture<DatasetProfile> createOrUpdateAsync(DatasetProfile item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -7,6 +7,7 @@ import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.data.entities.DatasetService;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
......@@ -28,6 +29,7 @@ public class DatasetServiceDaoImpl extends DatabaseAccess<DatasetService> implem
return this.getDatabaseService().createOrUpdate(item, DatasetService.class);
}
@Async
@Override
public CompletableFuture<DatasetService> createOrUpdateAsync(DatasetService item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.ExternalDataset;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
......@@ -48,6 +49,7 @@ public class ExternalDatasetDaoImpl extends DatabaseAccess<ExternalDataset> impl
return this.getDatabaseService().getQueryable(ExternalDataset.class);
}
@Async
@Override
public CompletableFuture<ExternalDataset> createOrUpdateAsync(ExternalDataset item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Invitation;
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;
......@@ -45,6 +46,7 @@ public class InvitationDaoImpl extends DatabaseAccess<Invitation> implements Inv
return this.getDatabaseService().getQueryable(Invitation.class);
}
@Async
@Override
public CompletableFuture<Invitation> createOrUpdateAsync(Invitation item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Organisation;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
......@@ -47,6 +48,7 @@ public class OrganisationDaoImpl extends DatabaseAccess<Organisation> implements
return this.getDatabaseService().getQueryable(Organisation.class);
}
@Async
@Override
public CompletableFuture<Organisation> createOrUpdateAsync(Organisation item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -8,6 +8,7 @@ import eu.eudat.data.entities.UserInfo;
import eu.eudat.queryable.QueryableList;
import eu.eudat.types.project.ProjectStateType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.persistence.criteria.JoinType;
......@@ -71,6 +72,7 @@ public class ProjectDaoImpl extends DatabaseAccess<Project> implements ProjectDa
return query;
}
@Async
@Override
public CompletableFuture<Project> createOrUpdateAsync(Project item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Registry;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
......@@ -47,6 +48,7 @@ public class RegistryDaoImpl extends DatabaseAccess<Registry> implements Registr
return this.getDatabaseService().getQueryable(Registry.class);
}
@Async
@Override
public CompletableFuture<Registry> createOrUpdateAsync(Registry item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Researcher;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
......@@ -49,6 +50,7 @@ public class ResearcherDaoImpl extends DatabaseAccess<Researcher> implements Res
return this.getDatabaseService().getQueryable(Researcher.class);
}
@Async
@Override
public CompletableFuture<Researcher> createOrUpdateAsync(Researcher item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Service;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
......@@ -47,6 +48,7 @@ public class ServiceDaoImpl extends DatabaseAccess<Service> implements ServiceDa
return this.getDatabaseService().getQueryable(Service.class);
}
@Async
@Override
public CompletableFuture<Service> createOrUpdateAsync(Service item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -5,6 +5,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.UserDMP;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
......@@ -41,6 +42,7 @@ public class UserDmpDaoImpl extends DatabaseAccess<UserDMP> implements UserDmpDa
return this.getDatabaseService().getQueryable(UserDMP.class);
}
@Async
@Override
public CompletableFuture<UserDMP> createOrUpdateAsync(UserDMP item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.UserInfo;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
......@@ -51,6 +52,7 @@ public class UserInfoDaoImpl extends DatabaseAccess<UserInfo> implements UserInf
return this.getDatabaseService().getQueryable(UserInfo.class);
}
@Async
@Override
public CompletableFuture<UserInfo> createOrUpdateAsync(UserInfo item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -7,6 +7,7 @@ import eu.eudat.data.entities.UserInfo;
import eu.eudat.data.entities.UserRole;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.List;
......@@ -57,6 +58,7 @@ public class UserRoleDaoImpl extends DatabaseAccess<UserRole> implements UserRol
return this.getDatabaseService().getQueryable(UserRole.class);
}
@Async
@Override
public CompletableFuture<UserRole> createOrUpdateAsync(UserRole item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
......
......@@ -4,6 +4,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.List;
import java.util.UUID;
/**
......@@ -143,4 +144,10 @@ public class Content implements DataEntity<Content, UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public Content buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
......@@ -33,9 +35,13 @@ public class Credential implements DataEntity<Credential,UUID> {
private String publicValue;
@Column(name = "\"Secret\"", nullable = false)
private String secret;
@Column(name = "\"CreationTime\"", nullable = false)
@Convert(converter = DateToUTCConverter.class)
private Date creationTime;
@Column(name = "\"LastUpdateTime\"", nullable = false)
@Convert(converter = DateToUTCConverter.class)
private Date lastUpdateTime;
@Column(name = "\"ExternalId\"", nullable = false)
......@@ -140,4 +146,10 @@ public class Credential implements DataEntity<Credential,UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public Credential buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.*;
import java.util.stream.Collectors;
@Entity
......@@ -15,7 +17,7 @@ import java.util.*;
@NamedEntityGraph(
name = "dataManagementPlanListingModel",
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"),
@NamedAttributeNode("project"),@NamedAttributeNode("users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode("dataset")}
@NamedAttributeNode("project"), @NamedAttributeNode("users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode("dataset")}
),
@NamedEntityGraph(
name = "fullyDetailed",
......@@ -132,9 +134,11 @@ public class DMP implements DataEntity<DMP, UUID> {
private String dmpProperties;
@Column(name = "\"Created\"")
@Convert(converter = DateToUTCConverter.class)
private Date created = null;
@Column(name = "\"Modified\"")
@Convert(converter = DateToUTCConverter.class)
private Date modified = new Date();
......@@ -319,4 +323,11 @@ public class DMP implements DataEntity<DMP, UUID> {
return this.id;
}
@Override
public DMP buildFromTuple(List<Tuple> tuple, String base) {
this.id = tuple.get(0).get(base.isEmpty() ? "id" : base + "." + "id", UUID.class);
this.dataset = tuple.stream().map(x -> new Dataset().buildFromTuple(tuple, base.isEmpty() ? "dataset" : base + "." + "dataset")).collect(Collectors.toSet());
this.creator = tuple.stream().map(x -> new UserInfo().buildFromTuple(tuple, base.isEmpty() ? "creator" : base + "." + "creator")).collect(Collectors.toList()).get(0);
return this;
}
}
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
......@@ -39,9 +41,11 @@ public class DMPProfile implements DataEntity<DMPProfile, UUID> {
@Column(name = "\"Created\"")
@Convert(converter = DateToUTCConverter.class)
private Date created = null;
@Column(name = "\"Modified\"")
@Convert(converter = DateToUTCConverter.class)
private Date modified = new Date();
public int getStatus() {
......@@ -111,4 +115,10 @@ public class DMPProfile implements DataEntity<DMPProfile, UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public DMPProfile buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}
......@@ -8,6 +8,7 @@ import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
......@@ -145,4 +146,10 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,U
public UUID getKeys() {
return this.id;
}
@Override
public DataRepository buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
......@@ -17,7 +18,7 @@ import java.util.stream.Collectors;
attributeNodes = {@NamedAttributeNode("services"), @NamedAttributeNode(value = "datasetDataRepositories", subgraph = "datasetDataRepositories"), @NamedAttributeNode("datasetExternalDatasets"), @NamedAttributeNode("registries"),
@NamedAttributeNode(value = "dmp", subgraph = "dmp"), @NamedAttributeNode("profile"), @NamedAttributeNode("creator")},
subgraphs = {
@NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users")}),
@NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users"), @NamedAttributeNode("project"),@NamedAttributeNode("organisations")}),
@NamedSubgraph(name = "datasetDataRepositories", attributeNodes = {@NamedAttributeNode("dataRepository")})
}),
......@@ -126,9 +127,11 @@ public class Dataset implements DataEntity<Dataset, UUID> {
private boolean isPublic;
@Column(name = "\"Created\"")
@Convert(converter = DateToUTCConverter.class)
private Date created = null;
@Column(name = "\"Modified\"")
@Convert(converter = DateToUTCConverter.class)
private Date modified = new Date();
@ManyToOne(fetch = FetchType.LAZY)
......@@ -328,4 +331,10 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public Dataset buildFromTuple(List<Tuple> tuple, String base) {
this.id = (UUID) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id");
return this;
}
}
......@@ -5,6 +5,7 @@ import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.List;
import java.util.UUID;
/**
......@@ -32,7 +33,6 @@ public class DatasetDataRepository implements DataEntity<DatasetDataRepository,U
@Column(name = "\"Role\"")
private Integer role;
@Column(name = "\"Data\"")
private String data;
......@@ -87,4 +87,10 @@ public class DatasetDataRepository implements DataEntity<DatasetDataRepository,U
public UUID getKeys() {