Merge branch 'Development'
This commit is contained in:
commit
7cf64c18f2
8
.env
8
.env
|
@ -1,6 +1,6 @@
|
|||
TAG=6.2.1
|
||||
ENV=dev
|
||||
TAG=6.3.0
|
||||
ENV=prod
|
||||
PROFILE=production
|
||||
AOT=no-aot
|
||||
ELASTIC_VERSION=6.2.1
|
||||
AOT=aot
|
||||
ELASTIC_VERSION=6.3.0
|
||||
ELASTIC_PASSWORD=changeme
|
||||
|
|
|
@ -25,3 +25,15 @@ dmp-backend/web/src/main/ui-resources/static/
|
|||
dmp-backend/data/target/data-1.0-SNAPSHOT.jar
|
||||
dmp-backend/data/target/
|
||||
dmp-backend/queryable/target/
|
||||
dmp-backend/elastic/target/
|
||||
dmp-backend/queryengine/target/
|
||||
*.tar
|
||||
*.gz
|
||||
final/
|
||||
temp/
|
||||
*.jar
|
||||
*.lst
|
||||
dmp-frontend/.vscode/
|
||||
*.docx
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TAG=6.2.1
|
||||
ELASTIC_VERSION=6.2.1
|
||||
TAG=6.3.1
|
||||
ELASTIC_VERSION=6.3.1
|
||||
ELASTIC_PASSWORD=changeme
|
||||
|
|
|
@ -100,7 +100,72 @@ services:
|
|||
networks: ['stack']
|
||||
depends_on: ['kibana']
|
||||
|
||||
#volumes:
|
||||
|
||||
##########################DOCSBOX######################################################################
|
||||
web:
|
||||
restart: always
|
||||
build: ./docsbox-master/docsbox
|
||||
expose:
|
||||
- "8000"
|
||||
links:
|
||||
- redis:redis
|
||||
volumes:
|
||||
- docsbox:/home/docsbox
|
||||
- media:/home/docsbox/media
|
||||
command: gunicorn -b :8000 docsbox:app
|
||||
networks: ['stack']
|
||||
|
||||
rqworker:
|
||||
restart: always
|
||||
build: ./docsbox-master/docsbox
|
||||
links:
|
||||
- redis:redis
|
||||
volumes:
|
||||
- web
|
||||
command: rq worker -c docsbox.settings
|
||||
networks: ['stack']
|
||||
|
||||
rqscheduler:
|
||||
restart: always
|
||||
build: ./docsbox-master/docsbox
|
||||
links:
|
||||
- redis:redis
|
||||
volumes:
|
||||
- web
|
||||
command: rqscheduler -H redis -p 6379 -d 0
|
||||
networks: ['stack']
|
||||
|
||||
nginx:
|
||||
restart: always
|
||||
build: ./docsbox-master/nginx/
|
||||
ports:
|
||||
- "81:80"
|
||||
volumes:
|
||||
- web
|
||||
links:
|
||||
- web:web
|
||||
networks: ['stack']
|
||||
|
||||
redis:
|
||||
restart: always
|
||||
image: redis:latest
|
||||
expose:
|
||||
- "6379"
|
||||
volumes:
|
||||
- redisdata:/data
|
||||
networks: ['stack']
|
||||
|
||||
|
||||
##########################SETTIGNS######################################################################
|
||||
|
||||
volumes:
|
||||
#esdata:
|
||||
# driver: local
|
||||
#driver: local
|
||||
redisdata:
|
||||
driver: local
|
||||
docsbox:
|
||||
driver: local
|
||||
media:
|
||||
driver: local
|
||||
networks: {stack: {}}
|
||||
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
FROM openjdk:8-jdk-alpine
|
||||
RUN apk add --update \
|
||||
curl \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
VOLUME /tmp
|
||||
ARG PROFILE=dev
|
||||
ARG PROFILE=production
|
||||
ENV PROF $PROFILE
|
||||
ADD web/src/main/resources/ProjectConfiguration.xml /tmp/ProjectConfiguration.xml
|
||||
ADD web/src/main/resources/ExternalUrls.xml /tmp/ExternalUrls.xml
|
||||
ADD web/target/web-1.0-SNAPSHOT.jar app.jar
|
||||
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=${PROFILE}","-jar","/app.jar"]
|
||||
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom" ,"-Dspring.profiles.active=${PROF}","-jar","/app.jar"]
|
|
@ -21,5 +21,10 @@
|
|||
<artifactId>queryable</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.eudat</groupId>
|
||||
<artifactId>elastic</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,46 @@
|
|||
package eu.eudat.data.converters;
|
||||
|
||||
import org.springframework.format.datetime.DateFormatter;
|
||||
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.Converter;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 9/25/2018.
|
||||
*/
|
||||
@Converter
|
||||
public class DateToUTCConverter implements AttributeConverter<Date, Date> {
|
||||
|
||||
@Override
|
||||
public Date convertToDatabaseColumn(Date attribute) {
|
||||
if(attribute == null) return null;
|
||||
DateFormat formatterIST = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
formatterIST.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
try {
|
||||
String date = formatterIST.format(attribute);
|
||||
return formatterIST.parse(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date convertToEntityAttribute(Date dbData) {
|
||||
if(dbData == null) return null;
|
||||
DateFormat formatterIST = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
formatterIST.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
try {
|
||||
String date = formatterIST.format(dbData);
|
||||
return formatterIST.parse(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.entities.Project;
|
||||
|
||||
import eu.eudat.data.entities.Grant;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -10,39 +11,19 @@ import java.util.UUID;
|
|||
public class DataManagementPlanCriteria extends Criteria<DMP> {
|
||||
private Date periodStart;
|
||||
private Date periodEnd;
|
||||
private List<eu.eudat.data.entities.Grant> grants;
|
||||
private boolean allVersions;
|
||||
private List<UUID> groupIds;
|
||||
|
||||
private List<eu.eudat.data.entities.Project> projects;
|
||||
|
||||
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;
|
||||
}
|
||||
private Integer status;
|
||||
private List<String> organisations;
|
||||
private Integer role;
|
||||
private List<UUID> collaborators;
|
||||
private List<UUID> datasetTemplates;
|
||||
private boolean isPublic;
|
||||
|
||||
public Date getPeriodStart() {
|
||||
return periodStart;
|
||||
}
|
||||
|
||||
public List<Project> getProjects() {
|
||||
return projects;
|
||||
}
|
||||
|
||||
public void setProjects(List<Project> projects) {
|
||||
this.projects = projects;
|
||||
}
|
||||
|
||||
public void setPeriodStart(Date periodStart) {
|
||||
this.periodStart = periodStart;
|
||||
}
|
||||
|
@ -50,9 +31,70 @@ public class DataManagementPlanCriteria extends Criteria<DMP> {
|
|||
public Date getPeriodEnd() {
|
||||
return periodEnd;
|
||||
}
|
||||
|
||||
public void setPeriodEnd(Date periodEnd) {
|
||||
this.periodEnd = periodEnd;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import eu.eudat.data.entities.Dataset;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -12,12 +13,18 @@ public class DatasetCriteria extends Criteria<Dataset> {
|
|||
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;
|
||||
|
||||
public boolean getAllVersions() {
|
||||
return allVersions;
|
||||
}
|
||||
|
||||
public void setAllVersions(boolean allVersions) {
|
||||
this.allVersions = allVersions;
|
||||
}
|
||||
|
@ -25,7 +32,6 @@ public class DatasetCriteria extends Criteria<Dataset> {
|
|||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
@ -33,7 +39,6 @@ public class DatasetCriteria extends Criteria<Dataset> {
|
|||
public Date getPeriodStart() {
|
||||
return periodStart;
|
||||
}
|
||||
|
||||
public void setPeriodStart(Date periodStart) {
|
||||
this.periodStart = periodStart;
|
||||
}
|
||||
|
@ -41,7 +46,6 @@ public class DatasetCriteria extends Criteria<Dataset> {
|
|||
public Date getPeriodEnd() {
|
||||
return periodEnd;
|
||||
}
|
||||
|
||||
public void setPeriodEnd(Date periodEnd) {
|
||||
this.periodEnd = periodEnd;
|
||||
}
|
||||
|
@ -49,8 +53,56 @@ public class DatasetCriteria extends Criteria<Dataset> {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,54 @@ package eu.eudat.data.dao.criteria;
|
|||
|
||||
|
||||
import eu.eudat.data.entities.DatasetProfile;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DatasetProfileCriteria extends Criteria<DatasetProfile> {
|
||||
|
||||
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 DatasetProfile filter");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean allVersions;
|
||||
private List<UUID> groupIds;
|
||||
private Short filter;
|
||||
private UUID userId;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import eu.eudat.data.entities.Dataset;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.eudat.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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import eu.eudat.data.entities.Funder;
|
||||
|
||||
public class FunderCriteria extends Criteria<Funder> {
|
||||
private String reference;
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import eu.eudat.data.entities.Grant;
|
||||
import eu.eudat.types.grant.GrantStateType;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import eu.eudat.data.entities.LoginConfirmationEmail;
|
||||
|
||||
public class LoginConfirmationEmailCriteria extends Criteria<LoginConfirmationEmail>{
|
||||
}
|
|
@ -3,4 +3,20 @@ package eu.eudat.data.dao.criteria;
|
|||
import eu.eudat.data.entities.Organisation;
|
||||
|
||||
public class OrganisationCriteria extends Criteria<Organisation> {
|
||||
private String labelLike;
|
||||
private Boolean isPublic;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,34 +2,13 @@ package eu.eudat.data.dao.criteria;
|
|||
|
||||
import eu.eudat.data.entities.Project;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class ProjectCriteria extends Criteria<Project> {
|
||||
private Date periodStart;
|
||||
private Date periodEnd;
|
||||
private String reference;
|
||||
private String reference;
|
||||
|
||||
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 String getReference() {
|
||||
return reference;
|
||||
}
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,11 +8,11 @@ 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;
|
||||
}
|
||||
|
@ -20,8 +20,14 @@ public class UserInfoCriteria extends Criteria<UserInfo> {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import eu.eudat.queryable.QueryableList;
|
|||
import eu.eudat.queryable.jpa.hibernatequeryablelist.QueryableHibernateList;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
|||
import eu.eudat.data.entities.Content;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -27,6 +28,7 @@ public class ContentDaoImpl extends DatabaseAccess<Content> implements ContentDa
|
|||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public CompletableFuture<Content> createOrUpdateAsync(Content item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import eu.eudat.data.dao.DatabaseAccessLayer;
|
|||
import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
|
||||
import eu.eudat.data.dao.criteria.DatasetWizardUserDmpCriteria;
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.entities.UserDMP;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
|
@ -15,6 +16,6 @@ public interface DMPDao extends DatabaseAccessLayer<DMP, UUID> {
|
|||
|
||||
QueryableList<DMP> getUserDmps(DatasetWizardUserDmpCriteria datasetWizardAutocompleteRequest, UserInfo userInfo);
|
||||
|
||||
QueryableList<DMP> getAuthenticated(QueryableList<DMP> query, UserInfo principal);
|
||||
QueryableList<DMP> getAuthenticated(QueryableList<DMP> query, UUID principalId);
|
||||
|
||||
}
|
|
@ -5,13 +5,16 @@ import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
|
|||
import eu.eudat.data.dao.criteria.DatasetWizardUserDmpCriteria;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.entities.UserDMP;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
@ -29,23 +32,52 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
|
|||
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.like(root.get("label"), "%" + criteria.getLike() + "%"));
|
||||
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.getProjects() != null && !criteria.getProjects().isEmpty())
|
||||
query.where(((builder, root) -> root.get("project").in(criteria.getProjects())));
|
||||
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.equal(externalRoot.get("groupId"), nestedRoot.get("groupId")), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class)));
|
||||
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.getStatus() != null) {
|
||||
if (criteria.getStatus() == DMP.DMPStatus.FINALISED.getValue()) {
|
||||
query.where((builder, root) -> builder.and(builder.equal(root.get("status"), DMP.DMPStatus.FINALISED.getValue()), builder.notEqual(root.get("isPublic"), true)));
|
||||
} 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"), true)));
|
||||
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("id").in(criteria.getDatasetTemplates())));
|
||||
}
|
||||
query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue()));
|
||||
return query;
|
||||
}
|
||||
|
||||
public QueryableList<DMP> getAuthenticated(QueryableList<DMP> query, UserInfo principal) {
|
||||
query.where((builder, root) -> builder.or(builder.equal(root.get("creator"), principal), builder.isMember(principal, root.get("users"))));
|
||||
public QueryableList<DMP> getAuthenticated(QueryableList<DMP> query, UUID principal) {
|
||||
query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).join("user").get("id"), principal));
|
||||
return query;
|
||||
}
|
||||
|
||||
|
@ -78,6 +110,7 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
|
|||
return this.getDatabaseService().getQueryable(DMP.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<DMP> createOrUpdateAsync(DMP item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
|
|
|
@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
|||
import eu.eudat.data.entities.DMPProfile;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -22,6 +23,7 @@ public class DMPProfileDaoImpl extends DatabaseAccess<DMPProfile> implements DMP
|
|||
super(databaseService);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<DMPProfile> createOrUpdateAsync(DMPProfile item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
|
@ -59,7 +61,8 @@ public class DMPProfileDaoImpl extends DatabaseAccess<DMPProfile> implements DMP
|
|||
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(root.get("label"), "%" + criteria.getLike() + "%"));
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
|||
import eu.eudat.data.entities.DataRepository;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -38,6 +39,7 @@ public class DataRepositoryDaoImpl extends DatabaseAccess<DataRepository> implem
|
|||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public CompletableFuture<DataRepository> createOrUpdateAsync(DataRepository item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
}
|
||||
|
|
|
@ -14,4 +14,6 @@ public interface DatasetDao extends DatabaseAccessLayer<Dataset, UUID> {
|
|||
|
||||
QueryableList<Dataset> getAuthenticated(QueryableList<Dataset> query, UserInfo principal);
|
||||
|
||||
Dataset isPublicDataset(UUID id);
|
||||
|
||||
}
|
|
@ -3,14 +3,17 @@ package eu.eudat.data.dao.entities;
|
|||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.criteria.DatasetCriteria;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.entities.Dataset;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
@ -19,17 +22,19 @@ import java.util.concurrent.CompletableFuture;
|
|||
public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDao {
|
||||
|
||||
@Autowired
|
||||
public DatasetDaoImpl(DatabaseService<Dataset> databaseService) {
|
||||
super(databaseService);
|
||||
}
|
||||
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.getLike() != null && !criteria.getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
|
||||
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)
|
||||
|
@ -38,6 +43,18 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
|
|||
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.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()));
|
||||
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.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())));
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -48,18 +65,30 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
|
|||
|
||||
@Override
|
||||
public Dataset find(UUID id) {
|
||||
return getDatabaseService().getQueryable(Dataset.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
|
||||
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.equal((root.get("id")), id)).getSingle();
|
||||
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) {
|
||||
query.where((builder, root) -> builder.or(builder.equal(root.get("dmp").get("creator"), principal), builder.isMember(principal, root.get("dmp").get("users"))
|
||||
, builder.equal(root.get("isPublic"), true)));
|
||||
if (principal.getId() == null) query.where((builder, root) -> builder.equal(root.get("isPublic"), true));
|
||||
else {
|
||||
query.where((builder, root) -> builder.or(builder.equal(root.get("dmp").get("creator"), principal), builder.equal(root.join("dmp", JoinType.LEFT).join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id"), principal.getId())));
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
|
@ -73,6 +102,7 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
|
|||
return this.getDatabaseService().getQueryable(Dataset.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
public CompletableFuture<Dataset> createOrUpdateAsync(Dataset item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import eu.eudat.data.entities.DatasetExternalDataset;
|
|||
import eu.eudat.data.entities.DatasetProfile;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -33,6 +34,7 @@ public class DatasetExternalDatasetDaoImpl extends DatabaseAccess<DatasetExterna
|
|||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public DatasetExternalDataset find(UUID id) {
|
||||
return getDatabaseService().getQueryable(DatasetExternalDataset.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
|
||||
}
|
||||
|
|
|
@ -5,9 +5,14 @@ import eu.eudat.data.dao.criteria.DatasetProfileCriteria;
|
|||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.DatasetProfile;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
|
@ -23,7 +28,31 @@ public class DatasetProfileDaoImpl extends DatabaseAccess<DatasetProfile> implem
|
|||
public QueryableList<DatasetProfile> getWithCriteria(DatasetProfileCriteria criteria) {
|
||||
QueryableList<DatasetProfile> query = getDatabaseService().getQueryable(DatasetProfile.class);
|
||||
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
|
||||
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())));
|
||||
}
|
||||
}
|
||||
query.where(((builder, root) -> builder.notEqual(root.get("status"), DatasetProfile.Status.DELETED.getValue())));
|
||||
return query;
|
||||
}
|
||||
|
||||
|
@ -52,6 +81,7 @@ public class DatasetProfileDaoImpl extends DatabaseAccess<DatasetProfile> implem
|
|||
return this.getDatabaseService().getQueryable(DatasetProfile.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<DatasetProfile> createOrUpdateAsync(DatasetProfile item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
|
|
|
@ -7,6 +7,7 @@ import eu.eudat.data.entities.DatasetProfile;
|
|||
import eu.eudat.data.entities.DatasetService;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -28,6 +29,7 @@ public class DatasetServiceDaoImpl extends DatabaseAccess<DatasetService> implem
|
|||
return this.getDatabaseService().createOrUpdate(item, DatasetService.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<DatasetService> createOrUpdateAsync(DatasetService item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
|
|
|
@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
|||
import eu.eudat.data.entities.ExternalDataset;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -24,7 +25,7 @@ public class ExternalDatasetDaoImpl extends DatabaseAccess<ExternalDataset> impl
|
|||
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.like(root.get("label"), "%" + criteria.getLike() + "%"));
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
|
||||
return query;
|
||||
}
|
||||
|
||||
|
@ -48,6 +49,7 @@ public class ExternalDatasetDaoImpl extends DatabaseAccess<ExternalDataset> impl
|
|||
return this.getDatabaseService().getQueryable(ExternalDataset.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<ExternalDataset> createOrUpdateAsync(ExternalDataset item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.dao.criteria.FunderCriteria;
|
||||
import eu.eudat.data.entities.Funder;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface FunderDao extends DatabaseAccessLayer<Funder, UUID> {
|
||||
|
||||
QueryableList<Funder> getWithCritetia(FunderCriteria criteria);
|
||||
|
||||
QueryableList<Funder> getAuthenticated(QueryableList<Funder> query, UserInfo principal);
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.criteria.FunderCriteria;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.Funder;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Component("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(root.get("reference"), "%" + criteria.getReference() + "%"));
|
||||
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) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.dao.criteria.GrantCriteria;
|
||||
import eu.eudat.data.entities.Grant;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface GrantDao extends DatabaseAccessLayer<Grant, UUID> {
|
||||
|
||||
QueryableList<Grant> getWithCriteria(GrantCriteria criteria);
|
||||
|
||||
QueryableList<Grant> getAuthenticated(QueryableList<Grant> query, UserInfo principal);
|
||||
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.criteria.GrantCriteria;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.entities.Grant;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.types.grant.GrantStateType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import 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.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.getFunderId() != null && !criteria.getFunderId().trim().isEmpty())
|
||||
query.where((builder, root) -> builder.equal(root.get("funder").get("id"), UUID.fromString(criteria.getFunderId())));
|
||||
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.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;
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
|||
import eu.eudat.data.entities.Invitation;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -45,6 +46,7 @@ public class InvitationDaoImpl extends DatabaseAccess<Invitation> implements Inv
|
|||
return this.getDatabaseService().getQueryable(Invitation.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<Invitation> createOrUpdateAsync(Invitation item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.dao.criteria.LoginConfirmationEmailCriteria;
|
||||
import eu.eudat.data.entities.LoginConfirmationEmail;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface LoginConfirmationEmailDao extends DatabaseAccessLayer<LoginConfirmationEmail, UUID> {
|
||||
|
||||
QueryableList<LoginConfirmationEmail> getWithCriteria(LoginConfirmationEmailCriteria criteria);
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.criteria.LoginConfirmationEmailCriteria;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.LoginConfirmationEmail;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
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 LoginConfirmationEmailDaoImpl extends DatabaseAccess<LoginConfirmationEmail> implements LoginConfirmationEmailDao {
|
||||
|
||||
@Autowired
|
||||
public LoginConfirmationEmailDaoImpl(DatabaseService<LoginConfirmationEmail> databaseService) {
|
||||
super(databaseService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<LoginConfirmationEmail> getWithCriteria(LoginConfirmationEmailCriteria criteria) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginConfirmationEmail createOrUpdate(LoginConfirmationEmail item) {
|
||||
return this.getDatabaseService().createOrUpdate(item, LoginConfirmationEmail.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<LoginConfirmationEmail> createOrUpdateAsync(LoginConfirmationEmail item) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginConfirmationEmail find(UUID id) {
|
||||
return this.getDatabaseService().getQueryable(LoginConfirmationEmail.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginConfirmationEmail find(UUID id, String hint) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(LoginConfirmationEmail item) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<LoginConfirmationEmail> asQueryable() {
|
||||
return this.getDatabaseService().getQueryable(LoginConfirmationEmail.class);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package eu.eudat.data.dao.entities;
|
|||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.dao.criteria.OrganisationCriteria;
|
||||
import eu.eudat.data.entities.Organisation;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -10,5 +11,6 @@ import java.util.UUID;
|
|||
public interface OrganisationDao extends DatabaseAccessLayer<Organisation, UUID> {
|
||||
|
||||
QueryableList<Organisation> getWithCriteria(OrganisationCriteria criteria);
|
||||
QueryableList<Organisation> getAuthenticated(QueryableList<Organisation> query, UserInfo principal);
|
||||
|
||||
}
|
|
@ -3,11 +3,15 @@ package eu.eudat.data.dao.entities;
|
|||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.criteria.OrganisationCriteria;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.entities.Organisation;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
|
@ -24,6 +28,12 @@ public class OrganisationDaoImpl extends DatabaseAccess<Organisation> implements
|
|||
QueryableList<Organisation> query = this.getDatabaseService().getQueryable(Organisation.class);
|
||||
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()));
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
|
@ -47,11 +57,17 @@ public class OrganisationDaoImpl extends DatabaseAccess<Organisation> implements
|
|||
return this.getDatabaseService().getQueryable(Organisation.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<Organisation> createOrUpdateAsync(Organisation item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
}
|
||||
|
||||
public QueryableList<Organisation> getAuthenticated(QueryableList<Organisation> query, UserInfo principal) {
|
||||
query.where((builder, root) -> builder.equal(root.join("dmps").get("creator"), principal));
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Organisation find(UUID id, String hint) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
|
|
@ -10,8 +10,7 @@ import java.util.UUID;
|
|||
|
||||
public interface ProjectDao extends DatabaseAccessLayer<Project, UUID> {
|
||||
|
||||
QueryableList<Project> getWithCriteria(ProjectCriteria criteria);
|
||||
QueryableList<Project> getWithCritetia(ProjectCriteria criteria);
|
||||
|
||||
QueryableList<Project> getAuthenticated(QueryableList<Project> query, UserInfo principal);
|
||||
|
||||
}
|
||||
QueryableList<Project> getAuthenticated(QueryableList<Project> query, UserInfo principal);
|
||||
}
|
||||
|
|
|
@ -6,68 +6,64 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
|||
import eu.eudat.data.entities.Project;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Component("projectDao")
|
||||
@Service("projectDao")
|
||||
public class ProjectDaoImpl extends DatabaseAccess<Project> implements ProjectDao {
|
||||
|
||||
@Autowired
|
||||
public ProjectDaoImpl(DatabaseService<Project> databaseService) {
|
||||
super(databaseService);
|
||||
}
|
||||
public ProjectDaoImpl(DatabaseService<Project> databaseService) {
|
||||
super(databaseService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<Project> getWithCriteria(ProjectCriteria criteria) {
|
||||
QueryableList<Project> query = getDatabaseService().getQueryable(Project.class);
|
||||
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
|
||||
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.equal(root.get("reference"), criteria.getReference()));
|
||||
query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue()));
|
||||
return query;
|
||||
}
|
||||
@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() + "%"));
|
||||
query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue()));
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project createOrUpdate(Project item) {
|
||||
return getDatabaseService().createOrUpdate(item, Project.class);
|
||||
}
|
||||
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 find(UUID id) {
|
||||
return getDatabaseService().getQueryable(Project.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
|
||||
}
|
||||
@Override
|
||||
public Project createOrUpdate(Project item) {
|
||||
return this.getDatabaseService().createOrUpdate(item, Project.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Project item) {
|
||||
this.getDatabaseService().delete(item);
|
||||
}
|
||||
@Override
|
||||
public CompletableFuture<Project> createOrUpdateAsync(Project item) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<Project> asQueryable() {
|
||||
return this.getDatabaseService().getQueryable(Project.class);
|
||||
}
|
||||
@Override
|
||||
public Project find(UUID id) {
|
||||
return this.getDatabaseService().getQueryable(Project.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
|
||||
}
|
||||
|
||||
public QueryableList<Project> getAuthenticated(QueryableList<Project> query, UserInfo principal) {
|
||||
query.where((builder, root) -> builder.or(builder.equal(root.get("creationUser"), principal), builder.isMember(principal, root.join("dmps", JoinType.LEFT).get("users")))).distinct();
|
||||
return query;
|
||||
}
|
||||
@Override
|
||||
public Project find(UUID id, String hint) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Project> createOrUpdateAsync(Project item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
}
|
||||
@Override
|
||||
public void delete(Project item) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project find(UUID id, String hint) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@Override
|
||||
public QueryableList<Project> asQueryable() {
|
||||
return this.getDatabaseService().getQueryable(Project.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
|||
import eu.eudat.data.entities.Registry;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -47,6 +48,7 @@ public class RegistryDaoImpl extends DatabaseAccess<Registry> implements Registr
|
|||
return this.getDatabaseService().getQueryable(Registry.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<Registry> createOrUpdateAsync(Registry item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
|
|
|
@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
|||
import eu.eudat.data.entities.Researcher;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -21,11 +22,11 @@ public class ResearcherDaoImpl extends DatabaseAccess<Researcher> implements Res
|
|||
|
||||
@Override
|
||||
public QueryableList<Researcher> getWithCriteria(ResearcherCriteria criteria) {
|
||||
QueryableList<Researcher> query = this.getDatabaseService().getQueryable(Researcher.class);
|
||||
if (criteria.getLike() != null)
|
||||
query.where((builder, root) -> builder.equal(root.get("reference"), criteria.getLike()));
|
||||
if (criteria.getName() != null)
|
||||
query.where((builder, root) -> builder.equal(root.get("label"), criteria.getName()));
|
||||
QueryableList<Researcher> query = asQueryable();
|
||||
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
||||
query.where((builder, root) ->builder.or(builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%")));
|
||||
if (criteria.getName() != null && !criteria.getName().isEmpty())
|
||||
query.where((builder, root) ->builder.or(builder.like(builder.upper(root.get("label")), "%" + criteria.getName().toUpperCase() + "%")));
|
||||
return query;
|
||||
}
|
||||
|
||||
|
@ -49,6 +50,7 @@ public class ResearcherDaoImpl extends DatabaseAccess<Researcher> implements Res
|
|||
return this.getDatabaseService().getQueryable(Researcher.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<Researcher> createOrUpdateAsync(Researcher item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
|
|
|
@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
|||
import eu.eudat.data.entities.Service;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -47,6 +48,7 @@ public class ServiceDaoImpl extends DatabaseAccess<Service> implements ServiceDa
|
|||
return this.getDatabaseService().getQueryable(Service.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<Service> createOrUpdateAsync(Service item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
|
|
|
@ -5,6 +5,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
|||
import eu.eudat.data.entities.UserDMP;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -41,6 +42,7 @@ public class UserDmpDaoImpl extends DatabaseAccess<UserDMP> implements UserDmpDa
|
|||
return this.getDatabaseService().getQueryable(UserDMP.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<UserDMP> createOrUpdateAsync(UserDMP item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
|
|
|
@ -11,4 +11,5 @@ public interface UserInfoDao extends DatabaseAccessLayer<UserInfo, UUID> {
|
|||
|
||||
QueryableList<UserInfo> getWithCriteria(UserInfoCriteria criteria);
|
||||
|
||||
QueryableList<UserInfo> getAuthenticated(QueryableList<UserInfo> users, UUID principalId);
|
||||
}
|
|
@ -5,59 +5,76 @@ import eu.eudat.data.dao.criteria.UserInfoCriteria;
|
|||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
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);
|
||||
}
|
||||
@Autowired
|
||||
public UserInfoDaoImpl(DatabaseService<UserInfo> databaseService) {
|
||||
super(databaseService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<UserInfo> getWithCriteria(UserInfoCriteria criteria) {
|
||||
QueryableList<UserInfo> users = this.getDatabaseService().getQueryable(UserInfo.class);
|
||||
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(root.get("name"), "%" + criteria.getLike() + "%"), builder.like(root.get("email"), "%" + criteria.getLike() + "%")));
|
||||
if (criteria.getEmail() != null)
|
||||
users.where((builder, root) -> builder.equal(root.get("email"), criteria.getEmail()));
|
||||
return users;
|
||||
}
|
||||
@Override
|
||||
public QueryableList<UserInfo> getWithCriteria(UserInfoCriteria criteria) {
|
||||
QueryableList<UserInfo> users = this.getDatabaseService().getQueryable(UserInfo.class);
|
||||
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 UserInfo createOrUpdate(UserInfo item) {
|
||||
return this.getDatabaseService().createOrUpdate(item, UserInfo.class);
|
||||
}
|
||||
@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 find(UUID id) {
|
||||
return this.getDatabaseService().getQueryable(UserInfo.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
|
||||
}
|
||||
@Override
|
||||
public UserInfo createOrUpdate(UserInfo item) {
|
||||
return this.getDatabaseService().createOrUpdate(item, UserInfo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(UserInfo item) {
|
||||
this.getDatabaseService().delete(item);
|
||||
}
|
||||
@Override
|
||||
public UserInfo find(UUID id) {
|
||||
return this.getDatabaseService().getQueryable(UserInfo.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<UserInfo> asQueryable() {
|
||||
return this.getDatabaseService().getQueryable(UserInfo.class);
|
||||
}
|
||||
@Override
|
||||
public void delete(UserInfo item) {
|
||||
this.getDatabaseService().delete(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<UserInfo> createOrUpdateAsync(UserInfo item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
}
|
||||
@Override
|
||||
public QueryableList<UserInfo> asQueryable() {
|
||||
return this.getDatabaseService().getQueryable(UserInfo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserInfo find(UUID id, String hint) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@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();
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import eu.eudat.data.entities.UserInfo;
|
|||
import eu.eudat.data.entities.UserRole;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -57,6 +58,7 @@ public class UserRoleDaoImpl extends DatabaseAccess<UserRole> implements UserRol
|
|||
return this.getDatabaseService().getQueryable(UserRole.class);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public CompletableFuture<UserRole> createOrUpdateAsync(UserRole item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
@ -13,134 +15,141 @@ import java.util.UUID;
|
|||
@Table(name = "\"Content\"")
|
||||
public class Content implements DataEntity<Content, UUID> {
|
||||
|
||||
public enum ParentType {
|
||||
PROJECT(0);
|
||||
public enum ParentType {
|
||||
GRANT(0);
|
||||
|
||||
private int value;
|
||||
private int value;
|
||||
|
||||
private ParentType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
private ParentType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static ParentType fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return PROJECT;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Content Parent Type Status");
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
public enum LocationType {
|
||||
EXTERNAL(0), INTERNAL(1);
|
||||
|
||||
private Integer value;
|
||||
private Integer value;
|
||||
|
||||
private LocationType(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
private LocationType(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
@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 = "\"Filename\"", nullable = false)
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Extension\"", nullable = false)
|
||||
private String extension;
|
||||
@Column(name = "\"Extension\"", nullable = false)
|
||||
private String extension;
|
||||
|
||||
@Column(name = "\"ParentType\"", nullable = false)
|
||||
private Integer parentType;
|
||||
@Column(name = "\"ParentType\"", nullable = false)
|
||||
private Integer parentType;
|
||||
|
||||
@Column(name = "\"Uri\"", nullable = false)
|
||||
private String uri;
|
||||
@Column(name = "\"Uri\"", nullable = false)
|
||||
private String uri;
|
||||
|
||||
@Column(name = "\"LocationType\"", nullable = false)
|
||||
private Integer locationType;
|
||||
@Column(name = "\"LocationType\"", nullable = false)
|
||||
private Integer locationType;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getExtension() {
|
||||
return extension;
|
||||
}
|
||||
public String getExtension() {
|
||||
return extension;
|
||||
}
|
||||
|
||||
public void setExtension(String extension) {
|
||||
this.extension = extension;
|
||||
}
|
||||
public void setExtension(String extension) {
|
||||
this.extension = extension;
|
||||
}
|
||||
|
||||
public Integer getParentType() {
|
||||
return parentType;
|
||||
}
|
||||
public Integer getParentType() {
|
||||
return parentType;
|
||||
}
|
||||
|
||||
public void setParentType(Integer parentType) {
|
||||
this.parentType = parentType;
|
||||
}
|
||||
public void setParentType(Integer parentType) {
|
||||
this.parentType = parentType;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public Integer getLocationType() {
|
||||
return locationType;
|
||||
}
|
||||
public Integer getLocationType() {
|
||||
return locationType;
|
||||
}
|
||||
|
||||
public void setLocationType(Integer locationType) {
|
||||
this.locationType = 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 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 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,143 +1,157 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
|
||||
import 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")})
|
||||
@NamedEntityGraph(
|
||||
name = "credentialUserInfo",
|
||||
attributeNodes = {@NamedAttributeNode("userInfo")})
|
||||
})
|
||||
public class Credential implements DataEntity<Credential,UUID> {
|
||||
public class Credential implements DataEntity<Credential, UUID> {
|
||||
|
||||
@Id
|
||||
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
@Id
|
||||
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"UserId\"", nullable = false)
|
||||
private UserInfo userInfo;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"UserId\"", nullable = false)
|
||||
private UserInfo userInfo;
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Integer status;
|
||||
@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 = "\"Secret\"", nullable = false)
|
||||
private String secret;
|
||||
@Column(name = "\"CreationTime\"", nullable = false)
|
||||
private Date creationTime;
|
||||
@Column(name = "\"LastUpdateTime\"", nullable = false)
|
||||
private Date lastUpdateTime;
|
||||
@Column(name = "\"Provider\"", nullable = false)
|
||||
private Integer provider;
|
||||
@Column(name = "\"Public\"", nullable = false)
|
||||
private String publicValue;
|
||||
@Column(name = "\"Secret\"", nullable = false)
|
||||
private String secret;
|
||||
|
||||
@Column(name = "\"ExternalId\"", nullable = false)
|
||||
private String externalId;
|
||||
@Column(name = "\"CreationTime\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date creationTime;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
@Column(name = "\"LastUpdateTime\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date lastUpdateTime;
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
@Column(name = "\"ExternalId\"", nullable = false)
|
||||
private String externalId;
|
||||
|
||||
public UserInfo getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setUserInfo(UserInfo userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
public UserInfo getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
public void setUserInfo(UserInfo userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
public Integer getProvider() {
|
||||
return provider;
|
||||
}
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setProvider(Integer provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getPublicValue() {
|
||||
return publicValue;
|
||||
}
|
||||
public Integer getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setPublicValue(String publicValue) {
|
||||
this.publicValue = publicValue;
|
||||
}
|
||||
public void setProvider(Integer provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public String getSecret() {
|
||||
return secret;
|
||||
}
|
||||
public String getPublicValue() {
|
||||
return publicValue;
|
||||
}
|
||||
|
||||
public void setSecret(String secret) {
|
||||
this.secret = secret;
|
||||
}
|
||||
public void setPublicValue(String publicValue) {
|
||||
this.publicValue = publicValue;
|
||||
}
|
||||
|
||||
public Date getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
public String getSecret() {
|
||||
return secret;
|
||||
}
|
||||
|
||||
public void setCreationTime(Date creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
public void setSecret(String secret) {
|
||||
this.secret = secret;
|
||||
}
|
||||
|
||||
public Date getLastUpdateTime() {
|
||||
return lastUpdateTime;
|
||||
}
|
||||
public Date getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
public void setLastUpdateTime(Date lastUpdateTime) {
|
||||
this.lastUpdateTime = lastUpdateTime;
|
||||
}
|
||||
public void setCreationTime(Date creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
|
||||
public String getExternalId() {
|
||||
return externalId;
|
||||
}
|
||||
public Date getLastUpdateTime() {
|
||||
return lastUpdateTime;
|
||||
}
|
||||
|
||||
public void setExternalId(String externalId) {
|
||||
this.externalId = externalId;
|
||||
}
|
||||
public void setLastUpdateTime(Date lastUpdateTime) {
|
||||
this.lastUpdateTime = lastUpdateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
public String getExternalId() {
|
||||
return externalId;
|
||||
}
|
||||
|
||||
Credential that = (Credential) o;
|
||||
public void setExternalId(String externalId) {
|
||||
this.externalId = externalId;
|
||||
}
|
||||
|
||||
return provider.intValue() == that.provider.intValue();
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return provider.intValue();
|
||||
}
|
||||
Credential that = (Credential) o;
|
||||
|
||||
@Override
|
||||
public void update(Credential entity) {
|
||||
this.status = entity.status;
|
||||
this.publicValue = entity.getPublicValue();
|
||||
this.secret = entity.getSecret();
|
||||
this.lastUpdateTime = new Date();
|
||||
}
|
||||
return provider.intValue() == that.provider.intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return provider.intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Credential entity) {
|
||||
this.status = entity.status;
|
||||
this.publicValue = entity.getPublicValue();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Entity
|
||||
|
@ -14,13 +15,16 @@ import java.util.*;
|
|||
@NamedEntityGraphs({
|
||||
@NamedEntityGraph(
|
||||
name = "dataManagementPlanListingModel",
|
||||
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"),
|
||||
@NamedAttributeNode("project"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode("dataset")}
|
||||
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"), @NamedAttributeNode("associatedDmps"),
|
||||
@NamedAttributeNode("grant"), @NamedAttributeNode(value = "users", subgraph = "users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode("dataset")},
|
||||
subgraphs = {
|
||||
@NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")}),
|
||||
}
|
||||
),
|
||||
@NamedEntityGraph(
|
||||
name = "fullyDetailed",
|
||||
attributeNodes = {
|
||||
@NamedAttributeNode("project"), @NamedAttributeNode("profile"),
|
||||
@NamedAttributeNode("grant"), @NamedAttributeNode("profile"),
|
||||
@NamedAttributeNode("users"), @NamedAttributeNode("organisations"), @NamedAttributeNode("researchers")}),
|
||||
@NamedEntityGraph(
|
||||
name = "dmpRecentActivity",
|
||||
|
@ -30,7 +34,7 @@ import java.util.*;
|
|||
public class DMP implements DataEntity<DMP, UUID> {
|
||||
|
||||
public enum DMPStatus {
|
||||
ACTIVE((short) 0), DELETED((short) 1);
|
||||
ACTIVE((short) 0), FINALISED((short) 1),DELETED((short) 99);
|
||||
|
||||
private short value;
|
||||
|
||||
|
@ -47,6 +51,8 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
case 0:
|
||||
return ACTIVE;
|
||||
case 1:
|
||||
return FINALISED;
|
||||
case 99:
|
||||
return DELETED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported DMP Status");
|
||||
|
@ -80,13 +86,20 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"Project\"")
|
||||
private Project project;
|
||||
@JoinColumn(name = "\"Grant\"")
|
||||
private Grant grant;
|
||||
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
/*@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"AssociatedDmps\"", columnDefinition = "xml", nullable = true)
|
||||
private String associatedDmps;
|
||||
private String associatedDmps;*/
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"DMPDatasetProfile\"",
|
||||
joinColumns = {@JoinColumn(name = "\"dmp\"", referencedColumnName = "\"ID\"")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "\"datasetprofile\"", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private Set<DatasetProfile> associatedDmps;
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"Profile\"")
|
||||
|
@ -114,12 +127,13 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
private Set<Researcher> researchers;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@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<UserInfo> users;
|
||||
)*/
|
||||
private Set<UserDMP> users;
|
||||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
|
@ -132,79 +146,80 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
private String dmpProperties;
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date modified = new Date();
|
||||
|
||||
|
||||
@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;
|
||||
|
||||
@Column(name = "\"DOI\"")
|
||||
private String doi;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"Project\"")
|
||||
private Project project;
|
||||
|
||||
|
||||
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<UserInfo> getUsers() {
|
||||
public Set<UserDMP> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(Set<UserInfo> users) {
|
||||
public void setUsers(Set<UserDMP> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -212,7 +227,6 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
public UUID getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(UUID groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
@ -220,7 +234,6 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
@ -228,31 +241,27 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
public Integer getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(Integer version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
public Grant getGrant() {
|
||||
return grant;
|
||||
}
|
||||
public void setGrant(Grant grant) {
|
||||
this.grant = grant;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public String getAssociatedDmps() {
|
||||
public Set<DatasetProfile> getAssociatedDmps() {
|
||||
return associatedDmps;
|
||||
}
|
||||
|
||||
public void setAssociatedDmps(String associatedDmps) {
|
||||
public void setAssociatedDmps(Set<DatasetProfile> associatedDmps) {
|
||||
this.associatedDmps = associatedDmps;
|
||||
}
|
||||
|
||||
public DMPProfile getProfile() {
|
||||
return profile;
|
||||
}
|
||||
|
||||
public void setProfile(DMPProfile profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
@ -260,7 +269,6 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
public Set<Dataset> getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public void setDataset(Set<Dataset> dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
@ -268,7 +276,6 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
public Set<Organisation> getOrganisations() {
|
||||
return organisations;
|
||||
}
|
||||
|
||||
public void setOrganisations(Set<Organisation> organisations) {
|
||||
this.organisations = organisations;
|
||||
}
|
||||
|
@ -276,7 +283,6 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
public Set<Researcher> getResearchers() {
|
||||
return researchers;
|
||||
}
|
||||
|
||||
public void setResearchers(Set<Researcher> researchers) {
|
||||
this.researchers = researchers;
|
||||
}
|
||||
|
@ -284,7 +290,6 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
public String getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(String properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
@ -292,11 +297,45 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
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 String getDoi() {
|
||||
return doi;
|
||||
}
|
||||
public void setDoi(String doi) {
|
||||
this.doi = doi;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DMP entity) {
|
||||
this.associatedDmps = entity.associatedDmps;
|
||||
|
@ -305,13 +344,18 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
this.status = entity.getStatus();
|
||||
this.created = entity.created;
|
||||
this.properties = entity.getProperties();
|
||||
this.project = entity.getProject();
|
||||
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();
|
||||
if (entity.getDoi() != null && entity.getDoi().trim().isEmpty()) this.doi = entity.doi;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -319,4 +363,11 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -15,6 +18,33 @@ import java.util.UUID;
|
|||
@Table(name = "\"DMPProfile\"")
|
||||
public class DMPProfile implements DataEntity<DMPProfile, UUID> {
|
||||
|
||||
public enum Status {
|
||||
SAVED((short) 0), FINALIZED((short) 1), DELETED((short) 99);
|
||||
|
||||
private short value;
|
||||
|
||||
private Status(short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public short getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Status fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return SAVED;
|
||||
case 1:
|
||||
return FINALIZED;
|
||||
case 99:
|
||||
return DELETED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Dmp Profile Status");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
|
@ -39,9 +69,11 @@ public class DMPProfile implements DataEntity<DMPProfile, UUID> {
|
|||
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date modified = new Date();
|
||||
|
||||
public int getStatus() {
|
||||
|
@ -105,10 +137,18 @@ public class DMPProfile implements DataEntity<DMPProfile, UUID> {
|
|||
this.modified = new Date();
|
||||
this.definition = entity.getDefinition();
|
||||
this.label = entity.getLabel();
|
||||
this.status= entity.getStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DMPProfile 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
@ -8,143 +9,151 @@ import org.hibernate.annotations.Type;
|
|||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"DataRepository\"")
|
||||
public class DataRepository implements Serializable, DataEntity<DataRepository,UUID> {
|
||||
public class DataRepository implements Serializable, DataEntity<DataRepository, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
|
||||
@Column(name = "\"Reference\"", nullable = false)
|
||||
private String reference;
|
||||
@Column(name = "\"Reference\"", nullable = false)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "dataRepository", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetDataRepository> datasetDataRepositories;
|
||||
@OneToMany(mappedBy = "dataRepository", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetDataRepository> datasetDataRepositories;
|
||||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Set<DatasetDataRepository> getDatasetDataRepositories() {
|
||||
return datasetDataRepositories;
|
||||
}
|
||||
public Set<DatasetDataRepository> getDatasetDataRepositories() {
|
||||
return datasetDataRepositories;
|
||||
}
|
||||
|
||||
public void setDatasetDataRepositories(Set<DatasetDataRepository> datasetDataRepositories) {
|
||||
this.datasetDataRepositories = datasetDataRepositories;
|
||||
}
|
||||
public void setDatasetDataRepositories(Set<DatasetDataRepository> datasetDataRepositories) {
|
||||
this.datasetDataRepositories = datasetDataRepositories;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DataRepository entity) {
|
||||
@Override
|
||||
public void update(DataRepository entity) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataRepository 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
@ -12,312 +14,311 @@ import java.util.stream.Collectors;
|
|||
@Entity
|
||||
@Table(name = "\"Dataset\"")
|
||||
@NamedEntityGraphs({
|
||||
@NamedEntityGraph(
|
||||
name = "datasetListingModel",
|
||||
attributeNodes = {@NamedAttributeNode("services"), @NamedAttributeNode("datasetDataRepositories"), @NamedAttributeNode("datasetExternalDatasets"), @NamedAttributeNode("registries"),
|
||||
@NamedAttributeNode(value = "dmp", subgraph = "dmp"), @NamedAttributeNode("profile"), @NamedAttributeNode("creator")},
|
||||
subgraphs = @NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users")})),
|
||||
@NamedEntityGraph(
|
||||
name = "datasetWizardModel",
|
||||
attributeNodes = {@NamedAttributeNode("services"), @NamedAttributeNode("datasetDataRepositories"), @NamedAttributeNode("datasetExternalDatasets"), @NamedAttributeNode("registries"),
|
||||
@NamedAttributeNode("dmp"), @NamedAttributeNode("profile"), @NamedAttributeNode("creator")}),
|
||||
@NamedEntityGraph(
|
||||
name = "datasetRecentActivity",
|
||||
attributeNodes = {@NamedAttributeNode(value = "dmp", subgraph = "dmp"), @NamedAttributeNode("creator")},
|
||||
subgraphs = @NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users")}))
|
||||
@NamedEntityGraph(
|
||||
name = "datasetListingModel",
|
||||
attributeNodes = {@NamedAttributeNode("services"), @NamedAttributeNode(value = "datasetDataRepositories", subgraph = "datasetDataRepositories"),
|
||||
@NamedAttributeNode(value = "datasetExternalDatasets", subgraph = "datasetExternalDatasets"), @NamedAttributeNode("registries"),
|
||||
@NamedAttributeNode(value = "dmp", subgraph = "dmp"), @NamedAttributeNode("profile"), @NamedAttributeNode("creator")},
|
||||
subgraphs = {
|
||||
@NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users"), @NamedAttributeNode("grant"), @NamedAttributeNode("organisations")}),
|
||||
@NamedSubgraph(name = "datasetDataRepositories", attributeNodes = {@NamedAttributeNode("dataRepository")}),
|
||||
@NamedSubgraph(name = "datasetExternalDatasets", attributeNodes = {@NamedAttributeNode("externalDataset")})
|
||||
}),
|
||||
|
||||
@NamedEntityGraph(
|
||||
name = "datasetWizardModel",
|
||||
attributeNodes = {@NamedAttributeNode("services"), @NamedAttributeNode("datasetDataRepositories"), @NamedAttributeNode("datasetExternalDatasets"), @NamedAttributeNode("registries"),
|
||||
@NamedAttributeNode("dmp"), @NamedAttributeNode("profile"), @NamedAttributeNode("creator")}),
|
||||
@NamedEntityGraph(
|
||||
name = "datasetRecentActivity",
|
||||
attributeNodes = {@NamedAttributeNode(value = "dmp", subgraph = "dmp")},
|
||||
subgraphs = @NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("users")})),
|
||||
@NamedEntityGraph(
|
||||
name = "datasetDataRepositories",
|
||||
attributeNodes = {@NamedAttributeNode(value = "dmp", subgraph = "dmp"), @NamedAttributeNode("creator")},
|
||||
subgraphs = @NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users")}))
|
||||
})
|
||||
public class Dataset implements DataEntity<Dataset, UUID> {
|
||||
|
||||
public static Set<String> getHints() {
|
||||
return hints;
|
||||
}
|
||||
public static Set<String> getHints() {
|
||||
return hints;
|
||||
}
|
||||
|
||||
private static final Set<String> hints = new HashSet<>(Arrays.asList("datasetListingModel"));
|
||||
private static final Set<String> hints = new HashSet<>(Arrays.asList("datasetListingModel"));
|
||||
|
||||
public enum Status {
|
||||
SAVED((short) 0), FINALISED((short) 1), DELETED((short) 99);
|
||||
public enum Status {
|
||||
SAVED((short) 0), FINALISED((short) 1), CANCELED((short) 2), DELETED((short) 99),;
|
||||
|
||||
private short value;
|
||||
private short value;
|
||||
|
||||
private Status(short value) {
|
||||
this.value = value;
|
||||
}
|
||||
private Status(short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public short getValue() {
|
||||
return value;
|
||||
}
|
||||
public short getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Status fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return SAVED;
|
||||
case 1:
|
||||
return FINALISED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Project Status");
|
||||
}
|
||||
}
|
||||
}
|
||||
public static Status fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return SAVED;
|
||||
case 1:
|
||||
return FINALISED;
|
||||
case 2:
|
||||
return CANCELED;
|
||||
case 99:
|
||||
return DELETED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Dataset Status");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||
@JoinColumn(name = "\"DMP\"", nullable = true)
|
||||
private DMP dmp;
|
||||
@JoinColumn(name = "\"DMP\"", nullable = false)
|
||||
private DMP dmp;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Properties\"", columnDefinition = "xml", nullable = true)
|
||||
private String properties;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Properties\"", columnDefinition = "xml", nullable = true)
|
||||
private String properties;
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
//@Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||
@JoinColumn(name = "\"Profile\"", nullable = true)
|
||||
private DatasetProfile profile;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
//@Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||
@JoinColumn(name = "\"Profile\"", nullable = true)
|
||||
private DatasetProfile profile;
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"DatasetRegistry\"",
|
||||
joinColumns = {@JoinColumn(name = "\"Dataset\"", referencedColumnName = "\"ID\"")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "\"Registry\"", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private Set<Registry> registries;
|
||||
|
||||
@OneToMany(mappedBy = "dataset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetDataRepository> datasetDataRepositories;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
@OneToMany(mappedBy = "dataset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetService> services;
|
||||
|
||||
@OneToMany(mappedBy = "dataset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetExternalDataset> datasetExternalDatasets;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"DatasetRegistry\"",
|
||||
joinColumns = {@JoinColumn(name = "\"Dataset\"", referencedColumnName = "\"ID\"")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "\"Registry\"", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private Set<Registry> registries;
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "dataset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetDataRepository> datasetDataRepositories;
|
||||
@Column(name = "\"Created\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date modified = new Date();
|
||||
|
||||
@OneToMany(mappedBy = "dataset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetService> services;
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"Creator\"", nullable = true)
|
||||
private UserInfo creator;
|
||||
|
||||
@OneToMany(mappedBy = "dataset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetExternalDataset> datasetExternalDatasets;
|
||||
@Column(name = "\"Description\"")
|
||||
private String description;
|
||||
|
||||
@Column(name= "\"FinalizedAt\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date finalizedAt;
|
||||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "\"IsPublic\"", nullable = false)
|
||||
private boolean isPublic;
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"Creator\"", nullable = true)
|
||||
private UserInfo creator;
|
||||
|
||||
@Column(name = "\"Description\"")
|
||||
private String description;
|
||||
|
||||
|
||||
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<Registry> getRegistries() {
|
||||
return registries;
|
||||
}
|
||||
|
||||
|
||||
public void setRegistries(Set<Registry> registries) {
|
||||
this.registries = registries;
|
||||
}
|
||||
|
||||
public Set<DatasetService> getServices() {
|
||||
return services;
|
||||
}
|
||||
|
||||
public void setServices(Set<DatasetService> services) {
|
||||
this.services = services;
|
||||
}
|
||||
|
||||
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 DMP getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
|
||||
|
||||
public void setDmp(DMP dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
|
||||
public String getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
public void setProperties(String properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
|
||||
public DatasetProfile getProfile() {
|
||||
return profile;
|
||||
}
|
||||
|
||||
|
||||
public void setProfile(DatasetProfile profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
|
||||
public Set<DatasetDataRepository> getDatasetDataRepositories() {
|
||||
return datasetDataRepositories;
|
||||
}
|
||||
|
||||
public void setDatasetDataRepositories(Set<DatasetDataRepository> datasetDataRepositories) {
|
||||
this.datasetDataRepositories = datasetDataRepositories;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public Set<DatasetExternalDataset> getDatasetExternalDatasets() {
|
||||
return datasetExternalDatasets;
|
||||
}
|
||||
|
||||
public void setDatasetExternalDatasets(Set<DatasetExternalDataset> datasetExternalDatasets) {
|
||||
this.datasetExternalDatasets = datasetExternalDatasets;
|
||||
}
|
||||
|
||||
public boolean isPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(boolean aPublic) {
|
||||
isPublic = aPublic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Dataset entity) {
|
||||
this.setRegistries(entity.getRegistries());
|
||||
if(this.getDatasetDataRepositories()==null) this.setDatasetDataRepositories(new HashSet<>());
|
||||
if(!this.getDatasetDataRepositories().containsAll(entity.getDatasetDataRepositories())){
|
||||
this.getDatasetDataRepositories().removeAll(this.getDatasetDataRepositories());
|
||||
this.getDatasetDataRepositories().addAll(entity.getDatasetDataRepositories().stream().map(item->{
|
||||
item.setDataset(this);
|
||||
return item;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
this.setDescription(entity.getDescription());
|
||||
this.setLabel(entity.getLabel());
|
||||
this.setProperties(entity.getProperties());
|
||||
if(this.getDatasetExternalDatasets()==null) this.setDatasetExternalDatasets(new HashSet<>());
|
||||
if(!this.getDatasetExternalDatasets().containsAll(entity.getDatasetExternalDatasets())) {
|
||||
this.getDatasetExternalDatasets().removeAll(this.getDatasetExternalDatasets());
|
||||
this.getDatasetExternalDatasets().addAll(entity.getDatasetExternalDatasets().stream().map(item -> {
|
||||
item.setDataset(this);
|
||||
return item;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
this.setStatus(entity.getStatus());
|
||||
this.setProfile(entity.getProfile());
|
||||
this.setModified(new Date());
|
||||
if (entity.getCreator() != null) this.creator = entity.getCreator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
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<Registry> getRegistries() {
|
||||
return registries;
|
||||
}
|
||||
public void setRegistries(Set<Registry> registries) {
|
||||
this.registries = registries;
|
||||
}
|
||||
|
||||
public Set<DatasetService> getServices() {
|
||||
return services;
|
||||
}
|
||||
public void setServices(Set<DatasetService> services) {
|
||||
this.services = services;
|
||||
}
|
||||
|
||||
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 DMP getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
public void setDmp(DMP dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
|
||||
public String getProperties() {
|
||||
return properties;
|
||||
}
|
||||
public void setProperties(String properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
|
||||
public DatasetProfile getProfile() {
|
||||
return profile;
|
||||
}
|
||||
public void setProfile(DatasetProfile profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
|
||||
public Set<DatasetDataRepository> getDatasetDataRepositories() {
|
||||
return datasetDataRepositories;
|
||||
}
|
||||
public void setDatasetDataRepositories(Set<DatasetDataRepository> datasetDataRepositories) {
|
||||
this.datasetDataRepositories = datasetDataRepositories;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public Set<DatasetExternalDataset> getDatasetExternalDatasets() {
|
||||
return datasetExternalDatasets;
|
||||
}
|
||||
public void setDatasetExternalDatasets(Set<DatasetExternalDataset> datasetExternalDatasets) {
|
||||
this.datasetExternalDatasets = datasetExternalDatasets;
|
||||
}
|
||||
|
||||
public Date getFinalizedAt() {
|
||||
return finalizedAt;
|
||||
}
|
||||
public void setFinalizedAt(Date finalizedAt) {
|
||||
this.finalizedAt = finalizedAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Dataset entity) {
|
||||
this.setRegistries(entity.getRegistries());
|
||||
if (this.getDatasetDataRepositories() == null) this.setDatasetDataRepositories(new HashSet<>());
|
||||
if (!this.getDatasetDataRepositories().containsAll(entity.getDatasetDataRepositories())) {
|
||||
this.getDatasetDataRepositories().removeAll(this.getDatasetDataRepositories());
|
||||
this.getDatasetDataRepositories().addAll(entity.getDatasetDataRepositories().stream().map(item -> {
|
||||
item.setDataset(this);
|
||||
return item;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
this.setUri(entity.getUri());
|
||||
this.setDescription(entity.getDescription());
|
||||
this.setLabel(entity.getLabel());
|
||||
this.setProperties(entity.getProperties());
|
||||
if (this.getDatasetExternalDatasets() == null) this.setDatasetExternalDatasets(new HashSet<>());
|
||||
if (!this.getDatasetExternalDatasets().containsAll(entity.getDatasetExternalDatasets())) {
|
||||
this.getDatasetExternalDatasets().removeAll(this.getDatasetExternalDatasets());
|
||||
this.getDatasetExternalDatasets().addAll(entity.getDatasetExternalDatasets().stream().map(item -> {
|
||||
item.setDataset(this);
|
||||
return item;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
if (this.getServices() == null) this.setServices(new HashSet<>());
|
||||
if(!this.getServices().containsAll(entity.getServices())) {
|
||||
this.getServices().removeAll(this.getServices());
|
||||
this.getServices().addAll(entity.getServices());
|
||||
}
|
||||
this.setDmp(entity.getDmp());
|
||||
this.setStatus(entity.getStatus());
|
||||
this.setProfile(entity.getProfile());
|
||||
this.setModified(new Date());
|
||||
if (entity.getStatus().equals(Status.FINALISED.getValue())) this.setFinalizedAt(new Date());
|
||||
if (entity.getCreator() != null) this.creator = entity.getCreator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dataset 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
@ -13,78 +14,84 @@ import java.util.UUID;
|
|||
|
||||
@Entity
|
||||
@Table(name = "\"DatasetDataRepository\"")
|
||||
public class DatasetDataRepository implements DataEntity<DatasetDataRepository,UUID> {
|
||||
public class DatasetDataRepository implements DataEntity<DatasetDataRepository, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"Dataset\"", nullable = false)
|
||||
private Dataset dataset;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"Dataset\"", nullable = false)
|
||||
private Dataset dataset;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"DataRepository\"", nullable = false)
|
||||
private DataRepository dataRepository;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"DataRepository\"", nullable = false)
|
||||
private DataRepository dataRepository;
|
||||
|
||||
@Column(name = "\"Role\"")
|
||||
private Integer role;
|
||||
@Column(name = "\"Role\"")
|
||||
private Integer role;
|
||||
|
||||
@Column(name = "\"Data\"")
|
||||
private String data;
|
||||
|
||||
@Column(name = "\"Data\"")
|
||||
private String data;
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Dataset getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public Dataset getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
public void setDataset(Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
public void setDataset(Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
public DataRepository getDataRepository() {
|
||||
return dataRepository;
|
||||
}
|
||||
|
||||
public DataRepository getDataRepository() {
|
||||
return dataRepository;
|
||||
}
|
||||
public void setDataRepository(DataRepository dataRepository) {
|
||||
this.dataRepository = dataRepository;
|
||||
}
|
||||
|
||||
public void setDataRepository(DataRepository dataRepository) {
|
||||
this.dataRepository = dataRepository;
|
||||
}
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
@Override
|
||||
public void update(DatasetDataRepository entity) {
|
||||
this.dataset = entity.getDataset();
|
||||
this.dataRepository = entity.getDataRepository();
|
||||
this.role = entity.getRole();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DatasetDataRepository entity) {
|
||||
this.dataset = entity.getDataset();
|
||||
this.dataRepository = entity.getDataRepository();
|
||||
this.role = entity.getRole();
|
||||
}
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public DatasetDataRepository 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,88 +1,95 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"DatasetExternalDataset\"")
|
||||
public class DatasetExternalDataset implements DataEntity<DatasetExternalDataset,UUID> {
|
||||
public class DatasetExternalDataset implements DataEntity<DatasetExternalDataset, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"Dataset\"", nullable = false)
|
||||
private Dataset dataset;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"ExternalDataset\"", nullable = false)
|
||||
private ExternalDataset externalDataset;
|
||||
|
||||
@Column(name = "\"Role\"")
|
||||
private Integer role;
|
||||
|
||||
@Column(name = "\"Data\"")
|
||||
private String data;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"Dataset\"", nullable = false)
|
||||
private Dataset dataset;
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"ExternalDataset\"", nullable = false)
|
||||
private ExternalDataset externalDataset;
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "\"Role\"")
|
||||
private Integer role;
|
||||
public Dataset getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
@Column(name = "\"Data\"")
|
||||
private String data;
|
||||
public void setDataset(Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
public ExternalDataset getExternalDataset() {
|
||||
return externalDataset;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public void setExternalDataset(ExternalDataset externalDataset) {
|
||||
this.externalDataset = externalDataset;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public Dataset getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public void setDataset(Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public ExternalDataset getExternalDataset() {
|
||||
return externalDataset;
|
||||
}
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public void setExternalDataset(ExternalDataset externalDataset) {
|
||||
this.externalDataset = externalDataset;
|
||||
}
|
||||
@Override
|
||||
public void update(DatasetExternalDataset entity) {
|
||||
this.dataset = entity.getDataset();
|
||||
this.externalDataset = entity.getExternalDataset();
|
||||
this.role = entity.getRole();
|
||||
}
|
||||
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DatasetExternalDataset entity) {
|
||||
this.dataset = entity.getDataset();
|
||||
this.externalDataset = entity.getExternalDataset();
|
||||
this.role = entity.getRole();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public DatasetExternalDataset 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,47 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"DatasetProfile\"")
|
||||
public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
|
||||
public class DatasetProfile implements DataEntity<DatasetProfile,UUID>{
|
||||
|
||||
public enum Status {
|
||||
SAVED((short) 0), FINALIZED((short) 1), DELETED((short) 99);
|
||||
|
||||
private short value;
|
||||
|
||||
private Status(short value) {
|
||||
this.value = value;
|
||||
}
|
||||
public short getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Status fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return SAVED;
|
||||
case 1:
|
||||
return FINALIZED;
|
||||
case 99:
|
||||
return DELETED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Dataset Profile Status");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
|
@ -31,108 +59,111 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
|
|||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
||||
private String definition;
|
||||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date created;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date modified = new Date();
|
||||
|
||||
@Column(name = "\"Description\"")
|
||||
private String description;
|
||||
|
||||
@Column(name = "\"GroupId\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID groupId;
|
||||
|
||||
@Column(name = "\"Version\"", nullable = false)
|
||||
private Short version;
|
||||
|
||||
@ManyToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"DMPDatasetProfile\"",
|
||||
joinColumns = {@JoinColumn(name = "\"datasetprofile\"", referencedColumnName = "\"ID\"")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "\"dmp\"", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private List<DMP> dmps;
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
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 UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(UUID id) { this.id = id;}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
|
||||
public Set<Dataset> getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public void setDataset(Set<Dataset> dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
public UUID getGroupId() { return groupId; }
|
||||
public void setGroupId(UUID groupId) { this.groupId = groupId;}
|
||||
|
||||
public Short getVersion() { return version; }
|
||||
public void setVersion(Short version) { this.version = version; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + "]";
|
||||
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + ", version=" + version + "]";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update(DatasetProfile entity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasetProfile buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,9 @@ package eu.eudat.data.entities;
|
|||
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
|
@ -14,77 +13,84 @@ import java.util.UUID;
|
|||
@Table(name = "\"DatasetService\"")
|
||||
public class DatasetService implements DataEntity<DatasetService, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"Dataset\"", nullable = false)
|
||||
private Dataset dataset;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"Dataset\"", nullable = false)
|
||||
private Dataset dataset;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"Service\"", nullable = false)
|
||||
private Service service;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "\"Service\"", nullable = false)
|
||||
private Service service;
|
||||
|
||||
@Column(name = "\"Role\"")
|
||||
private Integer role;
|
||||
@Column(name = "\"Role\"")
|
||||
private Integer role;
|
||||
|
||||
@Column(name = "\"Data\"")
|
||||
private String data;
|
||||
@Column(name = "\"Data\"")
|
||||
private String data;
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Dataset getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
public Dataset getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public void setDataset(Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
public void setDataset(Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
public Service getService() {
|
||||
return service;
|
||||
}
|
||||
public Service getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
public void setService(Service service) {
|
||||
this.service = service;
|
||||
}
|
||||
public void setService(Service service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DatasetService entity) {
|
||||
this.dataset = entity.getDataset();
|
||||
this.service = entity.getService();
|
||||
this.role = entity.getRole();
|
||||
}
|
||||
@Override
|
||||
public void update(DatasetService entity) {
|
||||
this.dataset = entity.getDataset();
|
||||
this.service = entity.getService();
|
||||
this.role = entity.getRole();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasetService buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
String currentBase = base.isEmpty() ? "" : base + ".";
|
||||
if(fields.contains(currentBase + "id")) this.id = UUID.fromString((String) tuple.get(0).get(currentBase + "id"));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -14,8 +17,6 @@ import java.util.UUID;
|
|||
public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
@ -29,9 +30,11 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
|
|||
private String reference;
|
||||
|
||||
@Column(name = "\"Created\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date created;
|
||||
|
||||
@Column(name = "\"Modified\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date modified;
|
||||
|
||||
@OneToMany(mappedBy = "externalDataset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
|
@ -104,4 +107,11 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
|
|||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExternalDataset 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,174 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"Funder\"")
|
||||
public class Funder implements DataEntity<Funder, UUID> {
|
||||
|
||||
public enum Status {
|
||||
ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99);
|
||||
|
||||
private short value;
|
||||
|
||||
Status(short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public short getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Status fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return INACTIVE;
|
||||
case 1:
|
||||
return ACTIVE;
|
||||
case 99:
|
||||
return DELETED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Funder Status");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum FunderType {
|
||||
EXTERNAL(0), INTERNAL(1);
|
||||
|
||||
private Integer value;
|
||||
|
||||
FunderType(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static FunderType fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return EXTERNAL;
|
||||
case 1:
|
||||
return INTERNAL;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Grant Type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
@Column(name = "\"Type\"")
|
||||
private Integer type;
|
||||
|
||||
|
||||
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 getReference() {
|
||||
return reference;
|
||||
}
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
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 Integer getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Funder entity) {
|
||||
this.label = entity.getLabel();
|
||||
this.reference = entity.getReference();
|
||||
this.definition = entity.getDefinition();
|
||||
this.status = entity.getStatus();
|
||||
this.created = entity.getCreated();
|
||||
this.modified = new Date();
|
||||
this.type = entity.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Funder buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,301 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"Grant\"")
|
||||
@NamedEntityGraphs({
|
||||
@NamedEntityGraph(
|
||||
name = "grantRecentActivity",
|
||||
attributeNodes = {@NamedAttributeNode(value = "dmps", subgraph = "dmps")},
|
||||
subgraphs = @NamedSubgraph(name = "dmps", attributeNodes = {@NamedAttributeNode("users")})
|
||||
),
|
||||
@NamedEntityGraph(
|
||||
name = "grantListingItem",
|
||||
attributeNodes = {@NamedAttributeNode(value = "dmps", subgraph = "dmps"), @NamedAttributeNode(value = "content")},
|
||||
subgraphs = @NamedSubgraph(name = "dmps", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("grant"), @NamedAttributeNode("users")})
|
||||
)
|
||||
})
|
||||
public class Grant implements DataEntity<Grant, UUID> {
|
||||
|
||||
public enum Status {
|
||||
ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99);
|
||||
|
||||
private short value;
|
||||
|
||||
private Status(short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public short getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Status fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return INACTIVE;
|
||||
case 1:
|
||||
return ACTIVE;
|
||||
case 99:
|
||||
return DELETED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Grant Status");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum GrantType {
|
||||
EXTERNAL(0), INTERNAL(1);
|
||||
|
||||
private Integer value;
|
||||
|
||||
private GrantType(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static GrantType fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return EXTERNAL;
|
||||
case 1:
|
||||
return INTERNAL;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Grant Type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "grant")
|
||||
private Set<DMP> dmps;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
@Column(name = "\"StartDate\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date startdate = null;
|
||||
|
||||
@Column(name = "\"EndDate\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date enddate = null;
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"CreationUser\"", nullable = true)
|
||||
private UserInfo creationUser;
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
@Column(name = "\"Description\"")
|
||||
private String description;
|
||||
|
||||
@Column(name = "\"Type\"")
|
||||
private Integer type;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"Content\"")
|
||||
private Content content;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"Funder\"")
|
||||
private Funder funder;
|
||||
|
||||
public Grant() {
|
||||
}
|
||||
|
||||
public Grant(Grant grant) {
|
||||
this.id = grant.getId();
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
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 Date getStartdate() {
|
||||
return startdate;
|
||||
}
|
||||
public void setStartdate(Date startdate) {
|
||||
this.startdate = startdate;
|
||||
}
|
||||
|
||||
public Date getEnddate() {
|
||||
return enddate;
|
||||
}
|
||||
public void setEnddate(Date enddate) {
|
||||
this.enddate = enddate;
|
||||
}
|
||||
|
||||
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 getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Set<DMP> getDmps() {
|
||||
return dmps;
|
||||
}
|
||||
public void setDmps(Set<DMP> dmps) {
|
||||
this.dmps = dmps;
|
||||
}
|
||||
|
||||
public UserInfo getCreationUser() {
|
||||
return creationUser;
|
||||
}
|
||||
public void setCreationUser(UserInfo creationUser) {
|
||||
this.creationUser = creationUser;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Content getContent() {
|
||||
return content;
|
||||
}
|
||||
public void setContent(Content content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Funder getFunder() {
|
||||
return funder;
|
||||
}
|
||||
public void setFunder(Funder funder) {
|
||||
this.funder = funder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Grant entity) {
|
||||
this.description = entity.getDescription();
|
||||
this.label = entity.getLabel();
|
||||
this.abbreviation = entity.getAbbreviation();
|
||||
this.created = entity.getCreated();
|
||||
this.definition = entity.getDefinition();
|
||||
this.dmps = entity.getDmps();
|
||||
this.startdate = entity.getStartdate();
|
||||
this.enddate = entity.getEnddate();
|
||||
this.modified = new Date();
|
||||
this.uri = entity.getUri();
|
||||
this.funder = entity.getFunder();
|
||||
if (entity.getContent() != null) this.content = entity.getContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Grant buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
String currentBase = base.isEmpty() ? "" : base + ".";
|
||||
if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id");
|
||||
if (fields.contains(currentBase + "dmps"))
|
||||
this.dmps = tuple.stream().map(x -> new DMP().buildFromTuple(Arrays.asList(x), fields, currentBase + "dmps")).collect(Collectors.toSet());
|
||||
if (fields.contains(currentBase + "creationUser"))
|
||||
this.creationUser = tuple.stream().map(x -> new UserInfo().buildFromTuple(Arrays.asList(x), fields, currentBase + "creationUser")).collect(Collectors.toList()).get(0);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,107 +1,116 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"Invitation\"")
|
||||
public class Invitation implements DataEntity<Invitation,UUID> {
|
||||
public class Invitation implements DataEntity<Invitation, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"Id\"", updatable = false, nullable = false)
|
||||
private UUID id;
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"Id\"", updatable = false, nullable = false)
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"InvitationEmail\"", nullable = false)
|
||||
private String invitationEmail;
|
||||
@Column(name = "\"InvitationEmail\"", nullable = false)
|
||||
private String invitationEmail;
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "\"CreationUser\"", nullable = false)
|
||||
private UserInfo user;
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "\"CreationUser\"", nullable = false)
|
||||
private UserInfo user;
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "\"Dmp\"", nullable = false)
|
||||
private DMP dmp;
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "\"Dmp\"", nullable = false)
|
||||
private DMP dmp;
|
||||
|
||||
@Column(name = "\"Token\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID token;
|
||||
@Column(name = "\"Token\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID token;
|
||||
|
||||
@Column(name = "\"AcceptedInvitation\"", nullable = false)
|
||||
private boolean acceptedInvitation;
|
||||
@Column(name = "\"AcceptedInvitation\"", nullable = false)
|
||||
private boolean acceptedInvitation;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Properties\"", columnDefinition = "xml", nullable = true)
|
||||
private String properties;
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Properties\"", columnDefinition = "xml", nullable = true)
|
||||
private String properties;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getInvitationEmail() {
|
||||
return invitationEmail;
|
||||
}
|
||||
public String getInvitationEmail() {
|
||||
return invitationEmail;
|
||||
}
|
||||
|
||||
public void setInvitationEmail(String invitationEmail) {
|
||||
this.invitationEmail = invitationEmail;
|
||||
}
|
||||
public void setInvitationEmail(String invitationEmail) {
|
||||
this.invitationEmail = invitationEmail;
|
||||
}
|
||||
|
||||
public UserInfo getUser() {
|
||||
return user;
|
||||
}
|
||||
public UserInfo getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(UserInfo user) {
|
||||
this.user = user;
|
||||
}
|
||||
public void setUser(UserInfo user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public DMP getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
public DMP getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
|
||||
public void setDmp(DMP dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
public void setDmp(DMP dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
public UUID getToken() {
|
||||
return token;
|
||||
}
|
||||
public UUID getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(UUID token) {
|
||||
this.token = token;
|
||||
}
|
||||
public void setToken(UUID token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public String getProperties() {
|
||||
return properties;
|
||||
}
|
||||
public String getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(String properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
public void setProperties(String properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public boolean getAcceptedInvitation() {
|
||||
return acceptedInvitation;
|
||||
}
|
||||
public boolean getAcceptedInvitation() {
|
||||
return acceptedInvitation;
|
||||
}
|
||||
|
||||
public void setAcceptedInvitation(boolean acceptedInvitation) {
|
||||
this.acceptedInvitation = acceptedInvitation;
|
||||
}
|
||||
public void setAcceptedInvitation(boolean acceptedInvitation) {
|
||||
this.acceptedInvitation = acceptedInvitation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Invitation entity) {
|
||||
@Override
|
||||
public void update(Invitation entity) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Invitation 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"LoginConfirmationEmail\"")
|
||||
public class LoginConfirmationEmail implements DataEntity<LoginConfirmationEmail, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false)
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"email\"", nullable = false)
|
||||
private String email;
|
||||
|
||||
@Column(name = "\"isConfirmed\"", nullable = false)
|
||||
private boolean isConfirmed;
|
||||
|
||||
@Column(name = "\"token\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID token;
|
||||
|
||||
@Column(name = "\"userId\"", nullable = false)
|
||||
private UUID userId;
|
||||
|
||||
@Column(name = "\"expiresAt\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date expiresAt;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public boolean getIsConfirmed() {
|
||||
return isConfirmed;
|
||||
}
|
||||
public void setIsConfirmed(boolean confirmed) {
|
||||
isConfirmed = confirmed;
|
||||
}
|
||||
|
||||
public UUID getToken() {
|
||||
return token;
|
||||
}
|
||||
public void setToken(UUID token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public UUID getUserId() {
|
||||
return userId;
|
||||
}
|
||||
public void setUserId(UUID userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Date getExpiresAt() {
|
||||
return expiresAt;
|
||||
}
|
||||
public void setExpiresAt(Date expiresAt) {
|
||||
this.expiresAt = expiresAt;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update(LoginConfirmationEmail entity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginConfirmationEmail buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
@ -8,12 +9,18 @@ import org.hibernate.annotations.Type;
|
|||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"Organisation\"")
|
||||
@NamedEntityGraphs({
|
||||
@NamedEntityGraph(
|
||||
name = "organisationRecentActivity",
|
||||
attributeNodes = {@NamedAttributeNode(value = "dmps")}
|
||||
)
|
||||
})
|
||||
public class Organisation implements Serializable, DataEntity<Organisation,UUID> {
|
||||
|
||||
@Id
|
||||
|
@ -39,60 +46,49 @@ public class Organisation implements Serializable, DataEntity<Organisation,UUID>
|
|||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"DMPOrganisation\"",
|
||||
joinColumns = {@JoinColumn(name = "\"Organisation\"", referencedColumnName = "\"ID\"")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private Set<DMP> dMPs;
|
||||
|
||||
private Set<DMP> dmps;
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date modified = new Date();
|
||||
|
||||
|
||||
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 UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -100,7 +96,6 @@ public class Organisation implements Serializable, DataEntity<Organisation,UUID>
|
|||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
@ -108,7 +103,6 @@ public class Organisation implements Serializable, DataEntity<Organisation,UUID>
|
|||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
@ -116,7 +110,6 @@ public class Organisation implements Serializable, DataEntity<Organisation,UUID>
|
|||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
@ -124,7 +117,6 @@ public class Organisation implements Serializable, DataEntity<Organisation,UUID>
|
|||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
@ -132,20 +124,17 @@ public class Organisation implements Serializable, DataEntity<Organisation,UUID>
|
|||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Set<DMP> getdMPs() {
|
||||
return dMPs;
|
||||
public Set<DMP> getDmps() {
|
||||
return dmps;
|
||||
}
|
||||
|
||||
public void setdMPs(Set<DMP> dMPs) {
|
||||
this.dMPs = dMPs;
|
||||
public void setDmps(Set<DMP> dmps) {
|
||||
this.dmps = dmps;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update(Organisation entity) {
|
||||
|
||||
|
@ -155,4 +144,11 @@ public class Organisation implements Serializable, DataEntity<Organisation,UUID>
|
|||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Organisation 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,295 +1,291 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"Project\"")
|
||||
@NamedEntityGraphs({
|
||||
@NamedEntityGraph(
|
||||
name = "projectRecentActivity",
|
||||
attributeNodes = {@NamedAttributeNode(value = "dmps", subgraph = "dmps")},
|
||||
subgraphs = @NamedSubgraph(name = "dmps", attributeNodes = {@NamedAttributeNode("users")})
|
||||
),
|
||||
@NamedEntityGraph(
|
||||
name = "projectListingItem",
|
||||
attributeNodes = {@NamedAttributeNode(value = "dmps", subgraph = "dmps"), @NamedAttributeNode(value = "content")},
|
||||
subgraphs = @NamedSubgraph(name = "dmps", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users")})
|
||||
)
|
||||
})
|
||||
public class Project implements DataEntity<Project, UUID> {
|
||||
|
||||
public enum Status {
|
||||
ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99);
|
||||
public enum Status {
|
||||
ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99);
|
||||
|
||||
private short value;
|
||||
|
||||
Status(short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public short getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
private short value;
|
||||
|
||||
private Status(short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public short getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Status fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return INACTIVE;
|
||||
case 1:
|
||||
return ACTIVE;
|
||||
case 99:
|
||||
return DELETED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Project Status");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ProjectType {
|
||||
EXTERNAL(0), INTERNAL(1);
|
||||
|
||||
private Integer value;
|
||||
|
||||
private ProjectType(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static ProjectType fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return EXTERNAL;
|
||||
case 1:
|
||||
return INTERNAL;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Project Type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "project")
|
||||
private Set<DMP> dmps;
|
||||
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
|
||||
@Column(name = "\"StartDate\"", nullable = false)
|
||||
private Date startdate = null;
|
||||
|
||||
@Column(name = "\"EndDate\"", nullable = false)
|
||||
private Date enddate = null;
|
||||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"CreationUser\"", nullable = true)
|
||||
private UserInfo creationUser;
|
||||
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
@Column(name = "\"Description\"")
|
||||
private String description;
|
||||
|
||||
@Column(name = "\"Type\"")
|
||||
private Integer type;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"Content\"")
|
||||
private Content content;
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
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 Date getStartdate() {
|
||||
return startdate;
|
||||
}
|
||||
|
||||
public void setStartdate(Date startdate) {
|
||||
this.startdate = startdate;
|
||||
}
|
||||
|
||||
public Date getEnddate() {
|
||||
return enddate;
|
||||
}
|
||||
|
||||
public void setEnddate(Date enddate) {
|
||||
this.enddate = enddate;
|
||||
}
|
||||
|
||||
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 getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
|
||||
public Set<DMP> getDmps() {
|
||||
return dmps;
|
||||
}
|
||||
|
||||
public void setDmps(Set<DMP> dmps) {
|
||||
this.dmps = dmps;
|
||||
}
|
||||
|
||||
public UserInfo getCreationUser() {
|
||||
return creationUser;
|
||||
}
|
||||
|
||||
public void setCreationUser(UserInfo creationUser) {
|
||||
this.creationUser = creationUser;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Content getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(Content content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Project entity) {
|
||||
this.description = entity.getDescription();
|
||||
this.label = entity.getLabel();
|
||||
this.abbreviation = entity.getAbbreviation();
|
||||
this.created = entity.getCreated();
|
||||
this.definition = entity.getDefinition();
|
||||
this.dmps = entity.getDmps();
|
||||
this.enddate = entity.getEnddate();
|
||||
this.modified = new Date();
|
||||
if (entity.getContent() != null) this.content = entity.getContent();
|
||||
//this.creationUser = entity.getCreationUser(); //TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
public static Status fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return INACTIVE;
|
||||
case 1:
|
||||
return ACTIVE;
|
||||
case 99:
|
||||
return DELETED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Project Status");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ProjectType {
|
||||
EXTERNAL(0), INTERNAL(1);
|
||||
|
||||
private Integer value;
|
||||
|
||||
ProjectType(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static ProjectType fromInteger(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return EXTERNAL;
|
||||
case 1:
|
||||
return INTERNAL;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Project Type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@OneToMany(mappedBy = "project")
|
||||
private Set<DMP> dmps;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
@Column(name = "\"StartDate\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date startdate = null;
|
||||
|
||||
@Column(name = "\"EndDate\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date enddate = null;
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"CreationUser\"", nullable = true)
|
||||
private UserInfo creationUser;
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
@Column(name = "\"Description\"")
|
||||
private String description;
|
||||
|
||||
@Column(name = "\"Type\"")
|
||||
private Integer type;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"Content\"")
|
||||
private Content content;
|
||||
|
||||
public Project() {
|
||||
}
|
||||
|
||||
public Project(Project project) {this.id = project.getId();}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Set<DMP> getDmps() {
|
||||
return dmps;
|
||||
}
|
||||
public void setDmps(Set<DMP> dmps) {
|
||||
this.dmps = dmps;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Date getStartdate() {
|
||||
return startdate;
|
||||
}
|
||||
public void setStartdate(Date startdate) {
|
||||
this.startdate = startdate;
|
||||
}
|
||||
|
||||
public Date getEnddate() {
|
||||
return enddate;
|
||||
}
|
||||
public void setEnddate(Date enddate) {
|
||||
this.enddate = enddate;
|
||||
}
|
||||
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public UserInfo getCreationUser() {
|
||||
return creationUser;
|
||||
}
|
||||
public void setCreationUser(UserInfo creationUser) {
|
||||
this.creationUser = creationUser;
|
||||
}
|
||||
|
||||
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 String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Content getContent() {
|
||||
return content;
|
||||
}
|
||||
public void setContent(Content content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Project entity) {
|
||||
this.description = entity.getDescription();
|
||||
this.label = entity.getLabel();
|
||||
this.abbreviation = entity.getAbbreviation();
|
||||
this.created = entity.getCreated();
|
||||
this.definition = entity.getDefinition();
|
||||
this.dmps = entity.getDmps();
|
||||
this.startdate = entity.getStartdate();
|
||||
this.enddate = entity.getEnddate();
|
||||
this.modified = new Date();
|
||||
this.uri = entity.getUri();
|
||||
if (entity.getContent() != null) this.content = entity.getContent();
|
||||
}
|
||||
|
||||
public Project projectFromGrant(Grant grant) {
|
||||
Project project = new Project();
|
||||
project.setDescription(grant.getDescription());
|
||||
project.setLabel(grant.getLabel());
|
||||
project.setAbbreviation(grant.getAbbreviation());
|
||||
project.setCreated(new Date());
|
||||
project.setDefinition(grant.getDefinition());
|
||||
project.setDmps(grant.getDmps());
|
||||
project.setStartdate(grant.getStartdate());
|
||||
project.setEnddate(grant.getEnddate());
|
||||
project.setModified(new Date());
|
||||
project.setUri(grant.getUri());
|
||||
project.setContent(grant.getContent());
|
||||
project.setReference(grant.getReference());
|
||||
project.setStatus(grant.getStatus());
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
String currentBase = base.isEmpty() ? "" : base + ".";
|
||||
if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id");
|
||||
if (fields.contains(currentBase + "dmps"))
|
||||
this.dmps = tuple.stream().map(x -> new DMP().buildFromTuple(Arrays.asList(x), fields, currentBase + "dmps")).collect(Collectors.toSet());
|
||||
if (fields.contains(currentBase + "creationUser"))
|
||||
this.creationUser = tuple.stream().map(x -> new UserInfo().buildFromTuple(Arrays.asList(x), fields, currentBase + "creationUser")).collect(Collectors.toList()).get(0);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,156 +1,165 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"Registry\"")
|
||||
public class Registry implements DataEntity<Registry,UUID> {
|
||||
public class Registry implements DataEntity<Registry, UUID> {
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
@Id
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
|
||||
@Column(name = "\"Reference\"", nullable = true)
|
||||
private String reference;
|
||||
@Column(name = "\"Reference\"", nullable = true)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"DatasetRegistry\"",
|
||||
joinColumns = {@JoinColumn(name = "\"Registry\"", referencedColumnName = "\"ID\"")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "\"Dataset\"", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private Set<Dataset> datasets;
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"DatasetRegistry\"",
|
||||
joinColumns = {@JoinColumn(name = "\"Registry\"", referencedColumnName = "\"ID\"")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "\"Dataset\"", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private Set<Dataset> datasets;
|
||||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
@Column(name = "\"Created\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
@Column(name = "\"Modified\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date modified = new Date();
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Set<Dataset> getDatasets() {
|
||||
return datasets;
|
||||
}
|
||||
public Set<Dataset> getDatasets() {
|
||||
return datasets;
|
||||
}
|
||||
|
||||
public void setDatasets(Set<Dataset> datasets) {
|
||||
this.datasets = datasets;
|
||||
}
|
||||
public void setDatasets(Set<Dataset> datasets) {
|
||||
this.datasets = datasets;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update(Registry entity) {
|
||||
@Override
|
||||
public void update(Registry entity) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Registry 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,157 +1,169 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"Researcher\"")
|
||||
public class Researcher implements DataEntity<Researcher,UUID> {
|
||||
public class Researcher implements DataEntity<Researcher, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Column(name = "\"PrimaryEmail\"")
|
||||
private String primaryEmail;
|
||||
@Column(name = "\"PrimaryEmail\"")
|
||||
private String primaryEmail;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"DMPResearcher\"",
|
||||
joinColumns = {@JoinColumn(name = "\"Researcher\"", referencedColumnName = "\"ID\"")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private Set<DMP> dMPs;
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"DMPResearcher\"",
|
||||
joinColumns = {@JoinColumn(name = "\"Researcher\"", referencedColumnName = "\"ID\"")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private Set<DMP> dMPs;
|
||||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
@Column(name = "\"Created\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
@Column(name = "\"Modified\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date modified = new Date();
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getPrimaryEmail() {
|
||||
return primaryEmail;
|
||||
}
|
||||
public String getPrimaryEmail() {
|
||||
return primaryEmail;
|
||||
}
|
||||
|
||||
public void setPrimaryEmail(String primaryEmail) {
|
||||
this.primaryEmail = primaryEmail;
|
||||
}
|
||||
public void setPrimaryEmail(String primaryEmail) {
|
||||
this.primaryEmail = primaryEmail;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Set<DMP> getdMPs() {
|
||||
return dMPs;
|
||||
}
|
||||
public Set<DMP> getdMPs() {
|
||||
return dMPs;
|
||||
}
|
||||
|
||||
public void setdMPs(Set<DMP> dMPs) {
|
||||
this.dMPs = dMPs;
|
||||
}
|
||||
public void setdMPs(Set<DMP> dMPs) {
|
||||
this.dMPs = dMPs;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update(Researcher entity) {
|
||||
@Override
|
||||
public void update(Researcher entity) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Researcher 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -15,138 +16,145 @@ import java.util.UUID;
|
|||
@Table(name = "\"Service\"")
|
||||
public class Service implements DataEntity<Service, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
@Id
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
|
||||
@Column(name = "\"Reference\"", nullable = true)
|
||||
private String reference;
|
||||
@Column(name = "\"Reference\"", nullable = true)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
||||
private String definition;
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
||||
private String definition;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "service", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetService> services;
|
||||
@OneToMany(mappedBy = "service", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetService> services;
|
||||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
@Column(name = "\"Created\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
@Column(name = "\"Modified\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date modified = new Date();
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Set<DatasetService> getServices() {
|
||||
return services;
|
||||
}
|
||||
public Set<DatasetService> getServices() {
|
||||
return services;
|
||||
}
|
||||
|
||||
public void setServices(Set<DatasetService> services) {
|
||||
this.services = services;
|
||||
}
|
||||
public void setServices(Set<DatasetService> services) {
|
||||
this.services = services;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Service entity) {
|
||||
@Override
|
||||
public void update(Service entity) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Service buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
String currentBase = base.isEmpty() ? "" : base + ".";
|
||||
if (fields.contains(currentBase + "id")) this.id = UUID.fromString((String) tuple.get(0).get(currentBase + "id"));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,97 +1,106 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"UserDMP\"")
|
||||
public class UserDMP implements DataEntity<UserDMP, UUID> {
|
||||
|
||||
public enum UserDMPRoles {
|
||||
OWNER(0), USER(1);
|
||||
public enum UserDMPRoles {
|
||||
OWNER(0), USER(1);
|
||||
|
||||
private Integer value;
|
||||
private Integer value;
|
||||
|
||||
private UserDMPRoles(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
private UserDMPRoles(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static UserDMPRoles fromInteger(Integer value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return OWNER;
|
||||
case 1:
|
||||
return USER;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported User Dmp Role Message Code");
|
||||
}
|
||||
}
|
||||
}
|
||||
public static UserDMPRoles fromInteger(Integer value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return OWNER;
|
||||
case 1:
|
||||
return USER;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported User Dmp Role Message Code");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "usr")
|
||||
private UserInfo user;
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "usr")
|
||||
private UserInfo user;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "dmp")
|
||||
private DMP dmp;
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "dmp")
|
||||
private DMP dmp;
|
||||
|
||||
@Column(name = "role")
|
||||
private Integer role;
|
||||
@Column(name = "role")
|
||||
private Integer role;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UserInfo getUser() {
|
||||
return user;
|
||||
}
|
||||
public UserInfo getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(UserInfo user) {
|
||||
this.user = user;
|
||||
}
|
||||
public void setUser(UserInfo user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public DMP getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
public DMP getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
|
||||
public void setDmp(DMP dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
public void setDmp(DMP dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UserDMP entity) {
|
||||
this.role = entity.getRole();
|
||||
}
|
||||
@Override
|
||||
public void update(UserDMP entity) {
|
||||
this.role = entity.getRole();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDMP 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,180 +1,188 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"UserInfo\"")
|
||||
@NamedEntityGraphs({
|
||||
@NamedEntityGraph(
|
||||
name = "userInfo",
|
||||
attributeNodes = {@NamedAttributeNode("userRoles"), @NamedAttributeNode("credentials")})
|
||||
@NamedEntityGraph(
|
||||
name = "userInfo",
|
||||
attributeNodes = {@NamedAttributeNode("userRoles"), @NamedAttributeNode("credentials")}),
|
||||
})
|
||||
public class UserInfo implements DataEntity<UserInfo, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@Column(name = "email", nullable = false)
|
||||
private String email = null;
|
||||
@Column(name = "email", nullable = false)
|
||||
private String email = null;
|
||||
|
||||
@Column(name = "authorization_level", nullable = false)
|
||||
private Short authorization_level; //0 admin, 1 user
|
||||
@Column(name = "authorization_level", nullable = false)
|
||||
private Short authorization_level; //0 admin, 1 user
|
||||
|
||||
@Column(name = "usertype", nullable = false)
|
||||
private Short usertype; // 0 internal, 1 external
|
||||
@Column(name = "usertype", nullable = false)
|
||||
private Short usertype; // 0 internal, 1 external
|
||||
|
||||
@Column(name = "verified_email", nullable = true)
|
||||
private Boolean verified_email = null;
|
||||
@Column(name = "verified_email", nullable = true)
|
||||
private Boolean verified_email = null;
|
||||
|
||||
@Column(name = "name", nullable = true)
|
||||
private String name = null;
|
||||
@Column(name = "name", nullable = true)
|
||||
private String name = null;
|
||||
|
||||
|
||||
@Column(name = "created", nullable = false)
|
||||
private Date created = null;
|
||||
@Column(name = "created", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date created = null;
|
||||
|
||||
|
||||
@Column(name = "lastloggedin", nullable = true)
|
||||
private Date lastloggedin = null;
|
||||
@Column(name = "lastloggedin", nullable = true)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date lastloggedin = null;
|
||||
|
||||
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "additionalinfo", nullable = true)
|
||||
private String additionalinfo;
|
||||
@Type(type = "eu.eudat.configurations.typedefinition.XMLType")
|
||||
@Column(name = "additionalinfo", nullable = true)
|
||||
private String additionalinfo;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"UserDMP\"",
|
||||
joinColumns = {@JoinColumn(name = "usr", referencedColumnName = "id")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "dmp", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private Set<DMP> dmps;
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"UserDMP\"",
|
||||
joinColumns = {@JoinColumn(name = "usr", referencedColumnName = "id")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "dmp", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private Set<DMP> dmps;
|
||||
|
||||
@OneToMany(mappedBy = "userInfo", fetch = FetchType.LAZY)
|
||||
private Set<Credential> credentials = new HashSet<>();
|
||||
@OneToMany(mappedBy = "userInfo", fetch = FetchType.LAZY)
|
||||
private Set<Credential> credentials = new HashSet<>();
|
||||
|
||||
@OneToMany(mappedBy = "userInfo", fetch = FetchType.LAZY)
|
||||
private Set<UserRole> userRoles = new HashSet<>();
|
||||
@OneToMany(mappedBy = "userInfo", fetch = FetchType.LAZY)
|
||||
private Set<UserRole> userRoles = new HashSet<>();
|
||||
|
||||
public Set<DMP> getDmps() {
|
||||
return dmps;
|
||||
}
|
||||
public Set<DMP> getDmps() {
|
||||
return dmps;
|
||||
}
|
||||
|
||||
public void setDmps(Set<DMP> dmps) {
|
||||
this.dmps = dmps;
|
||||
}
|
||||
public void setDmps(Set<DMP> dmps) {
|
||||
this.dmps = dmps;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getLastloggedin() {
|
||||
return lastloggedin;
|
||||
}
|
||||
public Date getLastloggedin() {
|
||||
return lastloggedin;
|
||||
}
|
||||
|
||||
public void setLastloggedin(Date lastloggedin) {
|
||||
this.lastloggedin = lastloggedin;
|
||||
}
|
||||
public void setLastloggedin(Date lastloggedin) {
|
||||
this.lastloggedin = lastloggedin;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public Short getAuthorization_level() {
|
||||
return authorization_level;
|
||||
}
|
||||
public Short getAuthorization_level() {
|
||||
return authorization_level;
|
||||
}
|
||||
|
||||
public void setAuthorization_level(Short authorization_level) {
|
||||
this.authorization_level = authorization_level;
|
||||
}
|
||||
public void setAuthorization_level(Short authorization_level) {
|
||||
this.authorization_level = authorization_level;
|
||||
}
|
||||
|
||||
public Short getUsertype() {
|
||||
return usertype;
|
||||
}
|
||||
public Short getUsertype() {
|
||||
return usertype;
|
||||
}
|
||||
|
||||
public void setUsertype(Short usertype) {
|
||||
this.usertype = usertype;
|
||||
}
|
||||
public void setUsertype(Short usertype) {
|
||||
this.usertype = usertype;
|
||||
}
|
||||
|
||||
public Boolean getVerified_email() {
|
||||
return verified_email;
|
||||
}
|
||||
public Boolean getVerified_email() {
|
||||
return verified_email;
|
||||
}
|
||||
|
||||
public void setVerified_email(Boolean verified_email) {
|
||||
this.verified_email = verified_email;
|
||||
}
|
||||
public void setVerified_email(Boolean verified_email) {
|
||||
this.verified_email = verified_email;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAdditionalinfo() {
|
||||
return additionalinfo;
|
||||
}
|
||||
public String getAdditionalinfo() {
|
||||
return additionalinfo;
|
||||
}
|
||||
|
||||
public void setAdditionalinfo(String additionalinfo) {
|
||||
this.additionalinfo = additionalinfo;
|
||||
}
|
||||
public void setAdditionalinfo(String additionalinfo) {
|
||||
this.additionalinfo = additionalinfo;
|
||||
}
|
||||
|
||||
public Set<Credential> getCredentials() {
|
||||
return credentials;
|
||||
}
|
||||
public Set<Credential> getCredentials() {
|
||||
return credentials;
|
||||
}
|
||||
|
||||
public void setCredentials(Set<Credential> credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
public void setCredentials(Set<Credential> credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
|
||||
public Set<UserRole> getUserRoles() {
|
||||
return userRoles;
|
||||
}
|
||||
public Set<UserRole> getUserRoles() {
|
||||
return userRoles;
|
||||
}
|
||||
|
||||
public void setUserRoles(Set<UserRole> userRoles) {
|
||||
this.userRoles = userRoles;
|
||||
}
|
||||
public void setUserRoles(Set<UserRole> userRoles) {
|
||||
this.userRoles = userRoles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UserInfo entity) {
|
||||
this.name = entity.getName();
|
||||
this.email = entity.getEmail();
|
||||
this.additionalinfo = entity.getAdditionalinfo();
|
||||
this.lastloggedin = entity.getLastloggedin();
|
||||
this.userRoles = entity.getUserRoles();
|
||||
}
|
||||
@Override
|
||||
public void update(UserInfo entity) {
|
||||
this.name = entity.getName();
|
||||
this.email = entity.getEmail();
|
||||
this.additionalinfo = entity.getAdditionalinfo();
|
||||
this.lastloggedin = entity.getLastloggedin();
|
||||
this.userRoles = entity.getUserRoles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserInfo 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
|
@ -11,50 +13,57 @@ import java.util.UUID;
|
|||
@Table(name = "\"UserRole\"")
|
||||
public class UserRole implements DataEntity<UserRole, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Role\"", nullable = false)
|
||||
private int role;
|
||||
@Column(name = "\"Role\"", nullable = false)
|
||||
private int role;
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "\"UserId\"", nullable = false)
|
||||
private UserInfo userInfo;
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "\"UserId\"", nullable = false)
|
||||
private UserInfo userInfo;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getRole() {
|
||||
return role;
|
||||
}
|
||||
public int getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(int role) {
|
||||
this.role = role;
|
||||
}
|
||||
public void setRole(int role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public UserInfo getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
public UserInfo getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public void setUserInfo(UserInfo userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
public void setUserInfo(UserInfo userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UserRole entity) {
|
||||
@Override
|
||||
public void update(UserRole entity) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserRole 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.entities.helpers.EntityBinder;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
|
@ -11,60 +14,69 @@ import java.util.UUID;
|
|||
@Table(name = "\"UserToken\"")
|
||||
public class UserToken implements DataEntity<UserToken, UUID> {
|
||||
|
||||
@Id
|
||||
@Column(name = "\"Token\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID token;
|
||||
@Id
|
||||
@Column(name = "\"Token\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID token;
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "\"UserId\"", nullable = false)
|
||||
private UserInfo user;
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "\"UserId\"", nullable = false)
|
||||
private UserInfo user;
|
||||
|
||||
@Column(name = "\"IssuedAt\"", nullable = false)
|
||||
private Date issuedAt = null;
|
||||
@Column(name = "\"IssuedAt\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date issuedAt = null;
|
||||
|
||||
|
||||
@Column(name = "\"ExpiresAt\"", nullable = false)
|
||||
private Date expiresAt = null;
|
||||
@Column(name = "\"ExpiresAt\"", nullable = false)
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date expiresAt = null;
|
||||
|
||||
public UUID getToken() {
|
||||
return token;
|
||||
}
|
||||
public UUID getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(UUID token) {
|
||||
this.token = token;
|
||||
}
|
||||
public void setToken(UUID token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public UserInfo getUser() {
|
||||
return user;
|
||||
}
|
||||
public UserInfo getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(UserInfo user) {
|
||||
this.user = user;
|
||||
}
|
||||
public void setUser(UserInfo user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public Date getIssuedAt() {
|
||||
return issuedAt;
|
||||
}
|
||||
public Date getIssuedAt() {
|
||||
return issuedAt;
|
||||
}
|
||||
|
||||
public void setIssuedAt(Date issuedAt) {
|
||||
this.issuedAt = issuedAt;
|
||||
}
|
||||
public void setIssuedAt(Date issuedAt) {
|
||||
this.issuedAt = issuedAt;
|
||||
}
|
||||
|
||||
public Date getExpiresAt() {
|
||||
return expiresAt;
|
||||
}
|
||||
public Date getExpiresAt() {
|
||||
return expiresAt;
|
||||
}
|
||||
|
||||
public void setExpiresAt(Date expiresAt) {
|
||||
this.expiresAt = expiresAt;
|
||||
}
|
||||
public void setExpiresAt(Date expiresAt) {
|
||||
this.expiresAt = expiresAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UserToken entity) {
|
||||
@Override
|
||||
public void update(UserToken entity) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.token;
|
||||
}
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return this.token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserToken buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
String currentBase = base.isEmpty() ? "" : base + ".";
|
||||
if (fields.contains(currentBase + "token")) this.token = EntityBinder.fromTuple(tuple, currentBase + "token");
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package eu.eudat.data.entities.helpers;
|
||||
|
||||
import javax.persistence.Tuple;
|
||||
import java.util.List;
|
||||
|
||||
public class EntityBinder {
|
||||
public static <T> T fromTuple(List<Tuple> tuple, String path) {
|
||||
try {
|
||||
return (T) tuple.get(0).get(path);
|
||||
}catch (IllegalArgumentException illegalArgument){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ public class DatasetWizardAutocompleteRequest extends Query<DatasetWizardUserDmp
|
|||
public QueryableList<DMP> applyCriteria() {
|
||||
QueryableList<DMP> query = this.getQuery().where((builder, root) -> builder.or(builder.equal(root.get("creator"), this.getCriteria().getUserInfo()), builder.isMember(this.getCriteria().getUserInfo(), root.get("users"))));
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) {
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ public class DatasetProfileAutocompleteRequest extends Query<DatasetProfileCrite
|
|||
public QueryableList<DatasetProfile> applyCriteria() {
|
||||
QueryableList<DatasetProfile> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,15 @@ public class DataManagementPlanCriteriaRequest extends Query<DataManagementPlanC
|
|||
public QueryableList<DMP> applyCriteria() {
|
||||
QueryableList<DMP> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||
query.where((builder, root) -> builder.or(
|
||||
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
|
||||
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
|
||||
if (this.getCriteria().getPeriodEnd() != null)
|
||||
query.where((builder, root) -> builder.lessThan(root.get("created"), this.getCriteria().getPeriodEnd()));
|
||||
if (this.getCriteria().getPeriodStart() != null)
|
||||
query.where((builder, root) -> builder.greaterThan(root.get("created"), this.getCriteria().getPeriodStart()));
|
||||
if (this.getCriteria().getProjects() != null && !this.getCriteria().getProjects().isEmpty())
|
||||
query.where(((builder, root) -> root.get("project").in(this.getCriteria().getProjects())));
|
||||
if (this.getCriteria().getGrants() != null && !this.getCriteria().getGrants().isEmpty())
|
||||
query.where(((builder, root) -> root.get("grant").in(this.getCriteria().getGrants())));
|
||||
if (!this.getCriteria().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 (this.getCriteria().getGroupIds() != null && !this.getCriteria().getGroupIds().isEmpty())
|
||||
|
|
|
@ -13,7 +13,7 @@ public class DataManagementPlanProfileCriteriaRequest extends Query<DataManageme
|
|||
public QueryableList<DMPProfile> applyCriteria() {
|
||||
QueryableList<DMPProfile> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package eu.eudat.data.query.items.item.funder;
|
||||
|
||||
import eu.eudat.data.dao.criteria.FunderCriteria;
|
||||
import eu.eudat.data.entities.Funder;
|
||||
import eu.eudat.data.query.definition.Query;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
public class FunderCriteriaRequest extends Query<FunderCriteria, Funder> {
|
||||
@Override
|
||||
public QueryableList<Funder> applyCriteria() {
|
||||
QueryableList<Funder> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
|
||||
query.where((builder, root) -> builder.notEqual(root.get("status"), Funder.Status.DELETED.getValue()));
|
||||
return query;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package eu.eudat.data.query.items.item.grant;
|
||||
|
||||
import eu.eudat.data.dao.criteria.GrantCriteria;
|
||||
import eu.eudat.data.entities.Grant;
|
||||
import eu.eudat.data.query.definition.Query;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
public class GrantCriteriaRequest extends Query<GrantCriteria, Grant> {
|
||||
private Integer length;
|
||||
|
||||
public Integer getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(Integer length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
private GrantCriteriaRequest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<Grant> applyCriteria() {
|
||||
QueryableList<Grant> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.or(
|
||||
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
|
||||
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
|
||||
if (this.getCriteria().getPeriodEnd() != null)
|
||||
query.where((builder, root) -> builder.lessThan(root.get("enddate"), this.getCriteria().getPeriodEnd()));
|
||||
if (this.getCriteria().getPeriodStart() != null)
|
||||
query.where((builder, root) -> builder.greaterThan(root.get("startdate"), this.getCriteria().getPeriodStart()));
|
||||
if (this.getCriteria().getReference() != null)
|
||||
query.where((builder, root) -> builder.equal(root.get("reference"), this.getCriteria().getReference()));
|
||||
query.where((builder, root) -> builder.notEqual(root.get("status"), Grant.Status.DELETED.getValue()));
|
||||
return query;
|
||||
}
|
||||
}
|
|
@ -5,24 +5,13 @@ import eu.eudat.data.entities.Project;
|
|||
import eu.eudat.data.query.definition.Query;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ProjectCriteriaRequest extends Query<ProjectCriteria,Project> {
|
||||
private ProjectCriteriaRequest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<Project> applyCriteria() {
|
||||
QueryableList<Project> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||
if (this.getCriteria().getPeriodEnd() != null)
|
||||
query.where((builder, root) -> builder.lessThan(root.get("enddate"), this.getCriteria().getPeriodEnd()));
|
||||
if (this.getCriteria().getPeriodStart() != null)
|
||||
query.where((builder, root) -> builder.greaterThan(root.get("startdate"), this.getCriteria().getPeriodStart()));
|
||||
if (this.getCriteria().getReference() != null)
|
||||
query.where((builder, root) -> builder.equal(root.get("reference"), this.getCriteria().getReference()));
|
||||
query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue()));
|
||||
return query;
|
||||
}
|
||||
public class ProjectCriteriaRequest extends Query<ProjectCriteria, Project> {
|
||||
@Override
|
||||
public QueryableList<Project> applyCriteria() {
|
||||
QueryableList<Project> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
|
||||
query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue()));
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class UserInfoRequestItem extends Query<UserInfoCriteria, UserInfo> {
|
|||
if (this.getCriteria().getAppRoles() != null && !this.getCriteria().getAppRoles().isEmpty())
|
||||
users.where((builder, root) -> root.join("userRoles").get("role").in(this.getCriteria().getAppRoles()));
|
||||
if (this.getCriteria().getLike() != null)
|
||||
users.where((builder, root) -> builder.or(builder.like(root.get("name"), "%" + this.getCriteria().getLike() + "%"), builder.like(root.get("email"), "%" + this.getCriteria().getLike() + "%")));
|
||||
users.where((builder, root) -> builder.or(builder.like(builder.upper(root.get("name")), "%" + this.getCriteria().getLike().toUpperCase() + "%"), builder.like(root.get("email"), "%" + this.getCriteria().getLike() + "%")));
|
||||
if (this.getCriteria().getEmail() != null)
|
||||
users.where((builder, root) -> builder.equal(root.get("email"), this.getCriteria().getEmail()));
|
||||
return users;
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package eu.eudat.data.query.items.table.dataset;
|
||||
|
||||
import eu.eudat.data.dao.criteria.DatasetPublicCriteria;
|
||||
import eu.eudat.data.entities.Dataset;
|
||||
import eu.eudat.data.query.definition.TableQuery;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
import eu.eudat.types.grant.GrantStateType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 10/2/2018.
|
||||
*/
|
||||
public class DatasetPublicTableRequest extends TableQuery<DatasetPublicCriteria, Dataset, UUID> {
|
||||
@Override
|
||||
public QueryableList<Dataset> applyCriteria() {
|
||||
QueryableList<Dataset> query = this.getQuery();
|
||||
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 (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.or(
|
||||
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
|
||||
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
|
||||
if (this.getCriteria().getGrants() != null && !this.getCriteria().getGrants().isEmpty())
|
||||
query.where(((builder, root) -> root.get("dmp").get("grant").get("id").in(this.getCriteria().getGrants())));
|
||||
if (this.getCriteria().getGrantStatus() != null) {
|
||||
if (this.getCriteria().getGrantStatus().getValue().equals(GrantStateType.FINISHED.getValue()))
|
||||
query.where((builder, root) -> builder.lessThan(root.get("dmp").get("grant").get("enddate"), new Date()));
|
||||
if (this.getCriteria().getGrantStatus().getValue().equals(GrantStateType.ONGOING.getValue()))
|
||||
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 (this.getCriteria().getDmpIds() != null && !this.getCriteria().getDmpIds().isEmpty()) {
|
||||
query.where(((builder, root) -> root.get("dmp").get("id").in(this.getCriteria().getDmpIds())));
|
||||
}
|
||||
if (this.getCriteria().getDatasetProfile() != null && !this.getCriteria().getDatasetProfile().isEmpty()) query
|
||||
.where(((builder, root) -> root.get("profile").get("id").in(this.getCriteria().getDatasetProfile())));
|
||||
if (this.getCriteria().getDmpOrganisations() != null && !this.getCriteria().getDmpOrganisations().isEmpty()) query
|
||||
.where(((builder, root) -> root.join("dmp").join("organisations").get("reference").in(this.getCriteria().getDmpOrganisations())));
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<Dataset> applyPaging(QueryableList<Dataset> items) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -10,12 +10,14 @@ import eu.eudat.queryable.types.SelectionField;
|
|||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DatasetTableRequest extends TableQuery<DatasetCriteria, eu.eudat.data.entities.Dataset,UUID> {
|
||||
public class DatasetTableRequest extends TableQuery<DatasetCriteria, eu.eudat.data.entities.Dataset, UUID> {
|
||||
@Override
|
||||
public QueryableList<Dataset> applyCriteria() {
|
||||
QueryableList<Dataset> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||
query.where((builder, root) -> builder.or(
|
||||
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
|
||||
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
|
||||
if (this.getCriteria().getStatus() != null)
|
||||
query.where((builder, root) -> builder.equal(root.get("status"), this.getCriteria().getStatus()));
|
||||
if (this.getCriteria().getPeriodEnd() != null)
|
||||
|
@ -26,6 +28,7 @@ public class DatasetTableRequest extends TableQuery<DatasetCriteria, eu.eudat.da
|
|||
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 (this.getCriteria().getDmpIds() != null && !this.getCriteria().getDmpIds().isEmpty())
|
||||
query.where((builder, root) -> root.get("dmp").get("id").in(this.getCriteria().getDmpIds()));
|
||||
query.where((builder, root) -> builder.equal(root.get("status"), Dataset.Status.FINALISED));
|
||||
return query;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ public class DatasetProfileTableRequestItem extends TableQuery<DatasetProfileCri
|
|||
public QueryableList<DatasetProfile> applyCriteria() {
|
||||
QueryableList<DatasetProfile> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
|
||||
return query;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,13 +16,15 @@ public class DataManagementPlanTableRequest extends TableQuery<DataManagementPla
|
|||
public QueryableList<DMP> applyCriteria() {
|
||||
QueryableList<DMP> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||
query.where((builder, root) -> builder.or(
|
||||
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
|
||||
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
|
||||
if (this.getCriteria().getPeriodEnd() != null)
|
||||
query.where((builder, root) -> builder.lessThan(root.get("created"), this.getCriteria().getPeriodEnd()));
|
||||
if (this.getCriteria().getPeriodStart() != null)
|
||||
query.where((builder, root) -> builder.greaterThan(root.get("created"), this.getCriteria().getPeriodStart()));
|
||||
if (this.getCriteria().getProjects() != null && !this.getCriteria().getProjects().isEmpty())
|
||||
query.where(((builder, root) -> root.get("project").in(this.getCriteria().getProjects())));
|
||||
if (this.getCriteria().getGrants() != null && !this.getCriteria().getGrants().isEmpty())
|
||||
query.where(((builder, root) -> root.get("grant").in(this.getCriteria().getGrants())));
|
||||
if (!this.getCriteria().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 (this.getCriteria().getGroupIds() != null && !this.getCriteria().getGroupIds().isEmpty())
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package eu.eudat.data.query.items.table.dmp;
|
||||
|
||||
import eu.eudat.data.dao.criteria.DataManagementPlanPublicCriteria;
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.query.PaginationService;
|
||||
import eu.eudat.data.query.definition.TableQuery;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.types.grant.GrantStateType;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DataManagmentPlanPublicTableRequest extends TableQuery<DataManagementPlanPublicCriteria, DMP, UUID> {
|
||||
|
||||
public QueryableList<DMP> applyCriteria() {
|
||||
QueryableList<DMP> query = this.getQuery();
|
||||
query.where((builder, root) -> builder.equal(root.get("isPublic"), true));
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.or(
|
||||
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
|
||||
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
|
||||
if (this.getCriteria().getGrants() != null && !this.getCriteria().getGrants().isEmpty())
|
||||
query.where(((builder, root) -> root.get("grant").get("id").in(this.getCriteria().getGrants())));
|
||||
if (this.getCriteria().getGrantStatus() != null) {
|
||||
if (this.getCriteria().getGrantStatus().getValue().equals(GrantStateType.FINISHED.getValue()))
|
||||
query.where((builder, root) -> builder.lessThan(root.get("grant").get("enddate"), new Date()));
|
||||
if (this.getCriteria().getGrantStatus().getValue().equals(GrantStateType.ONGOING.getValue()))
|
||||
query.where((builder, root) ->
|
||||
builder.or(builder.greaterThan(root.get("grant").get("enddate"), new Date())
|
||||
, builder.isNull(root.get("grant").get("enddate"))));
|
||||
}
|
||||
if (this.getCriteria().datasetProfile != null && !this.getCriteria().datasetProfile.isEmpty()) query
|
||||
.where(((builder, root) -> root.get("profile").get("id").in(this.getCriteria().datasetProfile)));
|
||||
if (this.getCriteria().getDmpOrganisations() != null && !this.getCriteria().getDmpOrganisations().isEmpty()) query
|
||||
.where(((builder, root) -> root.join("organisations").get("reference").in(this.getCriteria().getDmpOrganisations())));
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DMP> applyPaging(QueryableList<DMP> items) {
|
||||
return PaginationService.applyPaging(items, this);
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ public class ExternalDatasetTableRequest extends TableQuery<ExternalDatasetCrite
|
|||
public QueryableList<ExternalDataset> applyCriteria() {
|
||||
QueryableList<ExternalDataset> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
|
||||
return query;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package eu.eudat.data.query.items.table.grant;
|
||||
|
||||
import eu.eudat.data.dao.criteria.GrantCriteria;
|
||||
import eu.eudat.data.entities.Grant;
|
||||
import eu.eudat.data.query.definition.TableQuery;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class GrantTableRequest extends TableQuery<GrantCriteria,Grant,UUID> {
|
||||
@Override
|
||||
public QueryableList<Grant> applyCriteria() {
|
||||
QueryableList<Grant> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.or(
|
||||
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
|
||||
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
|
||||
if (this.getCriteria().getPeriodEnd() != null)
|
||||
query.where((builder, root) -> builder.lessThan(root.get("enddate"), this.getCriteria().getPeriodEnd()));
|
||||
if (this.getCriteria().getPeriodStart() != null)
|
||||
query.where((builder, root) -> builder.greaterThan(root.get("startdate"), this.getCriteria().getPeriodStart()));
|
||||
if (this.getCriteria().getReference() != null)
|
||||
query.where((builder, root) -> builder.equal(root.get("reference"), this.getCriteria().getReference()));
|
||||
query.where((builder, root) -> builder.notEqual(root.get("status"), Grant.Status.DELETED.getValue()));
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<Grant> applyPaging(QueryableList<Grant> items) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package eu.eudat.data.query.items.table.organisations;
|
||||
|
||||
import eu.eudat.data.dao.criteria.OrganisationCriteria;
|
||||
import eu.eudat.data.entities.Organisation;
|
||||
import eu.eudat.data.query.PaginationService;
|
||||
import eu.eudat.data.query.definition.TableQuery;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class OrganisationsTableRequest extends TableQuery<OrganisationCriteria, Organisation, UUID> {
|
||||
@Override
|
||||
public QueryableList<Organisation> applyCriteria() {
|
||||
QueryableList<Organisation> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) {
|
||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<Organisation> applyPaging(QueryableList<Organisation> items) {
|
||||
return PaginationService.applyPaging(items, this);
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package eu.eudat.data.query.items.table.project;
|
||||
|
||||
import eu.eudat.data.dao.criteria.ProjectCriteria;
|
||||
import eu.eudat.data.entities.Project;
|
||||
import eu.eudat.data.query.definition.Query;
|
||||
import eu.eudat.data.query.definition.TableQuery;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ProjectTableRequest extends TableQuery<ProjectCriteria,Project,UUID> {
|
||||
@Override
|
||||
public QueryableList<Project> applyCriteria() {
|
||||
QueryableList<Project> query = this.getQuery();
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||
if (this.getCriteria().getPeriodEnd() != null)
|
||||
query.where((builder, root) -> builder.lessThan(root.get("enddate"), this.getCriteria().getPeriodEnd()));
|
||||
if (this.getCriteria().getPeriodStart() != null)
|
||||
query.where((builder, root) -> builder.greaterThan(root.get("startdate"), this.getCriteria().getPeriodStart()));
|
||||
if (this.getCriteria().getReference() != null)
|
||||
query.where((builder, root) -> builder.equal(root.get("reference"), this.getCriteria().getReference()));
|
||||
query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue()));
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<Project> applyPaging(QueryableList<Project> items) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ public class UserInfoTableRequestItem extends TableQuery<UserInfoCriteria, UserI
|
|||
if (this.getCriteria().getAppRoles() != null && !this.getCriteria().getAppRoles().isEmpty())
|
||||
users.where((builder, root) -> root.join("userRoles").get("role").in(this.getCriteria().getAppRoles()));
|
||||
if (this.getCriteria().getLike() != null)
|
||||
users.where((builder, root) -> builder.or(builder.like(root.get("name"), "%" + this.getCriteria().getLike() + "%"), builder.like(root.get("email"), "%" + this.getCriteria().getLike() + "%")));
|
||||
users.where((builder, root) -> builder.or(builder.like(builder.upper(root.get("name")), "%" + this.getCriteria().getLike().toUpperCase() + "%"), builder.like(root.get("email"), "%" + this.getCriteria().getLike() + "%")));
|
||||
if (this.getCriteria().getEmail() != null)
|
||||
users.where((builder, root) -> builder.equal(root.get("email"), this.getCriteria().getEmail()));
|
||||
return users;
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
package eu.eudat.query;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.entities.Dataset;
|
||||
import eu.eudat.data.entities.Grant;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
|
||||
import javax.persistence.criteria.Subquery;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DMPQuery extends Query<DMP, UUID> {
|
||||
private UUID id;
|
||||
private UUID groupId;
|
||||
private String label;
|
||||
private int version;
|
||||
private GrantQuery grantQuery;
|
||||
private UserQuery userQuery;
|
||||
private DatasetQuery datasetQuery;
|
||||
private List<Integer> statuses;
|
||||
private Date created;
|
||||
private Date modified;
|
||||
|
||||
public DMPQuery(DatabaseAccessLayer<DMP, UUID> databaseAccessLayer) {
|
||||
super(databaseAccessLayer);
|
||||
}
|
||||
|
||||
public DMPQuery(DatabaseAccessLayer<DMP, UUID> databaseAccessLayer, List<String> selectionFields) {
|
||||
super(databaseAccessLayer, selectionFields);
|
||||
}
|
||||
|
||||
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 int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public GrantQuery getGrantQuery() {
|
||||
return grantQuery;
|
||||
}
|
||||
|
||||
public void setGrantQuery(GrantQuery grantQuery) {
|
||||
this.grantQuery = grantQuery;
|
||||
}
|
||||
|
||||
public List<Integer> getStatuses() {
|
||||
return statuses;
|
||||
}
|
||||
|
||||
public void setStatuses(List<Integer> statuses) {
|
||||
statuses = statuses;
|
||||
}
|
||||
|
||||
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 UserQuery getUserQuery() {
|
||||
return userQuery;
|
||||
}
|
||||
|
||||
public void setUserQuery(UserQuery userQuery) {
|
||||
this.userQuery = userQuery;
|
||||
}
|
||||
|
||||
public DatasetQuery getDatasetQuery() {
|
||||
return datasetQuery;
|
||||
}
|
||||
|
||||
public void setDatasetQuery(DatasetQuery datasetQuery) {
|
||||
this.datasetQuery = datasetQuery;
|
||||
}
|
||||
|
||||
public QueryableList<DMP> getQuery() {
|
||||
QueryableList<DMP> query = this.databaseAccessLayer.asQueryable();
|
||||
if (this.id != null) {
|
||||
query.where((builder, root) -> builder.equal(root.get("id"), this.id));
|
||||
}
|
||||
if (this.grantQuery != null) {
|
||||
Subquery<Grant> grantQuery = this.grantQuery.getQuery().query(Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "id")));
|
||||
query.where((builder, root) -> root.get("grant").get("id").in(grantQuery));
|
||||
}
|
||||
if (this.getStatuses() != null && !this.getStatuses().isEmpty()) {
|
||||
query.where((builder, root) -> root.get("status").in(this.getStatuses()));
|
||||
}
|
||||
if (this.userQuery != null) {
|
||||
Subquery<UserInfo> userInfoSubQuery = this.userQuery.getQuery().query(Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "id")));
|
||||
query.where((builder, root) -> root.get("creator").get("id").in(userInfoSubQuery));
|
||||
}
|
||||
if(this.datasetQuery != null){
|
||||
Subquery<Dataset> datasetSubQuery = this.datasetQuery.getQuery().query(Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:id")));
|
||||
query.where((builder, root) -> root.get("id").in(datasetSubQuery ));
|
||||
}
|
||||
if (!this.getSelectionFields().isEmpty() && this.getSelectionFields() != null) {
|
||||
query.withFields(this.getSelectionFields());
|
||||
}
|
||||
return query;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package eu.eudat.query;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class DatasetProfileQuery {
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package eu.eudat.query;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.entities.Dataset;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
|
||||
import javax.persistence.criteria.Subquery;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DatasetQuery extends Query<Dataset, UUID> {
|
||||
|
||||
private UUID id;
|
||||
private String label;
|
||||
private DMPQuery dmpQuery;
|
||||
|
||||
public DatasetQuery(DatabaseAccessLayer<Dataset, UUID> databaseAccessLayer) {
|
||||
super(databaseAccessLayer);
|
||||
}
|
||||
|
||||
public DatasetQuery(DatabaseAccessLayer<Dataset, UUID> databaseAccessLayer, List<String> selectionFields) {
|
||||
super(databaseAccessLayer, selectionFields);
|
||||
}
|
||||
|
||||
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 DMPQuery getDmpQuery() {
|
||||
return dmpQuery;
|
||||
}
|
||||
|
||||
public void setDmpQuery(DMPQuery dmpQuery) {
|
||||
this.dmpQuery = dmpQuery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<Dataset> getQuery() {
|
||||
QueryableList<Dataset> query = this.databaseAccessLayer.asQueryable();
|
||||
if (this.id != null) {
|
||||
query.where((builder, root) -> builder.equal(root.get("id"), this.id));
|
||||
}
|
||||
if (this.dmpQuery != null) {
|
||||
Subquery<DMP> dmpSubQuery = this.dmpQuery.getQuery().query(Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "id")));
|
||||
query.where((builder, root) -> root.get("dmp").get("id").in(dmpSubQuery));
|
||||
}
|
||||
return query;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package eu.eudat.query;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.entities.Grant;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
|
||||
import javax.persistence.criteria.Subquery;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class GrantQuery extends Query<Grant, UUID> {
|
||||
|
||||
private UUID id;
|
||||
private List<UUID> ids;
|
||||
private String label;
|
||||
private List<Integer> statuses;
|
||||
private Date created;
|
||||
private Date modified;
|
||||
private UserQuery userQuery;
|
||||
|
||||
public GrantQuery(DatabaseAccessLayer<Grant, UUID> databaseAccessLayer) {
|
||||
super(databaseAccessLayer);
|
||||
}
|
||||
|
||||
public GrantQuery(DatabaseAccessLayer<Grant, UUID> databaseAccessLayer, List<String> selectionFields) {
|
||||
super(databaseAccessLayer, selectionFields);
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public List<UUID> getIds() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setIds(List<UUID> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public List<Integer> getStatuses() {
|
||||
return statuses;
|
||||
}
|
||||
|
||||
public void setStatuses(List<Integer> statuses) {
|
||||
statuses = statuses;
|
||||
}
|
||||
|
||||
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 UserQuery getUserQuery() {
|
||||
return userQuery;
|
||||
}
|
||||
|
||||
public void setUserQuery(UserQuery userQuery) {
|
||||
this.userQuery = userQuery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<Grant> getQuery() {
|
||||
QueryableList<Grant> query = this.databaseAccessLayer.asQueryable();
|
||||
if (this.id != null)
|
||||
query.where((builder, root) -> builder.equal(root.get("id"), this.id));
|
||||
if (this.ids != null && !this.ids.isEmpty())
|
||||
query.where((builder, root) -> root.get("id").in(this.ids));
|
||||
if (this.getStatuses() != null && !this.getStatuses().isEmpty())
|
||||
query.where((builder, root) -> root.get("status").in(this.getStatuses()));
|
||||
if (this.userQuery != null) {
|
||||
Subquery<UserInfo> userInfoSubQuery = this.userQuery.getQuery().query(Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "id")));
|
||||
query.where((builder, root) -> root.get("creationUser").get("id").in(userInfoSubQuery));
|
||||
}
|
||||
if (!this.getSelectionFields().isEmpty() && this.getSelectionFields() != null) {
|
||||
query.withFields(this.getSelectionFields());
|
||||
}
|
||||
return query;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package eu.eudat.query;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Query<T extends DataEntity, K> {
|
||||
protected DatabaseAccessLayer<T, K> databaseAccessLayer;
|
||||
|
||||
private List<String> selectionFields = new LinkedList<>();
|
||||
|
||||
public Query(DatabaseAccessLayer<T, K> databaseAccessLayer, List<String> selectionFields) {
|
||||
this.databaseAccessLayer = databaseAccessLayer;
|
||||
this.selectionFields = selectionFields;
|
||||
}
|
||||
|
||||
public Query(DatabaseAccessLayer<T, K> databaseAccessLayer) {
|
||||
this.databaseAccessLayer = databaseAccessLayer;
|
||||
}
|
||||
|
||||
public abstract QueryableList<T> getQuery();
|
||||
|
||||
protected List<String> getSelectionFields() {
|
||||
return selectionFields;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package eu.eudat.query;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class UserQuery extends Query<UserInfo, UUID> {
|
||||
|
||||
private UUID id;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UserQuery(DatabaseAccessLayer<UserInfo, UUID> databaseAccessLayer) {
|
||||
super(databaseAccessLayer);
|
||||
}
|
||||
|
||||
public UserQuery(DatabaseAccessLayer<UserInfo, UUID> databaseAccessLayer, List<String> selectionFields) {
|
||||
super(databaseAccessLayer, selectionFields);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<UserInfo> getQuery() {
|
||||
QueryableList<UserInfo> query = this.databaseAccessLayer.asQueryable();
|
||||
if (this.id != null)
|
||||
query.where((builder, root) -> builder.equal(root.get("id"), this.id));
|
||||
return query;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package eu.eudat.types.grant;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 8/24/2018.
|
||||
*/
|
||||
public enum GrantStateType {
|
||||
ONGOING(0), FINISHED(1);
|
||||
|
||||
private Integer value;
|
||||
|
||||
private GrantStateType(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static GrantStateType fromInteger(Integer value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return ONGOING;
|
||||
case 1:
|
||||
return FINISHED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Grant State Type");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?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">
|
||||
<parent>
|
||||
<artifactId>dmp-backend</artifactId>
|
||||
<groupId>eu.eudat</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>elastic</artifactId>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,7 @@
|
|||
package eu.eudat.elastic.criteria;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 7/5/2018.
|
||||
*/
|
||||
public abstract class Criteria {
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue