Removing 'old' migration tool folder

This commit is contained in:
Thomas Georgios Giannos 2023-11-16 17:26:41 +02:00
parent 6e65d22fce
commit 765eff356d
998 changed files with 0 additions and 105296 deletions

View File

@ -1 +0,0 @@
web/target

View File

@ -1 +0,0 @@
PROFILE=docker

View File

@ -1,23 +0,0 @@
FROM maven:3-jdk-11 AS MAVEN_BUILD
COPY pom.xml /build/
COPY data /build/data/
COPY elastic /build/elastic/
#COPY logging /build/logging/
COPY queryable /build/queryable/
COPY web /build/web/
WORKDIR /build/
RUN mvn package -q
FROM amazoncorretto:11
WORKDIR /app
COPY --from=MAVEN_BUILD /build/web/target/web-1.0-SNAPSHOT.jar /app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom" ,"-Dspring.profiles.active=${PROFILE}","-jar","/app.jar"]

View File

@ -1,15 +0,0 @@
FROM maven:3-openjdk-11 AS MAVEN_BUILD
COPY pom.xml /build/
COPY data /build/data/
COPY elastic /build/elastic/
COPY queryable /build/queryable/
COPY web /build/web/
WORKDIR /build/
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"]

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>data</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>eu.eudat</groupId>
<artifactId>dmp-backend</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>dmp-backend</groupId>
<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>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.20</version>
</dependency>
</dependencies>
</project>

View File

@ -1,48 +0,0 @@
package eu.eudat.old.data.converters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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> {
private static final Logger logger = LoggerFactory.getLogger(DateToUTCConverter.class);
@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) {
logger.error(e.getMessage(), e);
}
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) {
logger.error(e.getMessage(), e);
}
return null;
}
}

View File

@ -1,22 +0,0 @@
package eu.eudat.old.data.dao;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.queryable.queryableentity.DataEntity;
public class DatabaseAccess<T extends DataEntity> {
public DatabaseAccess(DatabaseService<T> databaseService) {
this.databaseService = databaseService;
}
private DatabaseService<T> databaseService;
public DatabaseService<T> getDatabaseService() {
return databaseService;
}
public void setDatabaseService(DatabaseService<T> databaseService) {
this.databaseService = databaseService;
}
}

View File

@ -1,21 +0,0 @@
package eu.eudat.old.data.dao;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.queryable.queryableentity.DataEntity;
import java.util.concurrent.CompletableFuture;
public interface DatabaseAccessLayer<T extends DataEntity, I> {
T createOrUpdate(T item);
CompletableFuture<T> createOrUpdateAsync(T item);
T find(I id);
T find(I id, String hint);
void delete(T item);
QueryableList<T> asQueryable();
}

View File

@ -1,18 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import io.swagger.annotations.ApiModelProperty;
public abstract class Criteria<T> {
@ApiModelProperty(value = "like", name = "like", dataType = "String", allowEmptyValue = true, example = "\"\"")
private String like;
public String getLike() {
return like;
}
public void setLike(String like) {
this.like = like;
}
}

View File

@ -1,16 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.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;
}
}

View File

@ -1,135 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.DMP;
import eu.eudat.old.data.entities.DMPProfile;
import eu.eudat.old.data.entities.Grant;
import java.util.Date;
import java.util.List;
import java.util.UUID;
public class DataManagementPlanCriteria extends Criteria<DMP> {
private Date periodStart;
private Date periodEnd;
private DMPProfile profile;
private List<Grant> grants;
private boolean allVersions;
private List<UUID> groupIds;
private Integer status;
private List<String> organisations;
private Integer role;
private List<UUID> collaborators;
private List<UUID> datasetTemplates;
private boolean isPublic;
private boolean onlyPublic;
private Short grantStatus;
private boolean hasDoi;
public Date getPeriodStart() {
return periodStart;
}
public void setPeriodStart(Date periodStart) {
this.periodStart = periodStart;
}
public Date getPeriodEnd() {
return periodEnd;
}
public void setPeriodEnd(Date periodEnd) {
this.periodEnd = periodEnd;
}
public DMPProfile getProfile() {
return profile;
}
public void setProfile(DMPProfile profile) {
this.profile = profile;
}
public List<Grant> getGrants() {
return grants;
}
public void setGrants(List<Grant> grants) {
this.grants = grants;
}
public boolean getAllVersions() {
return allVersions;
}
public void setAllVersions(boolean allVersions) {
this.allVersions = allVersions;
}
public List<UUID> getGroupIds() {
return groupIds;
}
public void setGroupIds(List<UUID> groupIds) {
this.groupIds = groupIds;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public List<String> getOrganisations() {
return organisations;
}
public void setOrganisations(List<String> organisations) {
this.organisations = organisations;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public List<UUID> getCollaborators() {
return collaborators;
}
public void setCollaborators(List<UUID> collaborators) {
this.collaborators = collaborators;
}
public List<UUID> getDatasetTemplates() {
return datasetTemplates;
}
public void setDatasetTemplates(List<UUID> datasetTemplates) {
this.datasetTemplates = datasetTemplates;
}
public boolean getIsPublic() {
return isPublic;
}
public void setIsPublic(boolean isPublic) {
this.isPublic = isPublic;
}
public boolean isOnlyPublic() {
return onlyPublic;
}
public void setOnlyPublic(boolean onlyPublic) {
this.onlyPublic = onlyPublic;
}
public Short getGrantStatus() {
return grantStatus;
}
public void setGrantStatus(Short grantStatus) {
this.grantStatus = grantStatus;
}
public boolean hasDoi() {
return hasDoi;
}
public void setHasDoi(boolean hasDoi) {
this.hasDoi = hasDoi;
}
}

View File

@ -1,9 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.DMPProfile;
/**
* Created by ikalyvas on 3/21/2018.
*/
public class DataManagementPlanProfileCriteria extends Criteria<DMPProfile> {
}

View File

@ -1,66 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.DMP;
import eu.eudat.old.types.grant.GrantStateType;
import java.util.List;
import java.util.UUID;
public class DataManagementPlanPublicCriteria extends Criteria<DMP> {
private GrantStateType grantStatus;
private List<UUID> grants;
public List<UUID> datasetProfile;
private List<String> dmpOrganisations;
private Integer role;
private boolean allVersions;
private List<UUID> groupIds;
public GrantStateType getGrantStatus() {
return grantStatus;
}
public void setGrantStatus(GrantStateType grantStatus) {
this.grantStatus = grantStatus;
}
public List<UUID> getGrants() {
return grants;
}
public void setGrants(List<UUID> grants) {
this.grants = grants;
}
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;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public boolean getAllVersions() {
return allVersions;
}
public void setAllVersions(boolean allVersions) {
this.allVersions = allVersions;
}
public List<UUID> getGroupIds() {
return groupIds;
}
public void setGroupIds(List<UUID> groupIds) {
this.groupIds = groupIds;
}
}

View File

@ -1,17 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.DataRepository;
import java.util.UUID;
public class DataRepositoryCriteria extends Criteria<DataRepository> {
private UUID creationUserId;
public UUID getCreationUserId() {
return creationUserId;
}
public void setCreationUserId(UUID creationUserId) {
this.creationUserId = creationUserId;
}
}

View File

@ -1,143 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.Dataset;
import eu.eudat.old.elastic.entities.Tag;
import java.util.Date;
import java.util.List;
import java.util.UUID;
public class DatasetCriteria extends Criteria<Dataset> {
private Integer status;
private Date periodStart;
private Date periodEnd;
private List<UUID> dmpIds;
private List<Tag> tags;
private boolean allVersions;
private UUID profileDatasetId;
private List<String> organisations;
private Integer role;
private List<UUID> grants;
private List<UUID> collaborators;
private List<UUID> datasetTemplates;
private List<UUID> groupIds;
private Boolean isPublic;
private Short grantStatus;
private boolean hasDoi;
public boolean getAllVersions() {
return allVersions;
}
public void setAllVersions(boolean allVersions) {
this.allVersions = allVersions;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getPeriodStart() {
return periodStart;
}
public void setPeriodStart(Date periodStart) {
this.periodStart = periodStart;
}
public Date getPeriodEnd() {
return periodEnd;
}
public void setPeriodEnd(Date periodEnd) {
this.periodEnd = periodEnd;
}
public List<UUID> getDmpIds() {
return dmpIds;
}
public void setDmpIds(List<UUID> dmpIds) {
this.dmpIds = dmpIds;
}
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
public UUID getProfileDatasetId() {
return profileDatasetId;
}
public void setProfileDatasetId(UUID profileDatasetId) {
this.profileDatasetId = profileDatasetId;
}
public List<String> getOrganisations() {
return organisations;
}
public void setOrganisations(List<String> organisations) {
this.organisations = organisations;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public List<UUID> getGrants() {
return grants;
}
public void setGrants(List<UUID> grants) {
this.grants = grants;
}
public List<UUID> getCollaborators() {
return collaborators;
}
public void setCollaborators(List<UUID> collaborators) {
this.collaborators = collaborators;
}
public List<UUID> getDatasetTemplates() {
return datasetTemplates;
}
public void setDatasetTemplates(List<UUID> datasetTemplates) {
this.datasetTemplates = datasetTemplates;
}
public List<UUID> getGroupIds() {
return groupIds;
}
public void setGroupIds(List<UUID> groupIds) {
this.groupIds = groupIds;
}
public Boolean getIsPublic() {
return isPublic;
}
public void setIsPublic(Boolean isPublic) {
this.isPublic = isPublic;
}
public Short getGrantStatus() {
return grantStatus;
}
public void setGrantStatus(Short grantStatus) {
this.grantStatus = grantStatus;
}
public boolean hasDoi() {
return hasDoi;
}
public void setHasDoi(boolean hasDoi) {
this.hasDoi = hasDoi;
}
}

View File

@ -1,101 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.DescriptionTemplate;
import java.util.Date;
import java.util.List;
import java.util.UUID;
public class DatasetProfileCriteria extends Criteria<DescriptionTemplate> {
public enum DatasetProfileFilter {
DMPs((short) 0), Datasets((short) 1);
private short value;
private DatasetProfileFilter(short value) {
this.value = value;
}
public short getValue() { return value; }
public static DatasetProfileFilter fromInteger(short value) {
switch (value) {
case 0:
return DMPs;
case 1:
return Datasets;
default:
throw new RuntimeException("Unsupported DescriptionTemplate filter");
}
}
}
private boolean allVersions;
private List<UUID> groupIds;
private Short filter;
private UUID userId;
private boolean finalized;
private Integer status;
private Integer role;
private List<UUID> ids;
private Date periodStart;
public boolean getAllVersions() { return allVersions; }
public void setAllVersions(boolean allVersions) { this.allVersions = allVersions; }
public List<UUID> getGroupIds() { return groupIds; }
public void setGroupIds(List<UUID> groupIds) { this.groupIds = groupIds; }
public Short getFilter() {
return filter;
}
public void setFilter(Short filter) {
this.filter = filter;
}
public UUID getUserId() {
return userId;
}
public void setUserId(UUID userId) {
this.userId = userId;
}
public boolean getFinalized() {
return finalized;
}
public void setFinalized(boolean finalized) {
this.finalized = finalized;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public List<UUID> getIds() {
return ids;
}
public void setIds(List<UUID> ids) {
this.ids = ids;
}
public Date getPeriodStart() {
return periodStart;
}
public void setPeriodStart(Date periodStart) {
this.periodStart = periodStart;
}
}

View File

@ -1,18 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.DescriptionTemplate;
import java.util.UUID;
public class DatasetProfileWizardCriteria extends Criteria<DescriptionTemplate> {
private UUID id;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
}

View File

@ -1,70 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.Dataset;
import eu.eudat.old.elastic.entities.Tag;
import eu.eudat.old.types.grant.GrantStateType;
import java.util.List;
import java.util.UUID;
/**
* Created by ikalyvas on 10/2/2018.
*/
public class DatasetPublicCriteria extends Criteria<Dataset>{
private GrantStateType grantStatus;
private List<UUID> grants;
private List<UUID> datasetProfile;
private List<String> dmpOrganisations;
private List<Tag> tags;
private List<UUID> dmpIds;
private Integer role;
public GrantStateType getGrantStatus() {
return grantStatus;
}
public void setGrantStatus(GrantStateType grantStatus) {
this.grantStatus = grantStatus;
}
public List<UUID> getGrants() {
return grants;
}
public void setGrants(List<UUID> grants) {
this.grants = grants;
}
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;
}
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
public List<UUID> getDmpIds() {
return dmpIds;
}
public void setDmpIds(List<UUID> dmpIds) {
this.dmpIds = dmpIds;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
}

View File

@ -1,17 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.DMP;
import eu.eudat.old.data.entities.UserInfo;
public class DatasetWizardUserDmpCriteria extends Criteria<DMP> {
private UserInfo userInfo;
public UserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(UserInfo userInfo) {
this.userInfo = userInfo;
}
}

View File

@ -1,51 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import java.util.List;
/**
* Created by ikalyvas on 3/26/2018.
*/
public class DynamicFieldsCriteria extends Criteria {
public static class DynamicFieldDependencyCriteria {
private String property;
private String value;
public DynamicFieldDependencyCriteria() {
}
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
private String id;
private List<DynamicFieldDependencyCriteria> dynamicFields;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List<DynamicFieldDependencyCriteria> getDynamicFields() {
return dynamicFields;
}
public void setDynamicFields(List<DynamicFieldDependencyCriteria> dynamicFields) {
this.dynamicFields = dynamicFields;
}
}

View File

@ -1,6 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.EmailConfirmation;
public class EmailConfirmationCriteria extends Criteria<EmailConfirmation>{
}

View File

@ -1,15 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.ExternalDataset;
import java.util.UUID;
public class ExternalDatasetCriteria extends Criteria<ExternalDataset> {
private UUID creationUserId;
public UUID getCreationUserId() {
return creationUserId;
}
public void setCreationUserId(UUID creationUserId) {
this.creationUserId = creationUserId;
}
}

View File

@ -1,34 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.Funder;
import java.util.Date;
public class FunderCriteria extends Criteria<Funder> {
private String reference;
private String exactReference;
private Date periodStart;
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getExactReference() {
return exactReference;
}
public void setExactReference(String exactReference) {
this.exactReference = exactReference;
}
public Date getPeriodStart() {
return periodStart;
}
public void setPeriodStart(Date periodStart) {
this.periodStart = periodStart;
}
}

View File

@ -1,82 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.Grant;
import java.util.Date;
public class GrantCriteria extends Criteria<Grant> {
private Date periodStart;
private Date periodEnd;
private String reference;
private Integer grantStateType;
private boolean isPublic;
private String funderId;
private String funderReference;
private String exactReference;
private boolean isActive;
public Date getPeriodStart() {
return periodStart;
}
public void setPeriodStart(Date periodStart) {
this.periodStart = periodStart;
}
public Date getPeriodEnd() {
return periodEnd;
}
public void setPeriodEnd(Date periodEnd) {
this.periodEnd = periodEnd;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public Integer getGrantStateType() {
return grantStateType;
}
public void setGrantStateType(Integer grantStateType) {
this.grantStateType = grantStateType;
}
public boolean isPublic() {
return isPublic;
}
public void setPublic(boolean aPublic) {
isPublic = aPublic;
}
public String getFunderId() {
return funderId;
}
public void setFunderId(String funderId) {
this.funderId = funderId;
}
public String getFunderReference() {
return funderReference;
}
public void setFunderReference(String funderReference) {
this.funderReference = funderReference;
}
public String getExactReference() {
return exactReference;
}
public void setExactReference(String exactReference) {
this.exactReference = exactReference;
}
public boolean isActive() {
return isActive;
}
public void setActive(boolean active) {
isActive = active;
}
}

View File

@ -1,6 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.Invitation;
public class InvitationCriteria extends Criteria<Invitation> {
}

View File

@ -1,38 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.Lock;
import eu.eudat.old.data.entities.UserInfo;
import java.util.Date;
import java.util.UUID;
public class LockCriteria extends Criteria<Lock> {
private UUID target;
private UserInfo lockedBy;
private Date touchedAt;
public UUID getTarget() {
return target;
}
public void setTarget(UUID target) {
this.target = target;
}
public UserInfo getLockedBy() {
return lockedBy;
}
public void setLockedBy(UserInfo lockedBy) {
this.lockedBy = lockedBy;
}
public Date getTouchedAt() {
return touchedAt;
}
public void setTouchedAt(Date touchedAt) {
this.touchedAt = touchedAt;
}
}

View File

@ -1,26 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.enumeration.notification.NotifyState;
import eu.eudat.old.data.enumeration.notification.ActiveStatus;
public class NotificationCriteria {
private ActiveStatus isActive;
private NotifyState notifyState;
public ActiveStatus getIsActive() {
return isActive;
}
public void setIsActive(ActiveStatus isActive) {
this.isActive = isActive;
}
public NotifyState getNotifyState() {
return notifyState;
}
public void setNotifyState(NotifyState notifyState) {
this.notifyState = notifyState;
}
}

View File

@ -1,31 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.Organisation;
public class OrganisationCriteria extends Criteria<Organisation> {
private String labelLike;
private Boolean isPublic;
private boolean isActive;
public String getLabelLike() {
return labelLike;
}
public void setLabelLike(String labelLike) {
this.labelLike = labelLike;
}
public Boolean getPublic() {
return isPublic;
}
public void setPublic(Boolean aPublic) {
isPublic = aPublic;
}
public boolean isActive() {
return isActive;
}
public void setActive(boolean active) {
isActive = active;
}
}

View File

@ -1,34 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.Project;
import java.util.Date;
public class ProjectCriteria extends Criteria<Project> {
private String reference;
private String exactReference;
private Date periodStart;
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getExactReference() {
return exactReference;
}
public void setExactReference(String exactReference) {
this.exactReference = exactReference;
}
public Date getPeriodStart() {
return periodStart;
}
public void setPeriodStart(Date periodStart) {
this.periodStart = periodStart;
}
}

View File

@ -1,17 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.Registry;
import java.util.UUID;
public class RegistryCriteria extends Criteria<Registry> {
private UUID creationUserId;
public UUID getCreationUserId() {
return creationUserId;
}
public void setCreationUserId(UUID creationUserId) {
this.creationUserId = creationUserId;
}
}

View File

@ -1,16 +0,0 @@
package eu.eudat.old.data.dao.criteria;
/**
* Created by ikalyvas on 3/26/2018.
*/
public class RequestItem<T> {
T criteria;
public T getCriteria() {
return criteria;
}
public void setCriteria(T criteria) {
this.criteria = criteria;
}
}

View File

@ -1,35 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.Researcher;
import java.util.Date;
public class ResearcherCriteria extends Criteria<Researcher> {
private String name;
private String reference;
private Date periodStart;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public Date getPeriodStart() {
return periodStart;
}
public void setPeriodStart(Date periodStart) {
this.periodStart = periodStart;
}
}

View File

@ -1,17 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.Service;
import java.util.UUID;
public class ServiceCriteria extends Criteria<Service> {
private UUID creationUserId;
public UUID getCreationUserId() {
return creationUserId;
}
public void setCreationUserId(UUID creationUserId) {
this.creationUserId = creationUserId;
}
}

View File

@ -1,33 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.UserInfo;
import java.util.List;
public class UserInfoCriteria extends Criteria<UserInfo> {
private String email;
private List<Integer> appRoles;
private String collaboratorLike;
public List<Integer> getAppRoles() {
return appRoles;
}
public void setAppRoles(List<Integer> appRoles) {
this.appRoles = appRoles;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getCollaboratorLike() {
return collaboratorLike;
}
public void setCollaboratorLike(String collaboratorLike) {
this.collaboratorLike = collaboratorLike;
}
}

View File

@ -1,20 +0,0 @@
package eu.eudat.old.data.dao.criteria;
import eu.eudat.old.data.entities.UserRole;
import java.util.List;
/**
* Created by ikalyvas on 2/1/2018.
*/
public class UserRoleCriteria extends Criteria<UserRole> {
private List<Integer> appRoles;
public List<Integer> getAppRoles() {
return appRoles;
}
public void setAppRoles(List<Integer> appRoles) {
this.appRoles = appRoles;
}
}

View File

@ -1,49 +0,0 @@
package eu.eudat.old.data.dao.databaselayer.context;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.queryable.jpa.hibernatequeryablelist.QueryableHibernateList;
import eu.eudat.old.queryable.queryableentity.DataEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceContext;
@Repository("databaseCtx")
public class DatabaseContext<T extends DataEntity> {
@PersistenceContext
private EntityManager entityManager;
@Autowired
public DatabaseContext(EntityManagerFactory entityManagerFactory) {
this.entityManager = entityManagerFactory.createEntityManager();
}
public QueryableList<T> getQueryable(Class<T> type) {
return new QueryableHibernateList<>(this.entityManager, type).setEntity(type);
}
@Transactional
public T createOrUpdate(T item, Class<T> type) {
EntityManager entityManager = this.entityManager;
if (item.getKeys() != null) {
T oldItem = entityManager.find(type, item.getKeys());
if (oldItem != null) {
oldItem.update(item);
entityManager.merge(oldItem);
return oldItem;
} else {
entityManager.persist(item);
}
} else entityManager.persist(item);
return item;
}
public void delete(T item) {
this.entityManager.remove(item);
}
}

View File

@ -1,41 +0,0 @@
package eu.eudat.old.data.dao.databaselayer.service;
import eu.eudat.old.data.dao.databaselayer.context.DatabaseContext;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.queryable.queryableentity.DataEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.Set;
@Service("databaseService")
public class DatabaseService<T extends DataEntity> {
private DatabaseContext<T> databaseCtx;
@Autowired
public DatabaseService(DatabaseContext<T> databaseCtx) {
this.databaseCtx = databaseCtx;
}
public QueryableList<T> getQueryable(Class<T> tClass) {
return this.databaseCtx.getQueryable(tClass);
}
public QueryableList<T> getQueryable(Set<String> hints, Class<T> tClass) {
return this.databaseCtx.getQueryable(tClass);
}
@Transactional
public T createOrUpdate(T item, Class<T> tClass) {
return this.databaseCtx.createOrUpdate(item, tClass);
}
public void delete(T item) {
this.databaseCtx.delete(item);
}
}

View File

@ -1,12 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.Content;
import java.util.UUID;
/**
* Created by ikalyvas on 3/16/2018.
*/
public interface ContentDao extends DatabaseAccessLayer<Content, UUID> {
}

View File

@ -1,55 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.Content;
import eu.eudat.old.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;
/**
* Created by ikalyvas on 3/16/2018.
*/
@Service("contentDao")
public class ContentDaoImpl extends DatabaseAccess<Content> implements ContentDao {
@Autowired
public ContentDaoImpl(DatabaseService<Content> databaseService) {
super(databaseService);
}
@Override
public Content createOrUpdate(Content item) {
return this.getDatabaseService().createOrUpdate(item, Content.class);
}
@Override
@Async
public CompletableFuture<Content> createOrUpdateAsync(Content item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public Content find(UUID id) {
return this.getDatabaseService().getQueryable(Content.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public Content find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public void delete(Content item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Content> asQueryable() {
return this.getDatabaseService().getQueryable(Content.class);
}
}

View File

@ -1,21 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.DMP;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.dao.criteria.DataManagementPlanCriteria;
import eu.eudat.old.data.dao.criteria.DatasetWizardUserDmpCriteria;
import java.util.List;
import java.util.UUID;
public interface DMPDao extends DatabaseAccessLayer<DMP, UUID> {
QueryableList<DMP> getWithCriteria(DataManagementPlanCriteria criteria);
QueryableList<DMP> getUserDmps(DatasetWizardUserDmpCriteria datasetWizardAutocompleteRequest, UserInfo userInfo);
QueryableList<DMP> getAuthenticated(QueryableList<DMP> query, UUID principalId, List<Integer> roles);
}

View File

@ -1,151 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.queryable.types.FieldSelectionType;
import eu.eudat.old.queryable.types.SelectionField;
import eu.eudat.old.data.dao.criteria.DataManagementPlanCriteria;
import eu.eudat.old.data.dao.criteria.DatasetWizardUserDmpCriteria;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.DMP;
import eu.eudat.old.types.grant.GrantStateType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.persistence.criteria.Join;
import javax.persistence.criteria.JoinType;
import javax.transaction.Transactional;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("dMPDao")
public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
@Autowired
public DMPDaoImpl(DatabaseService<DMP> databaseService) {
super(databaseService);
}
@Override
public QueryableList<DMP> getWithCriteria(DataManagementPlanCriteria criteria) {
QueryableList<DMP> query = getDatabaseService().getQueryable(DMP.getHints(), DMP.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.like(builder.upper(root.get("description")), "%" + criteria.getLike().toUpperCase() + "%")));
if (criteria.getPeriodEnd() != null)
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())
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("version"),
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(
builder1.equal(externalRoot.get("groupId"), nestedRoot.get("groupId")),
builder1.notEqual(nestedRoot.get("status"), DMP.DMPStatus.DELETED.getValue())), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class)));
if (criteria.getGroupIds() != null && !criteria.getGroupIds().isEmpty())
query.where((builder, root) -> root.get("groupId").in(criteria.getGroupIds()));
if (criteria.getStatus() != null) {
if (criteria.getStatus() == DMP.DMPStatus.FINALISED.getValue()) {
query.where((builder, root) -> builder.equal(root.get("status"), DMP.DMPStatus.FINALISED.getValue()));
} else if (criteria.getStatus() == DMP.DMPStatus.ACTIVE.getValue()) {
query.where((builder, root) -> builder.equal(root.get("status"), DMP.DMPStatus.ACTIVE.getValue()));
}
}
if (criteria.getIsPublic()) {
query.where(((builder, root) -> builder.equal(root.get("isPublic"), criteria.getIsPublic())));
}
/*if (criteria.getRole() != null) {
if (criteria.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())) {
query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).get("role"), UserDMP.UserDMPRoles.OWNER.getValue()));
} else if (criteria.getRole().equals(UserDMP.UserDMPRoles.USER.getValue())) {
query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).get("role"), UserDMP.UserDMPRoles.USER.getValue()));
}
}*/
if (criteria.getOrganisations() != null && !criteria.getOrganisations().isEmpty()) {
query.where((builder, root) -> root.join("organisations").get("reference").in(criteria.getOrganisations()));
}
if (criteria.getCollaborators() != null && !criteria.getCollaborators().isEmpty()) {
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()));
}
if (criteria.getGrantStatus() != null) {
if (criteria.getGrantStatus().equals(GrantStateType.FINISHED.getValue().shortValue()))
query.where((builder, root) -> builder.lessThan(root.get("grant").get("enddate"), new Date()));
if (criteria.getGrantStatus().equals(GrantStateType.ONGOING.getValue().shortValue()))
query.where((builder, root) ->
builder.or(builder.greaterThan(root.get("grant").get("enddate"), new Date())
, builder.isNull(root.get("grant").get("enddate"))));
}
if (criteria.hasDoi()) {
query.where((builder, root) -> builder.not(builder.isNull(root.join("dois").get("id"))));
}
query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue()));
return query;
}
public QueryableList<DMP> getAuthenticated(QueryableList<DMP> query, UUID principal, List<Integer> roles) {
if (roles != null && !roles.isEmpty()) {
query.where((builder, root) -> {
Join userJoin = root.join("users", JoinType.LEFT);
return builder.and(builder.equal(userJoin.join("user", JoinType.LEFT).get("id"), principal), userJoin.get("role").in(roles));
});
} else {
query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id"), principal));
}
return query;
}
@Override
@Transactional
public DMP createOrUpdate(DMP item) {
return this.getDatabaseService().createOrUpdate(item, DMP.class);
}
@Override
public DMP find(UUID id) {
return getDatabaseService().getQueryable(DMP.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
}
@Override
public QueryableList<DMP> getUserDmps(DatasetWizardUserDmpCriteria datasetWizardUserDmpCriteria, UserInfo userInfo) {
QueryableList<DMP> query = getDatabaseService().getQueryable(DMP.class).where((builder, root) -> builder.or(builder.equal(root.get("creator"), userInfo), builder.isMember(userInfo, root.get("users"))));
if (datasetWizardUserDmpCriteria.getLike() != null && !datasetWizardUserDmpCriteria.getLike().isEmpty()) {
query.where((builder, root) -> builder.like(root.get("label"), "%" + datasetWizardUserDmpCriteria.getLike() + "%"));
}
return query;
}
@Override
public void delete(DMP item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<DMP> asQueryable() {
return this.getDatabaseService().getQueryable(DMP.class);
}
@Async
@Override
public CompletableFuture<DMP> createOrUpdateAsync(DMP item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public DMP find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,20 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.dao.criteria.DataManagementPlanBlueprintCriteria;
import eu.eudat.old.data.dao.criteria.DataManagementPlanProfileCriteria;
import eu.eudat.old.data.entities.DMPProfile;
import eu.eudat.old.queryable.QueryableList;
import java.util.UUID;
/**
* Created by ikalyvas on 3/21/2018.
*/
public interface DMPProfileDao extends DatabaseAccessLayer<DMPProfile, UUID> {
QueryableList<DMPProfile> getWithCriteria(DataManagementPlanProfileCriteria criteria);
QueryableList<DMPProfile> getWithCriteriaBlueprint(DataManagementPlanBlueprintCriteria criteria);
}

View File

@ -1,85 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.criteria.DataManagementPlanBlueprintCriteria;
import eu.eudat.old.data.dao.criteria.DataManagementPlanProfileCriteria;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.DMPProfile;
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;
/**
* Created by ikalyvas on 3/21/2018.
*/
@Service("dmpProfileDao")
public class DMPProfileDaoImpl extends DatabaseAccess<DMPProfile> implements DMPProfileDao {
@Autowired
public DMPProfileDaoImpl(DatabaseService<DMPProfile> databaseService) {
super(databaseService);
}
@Async
@Override
public CompletableFuture<DMPProfile> createOrUpdateAsync(DMPProfile item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public DMPProfile createOrUpdate(DMPProfile item) {
return this.getDatabaseService().createOrUpdate(item, DMPProfile.class);
}
@Override
public DMPProfile find(UUID id) {
return getDatabaseService().getQueryable(DMPProfile.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
}
@Override
public DMPProfile find(UUID id, String hint) {
return getDatabaseService().getQueryable(DMPProfile.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
}
@Override
public void delete(DMPProfile item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<DMPProfile> asQueryable() {
return this.getDatabaseService().getQueryable(DMPProfile.class);
}
@Override
public QueryableList<DMPProfile> getWithCriteria(DataManagementPlanProfileCriteria 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() + "%"));
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;
}
}

View File

@ -1,12 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.DataRepositoryCriteria;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.DataRepository;
import eu.eudat.old.queryable.QueryableList;
import java.util.UUID;
public interface DataRepositoryDao extends DatabaseAccessLayer<DataRepository, UUID> {
QueryableList<DataRepository> getWithCriteria(DataRepositoryCriteria criteria);
}

View File

@ -1,65 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.DataRepositoryCriteria;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.DataRepository;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("dataRepositoryDao")
public class DataRepositoryDaoImpl extends DatabaseAccess<DataRepository> implements DataRepositoryDao {
@Autowired
public DataRepositoryDaoImpl(DatabaseService<DataRepository> databaseService) {
super(databaseService);
}
@Override
public QueryableList<DataRepository> getWithCriteria(DataRepositoryCriteria criteria) {
QueryableList<DataRepository> query = this.getDatabaseService().getQueryable(DataRepository.class);
if (criteria.getLike() != null)
query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.equal(builder.upper(root.get("label")), criteria.getLike().toUpperCase())));
if (criteria.getCreationUserId() != null)
query.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), criteria.getCreationUserId()));
return query;
}
@Override
public DataRepository find(UUID id) {
return this.getDatabaseService().getQueryable(DataRepository.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public DataRepository createOrUpdate(DataRepository item) {
return getDatabaseService().createOrUpdate(item, DataRepository.class);
}
@Override
@Async
public CompletableFuture<DataRepository> createOrUpdateAsync(DataRepository item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public DataRepository find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public void delete(DataRepository item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<DataRepository> asQueryable() {
return this.getDatabaseService().getQueryable(DataRepository.class);
}
}

View File

@ -1,22 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.dao.criteria.DatasetCriteria;
import eu.eudat.old.data.entities.Dataset;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.queryable.QueryableList;
import java.util.List;
import java.util.UUID;
public interface DatasetDao extends DatabaseAccessLayer<Dataset, UUID> {
QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria);
QueryableList<Dataset> filterFromElastic(DatasetCriteria criteria, List<UUID> ids);
QueryableList<Dataset> getAuthenticated(QueryableList<Dataset> query, UserInfo principal, List<Integer> roles);
Dataset isPublicDataset(UUID id);
}

View File

@ -1,152 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.DatasetCriteria;
import eu.eudat.old.queryable.types.FieldSelectionType;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.DMP;
import eu.eudat.old.data.entities.Dataset;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.queryable.types.SelectionField;
import eu.eudat.old.types.grant.GrantStateType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.persistence.criteria.Join;
import javax.persistence.criteria.JoinType;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("datasetDao")
public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDao {
@Autowired
public DatasetDaoImpl(DatabaseService<Dataset> databaseService) { super(databaseService); }
@Override
public QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria) {
QueryableList<Dataset> query = getDatabaseService().getQueryable(Dataset.getHints(), Dataset.class);
if (criteria.getIsPublic() != null && criteria.getIsPublic()) {
query.where((builder, root) -> builder.equal(root.get("dmp").get("isPublic"), true));
query.where((builder, root) -> builder.equal(root.get("status"), Dataset.Status.FINALISED.getValue()));
/*query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"),
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")),
Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));*/
}
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.like(builder.upper(root.get("description")), "%" + criteria.getLike().toUpperCase() + "%")));
if (criteria.getStatus() != null)
query.where((builder, root) -> builder.equal(root.get("status"), criteria.getStatus()));
if (criteria.getProfileDatasetId() != null)
query.where((builder, root) -> builder.equal(root.get("profile").get("id"), criteria.getProfileDatasetId()));
if (criteria.getPeriodEnd() != null)
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.getAllVersions())
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"), query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")), builder1.notEqual(nestedRoot.get("dmp").get("status"), DMP.DMPStatus.DELETED.getValue())), Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));
if (criteria.getGroupIds() != null && !criteria.getGroupIds().isEmpty())
query.where((builder, root) -> root.get("dmp").get("groupId").in(criteria.getGroupIds()));
if (criteria.getDmpIds() != null && !criteria.getDmpIds().isEmpty())
query.where((builder, root) -> root.get("dmp").get("id").in(criteria.getDmpIds()));
/*if (criteria.getRole() != null) {
query.where((builder, root) -> builder.equal(root.join("dmp").join("users").get("role"), criteria.getRole()));
} else {
query.where((builder, root) -> root.join("dmp").join("users").get("role").in(UserDMP.UserDMPRoles.getAllValues()));
}*/
if (criteria.getOrganisations() != null && !criteria.getOrganisations().isEmpty())
query.where((builder, root) -> root.join("dmp").join("organisations").get("reference").in(criteria.getOrganisations()));
if (criteria.getGrants() != null && !criteria.getGrants().isEmpty())
query.where((builder, root) -> root.join("dmp").join("grant").get("id").in(criteria.getGrants()));
if (criteria.getGrantStatus() != null) {
if (criteria.getGrantStatus().equals(GrantStateType.FINISHED.getValue().shortValue()))
query.where((builder, root) -> builder.lessThan(root.get("dmp").get("grant").get("enddate"), new Date()));
if (criteria.getGrantStatus().equals(GrantStateType.ONGOING.getValue().shortValue()))
query.where((builder, root) ->
builder.or(builder.greaterThan(root.get("dmp").get("grant").get("enddate"), new Date())
, builder.isNull(root.get("dmp").get("grant").get("enddate"))));
}
if (criteria.getCollaborators() != null && !criteria.getCollaborators().isEmpty())
query.where((builder, root) -> root.join("dmp", JoinType.LEFT).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.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.notEqual(root.get("status"), Dataset.Status.DELETED.getValue()));
query.where((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.CANCELED.getValue()));
return query;
}
public QueryableList<Dataset> filterFromElastic(DatasetCriteria criteria, List<UUID> ids) {
QueryableList<Dataset> query = getDatabaseService().getQueryable(Dataset.getHints(), Dataset.class);
query.where(((builder, root) -> root.get("id").in(ids)));
if (!criteria.getAllVersions())
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"), query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")), builder1.notEqual(nestedRoot.get("dmp").get("status"), DMP.DMPStatus.DELETED.getValue())), Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));
return query;
}
@Override
public Dataset createOrUpdate(Dataset item) {
return getDatabaseService().createOrUpdate(item, Dataset.class);
}
@Override
public Dataset find(UUID id) {
return getDatabaseService().getQueryable(Dataset.class)
.where((builder, root) -> builder.and(builder.notEqual(root.get("status"),Dataset.Status.DELETED.getValue()), builder.notEqual(root.get("status"),Dataset.Status.CANCELED.getValue()), builder.equal((root.get("id")), id))).getSingle();
}
@Override
public Dataset find(UUID id, String hint) {
return getDatabaseService().getQueryable(Dataset.getHints(), Dataset.class).withHint(hint)
.where((builder, root) -> builder.and(builder.notEqual(root.get("status"),Dataset.Status.DELETED.getValue()), builder.notEqual(root.get("status"),Dataset.Status.CANCELED.getValue()), builder.equal((root.get("id")), id))).getSingle();
}
@Override
public Dataset isPublicDataset(UUID id) {
QueryableList<Dataset> query = getDatabaseService().getQueryable(Dataset.getHints(), Dataset.class);
query.where(((builder, root) -> builder.equal(root.get("id"), id)));
return query.withHint("datasetListingModel").getSingle();
}
@Override
public QueryableList<Dataset> getAuthenticated(QueryableList<Dataset> query, UserInfo principal, List<Integer> roles) {
if (roles != null && !roles.isEmpty()) {
query.where((builder, root) -> {
Join userJoin = root.join("dmp", JoinType.LEFT).join("users", JoinType.LEFT);
return builder.and(builder.equal(userJoin.join("user", JoinType.LEFT).get("id"), principal.getId()), userJoin.get("role").in(roles));
});
} else {
query.where((builder, root) -> builder.equal(root.join("dmp", JoinType.LEFT).join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id"), principal.getId()));
}
return query;
}
@Override
public void delete(Dataset item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Dataset> asQueryable() {
return this.getDatabaseService().getQueryable(Dataset.class);
}
@Async
public CompletableFuture<Dataset> createOrUpdateAsync(Dataset item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
}

View File

@ -1,13 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.entities.DatasetExternalDataset;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import java.util.UUID;
/**
* Created by ikalyvas on 5/22/2018.
*/
public interface DatasetExternalDatasetDao extends DatabaseAccessLayer<DatasetExternalDataset, UUID> {
}

View File

@ -1,56 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.DatasetExternalDataset;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
/**
* Created by ikalyvas on 5/22/2018.
*/
@Component("datasetExternalDatasetDao")
public class DatasetExternalDatasetDaoImpl extends DatabaseAccess<DatasetExternalDataset> implements DatasetExternalDatasetDao {
@Autowired
public DatasetExternalDatasetDaoImpl(DatabaseService<DatasetExternalDataset> databaseService) {
super(databaseService);
}
@Override
public DatasetExternalDataset createOrUpdate(DatasetExternalDataset item) {
return this.getDatabaseService().createOrUpdate(item,DatasetExternalDataset.class);
}
@Override
public CompletableFuture<DatasetExternalDataset> createOrUpdateAsync(DatasetExternalDataset item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
@Async
public DatasetExternalDataset find(UUID id) {
return getDatabaseService().getQueryable(DatasetExternalDataset.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public DatasetExternalDataset find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public void delete(DatasetExternalDataset item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<DatasetExternalDataset> asQueryable() {
return this.getDatabaseService().getQueryable(DatasetExternalDataset.class);
}
}

View File

@ -1,24 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.entities.DescriptionTemplateType;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.dao.criteria.DatasetProfileCriteria;
import eu.eudat.old.data.entities.DescriptionTemplate;
import eu.eudat.old.queryable.QueryableList;
import java.util.List;
import java.util.UUID;
public interface DatasetProfileDao extends DatabaseAccessLayer<DescriptionTemplate, UUID> {
QueryableList<DescriptionTemplate> getWithCriteria(DatasetProfileCriteria criteria);
QueryableList<DescriptionTemplate> getAll();
QueryableList<DescriptionTemplate> getAuthenticated(QueryableList<DescriptionTemplate> query, UUID principal, List<Integer> roles);
List<DescriptionTemplate> getAllIds();
Long countWithType(DescriptionTemplateType type);
}

View File

@ -1,134 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.entities.DescriptionTemplate;
import eu.eudat.old.data.entities.DescriptionTemplateType;
import eu.eudat.old.queryable.types.FieldSelectionType;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.criteria.DatasetProfileCriteria;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.queryable.types.SelectionField;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
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 {
@Autowired
public DatasetProfileDaoImpl(DatabaseService<DescriptionTemplate> databaseService) {
super(databaseService);
}
@Override
public QueryableList<DescriptionTemplate> getWithCriteria(DatasetProfileCriteria criteria) {
QueryableList<DescriptionTemplate> query = getDatabaseService().getQueryable(DescriptionTemplate.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())
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("version"),
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("groupId"),
nestedRoot.get("groupId")), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class)));
if (criteria.getGroupIds() != null && !criteria.getGroupIds().isEmpty())
query.where((builder, root) -> root.get("groupId").in(criteria.getGroupIds()));
if (criteria.getFilter() != null && criteria.getUserId() != null) {
if (criteria.getFilter().equals(DatasetProfileCriteria.DatasetProfileFilter.DMPs.getValue())) {
query.initSubQuery(UUID.class).where((builder, root) ->
builder.and(root.get("id").in(
query.subQuery((builder1, root1) -> builder1.equal(root1.join("dmps", JoinType.LEFT).join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id"), criteria.getUserId()),
Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "id")))),
builder.notEqual(root.get("id"), criteria.getUserId())));
//query.where(((builder, root) -> builder.equal(root.join("dmps", JoinType.LEFT).join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id"), criteria.getUserId())));
}
if (criteria.getFilter().equals(DatasetProfileCriteria.DatasetProfileFilter.Datasets.getValue())) {
query.initSubQuery(UUID.class).where((builder, root) ->
builder.and(root.get("id").in(
query.subQuery((builder1, root1) -> builder1.equal(root1.join("dataset", JoinType.LEFT).join("dmp", JoinType.LEFT).join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id"), criteria.getUserId()),
Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "id")))),
builder.notEqual(root.get("id"), criteria.getUserId())));
}
}
if (criteria.getStatus() != null) {
query.where(((builder, root) -> builder.equal(root.get("status"), criteria.getStatus())));
}
if (criteria.getIds() != null) {
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())));
} else {
query.where(((builder, root) -> builder.notEqual(root.get("status"), DescriptionTemplate.Status.DELETED.getValue())));
}
if (criteria.getPeriodStart() != null)
query.where((builder, root) -> builder.greaterThanOrEqualTo(root.get("created"), criteria.getPeriodStart()));
return query;
}
@Override
public DescriptionTemplate createOrUpdate(DescriptionTemplate item) {
return this.getDatabaseService().createOrUpdate(item, DescriptionTemplate.class);
}
@Override
public DescriptionTemplate find(UUID id) {
return getDatabaseService().getQueryable(DescriptionTemplate.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public QueryableList<DescriptionTemplate> getAll() {
return getDatabaseService().getQueryable(DescriptionTemplate.class);
}
@Override
public List<DescriptionTemplate> getAllIds(){
return getDatabaseService().getQueryable(DescriptionTemplate.class).withFields(Collections.singletonList("id")).toList();
}
@Override
public void delete(DescriptionTemplate item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<DescriptionTemplate> asQueryable() {
return this.getDatabaseService().getQueryable(DescriptionTemplate.class);
}
@Async
@Override
public CompletableFuture<DescriptionTemplate> createOrUpdateAsync(DescriptionTemplate item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public DescriptionTemplate find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public QueryableList<DescriptionTemplate> getAuthenticated(QueryableList<DescriptionTemplate> query, UUID principal, List<Integer> roles) {
if (roles != null && !roles.isEmpty()) {
query.where((builder, root) -> {
Join userJoin = root.join("users", JoinType.LEFT);
return builder.and(builder.equal(userJoin.join("user", JoinType.LEFT).get("id"), principal), userJoin.get("role").in(roles));
});
} else {
query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id"), principal));
}
return query;
}
@Override
public Long countWithType(DescriptionTemplateType type) {
return this.getDatabaseService().getQueryable(DescriptionTemplate.class).where((builder, root) -> builder.equal(root.get("type"), type)).count();
}
}

View File

@ -1,12 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.DatasetService;
import java.util.UUID;
/**
* Created by ikalyvas on 5/22/2018.
*/
public interface DatasetServiceDao extends DatabaseAccessLayer<DatasetService, UUID> {
}

View File

@ -1,55 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.entities.DatasetService;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
/**
* Created by ikalyvas on 5/22/2018.
*/
@Component("datasetServiceDao")
public class DatasetServiceDaoImpl extends DatabaseAccess<DatasetService> implements DatasetServiceDao {
@Autowired
public DatasetServiceDaoImpl(DatabaseService<DatasetService> databaseService) {
super(databaseService);
}
@Override
public DatasetService createOrUpdate(DatasetService item) {
return this.getDatabaseService().createOrUpdate(item, DatasetService.class);
}
@Async
@Override
public CompletableFuture<DatasetService> createOrUpdateAsync(DatasetService item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public DatasetService find(UUID id) {
return getDatabaseService().getQueryable(DatasetService.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public DatasetService find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public void delete(DatasetService item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<DatasetService> asQueryable() {
return this.getDatabaseService().getQueryable(DatasetService.class);
}
}

View File

@ -1,10 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.DescriptionTemplateType;
import java.util.UUID;
public interface DescriptionTemplateTypeDao extends DatabaseAccessLayer<DescriptionTemplateType, UUID> {
DescriptionTemplateType findFromName(String name);
}

View File

@ -1,65 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.entities.DescriptionTemplateType;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
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();
}
}

View File

@ -1,9 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.DMPDatasetProfile;
import java.util.UUID;
public interface DmpDatasetProfileDao extends DatabaseAccessLayer<DMPDatasetProfile, UUID> {
}

View File

@ -1,51 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.DMPDatasetProfile;
import eu.eudat.old.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);
}
}

View File

@ -1,13 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.EmailConfirmation;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.dao.criteria.EmailConfirmationCriteria;
import java.util.UUID;
public interface EmailConfirmationDao extends DatabaseAccessLayer<EmailConfirmation, UUID> {
QueryableList<EmailConfirmation> getWithCriteria(EmailConfirmationCriteria criteria);
}

View File

@ -1,56 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.criteria.EmailConfirmationCriteria;
import eu.eudat.old.data.entities.EmailConfirmation;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Service("LoginConfirmationEmailDao")
public class EmailConfirmationDaoImpl extends DatabaseAccess<EmailConfirmation> implements EmailConfirmationDao {
@Autowired
public EmailConfirmationDaoImpl(DatabaseService<EmailConfirmation> databaseService) {
super(databaseService);
}
@Override
public QueryableList<EmailConfirmation> getWithCriteria(EmailConfirmationCriteria criteria) {
return null;
}
@Override
public EmailConfirmation createOrUpdate(EmailConfirmation item) {
return this.getDatabaseService().createOrUpdate(item, EmailConfirmation.class);
}
@Override
public CompletableFuture<EmailConfirmation> createOrUpdateAsync(EmailConfirmation item) {
return null;
}
@Override
public EmailConfirmation find(UUID id) {
return this.getDatabaseService().getQueryable(EmailConfirmation.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public EmailConfirmation find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public void delete(EmailConfirmation item) {
throw new UnsupportedOperationException();
}
@Override
public QueryableList<EmailConfirmation> asQueryable() {
return this.getDatabaseService().getQueryable(EmailConfirmation.class);
}
}

View File

@ -1,10 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.EntityDoi;
import java.util.UUID;
public interface EntityDoiDao extends DatabaseAccessLayer<EntityDoi, UUID> {
EntityDoi findFromDoi(String doi);
}

View File

@ -1,56 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.EntityDoi;
import eu.eudat.old.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);
}
}

View File

@ -1,15 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.ExternalDatasetCriteria;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.ExternalDataset;
import eu.eudat.old.queryable.QueryableList;
import java.util.UUID;
public interface ExternalDatasetDao extends DatabaseAccessLayer<ExternalDataset, UUID> {
QueryableList<ExternalDataset> getWithCriteria(ExternalDatasetCriteria criteria);
}

View File

@ -1,66 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.ExternalDatasetCriteria;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.ExternalDataset;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("externalDatasetDao")
public class ExternalDatasetDaoImpl extends DatabaseAccess<ExternalDataset> implements ExternalDatasetDao {
@Autowired
public ExternalDatasetDaoImpl(DatabaseService<ExternalDataset> databaseService) {
super(databaseService);
}
@Override
public QueryableList<ExternalDataset> getWithCriteria(ExternalDatasetCriteria criteria) {
QueryableList<ExternalDataset> query = this.getDatabaseService().getQueryable(ExternalDataset.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.equal(builder.upper(root.get("label")), criteria.getLike().toUpperCase())));
if (criteria.getCreationUserId() != null)
query.where((builder, root) -> builder.equal(root.join("creationUser").get("id"), criteria.getCreationUserId()));
return query;
}
@Override
public ExternalDataset createOrUpdate(ExternalDataset item) {
return this.getDatabaseService().createOrUpdate(item, ExternalDataset.class);
}
@Override
public ExternalDataset find(UUID id) {
return this.getDatabaseService().getQueryable(ExternalDataset.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public void delete(ExternalDataset item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<ExternalDataset> asQueryable() {
return this.getDatabaseService().getQueryable(ExternalDataset.class);
}
@Async
@Override
public CompletableFuture<ExternalDataset> createOrUpdateAsync(ExternalDataset item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public ExternalDataset find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,11 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.FileUpload;
import java.util.List;
import java.util.UUID;
public interface FileUploadDao extends DatabaseAccessLayer<FileUpload, UUID> {
List<FileUpload> getFileUploads(UUID entityId);
}

View File

@ -1,56 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.entities.FileUpload;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
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;
@Component("FileUploadDao")
public class FileUploadDaoImpl extends DatabaseAccess<FileUpload> implements FileUploadDao {
@Autowired
public FileUploadDaoImpl(DatabaseService<FileUpload> databaseService) {
super(databaseService);
}
@Override
public FileUpload createOrUpdate(FileUpload item) {
return getDatabaseService().createOrUpdate(item, FileUpload.class);
}
//
@Override
public CompletableFuture<FileUpload> createOrUpdateAsync(FileUpload item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public FileUpload find(UUID id) {
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;
}
@Override
public void delete(FileUpload item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<FileUpload> asQueryable() {
return this.getDatabaseService().getQueryable(FileUpload.class);
}
}

View File

@ -1,16 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.dao.criteria.FunderCriteria;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.entities.Funder;
import eu.eudat.old.data.entities.UserInfo;
import java.util.UUID;
public interface FunderDao extends DatabaseAccessLayer<Funder, UUID> {
QueryableList<Funder> getWithCritetia(FunderCriteria criteria);
QueryableList<Funder> getAuthenticated(QueryableList<Funder> query, UserInfo principal);
}

View File

@ -1,75 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.FunderCriteria;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.Funder;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("funderDao")
public class FunderDaoImpl extends DatabaseAccess<Funder> implements FunderDao {
@Autowired
public FunderDaoImpl(DatabaseService<Funder> databaseService) {
super(databaseService);
}
@Override
public QueryableList<Funder> getWithCritetia(FunderCriteria criteria) {
QueryableList<Funder> query = getDatabaseService().getQueryable(Funder.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) ->
builder.or(builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.or(builder.like(builder.upper(root.get("definition")), "%" + criteria.getLike().toUpperCase() + "%"))));
if (criteria.getReference() != null)
query.where((builder, root) -> builder.like(builder.upper(root.get("reference")), "%" + criteria.getReference().toUpperCase() + "%"));
if (criteria.getExactReference() != null)
query.where((builder, root) -> builder.like(builder.upper(root.get("reference")), criteria.getExactReference().toUpperCase()));
if (criteria.getPeriodStart() != null)
query.where((builder, root) -> builder.greaterThanOrEqualTo(root.get("created"), criteria.getPeriodStart()));
query.where((builder, root) -> builder.notEqual(root.get("status"), Funder.Status.DELETED.getValue()));
return query;
}
@Override
public QueryableList<Funder> getAuthenticated(QueryableList<Funder> query, UserInfo principal) {
query.where((builder, root) -> builder.equal(root.get("creationUser"), principal));
return query;
}
@Override
public Funder createOrUpdate(Funder item) {
return this.getDatabaseService().createOrUpdate(item, Funder.class);
}
@Override
public CompletableFuture<Funder> createOrUpdateAsync(Funder item) {
return null;
}
@Override
public Funder find(UUID id) {
return this.getDatabaseService().getQueryable(Funder.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public Funder find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public void delete(Funder item) {
throw new UnsupportedOperationException();
}
@Override
public QueryableList<Funder> asQueryable() {
return this.getDatabaseService().getQueryable(Funder.class);
}
}

View File

@ -1,17 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.Grant;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.dao.criteria.GrantCriteria;
import eu.eudat.old.data.entities.UserInfo;
import java.util.UUID;
public interface GrantDao extends DatabaseAccessLayer<Grant, UUID> {
QueryableList<Grant> getWithCriteria(GrantCriteria criteria);
QueryableList<Grant> getAuthenticated(QueryableList<Grant> query, UserInfo principal);
}

View File

@ -1,101 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.criteria.GrantCriteria;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.DMP;
import eu.eudat.old.data.entities.Grant;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.types.grant.GrantStateType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.persistence.criteria.JoinType;
import java.util.Date;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("grantDao")
public class GrantDaoImpl extends DatabaseAccess<Grant> implements GrantDao {
@Autowired
public GrantDaoImpl(DatabaseService<Grant> databaseService) {
super(databaseService);
}
@Override
public QueryableList<Grant> getWithCriteria(GrantCriteria criteria) {
QueryableList<Grant> query = getDatabaseService().getQueryable(Grant.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) ->
builder.or(builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.or(builder.like(builder.upper(root.get("description")), "%" + criteria.getLike().toUpperCase() + "%"))));
if (criteria.getPeriodEnd() != null)
query.where((builder, root) -> builder.lessThan(root.get("enddate"), criteria.getPeriodEnd()));
if (criteria.getPeriodStart() != null)
query.where((builder, root) -> builder.greaterThan(root.get("startdate"), criteria.getPeriodStart()));
if (criteria.getReference() != null)
query.where((builder, root) -> builder.like(root.get("reference"), "%" + criteria.getReference() + "%"));
if (criteria.getExactReference() != null)
query.where((builder, root) -> builder.like(root.get("reference"), criteria.getExactReference()));
if (criteria.getGrantStateType() != null) {
if (criteria.getGrantStateType().equals(GrantStateType.FINISHED.getValue()))
query.where((builder, root) -> builder.lessThan(root.get("enddate"), new Date()));
if (criteria.getGrantStateType().equals(GrantStateType.ONGOING.getValue()))
query.where((builder, root) ->
builder.or(builder.greaterThan(root.get("enddate"), new Date())
, builder.isNull(root.get("enddate"))));
}
if (criteria.isPublic()) {
query.where((builder, root) -> builder.equal(root.join("dmps").get("status"), DMP.DMPStatus.FINALISED.getValue())).distinct();
}
if (criteria.isActive()) {
query.where((builder, root) -> builder.notEqual(root.join("dmps").get("status"), DMP.DMPStatus.DELETED.getValue())).distinct();
}
if (criteria.getFunderId() != null && !criteria.getFunderId().trim().isEmpty())
query.where((builder, root) -> builder.equal(root.get("funder").get("id"), UUID.fromString(criteria.getFunderId())));
if (criteria.getFunderReference() != null && !criteria.getFunderReference().isEmpty())
query.where((builder, root) -> builder.or(builder.like(root.join("funder", JoinType.LEFT).get("reference"), "%" + criteria.getFunderReference())));
query.where((builder, root) -> builder.notEqual(root.get("status"), Grant.Status.DELETED.getValue()));
return query;
}
@Override
public Grant createOrUpdate(Grant item) {
return getDatabaseService().createOrUpdate(item, Grant.class);
}
@Override
public Grant find(UUID id) {
return getDatabaseService().getQueryable(Grant.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
}
@Override
public void delete(Grant item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Grant> asQueryable() {
return this.getDatabaseService().getQueryable(Grant.class);
}
public QueryableList<Grant> getAuthenticated(QueryableList<Grant> query, UserInfo principal) {
query.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), principal.getId())).distinct();
return query;
}
@Async
@Override
public CompletableFuture<Grant> createOrUpdateAsync(Grant item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public Grant find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,15 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.InvitationCriteria;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.Invitation;
import eu.eudat.old.queryable.QueryableList;
import java.util.UUID;
public interface InvitationDao extends DatabaseAccessLayer<Invitation, UUID> {
QueryableList<Invitation> getWithCriteria(InvitationCriteria criteria);
}

View File

@ -1,59 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.InvitationCriteria;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.Invitation;
import eu.eudat.old.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("invitationDao")
public class InvitationDaoImpl extends DatabaseAccess<Invitation> implements InvitationDao {
@Autowired
public InvitationDaoImpl(DatabaseService<Invitation> databaseService) {
super(databaseService);
}
@Override
public QueryableList<Invitation> getWithCriteria(InvitationCriteria criteria) {
return null;
}
@Override
public Invitation createOrUpdate(Invitation item) {
return this.getDatabaseService().createOrUpdate(item, Invitation.class);
}
@Override
public Invitation find(UUID id) {
return this.getDatabaseService().getQueryable(Invitation.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public void delete(Invitation item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Invitation> asQueryable() {
return this.getDatabaseService().getQueryable(Invitation.class);
}
@Async
@Override
public CompletableFuture<Invitation> createOrUpdateAsync(Invitation item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public Invitation find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,13 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.dao.criteria.LockCriteria;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.entities.Lock;
import java.util.UUID;
public interface LockDao extends DatabaseAccessLayer<Lock, UUID> {
QueryableList<Lock> getWithCriteria(LockCriteria criteria);
}

View File

@ -1,65 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.criteria.LockCriteria;
import eu.eudat.old.data.entities.Lock;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
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("LockDao")
public class LockDaoImpl extends DatabaseAccess<Lock> implements LockDao {
@Autowired
public LockDaoImpl(DatabaseService<Lock> databaseService) {
super(databaseService);
}
@Override
public QueryableList<Lock> getWithCriteria(LockCriteria criteria) {
QueryableList<Lock> query = this.getDatabaseService().getQueryable(Lock.class);
if (criteria.getTouchedAt() != null)
query.where((builder, root) -> builder.equal(root.get("touchedAt"), criteria.getTouchedAt()));
if (criteria.getLockedBy() != null)
query.where(((builder, root) -> builder.equal(root.get("lockedBy"), criteria.getLockedBy())));
if (criteria.getTarget() != null)
query.where(((builder, root) -> builder.equal(root.get("target"), criteria.getTarget())));
return query;
}
@Override
public Lock createOrUpdate(Lock item) {
return this.getDatabaseService().createOrUpdate(item, Lock.class);
}
@Async
@Override
public CompletableFuture<Lock> createOrUpdateAsync(Lock item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public Lock find(UUID id) {
return this.getDatabaseService().getQueryable(Lock.class).where(((builder, root) -> builder.equal(root.get("id"), id))).getSingle();
}
@Override
public Lock find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public void delete(Lock item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Lock> asQueryable() {
return this.getDatabaseService().getQueryable(Lock.class);
}
}

View File

@ -1,13 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.NotificationCriteria;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.Notification;
import eu.eudat.old.queryable.QueryableList;
import java.util.UUID;
public interface NotificationDao extends DatabaseAccessLayer<Notification, UUID> {
QueryableList<Notification> getWithCriteria(NotificationCriteria criteria);
}

View File

@ -1,60 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.NotificationCriteria;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.Notification;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Service("NotificationDao")
public class NotificationDaoImpl extends DatabaseAccess<Notification> implements NotificationDao {
@Autowired
public NotificationDaoImpl(DatabaseService<Notification> databaseService) {
super(databaseService);
}
@Override
public QueryableList<Notification> getWithCriteria(NotificationCriteria criteria) {
QueryableList<Notification> query = this.getDatabaseService().getQueryable(Notification.class);
if (criteria.getIsActive() != null)
query.where((builder, root) -> builder.equal(root.get("isActive"), criteria.getIsActive()));
if (criteria.getNotifyState() != null)
query.where(((builder, root) -> builder.equal(root.get("notifyState"), criteria.getNotifyState())));
return query;
}
@Override
public Notification createOrUpdate(Notification item) {
return this.getDatabaseService().createOrUpdate(item, Notification.class);
}
@Override
public CompletableFuture<Notification> createOrUpdateAsync(Notification item) {
return CompletableFuture.supplyAsync(() -> this.getDatabaseService().createOrUpdate(item, Notification.class));
}
@Override
public Notification find(UUID id) {
return this.getDatabaseService().getQueryable(Notification.class).where(((builder, root) -> builder.equal(root.get("id"), id))).getSingle();
}
@Override
public Notification find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public void delete(Notification item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Notification> asQueryable() {
return this.getDatabaseService().getQueryable(Notification.class);
}
}

View File

@ -1,16 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.dao.criteria.OrganisationCriteria;
import eu.eudat.old.data.entities.Organisation;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.queryable.QueryableList;
import java.util.UUID;
public interface OrganisationDao extends DatabaseAccessLayer<Organisation, UUID> {
QueryableList<Organisation> getWithCriteria(OrganisationCriteria criteria);
QueryableList<Organisation> getAuthenticated(QueryableList<Organisation> query, UserInfo principal);
}

View File

@ -1,84 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.OrganisationCriteria;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.DMP;
import eu.eudat.old.data.entities.Organisation;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.persistence.criteria.JoinType;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("organisationDao")
public class OrganisationDaoImpl extends DatabaseAccess<Organisation> implements OrganisationDao {
@Autowired
public OrganisationDaoImpl(DatabaseService<Organisation> databaseService) {
super(databaseService);
}
@Override
public QueryableList<Organisation> getWithCriteria(OrganisationCriteria criteria) {
QueryableList<Organisation> query = this.getDatabaseService().getQueryable(Organisation.class);
if (criteria.getLabelLike() != null && criteria.getLike() != null) {
query.where((builder, root) -> builder.or(builder.equal(root.get("reference"), criteria.getLike()), builder.like(builder.upper(root.get("label")), "%" + criteria.getLabelLike().toUpperCase() + "%")));
} else {
if (criteria.getLike() != null)
query.where((builder, root) -> builder.equal(root.get("reference"), criteria.getLike()));
if (criteria.getLabelLike() != null) {
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLabelLike().toUpperCase() + "%"));
}
if (criteria.getPublic() != null && criteria.getPublic()) {
query.where((builder, root) -> builder.equal(root.join("dmps", JoinType.LEFT).get("status"), DMP.DMPStatus.FINALISED.getValue()));
}
}
if (criteria.isActive()) {
query.where((builder, root) -> builder.notEqual(root.join("dmps").get("status"), DMP.DMPStatus.DELETED.getValue())).distinct();
}
return query;
}
@Override
public Organisation createOrUpdate(Organisation item) {
return this.getDatabaseService().createOrUpdate(item, Organisation.class);
}
@Override
public Organisation find(UUID id) {
return this.getDatabaseService().getQueryable(Organisation.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public void delete(Organisation item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Organisation> asQueryable() {
return this.getDatabaseService().getQueryable(Organisation.class);
}
@Async
@Override
public CompletableFuture<Organisation> createOrUpdateAsync(Organisation item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
public QueryableList<Organisation> getAuthenticated(QueryableList<Organisation> query, UserInfo principal) {
query.where((builder, root) -> builder.equal(root.join("dmps").join("users").get("user"), principal));
return query;
}
@Override
public Organisation find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,16 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.dao.criteria.ProjectCriteria;
import eu.eudat.old.data.entities.Project;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.queryable.QueryableList;
import java.util.UUID;
public interface ProjectDao extends DatabaseAccessLayer<Project, UUID> {
QueryableList<Project> getWithCritetia(ProjectCriteria criteria);
QueryableList<Project> getAuthenticated(QueryableList<Project> query, UserInfo principal);
}

View File

@ -1,73 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.ProjectCriteria;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.Project;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.stereotype.Service;
import javax.persistence.criteria.JoinType;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Service("projectDao")
public class ProjectDaoImpl extends DatabaseAccess<Project> implements ProjectDao {
public ProjectDaoImpl(DatabaseService<Project> databaseService) {
super(databaseService);
}
@Override
public QueryableList<Project> getWithCritetia(ProjectCriteria criteria) {
QueryableList<Project> query = getDatabaseService().getQueryable(Project.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) ->
builder.or(builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.or(builder.like(builder.upper(root.get("description")), "%" + criteria.getLike().toUpperCase() + "%"))));
if (criteria.getReference() != null)
query.where((builder, root) -> builder.like(root.get("reference"), "%" + criteria.getReference() + "%"));
if (criteria.getExactReference() != null)
query.where((builder, root) -> builder.like(root.get("reference"), criteria.getExactReference()));
if (criteria.getPeriodStart() != null)
query.where((builder, root) -> builder.greaterThanOrEqualTo(root.get("startdate"), criteria.getPeriodStart()));
query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue()));
return query;
}
public QueryableList<Project> getAuthenticated(QueryableList<Project> query, UserInfo principal) {
query.where((builder, root) -> builder.or(builder.equal(root.get("creationUser"), principal), builder.equal(root.join("dmps", JoinType.LEFT).join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id"), principal.getId()))).distinct();
return query;
}
@Override
public Project createOrUpdate(Project item) {
return this.getDatabaseService().createOrUpdate(item, Project.class);
}
@Override
public CompletableFuture<Project> createOrUpdateAsync(Project item) {
return null;
}
@Override
public Project find(UUID id) {
return this.getDatabaseService().getQueryable(Project.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public Project find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public void delete(Project item) {
throw new UnsupportedOperationException();
}
@Override
public QueryableList<Project> asQueryable() {
return this.getDatabaseService().getQueryable(Project.class);
}
}

View File

@ -1,14 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.RegistryCriteria;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.Registry;
import eu.eudat.old.queryable.QueryableList;
import java.util.UUID;
public interface RegistryDao extends DatabaseAccessLayer<Registry, UUID> {
QueryableList<Registry> getWithCriteria(RegistryCriteria criteria);
}

View File

@ -1,66 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.RegistryCriteria;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.Registry;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("registryDao")
public class RegistryDaoImpl extends DatabaseAccess<Registry> implements RegistryDao {
@Autowired
public RegistryDaoImpl(DatabaseService<Registry> databaseService) {
super(databaseService);
}
@Override
public QueryableList<Registry> getWithCriteria(RegistryCriteria criteria) {
QueryableList<Registry> query = this.getDatabaseService().getQueryable(Registry.class);
if (criteria.getLike() != null)
if (criteria.getLike() != null)
query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.equal(builder.upper(root.get("label")), criteria.getLike().toUpperCase())));
if (criteria.getCreationUserId() != null)
query.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), criteria.getCreationUserId()));
return query;
}
@Override
public Registry createOrUpdate(Registry item) {
return this.getDatabaseService().createOrUpdate(item, Registry.class);
}
@Override
public Registry find(UUID id) {
return this.getDatabaseService().getQueryable(Registry.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public void delete(Registry item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Registry> asQueryable() {
return this.getDatabaseService().getQueryable(Registry.class);
}
@Async
@Override
public CompletableFuture<Registry> createOrUpdateAsync(Registry item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public Registry find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,14 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.dao.criteria.ResearcherCriteria;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.entities.Researcher;
import java.util.UUID;
public interface ResearcherDao extends DatabaseAccessLayer<Researcher, UUID> {
QueryableList<Researcher> getWithCriteria(ResearcherCriteria criteria);
}

View File

@ -1,67 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.criteria.ResearcherCriteria;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.Researcher;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("researcherDao")
public class ResearcherDaoImpl extends DatabaseAccess<Researcher> implements ResearcherDao {
@Autowired
public ResearcherDaoImpl(DatabaseService<Researcher> databaseService) {
super(databaseService);
}
@Override
public QueryableList<Researcher> getWithCriteria(ResearcherCriteria criteria) {
QueryableList<Researcher> query = asQueryable();
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) ->builder.or(builder.like(builder.lower(root.get("reference")), "%" + criteria.getLike().toLowerCase() + "%")));
if (criteria.getName() != null && !criteria.getName().isEmpty())
query.where((builder, root) ->builder.or(builder.like(builder.lower(root.get("label")), "%" + criteria.getName().toLowerCase() + "%")));
if (criteria.getReference() != null && !criteria.getReference().isEmpty())
query.where((builder, root) ->builder.or(builder.like(root.get("reference"), criteria.getReference())));
if (criteria.getPeriodStart() != null)
query.where((builder, root) -> builder.greaterThanOrEqualTo(root.get("created"), criteria.getPeriodStart()));
return query;
}
@Override
public Researcher createOrUpdate(Researcher item) {
return this.getDatabaseService().createOrUpdate(item, Researcher.class);
}
@Override
public Researcher find(UUID id) {
return this.getDatabaseService().getQueryable(Researcher.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public void delete(Researcher item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Researcher> asQueryable() {
return this.getDatabaseService().getQueryable(Researcher.class);
}
@Async
@Override
public CompletableFuture<Researcher> createOrUpdateAsync(Researcher item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public Researcher find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,14 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.dao.criteria.ServiceCriteria;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.entities.Service;
import java.util.UUID;
public interface ServiceDao extends DatabaseAccessLayer<Service, UUID> {
QueryableList<Service> getWithCriteria(ServiceCriteria criteria);
}

View File

@ -1,65 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.ServiceCriteria;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.Service;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("serviceDao")
public class ServiceDaoImpl extends DatabaseAccess<Service> implements ServiceDao {
@Autowired
public ServiceDaoImpl(DatabaseService<Service> databaseService) {
super(databaseService);
}
@Override
public QueryableList<Service> getWithCriteria(ServiceCriteria criteria) {
QueryableList<Service> query = this.getDatabaseService().getQueryable(Service.class);
if (criteria.getLike() != null)
query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.equal(builder.upper(root.get("label")), criteria.getLike().toUpperCase())));
if (criteria.getCreationUserId() != null)
query.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), criteria.getCreationUserId()));
return query;
}
@Override
public Service createOrUpdate(Service item) {
return this.getDatabaseService().createOrUpdate(item, Service.class);
}
@Override
public Service find(UUID id) {
return this.getDatabaseService().getQueryable(Service.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public void delete(Service item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Service> asQueryable() {
return this.getDatabaseService().getQueryable(Service.class);
}
@Async
@Override
public CompletableFuture<Service> createOrUpdateAsync(Service item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public Service find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,12 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.UserDatasetProfile;
import java.util.UUID;
/**
* Created by ikalyvas on 2/8/2018.
*/
public interface UserDatasetProfileDao extends DatabaseAccessLayer<UserDatasetProfile, UUID> {
}

View File

@ -1,52 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.entities.UserDatasetProfile;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("userDatasetProfileDao")
public class UserDatasetProfileDaoImpl extends DatabaseAccess<UserDatasetProfile> implements UserDatasetProfileDao {
@Autowired
public UserDatasetProfileDaoImpl(DatabaseService<UserDatasetProfile> databaseService) {
super(databaseService);
}
@Override
public UserDatasetProfile createOrUpdate(UserDatasetProfile item) {
return this.getDatabaseService().createOrUpdate(item, UserDatasetProfile.class);
}
@Override
public UserDatasetProfile find(UUID id) {
return this.getDatabaseService().getQueryable(UserDatasetProfile.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingleOrDefault();
}
@Override
public void delete(UserDatasetProfile item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<UserDatasetProfile> asQueryable() {
return this.getDatabaseService().getQueryable(UserDatasetProfile.class);
}
@Async
@Override
public CompletableFuture<UserDatasetProfile> createOrUpdateAsync(UserDatasetProfile item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public UserDatasetProfile find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,12 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.UserDMP;
import java.util.UUID;
/**
* Created by ikalyvas on 2/8/2018.
*/
public interface UserDmpDao extends DatabaseAccessLayer<UserDMP, UUID> {
}

View File

@ -1,55 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.UserDMP;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
/**
* Created by ikalyvas on 2/8/2018.
*/
@Component("userDmpDao")
public class UserDmpDaoImpl extends DatabaseAccess<UserDMP> implements UserDmpDao {
@Autowired
public UserDmpDaoImpl(DatabaseService<UserDMP> databaseService) {
super(databaseService);
}
@Override
public UserDMP createOrUpdate(UserDMP item) {
return this.getDatabaseService().createOrUpdate(item, UserDMP.class);
}
@Override
public UserDMP find(UUID id) {
return this.getDatabaseService().getQueryable(UserDMP.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingleOrDefault();
}
@Override
public void delete(UserDMP item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<UserDMP> asQueryable() {
return this.getDatabaseService().getQueryable(UserDMP.class);
}
@Async
@Override
public CompletableFuture<UserDMP> createOrUpdateAsync(UserDMP item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public UserDMP find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,15 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.UserInfoCriteria;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.queryable.QueryableList;
import java.util.UUID;
public interface UserInfoDao extends DatabaseAccessLayer<UserInfo, UUID> {
QueryableList<UserInfo> getWithCriteria(UserInfoCriteria criteria);
QueryableList<UserInfo> getAuthenticated(QueryableList<UserInfo> users, UUID principalId);
}

View File

@ -1,81 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.criteria.UserInfoCriteria;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.queryable.types.FieldSelectionType;
import eu.eudat.old.queryable.types.SelectionField;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("userInfoDao")
public class UserInfoDaoImpl extends DatabaseAccess<UserInfo> implements UserInfoDao {
@Autowired
public UserInfoDaoImpl(DatabaseService<UserInfo> databaseService) {
super(databaseService);
}
@Override
public QueryableList<UserInfo> getWithCriteria(UserInfoCriteria criteria) {
QueryableList<UserInfo> users = this.getDatabaseService().getQueryable(UserInfo.class);
users.where(((builder, root) -> builder.equal(root.get("userStatus"), 0)));
if (criteria.getAppRoles() != null && !criteria.getAppRoles().isEmpty())
users.where((builder, root) -> root.join("userRoles").get("role").in(criteria.getAppRoles()));
if (criteria.getLike() != null)
users.where((builder, root) -> builder.or(builder.like(builder.upper(root.get("name")), "%" + criteria.getLike().toUpperCase() + "%"), builder.like(root.get("email"), "%" + criteria.getLike() + "%")));
if (criteria.getEmail() != null)
users.where((builder, root) -> builder.equal(root.get("email"), criteria.getEmail()));
if (criteria.getCollaboratorLike() != null)
users.where((builder, root) -> builder.or(builder.like(builder.upper(root.get("name")), "%" + criteria.getCollaboratorLike().toUpperCase() + "%"), builder.like(root.get("email"), "%" + criteria.getCollaboratorLike() + "%")));
return users;
}
@Override
public QueryableList<UserInfo> getAuthenticated(QueryableList<UserInfo> users, UUID principalId) {
users.initSubQuery(UUID.class).where((builder, root) ->
builder.and(root.join("dmps").get("id").in(
users.subQuery((builder1, root1) -> builder1.equal(root1.get("id"), principalId),
Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmps:id")))),
builder.notEqual(root.get("id"), principalId)));
return users;
}
@Override
public UserInfo createOrUpdate(UserInfo item) {
return this.getDatabaseService().createOrUpdate(item, UserInfo.class);
}
@Override
public UserInfo find(UUID id) {
return this.getDatabaseService().getQueryable(UserInfo.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public void delete(UserInfo item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<UserInfo> asQueryable() {
return this.getDatabaseService().getQueryable(UserInfo.class);
}
@Async
@Override
public CompletableFuture<UserInfo> createOrUpdateAsync(UserInfo item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public UserInfo find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,18 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.dao.criteria.UserRoleCriteria;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.data.entities.UserRole;
import eu.eudat.old.queryable.QueryableList;
import java.util.List;
import java.util.UUID;
public interface UserRoleDao extends DatabaseAccessLayer<UserRole, UUID> {
QueryableList<UserRole> getWithCriteria(UserRoleCriteria criteria);
List<UserRole> getUserRoles(UserInfo userInfo);
}

View File

@ -1,71 +0,0 @@
package eu.eudat.old.data.dao.entities;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.criteria.UserRoleCriteria;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.UserInfo;
import eu.eudat.old.data.entities.UserRole;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("userRoleDao")
public class UserRoleDaoImpl extends DatabaseAccess<UserRole> implements UserRoleDao {
@Autowired
public UserRoleDaoImpl(DatabaseService<UserRole> databaseService) {
super(databaseService);
}
@Override
public UserRole createOrUpdate(UserRole item) {
return this.getDatabaseService().createOrUpdate(item, UserRole.class);
}
@Override
public UserRole find(UUID id) {
return this.getDatabaseService().getQueryable(UserRole.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingleOrDefault();
}
@Override
public List<UserRole> getUserRoles(UserInfo userInfo) {
return this.getDatabaseService().getQueryable(UserRole.class).where((builder, root) -> builder.equal(root.get("userInfo"), userInfo)).toList();
}
@Override
public void delete(UserRole item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<UserRole> getWithCriteria(UserRoleCriteria criteria) {
QueryableList<UserRole> query = this.getDatabaseService().getQueryable(UserRole.class);
if (criteria.getLike() != null)
query.where((builder, root) -> builder.equal(root.get("userInfo").get("name"), criteria.getLike()));
if (criteria.getAppRoles() != null && !criteria.getAppRoles().isEmpty())
query.where((builder, root) -> root.get("role").in(criteria.getAppRoles()));
return query;
}
@Override
public QueryableList<UserRole> asQueryable() {
return this.getDatabaseService().getQueryable(UserRole.class);
}
@Async
@Override
public CompletableFuture<UserRole> createOrUpdateAsync(UserRole item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public UserRole find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,12 +0,0 @@
package eu.eudat.old.data.dao.entities.security;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.Credential;
import java.util.UUID;
public interface CredentialDao extends DatabaseAccessLayer<Credential, UUID> {
Credential getLoggedInCredentials(String username, String secret, Integer provider);
}

View File

@ -1,61 +0,0 @@
package eu.eudat.old.data.dao.entities.security;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.entities.Credential;
import eu.eudat.old.queryable.QueryableList;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("credentialDao")
public class CredentialDaoImpl extends DatabaseAccess<Credential> implements CredentialDao {
@Autowired
public CredentialDaoImpl(DatabaseService<Credential> databaseService) {
super(databaseService);
}
@Override
public Credential createOrUpdate(Credential item) {
return this.getDatabaseService().createOrUpdate(item, Credential.class);
}
@Override
public Credential find(UUID id) {
return this.getDatabaseService().getQueryable(Credential.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingleOrDefault();
}
@Override
public Credential getLoggedInCredentials(String username, String secret, Integer provider) {
return this.getDatabaseService().getQueryable(Credential.class).where(((builder, root) ->
builder.and(
builder.equal(root.get("publicValue"), username),
builder.equal(root.get("secret"), secret),
builder.equal(root.get("provider"), provider)
))).getSingleOrDefault();
}
@Override
public void delete(Credential item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Credential> asQueryable() {
return this.getDatabaseService().getQueryable(Credential.class);
}
@Override
public CompletableFuture<Credential> createOrUpdateAsync(Credential item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public Credential find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,16 +0,0 @@
package eu.eudat.old.data.dao.entities.security;
import eu.eudat.old.data.dao.DatabaseAccessLayer;
import eu.eudat.old.data.entities.UserToken;
import java.util.UUID;
public interface UserTokenDao extends DatabaseAccessLayer<UserToken, UUID> {
UserToken createOrUpdate(UserToken item);
UserToken find(UUID id);
void delete(UserToken token);
}

View File

@ -1,51 +0,0 @@
package eu.eudat.old.data.dao.entities.security;
import eu.eudat.old.data.dao.DatabaseAccess;
import eu.eudat.old.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.old.data.entities.UserToken;
import eu.eudat.old.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Component("userTokenDao")
public class UserTokenDaoImpl extends DatabaseAccess<UserToken> implements UserTokenDao {
@Autowired
public UserTokenDaoImpl(DatabaseService<UserToken> databaseService) {
super(databaseService);
}
@Override
public UserToken createOrUpdate(UserToken item) {
return this.getDatabaseService().createOrUpdate(item, UserToken.class);
}
@Override
public UserToken find(UUID id) {
return this.getDatabaseService().getQueryable(UserToken.class).where((builder, root) -> builder.equal(root.get("token"), id)).getSingleOrDefault();
}
@Override
public void delete(UserToken userToken) {
this.getDatabaseService().delete(userToken);
}
@Override
public QueryableList<UserToken> asQueryable() {
return this.getDatabaseService().getQueryable(UserToken.class);
}
@Override
public CompletableFuture<UserToken> createOrUpdateAsync(UserToken item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public UserToken find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,155 +0,0 @@
package eu.eudat.old.data.entities;
import eu.eudat.old.data.entities.helpers.EntityBinder;
import eu.eudat.old.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.List;
import java.util.UUID;
/**
* Created by ikalyvas on 3/15/2018.
*/
@Entity
@Table(name = "\"Content\"")
public class Content implements DataEntity<Content, UUID> { //IGNORE ME
public enum ParentType {
GRANT(0);
private int value;
private ParentType(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public static ParentType fromInteger(int value) {
switch (value) {
case 0:
return GRANT;
default:
throw new RuntimeException("Unsupported Content Parent Type Status");
}
}
}
public enum LocationType {
EXTERNAL(0), INTERNAL(1);
private Integer value;
private LocationType(Integer value) {
this.value = value;
}
public Integer getValue() {
return value;
}
public static LocationType fromInteger(int value) {
switch (value) {
case 0:
return EXTERNAL;
case 1:
return INTERNAL;
default:
throw new RuntimeException("Unsupported Content Location Type");
}
}
}
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@Column(name = "\"Filename\"", nullable = false)
private String label;
@Column(name = "\"Extension\"", nullable = false)
private String extension;
@Column(name = "\"ParentType\"", nullable = false)
private Integer parentType;
@Column(name = "\"Uri\"", nullable = false)
private String uri;
@Column(name = "\"LocationType\"", nullable = false)
private Integer locationType;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getExtension() {
return extension;
}
public void setExtension(String extension) {
this.extension = extension;
}
public Integer getParentType() {
return parentType;
}
public void setParentType(Integer parentType) {
this.parentType = parentType;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public Integer getLocationType() {
return locationType;
}
public void setLocationType(Integer locationType) {
this.locationType = locationType;
}
@Override
public void update(Content entity) {
this.extension = entity.getExtension();
this.label = entity.getLabel();
this.locationType = entity.getLocationType();
this.parentType = entity.getParentType();
this.uri = entity.getUri();
}
@Override
public UUID getKeys() {
return this.id;
}
@Override
public Content 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");
return this;
}
}

View File

@ -1,168 +0,0 @@
package eu.eudat.old.data.entities;
import eu.eudat.old.data.entities.helpers.EntityBinder;
import eu.eudat.old.data.converters.DateToUTCConverter;
import eu.eudat.old.queryable.queryableentity.DataEntity;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Entity
@Table(name = "\"Credential\"")
@NamedEntityGraphs({
@NamedEntityGraph(
name = "credentialUserInfo",
attributeNodes = {@NamedAttributeNode("userInfo")})
})
public class Credential implements DataEntity<Credential, UUID> {
@Id
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@ManyToOne
@JoinColumn(name = "\"UserId\"", nullable = false)
private UserInfo userInfo;
@Column(name = "\"Status\"", nullable = false)
private Integer status;
@Column(name = "\"Provider\"", nullable = false)
private Integer provider;
@Column(name = "\"Public\"", nullable = false)
private String publicValue;
@Column(name = "\"Email\"")
private String email;
@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)
private String externalId;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public UserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(UserInfo userInfo) {
this.userInfo = userInfo;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getProvider() {
return provider;
}
public void setProvider(Integer provider) {
this.provider = provider;
}
public String getPublicValue() {
return publicValue;
}
public void setPublicValue(String publicValue) {
this.publicValue = publicValue;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
public Date getCreationTime() {
return creationTime;
}
public void setCreationTime(Date creationTime) {
this.creationTime = creationTime;
}
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
public String getExternalId() {
return externalId;
}
public void setExternalId(String externalId) {
this.externalId = externalId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Credential that = (Credential) o;
return provider.intValue() == that.provider.intValue();
}
@Override
public int hashCode() {
return provider.intValue();
}
@Override
public void update(Credential entity) {
this.status = entity.status;
this.publicValue = entity.getPublicValue();
this.email = entity.getEmail();
this.secret = entity.getSecret();
this.lastUpdateTime = new Date();
}
@Override
public UUID getKeys() {
return this.id;
}
@Override
public Credential 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");
return this;
}
}

View File

@ -1,399 +0,0 @@
package eu.eudat.old.data.entities;
import eu.eudat.old.data.converters.DateToUTCConverter;
import eu.eudat.old.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.*;
import java.util.stream.Collectors;
@Entity
@Table(name = "\"DMP\"")
@NamedEntityGraphs({
@NamedEntityGraph(
name = "dataManagementPlanListingModel",
attributeNodes = {
@NamedAttributeNode("grant"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile")}/*,*/
/*subgraphs = {
@NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")}),
}*/
),
@NamedEntityGraph(
name = "fullyDetailed",
attributeNodes = {
@NamedAttributeNode("grant"), @NamedAttributeNode("profile"),
@NamedAttributeNode(value = "users", subgraph = "users"), @NamedAttributeNode("organisations"), @NamedAttributeNode("researchers")
},
subgraphs = {
@NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")})
}
),
@NamedEntityGraph(
name = "dmpRecentActivity",
attributeNodes = {
@NamedAttributeNode("users"), @NamedAttributeNode("creator")}),
@NamedEntityGraph(
name = "recentDmpModel",
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"), @NamedAttributeNode("associatedDmps"),
@NamedAttributeNode("grant"), @NamedAttributeNode(value = "users", subgraph = "users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode(value = "dataset", subgraph = "dataset")},
subgraphs = {
@NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")}),
@NamedSubgraph(name = "dataset", attributeNodes = {@NamedAttributeNode("id"), @NamedAttributeNode("label")})
}
),
@NamedEntityGraph(
name = "versionListingModel",
attributeNodes = {@NamedAttributeNode("id"), @NamedAttributeNode("groupId"), @NamedAttributeNode("version")}
)
})
public class DMP implements DataEntity<DMP, UUID> {
public enum DMPStatus {
ACTIVE((short) 0), FINALISED((short) 1),DELETED((short) 99);
private short value;
private DMPStatus(short value) {
this.value = value;
}
public short getValue() {
return value;
}
public static DMPStatus fromInteger(short value) {
switch (value) {
case 0:
return ACTIVE;
case 1:
return FINALISED;
case 99:
return DELETED;
default:
throw new RuntimeException("Unsupported DMP Status");
}
}
}
public static Set<String> getHints() {
return hints;
}
private static final Set<String> hints = new HashSet<>(Arrays.asList("dataManagementPlanListingModel", "fullyDetailed"));
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@Column(name = "\"GroupId\"", columnDefinition = "BINARY(16)")
private UUID groupId;
@Column(name = "\"Label\"")
private String label;
@Column(name = "\"Version\"")
private Integer version;
@OneToMany(mappedBy = "dmp", fetch = FetchType.LAZY)
private Set<Dataset> dataset;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "\"Grant\"")
private Grant grant;
/*@Column(name = "\"AssociatedDmps\"", columnDefinition = "xml", nullable = true)
private String associatedDmps;*/
@OneToMany(fetch = FetchType.LAZY, mappedBy = "dmp")
private Set<DMPDatasetProfile> associatedDmps;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "\"Profile\"")
private DMPProfile profile;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "\"Creator\"")
private UserInfo creator;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name = "\"DMPOrganisation\"",
joinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")},
inverseJoinColumns = {@JoinColumn(name = "\"Organisation\"", referencedColumnName = "\"ID\"")}
)
private Set<Organisation> organisations;
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name = "\"DMPResearcher\"",
joinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")},
inverseJoinColumns = {@JoinColumn(name = "\"Researcher\"", referencedColumnName = "\"ID\"")}
)
private Set<Researcher> researchers;
@OneToMany(mappedBy = "dmp", fetch = FetchType.LAZY)
/*@OneToMany(fetch = FetchType.LAZY)
@JoinTable(name = "\"UserDMP\"",
joinColumns = {@JoinColumn(name = "dmp", referencedColumnName = "\"ID\"")},
inverseJoinColumns = {@JoinColumn(name = "usr", referencedColumnName = "id")}
)*/
private Set<UserDMP> users;
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Column(name = "\"Properties\"")
private String properties;
@Column(name = "\"DmpProperties\"")
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();
@Column(name = "\"Description\"")
private String description;
@Column(name= "\"FinalizedAt\"")
@Convert(converter = DateToUTCConverter.class)
private Date finalizedAt;
@Column(name = "\"isPublic\"", nullable = false)
private boolean isPublic;
@Column(name= "\"PublishedAt\"")
@Convert(converter = DateToUTCConverter.class)
private Date publishedAt;
@OneToMany(mappedBy = "entityId", fetch = FetchType.LAZY)
private Set<EntityDoi> dois;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "\"Project\"")
private Project project;
@Column(name = "\"extraProperties\"")
private String extraProperties;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public UserInfo getCreator() {
return creator;
}
public void setCreator(UserInfo creator) {
this.creator = creator;
}
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public Set<UserDMP> getUsers() {
return users;
}
public void setUsers(Set<UserDMP> users) {
this.users = users;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public UUID getGroupId() {
return groupId;
}
public void setGroupId(UUID groupId) {
this.groupId = groupId;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public Grant getGrant() {
return grant;
}
public void setGrant(Grant grant) {
this.grant = grant;
}
public Set<DMPDatasetProfile> getAssociatedDmps() {
return associatedDmps;
}
public void setAssociatedDmps(Set<DMPDatasetProfile> associatedDmps) {
this.associatedDmps = associatedDmps;
}
public DMPProfile getProfile() {
return profile;
}
public void setProfile(DMPProfile profile) {
this.profile = profile;
}
public Set<Dataset> getDataset() {
return dataset;
}
public void setDataset(Set<Dataset> dataset) {
this.dataset = dataset;
}
public Set<Organisation> getOrganisations() {
return organisations;
}
public void setOrganisations(Set<Organisation> organisations) {
this.organisations = organisations;
}
public Set<Researcher> getResearchers() {
return researchers;
}
public void setResearchers(Set<Researcher> researchers) {
this.researchers = researchers;
}
public String getProperties() {
return properties;
}
public void setProperties(String properties) {
this.properties = properties;
}
public String getDmpProperties() {
return dmpProperties;
}
public void setDmpProperties(String dmpProperties) {
this.dmpProperties = dmpProperties;
}
public Date getFinalizedAt() {
return finalizedAt;
}
public void setFinalizedAt(Date finalizedAt) {
this.finalizedAt = finalizedAt;
}
public boolean isPublic() {
return isPublic;
}
public void setPublic(boolean aPublic) {
isPublic = aPublic;
}
public Date getPublishedAt() {
return publishedAt;
}
public void setPublishedAt(Date publishedAt) {
this.publishedAt = publishedAt;
}
public Set<EntityDoi> getDois() {
return dois;
}
public void setDois(Set<EntityDoi> dois) {
this.dois = dois;
}
public Project getProject() {
return project;
}
public void setProject(Project project) {
this.project = project;
}
public String getExtraProperties() {
return extraProperties;
}
public void setExtraProperties(String extraProperties) {
this.extraProperties = extraProperties;
}
@Override
public void update(DMP entity) {
this.associatedDmps = entity.associatedDmps;
this.label = entity.getLabel();
this.profile = entity.getProfile();
this.status = entity.getStatus();
this.created = entity.created;
this.properties = entity.getProperties();
this.grant = entity.getGrant();
this.description = entity.getDescription();
this.researchers = entity.getResearchers();
this.organisations = entity.getOrganisations();
this.dmpProperties = entity.getDmpProperties();
this.isPublic = entity.isPublic;
this.project = entity.getProject();
this.setModified(new Date());
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();
this.extraProperties = entity.getExtraProperties();
}
@Override
public UUID getKeys() {
return this.id;
}
@Override
public DMP buildFromTuple(List<Tuple> tuple, List<String> fields, 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, fields ,base.isEmpty() ? "dataset" : base + "." + "dataset")).collect(Collectors.toSet());
this.creator = tuple.stream().map(x -> new UserInfo().buildFromTuple(tuple, fields , base.isEmpty() ? "creator" : base + "." + "creator")).collect(Collectors.toList()).get(0);
return this;
}
}

Some files were not shown because too many files have changed in this diff Show More