diff --git a/dmp-backend/core/pom.xml b/dmp-backend/core/pom.xml
new file mode 100644
index 000000000..6b4369902
--- /dev/null
+++ b/dmp-backend/core/pom.xml
@@ -0,0 +1,31 @@
+
+
+ 4.0.0
+
+ eu.eudat
+ dmp-backend
+ 1.0.0-SNAPSHOT
+
+
+ core
+
+
+ UTF-8
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 17
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/DescriptionTemplateTypeStatus.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/DescriptionTemplateTypeStatus.java
new file mode 100644
index 000000000..718809a01
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/DescriptionTemplateTypeStatus.java
@@ -0,0 +1,43 @@
+package eu.eudat.commons.enums;
+
+public enum DescriptionTemplateTypeStatus {
+
+ SAVED((short) 0), FINALIZED((short) 1), DELETED((short) 99);
+
+ private final short value;
+
+ DescriptionTemplateTypeStatus(short value) {
+ this.value = value;
+ }
+
+ public short getValue() {
+ return value;
+ }
+
+ public static DescriptionTemplateTypeStatus fromInteger(int value) {
+ switch (value) {
+ case 0:
+ return SAVED;
+ case 1:
+ return FINALIZED;
+ case 99:
+ return DELETED;
+ default:
+ throw new RuntimeException("Unsupported Description Template Type Status");
+ }
+ }
+
+ public static DescriptionTemplateTypeStatus fromLabel(String value) {
+ switch (value) {
+ case "SAVED":
+ return SAVED;
+ case "FINALISED":
+ return FINALIZED;
+ case "DELETED":
+ return DELETED;
+ default:
+ throw new RuntimeException("Unsupported Description Template Type Status");
+ }
+ }
+
+}
diff --git a/dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/DataType.java b/dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/DataType.java
similarity index 100%
rename from dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/DataType.java
rename to dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/DataType.java
diff --git a/dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/DatabaseColumnType.java b/dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/DatabaseColumnType.java
similarity index 100%
rename from dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/DatabaseColumnType.java
rename to dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/DatabaseColumnType.java
diff --git a/dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/PostgreSQLDatabaseColumnType.java b/dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/PostgreSQLDatabaseColumnType.java
similarity index 100%
rename from dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/PostgreSQLDatabaseColumnType.java
rename to dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/PostgreSQLDatabaseColumnType.java
diff --git a/dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/PostgreSQLEnumType.java b/dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/PostgreSQLEnumType.java
similarity index 100%
rename from dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/PostgreSQLEnumType.java
rename to dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/PostgreSQLEnumType.java
diff --git a/dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/UUIDType.java b/dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/UUIDType.java
similarity index 68%
rename from dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/UUIDType.java
rename to dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/UUIDType.java
index 551a8d6c0..2a1fb5cbe 100644
--- a/dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/UUIDType.java
+++ b/dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/UUIDType.java
@@ -14,7 +14,7 @@ import java.util.UUID;
/**
* Currently not used
*/
-public class UUIDType implements UserType {
+public class UUIDType implements UserType {
private final int[] sqlTypesSupported = new int[]{Types.NUMERIC};
private final String CAST_EXCEPTION_TEXT = " cannot be cast to a java.util.UUID";
@@ -22,18 +22,27 @@ public class UUIDType implements UserType {
return sqlTypesSupported;
}
- @SuppressWarnings("rawtypes")
- public Class returnedClass() {
+ @Override
+ public int getSqlType() {
+ return sqlTypesSupported[0];
+ }
+
+ public Class returnedClass() {
return UUID.class;
}
- public boolean equals(Object x, Object y) throws HibernateException {
+ public boolean equals(UUID x, UUID y) throws HibernateException {
if (x == null) return y == null;
else return x.equals(y);
}
- public int hashCode(Object x) throws HibernateException {
- return x == null ? null : x.hashCode();
+ public int hashCode(UUID x) throws HibernateException {
+ return x == null ? -1 : x.hashCode();
+ }
+
+ @Override
+ public UUID nullSafeGet(ResultSet rs, int position, SharedSessionContractImplementor session, Object owner) throws SQLException {
+ return null;
}
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
@@ -58,25 +67,24 @@ public class UUIDType implements UserType {
st.setObject(index, uuid, Types.OTHER);
}
- public Object deepCopy(Object value) throws HibernateException {
+ public UUID deepCopy(UUID value) throws HibernateException {
if (value == null) return null;
- UUID uuid = (UUID) value;
- return new UUID(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
+ return new UUID(value.getMostSignificantBits(), value.getLeastSignificantBits());
}
public boolean isMutable() {
return false;
}
- public Serializable disassemble(Object value) throws HibernateException {
- return (Serializable) value;
+ public Serializable disassemble(UUID value) throws HibernateException {
+ return value;
}
- public Object assemble(Serializable cached, Object owner) throws HibernateException {
- return cached;
+ public UUID assemble(Serializable cached, Object owner) throws HibernateException {
+ return (UUID) cached;
}
- public Object replace(Object original, Object target, Object owner) throws HibernateException {
+ public UUID replace(UUID original, Object target, Object owner) throws HibernateException {
return original;
}
@@ -98,7 +106,7 @@ public class UUIDType implements UserType {
return nullSafeGet(rs, names, owner);
}
- public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
+ public void nullSafeSet(PreparedStatement st, UUID value, int index, SharedSessionContractImplementor session)
throws HibernateException, SQLException {
nullSafeSet(st, value, index);
}
diff --git a/dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/XMLType.java b/dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/XMLType.java
similarity index 66%
rename from dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/XMLType.java
rename to dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/XMLType.java
index 8ac8be93a..bd825ae3c 100644
--- a/dmp-backend/web/src/main/java/eu/eudat/configurations/typedefinition/XMLType.java
+++ b/dmp-backend/core/src/main/java/eu/eudat/configurations/typedefinition/XMLType.java
@@ -13,7 +13,7 @@ import java.sql.Types;
/**
* Store and retrieve a PostgreSQL "xml" column as a Java string.
*/
-public class XMLType implements UserType {
+public class XMLType implements UserType {
private final int[] sqlTypesSupported = new int[]{Types.VARCHAR};
@@ -21,11 +21,16 @@ public class XMLType implements UserType {
return sqlTypesSupported;
}
- public Class returnedClass() {
+ @Override
+ public int getSqlType() {
+ return sqlTypesSupported[0];
+ }
+
+ public Class returnedClass() {
return String.class;
}
- public boolean equals(Object x, Object y) throws HibernateException {
+ public boolean equals(String x, String y) throws HibernateException {
if (x == null) {
return y == null;
} else {
@@ -33,8 +38,13 @@ public class XMLType implements UserType {
}
}
- public int hashCode(Object x) throws HibernateException {
- return x == null ? null : x.hashCode();
+ public int hashCode(String x) throws HibernateException {
+ return x == null ? -1 : x.hashCode();
+ }
+
+ @Override
+ public String nullSafeGet(ResultSet resultSet, int i, SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws SQLException {
+ return null;
}
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
@@ -51,25 +61,23 @@ public class XMLType implements UserType {
}
}
- public Object deepCopy(Object value) throws HibernateException {
- if (value == null)
- return null;
- return new String((String) value);
+ public String deepCopy(String value) throws HibernateException {
+ return value;
}
public boolean isMutable() {
return false;
}
- public Serializable disassemble(Object value) throws HibernateException {
- return (String) value;
+ public Serializable disassemble(String value) throws HibernateException {
+ return value;
}
- public Object assemble(Serializable cached, Object owner) throws HibernateException {
+ public String assemble(Serializable cached, Object owner) throws HibernateException {
return (String) cached;
}
- public Object replace(Object original, Object target, Object owner) throws HibernateException {
+ public String replace(String original, String target, Object owner) throws HibernateException {
return original;
}
@@ -78,9 +86,8 @@ public class XMLType implements UserType {
return nullSafeGet(rs, names, owner);
}
- public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
+ public void nullSafeSet(PreparedStatement st, String value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
nullSafeSet(st, value, index);
-
}
}
\ No newline at end of file
diff --git a/dmp-backend/core/src/main/java/eu/eudat/convention/ConventionService.java b/dmp-backend/core/src/main/java/eu/eudat/convention/ConventionService.java
new file mode 100644
index 000000000..fc051a956
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/convention/ConventionService.java
@@ -0,0 +1,40 @@
+package eu.eudat.convention;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.function.Function;
+
+public interface ConventionService {
+
+ Boolean isValidId(Integer id);
+
+ Boolean isValidGuid(UUID guid);
+
+ Boolean isValidUUID(String str);
+ UUID parseUUIDSafe(String str);
+
+ Boolean isValidHash(String hash);
+
+ String hashValue(Object value);
+
+ String limit(String text, int maxLength);
+
+ String truncate(String text, int maxLength);
+
+ UUID getEmptyUUID();
+
+ boolean isNullOrEmpty(String value);
+
+ boolean isListNullOrEmpty(List> value);
+
+ String stringEmpty();
+
+ String asPrefix(String name);
+
+ String asIndexerPrefix(String part);
+
+ String asIndexer(String... names);
+
+ Map> toDictionaryOfList(List items, Function keySelector);
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/convention/ConventionServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/convention/ConventionServiceImpl.java
new file mode 100644
index 000000000..a57333284
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/convention/ConventionServiceImpl.java
@@ -0,0 +1,150 @@
+package eu.eudat.convention;
+
+import eu.eudat.errorcode.ErrorThesaurusProperties;
+import gr.cite.tools.exception.MyApplicationException;
+import gr.cite.tools.logging.LoggerService;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+import java.time.Instant;
+import java.util.*;
+import java.util.function.Function;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+@Component
+@Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
+public class ConventionServiceImpl implements ConventionService {
+ private final static Pattern UUID_REGEX_PATTERN = Pattern.compile("^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$");
+
+ private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(ConventionServiceImpl.class));
+ private final ErrorThesaurusProperties errors;
+
+ @Autowired
+ public ConventionServiceImpl(ErrorThesaurusProperties errors) {
+ this.errors = errors;
+ }
+
+ @Override
+ public Boolean isValidId(Integer id) {
+ return id != null && id > 0;
+ }
+
+ @Override
+ public Boolean isValidGuid(UUID guid) {
+ return guid != null && !guid.equals(this.getEmptyUUID());
+ }
+
+ @Override
+ public Boolean isValidUUID(String str) {
+ if (this.isNullOrEmpty(str)) {
+ return false;
+ }
+ return UUID_REGEX_PATTERN.matcher(str).matches();
+ }
+
+ @Override
+ public UUID parseUUIDSafe(String str) {
+ if (!this.isValidUUID(str)) {
+ return null;
+ }
+ try {
+ return UUID.fromString(str);
+ } catch (Exception ex){
+ logger.warn("invalid uuid" + str, ex);
+ return null;
+ }
+ }
+
+ @Override
+ public Boolean isValidHash(String hash) {
+ return !this.isNullOrEmpty(hash);
+ }
+
+ @Override
+ public String hashValue(Object value) throws MyApplicationException {
+ if (value == null) return this.stringEmpty();
+ if (value instanceof Instant) return String.format("%ts", (Instant) value);
+ throw new MyApplicationException(this.errors.getSystemError().getCode(), this.errors.getSystemError().getMessage());
+ }
+
+ @Override
+ public String limit(String text, int maxLength) {
+ if (this.isNullOrEmpty(text)) return text;
+ if (text.length() > maxLength) return String.format("%s...", text.substring(0, maxLength));
+ else return text;
+ }
+
+ @Override
+ public String truncate(String text, int maxLength) {
+ String truncated = text;
+ if (text.length() < maxLength) return text;
+
+ truncated = truncated.trim();
+ truncated = truncated.replaceAll("\\s+", " ");//remove multiple spaces
+ if (truncated.length() < maxLength) return truncated;
+ truncated = truncated.replaceAll("([.!@#$%^&-=':;,<>?*\"/|])+", "");//remove multiple spaces
+ if (truncated.length() < maxLength) return truncated;
+ truncated = truncated.replaceAll("([aeiou])+", "");//remove multiple spaces
+ if (truncated.length() < maxLength) return truncated;
+ truncated = truncated.replaceAll("([AEIOU])+", "");//remove multiple spaces
+ if (truncated.length() < maxLength) return truncated;
+
+ if (text.length() > maxLength) return String.format("%s...", text.substring(0, maxLength));
+ return text;
+
+ }
+
+ @Override
+ public UUID getEmptyUUID() {
+ return new UUID(0L, 0L);
+ }
+
+ @Override
+ public boolean isNullOrEmpty(String value) {
+ return value == null || value.isEmpty();
+ }
+
+ @Override
+ public boolean isListNullOrEmpty(List> value) {
+ if(value == null) return true;
+ return value.isEmpty();
+ }
+
+ @Override
+ public String stringEmpty() {
+ return "";
+ }
+
+ @Override
+ public String asPrefix(String name) {
+ if (name == null) return null;
+ return name + ".";
+ }
+
+ @Override
+ public String asIndexer(String... names) {
+ if (names == null) return null;
+ return String.join(".", Arrays.stream(names).filter(x -> !this.isNullOrEmpty(x)).collect(Collectors.toList()));
+ }
+
+ @Override
+ public String asIndexerPrefix(String part) {
+ if (part == null) return null;
+ return part + ".";
+ }
+
+ @Override
+ public Map> toDictionaryOfList(List items, Function keySelector) {
+ Map> map = new HashMap<>();
+ for (V model : items) {
+ K key = keySelector.apply(model);
+ if (!map.containsKey(key)) map.put(key, new ArrayList());
+ map.get(key).add(model);
+ }
+ return map;
+ }
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/BaseEntity.java b/dmp-backend/core/src/main/java/eu/eudat/data/BaseEntity.java
new file mode 100644
index 000000000..df00c3311
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/data/BaseEntity.java
@@ -0,0 +1,5 @@
+package eu.eudat.data;
+
+public interface BaseEntity {
+
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/DescriptionTemplateTypeEntity.java b/dmp-backend/core/src/main/java/eu/eudat/data/DescriptionTemplateTypeEntity.java
new file mode 100644
index 000000000..be7a2477f
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/data/DescriptionTemplateTypeEntity.java
@@ -0,0 +1,54 @@
+package eu.eudat.data;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import jakarta.persistence.*;
+import java.util.UUID;
+
+@Entity
+@Table(name = "DescriptionTemplateType")
+public class DescriptionTemplateTypeEntity implements BaseEntity {
+
+ @Id
+ @GeneratedValue
+ @GenericGenerator(name = "uuid2", strategy = "uuid2")
+ @Column(name = "ID", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
+ private UUID id;
+
+ public static final String _id = "ID";
+
+ @Column(name = "Name", nullable = false)
+ private String name;
+
+ public static final String _name = "Name";
+
+ @Column(name = "Status", nullable = false)
+ private Short status;
+
+ public static final String _status = "Status";
+
+ public UUID getId() {
+ return id;
+ }
+
+ public void setId(UUID id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Short getStatus() {
+ return status;
+ }
+
+ public void setStatus(Short status) {
+ this.status = status;
+ }
+
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/errorcode/ErrorDescription.java b/dmp-backend/core/src/main/java/eu/eudat/errorcode/ErrorDescription.java
new file mode 100644
index 000000000..a7387ec9f
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/errorcode/ErrorDescription.java
@@ -0,0 +1,25 @@
+package eu.eudat.errorcode;
+
+public class ErrorDescription {
+
+ private int code;
+
+ private String message;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/errorcode/ErrorThesaurusConfiguration.java b/dmp-backend/core/src/main/java/eu/eudat/errorcode/ErrorThesaurusConfiguration.java
new file mode 100644
index 000000000..3aaa16690
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/errorcode/ErrorThesaurusConfiguration.java
@@ -0,0 +1,12 @@
+package eu.eudat.errorcode;
+
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@EnableConfigurationProperties(ErrorThesaurusProperties.class)
+public class ErrorThesaurusConfiguration {
+
+
+
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/errorcode/ErrorThesaurusProperties.java b/dmp-backend/core/src/main/java/eu/eudat/errorcode/ErrorThesaurusProperties.java
new file mode 100644
index 000000000..536391a02
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/errorcode/ErrorThesaurusProperties.java
@@ -0,0 +1,48 @@
+package eu.eudat.errorcode;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+@ConfigurationProperties(prefix = "error-thesaurus")
+public class ErrorThesaurusProperties {
+
+ private ErrorDescription systemError;
+
+ public ErrorDescription getSystemError() {
+ return systemError;
+ }
+
+ public void setSystemError(ErrorDescription systemError) {
+ this.systemError = systemError;
+ }
+
+ private ErrorDescription forbidden;
+
+ public ErrorDescription getForbidden() {
+ return forbidden;
+ }
+
+ public void setForbidden(ErrorDescription forbidden) {
+ this.forbidden = forbidden;
+ }
+
+ private ErrorDescription hashConflict;
+
+ public ErrorDescription getHashConflict() {
+ return hashConflict;
+ }
+
+ public void setHashConflict(ErrorDescription hashConflict) {
+ this.hashConflict = hashConflict;
+ }
+
+ private ErrorDescription modelValidation;
+
+ public ErrorDescription getModelValidation() {
+ return modelValidation;
+ }
+
+ public void setModelValidation(ErrorDescription modelValidation) {
+ this.modelValidation = modelValidation;
+ }
+
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/DescriptionTemplateType.java b/dmp-backend/core/src/main/java/eu/eudat/model/DescriptionTemplateType.java
new file mode 100644
index 000000000..1350eb689
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/model/DescriptionTemplateType.java
@@ -0,0 +1,37 @@
+package eu.eudat.model;
+
+import java.util.UUID;
+
+public class DescriptionTemplateType {
+
+ private UUID id;
+
+ private String name;
+
+ private short status;
+
+ public UUID getId() {
+ return id;
+ }
+
+ public void setId(UUID id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public short getStatus() {
+ return status;
+ }
+
+ public void setStatus(short status) {
+ this.status = status;
+ }
+
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/BaseBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/BaseBuilder.java
new file mode 100644
index 000000000..4d6b584ab
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/BaseBuilder.java
@@ -0,0 +1,97 @@
+package eu.eudat.model.builder;
+
+import eu.eudat.convention.ConventionService;
+import gr.cite.tools.data.builder.Builder;
+import gr.cite.tools.data.query.QueryBase;
+import gr.cite.tools.fieldset.BaseFieldSet;
+import gr.cite.tools.fieldset.FieldSet;
+import gr.cite.tools.logging.LoggerService;
+
+import java.time.Instant;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public abstract class BaseBuilder implements Builder {
+
+ protected final LoggerService logger;
+
+ protected final ConventionService conventionService;
+
+ public BaseBuilder(
+ ConventionService conventionService,
+ LoggerService logger
+ ) {
+ this.conventionService = conventionService;
+ this.logger = logger;
+ }
+
+ public M build(FieldSet directives, D data) {
+ if (data == null) {
+ return null;
+ }
+ List models = this.build(directives == null ? getFullFieldSet() : directives, List.of(data));
+ return models.stream().findFirst().orElse(null);
+ }
+
+ public abstract List build(FieldSet directives, List data);
+
+ public abstract FieldSet getFullFieldSet();
+
+ public Map asForeignKey(QueryBase query, FieldSet directives, Function keySelector) {
+ this.logger.trace("Building references from query");
+ List data = query.collectAs(directives);
+ this.logger.trace("collected {} items to build", Optional.ofNullable(data).map(List::size).orElse(0));
+ return this.asForeignKey(data, directives, keySelector);
+ }
+
+ public Map asForeignKey(List data, FieldSet directives, Function keySelector) {
+ this.logger.trace("building references");
+ List models = this.build(directives, data);
+ this.logger.trace("mapping {} build items from {} requested", Optional.ofNullable(models).map(List::size).orElse(0), Optional.ofNullable(data).map(List::size).orElse(0));
+ assert models != null;
+ return models.stream().collect(Collectors.toMap(keySelector, o -> o));
+ }
+
+ public Map> asMasterKey(QueryBase query, FieldSet directives, Function keySelector) {
+ this.logger.trace("Building details from query");
+ List data = query.collectAs(directives);
+ this.logger.trace("collected {} items to build", Optional.ofNullable(data).map(List::size).orElse(0));
+ return this.asMasterKey(data, directives, keySelector);
+ }
+
+ public Map> asMasterKey(List data, FieldSet directives, Function keySelector) {
+ this.logger.trace("building details");
+ List models = this.build(directives, data);
+ this.logger.trace("mapping {} build items from {} requested", Optional.ofNullable(models).map(List::size).orElse(0), Optional.ofNullable(data).map(List::size).orElse(0));
+ Map> map = new HashMap<>();
+ assert models != null;
+ for (M model : models) {
+ K key = keySelector.apply(model);
+ if (!map.containsKey(key))
+ map.put(key, new ArrayList());
+ map.get(key).add(model);
+ }
+ return map;
+ }
+
+ public Map asEmpty(List keys, Function mapper, Function keySelector) {
+ this.logger.trace("building static references");
+ List models = keys.stream().map(mapper).collect(Collectors.toList());
+ this.logger.trace("mapping {} build items from {} requested", Optional.of(models).map(List::size).orElse(0), Optional.of(keys).map(List::size));
+ return models.stream().collect(Collectors.toMap(keySelector, o -> o));
+ }
+
+ protected String hashValue(Instant value) {
+ return this.conventionService.hashValue(value);
+ }
+
+ protected String asPrefix(String name) {
+ return this.conventionService.asPrefix(name);
+ }
+
+ protected String asIndexer(String... names) {
+ return this.conventionService.asIndexer(names);
+ }
+
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/builder/DescriptionTemplateTypeBuilder.java b/dmp-backend/core/src/main/java/eu/eudat/model/builder/DescriptionTemplateTypeBuilder.java
new file mode 100644
index 000000000..edafeb799
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/model/builder/DescriptionTemplateTypeBuilder.java
@@ -0,0 +1,56 @@
+package eu.eudat.model.builder;
+
+import eu.eudat.convention.ConventionService;
+import eu.eudat.data.DescriptionTemplateTypeEntity;
+import eu.eudat.model.DescriptionTemplateType;
+import gr.cite.tools.fieldset.BaseFieldSet;
+import gr.cite.tools.fieldset.FieldSet;
+import gr.cite.tools.logging.LoggerService;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+@Component
+public class DescriptionTemplateTypeBuilder extends BaseBuilder {
+
+ public DescriptionTemplateTypeBuilder(ConventionService conventionService) {
+ super(conventionService, new LoggerService(LoggerFactory.getLogger(DescriptionTemplateTypeBuilder.class)));
+ }
+
+ @Override
+ public List build(FieldSet directives, List data) {
+ if (directives == null || directives.isEmpty())
+ return new ArrayList<>();
+
+ List models = new ArrayList<>(100);
+
+ if (data == null)
+ return models;
+ for (DescriptionTemplateTypeEntity d : data) {
+ DescriptionTemplateType m = new DescriptionTemplateType();
+ if (directives.hasField(this.asIndexer(DescriptionTemplateTypeEntity._id)))
+ m.setId(d.getId());
+ if (directives.hasField(this.asIndexer(DescriptionTemplateTypeEntity._name)))
+ m.setName(d.getName());
+ if (directives.hasField(this.asIndexer(DescriptionTemplateTypeEntity._status)))
+ m.setStatus(d.getStatus());
+ models.add(m);
+ }
+
+ return models;
+ }
+
+ @Override
+ public FieldSet getFullFieldSet() {
+ BaseFieldSet fieldSet = new BaseFieldSet();
+ fieldSet.setFields(Set.of(
+ DescriptionTemplateTypeEntity._id,
+ DescriptionTemplateTypeEntity._name,
+ DescriptionTemplateTypeEntity._status
+ ));
+ return fieldSet;
+ }
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/result/QueryResult.java b/dmp-backend/core/src/main/java/eu/eudat/model/result/QueryResult.java
new file mode 100644
index 000000000..84cfa612a
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/model/result/QueryResult.java
@@ -0,0 +1,71 @@
+package eu.eudat.model.result;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QueryResult {
+
+ public QueryResult() {
+ }
+
+ public QueryResult(List items, long count, long countOverride) {
+ this.items = items;
+ this.count = count;
+ this.countOverride = countOverride;
+ }
+
+ public QueryResult(List items, long count) {
+ this.items = items;
+ this.count = count;
+ this.countOverride = 0;
+ }
+
+ public QueryResult(M item) {
+ this.items = List.of(item);
+ this.count = 1;
+ this.countOverride = 0;
+ }
+
+ public QueryResult(List items) {
+ this.items = items;
+ if (items != null)
+ this.count = items.size();
+ else
+ this.count = 0;
+ }
+
+ private List items;
+
+ private long count;
+
+ private long countOverride;
+
+ public List getItems() {
+ return items;
+ }
+
+ public void setItems(List items) {
+ this.items = items;
+ }
+
+ public long getCount() {
+ return count;
+ }
+
+ public void setCount(long count) {
+ this.count = count;
+ }
+
+ public long getCountOverride() {
+ return countOverride;
+ }
+
+ public void setCountOverride(long countOverride) {
+ this.countOverride = countOverride;
+ }
+
+ public static QueryResult> empty() {
+ return new QueryResult<>(new ArrayList<>(), 0L);
+ }
+
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/query/DescriptionTemplateTypeQuery.java b/dmp-backend/core/src/main/java/eu/eudat/query/DescriptionTemplateTypeQuery.java
new file mode 100644
index 000000000..8476fb6b6
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/query/DescriptionTemplateTypeQuery.java
@@ -0,0 +1,132 @@
+package eu.eudat.query;
+
+import eu.eudat.commons.enums.DescriptionTemplateTypeStatus;
+import eu.eudat.data.DescriptionTemplateTypeEntity;
+import eu.eudat.query.lookup.DescriptionTemplateTypeLookup;
+import eu.eudat.query.lookup.LookupAware;
+import gr.cite.tools.data.query.FieldResolver;
+import gr.cite.tools.data.query.QueryBase;
+import gr.cite.tools.data.query.QueryContext;
+import jakarta.persistence.Tuple;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.Predicate;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+
+@Component
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class DescriptionTemplateTypeQuery extends QueryBase implements LookupAware {
+
+ private Collection ids;
+
+ private Collection names;
+
+ private Collection statuses;
+
+ public DescriptionTemplateTypeQuery ids(UUID value) {
+ this.ids = List.of(value);
+ return this;
+ }
+
+ public DescriptionTemplateTypeQuery ids(UUID... value) {
+ this.ids = Arrays.asList(value);
+ return this;
+ }
+
+ public DescriptionTemplateTypeQuery ids(List value) {
+ this.ids = value;
+ return this;
+ }
+
+ public DescriptionTemplateTypeQuery names(String value) {
+ this.names = List.of(value);
+ return this;
+ }
+
+ public DescriptionTemplateTypeQuery names(String... value) {
+ this.names = Arrays.asList(value);
+ return this;
+ }
+
+ public DescriptionTemplateTypeQuery names(List value) {
+ this.names = value;
+ return this;
+ }
+
+ public DescriptionTemplateTypeQuery statuses(Short value) {
+ this.statuses = List.of(value);
+ return this;
+ }
+
+ public DescriptionTemplateTypeQuery statuses(Short... value) {
+ this.statuses = Arrays.asList(value);
+ return this;
+ }
+
+ public DescriptionTemplateTypeQuery statuses(List value) {
+ this.statuses = value;
+ return this;
+ }
+
+ @Override
+ public DescriptionTemplateTypeQuery fromLookup(DescriptionTemplateTypeLookup lookup) {
+ if (lookup == null) return this;
+ if (lookup.getName() != null) names(lookup.getName());
+ if (lookup.getStatus() != null) statuses(DescriptionTemplateTypeStatus.fromLabel(lookup.getStatus()).getValue());
+ return this;
+ }
+
+ @Override
+ protected Boolean isFalseQuery() {
+ return Boolean.FALSE;
+ }
+
+ @Override
+ protected Class entityClass() {
+ return DescriptionTemplateTypeEntity.class;
+ }
+
+ @Override
+ protected Predicate applyFilters(QueryContext queryContext) {
+ List predicates = new ArrayList<>();
+
+ if (this.ids != null) {
+ CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateTypeEntity._id));
+ for (UUID item : this.ids) inClause.value(item);
+ predicates.add(inClause);
+ }
+
+ if (this.names != null) {
+ CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateTypeEntity._name));
+ for (String item : this.names) inClause.value(item);
+ predicates.add(inClause);
+ }
+
+ if (this.statuses != null) {
+ CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateTypeEntity._status));
+ for (Short item : this.statuses) inClause.value(item);
+ predicates.add(inClause);
+ }
+
+ if (!predicates.isEmpty()) {
+ Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
+ return queryContext.CriteriaBuilder.and(predicatesArray);
+ } else {
+ return queryContext.CriteriaBuilder.and();
+ }
+ }
+
+ @Override
+ protected String fieldNameOf(FieldResolver item) {
+ return null;
+ }
+
+ @Override
+ protected DescriptionTemplateTypeEntity convert(Tuple tuple, Set columns) {
+ return null;
+ }
+
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/query/lookup/DescriptionTemplateTypeLookup.java b/dmp-backend/core/src/main/java/eu/eudat/query/lookup/DescriptionTemplateTypeLookup.java
new file mode 100644
index 000000000..0c928c99e
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/query/lookup/DescriptionTemplateTypeLookup.java
@@ -0,0 +1,25 @@
+package eu.eudat.query.lookup;
+
+import gr.cite.tools.data.query.Lookup;
+
+public class DescriptionTemplateTypeLookup extends Lookup {
+
+ private String name, status;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/query/lookup/LookupAware.java b/dmp-backend/core/src/main/java/eu/eudat/query/lookup/LookupAware.java
new file mode 100644
index 000000000..993c6b137
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/query/lookup/LookupAware.java
@@ -0,0 +1,12 @@
+package eu.eudat.query.lookup;
+
+public interface LookupAware {
+
+ /**
+ * Every query that supports building from a lookup object should implement this interface
+ * @param lookup The object containing all the lookup options
+ * @return The query built from all the set options
+ */
+ Q fromLookup(L lookup);
+
+}
diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/DescriptionTemplateTypeService.java b/dmp-backend/core/src/main/java/eu/eudat/service/DescriptionTemplateTypeService.java
new file mode 100644
index 000000000..3f8ebef88
--- /dev/null
+++ b/dmp-backend/core/src/main/java/eu/eudat/service/DescriptionTemplateTypeService.java
@@ -0,0 +1,101 @@
+package eu.eudat.service;
+
+import eu.eudat.commons.enums.DescriptionTemplateTypeStatus;
+import eu.eudat.data.DescriptionTemplateTypeEntity;
+import eu.eudat.model.DescriptionTemplateType;
+import eu.eudat.model.builder.DescriptionTemplateTypeBuilder;
+import eu.eudat.query.DescriptionTemplateTypeQuery;
+import eu.eudat.query.lookup.DescriptionTemplateTypeLookup;
+import gr.cite.tools.data.builder.BuilderFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.DefaultTransactionDefinition;
+
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import java.util.List;
+import java.util.UUID;
+
+@Service
+public class DescriptionTemplateTypeService {
+
+ private final ApplicationContext applicationContext;
+
+ private final BuilderFactory builderFactory;
+
+ private final PlatformTransactionManager transactionManager;
+
+ @PersistenceContext
+ private EntityManager entityManager;
+
+ public DescriptionTemplateTypeService(ApplicationContext applicationContext, BuilderFactory builderFactory, PlatformTransactionManager platformTransactionManager) {
+ this.applicationContext = applicationContext;
+ this.builderFactory = builderFactory;
+ this.transactionManager = platformTransactionManager;
+ }
+
+ public List getAll(DescriptionTemplateTypeLookup lookup) {
+ DescriptionTemplateTypeQuery query = applicationContext.getBean(DescriptionTemplateTypeQuery.class);
+ return builderFactory
+ .builder(DescriptionTemplateTypeBuilder.class)
+ .build(lookup.getProject(), query.fromLookup(lookup).collect());
+ }
+
+ public DescriptionTemplateType getById(UUID id) {
+ DescriptionTemplateTypeQuery query = applicationContext.getBean(DescriptionTemplateTypeQuery.class);
+ return builderFactory
+ .builder(DescriptionTemplateTypeBuilder.class)
+ .build(null, query.ids(id).first());
+ }
+
+ public DescriptionTemplateType create(DescriptionTemplateType payload) {
+ DescriptionTemplateTypeEntity created = new DescriptionTemplateTypeEntity();
+ created.setId(UUID.randomUUID());
+ created.setName(payload.getName());
+ created.setStatus(DescriptionTemplateTypeStatus.SAVED.getValue());
+
+ DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
+ definition.setName(UUID.randomUUID().toString());
+ definition.setIsolationLevel(TransactionDefinition.ISOLATION_READ_COMMITTED);
+ definition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
+ TransactionStatus status = null;
+ try {
+ status = transactionManager.getTransaction(definition);
+ entityManager.persist(created);
+
+ entityManager.flush();
+ transactionManager.commit(status);
+ } catch (Exception ex) {
+ if (status != null)
+ transactionManager.rollback(status);
+ throw ex;
+ }
+
+ DescriptionTemplateTypeQuery query = applicationContext.getBean(DescriptionTemplateTypeQuery.class);
+ return builderFactory
+ .builder(DescriptionTemplateTypeBuilder.class)
+ .build(null, query.ids(created.getId()).first());
+ }
+
+ public DescriptionTemplateType update(DescriptionTemplateType payload) {
+ DescriptionTemplateTypeEntity entity = entityManager.find(DescriptionTemplateTypeEntity.class, payload.getId());
+ entity.setName(payload.getName());
+ entity.setStatus(payload.getStatus());
+ entityManager.merge(entity);
+ entityManager.flush();
+ return builderFactory.builder(DescriptionTemplateTypeBuilder.class).build(null, entity);
+ }
+
+ public boolean delete (UUID id) {
+ DescriptionTemplateTypeEntity entity = entityManager.find(DescriptionTemplateTypeEntity.class, id);
+ if (entity == null) return false;
+ entity.setStatus(DescriptionTemplateTypeStatus.DELETED.getValue());
+ entityManager.merge(entity);
+ entityManager.flush();
+ return true;
+ }
+
+}
diff --git a/dmp-backend/data/pom.xml b/dmp-backend/data/pom.xml
index 6c162868f..59d45c51d 100644
--- a/dmp-backend/data/pom.xml
+++ b/dmp-backend/data/pom.xml
@@ -15,6 +15,13 @@
+
+
+ eu.eudat
+ core
+ 1.0.0-SNAPSHOT
+
+
dmp-backend
queryable
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/converters/DateToUTCConverter.java b/dmp-backend/data/src/main/java/eu/eudat/data/converters/DateToUTCConverter.java
index e0fd8e070..3a9207eb2 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/converters/DateToUTCConverter.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/converters/DateToUTCConverter.java
@@ -4,8 +4,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.format.datetime.DateFormatter;
-import javax.persistence.AttributeConverter;
-import javax.persistence.Converter;
+import jakarta.persistence.AttributeConverter;
+import jakarta.persistence.Converter;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/context/DatabaseContext.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/context/DatabaseContext.java
index 49f823d63..6857e4ffd 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/context/DatabaseContext.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/context/DatabaseContext.java
@@ -8,9 +8,9 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.PersistenceContext;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.EntityManagerFactory;
+import jakarta.persistence.PersistenceContext;
@Repository("databaseCtx")
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/service/DatabaseService.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/service/DatabaseService.java
index 6355da0e2..6ef82d736 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/service/DatabaseService.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/service/DatabaseService.java
@@ -7,7 +7,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import javax.transaction.Transactional;
+import jakarta.transaction.Transactional;
import java.util.Set;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DMPDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DMPDaoImpl.java
index ac8ce47d7..ab9c07b93 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DMPDaoImpl.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DMPDaoImpl.java
@@ -10,13 +10,13 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
import eu.eudat.types.grant.GrantStateType;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.JoinType;
+import jakarta.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.JoinType;
-import javax.transaction.Transactional;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -26,41 +26,41 @@ import java.util.concurrent.CompletableFuture;
@Component("dMPDao")
public class DMPDaoImpl extends DatabaseAccess implements DMPDao {
- @Autowired
- public DMPDaoImpl(DatabaseService databaseService) {
- super(databaseService);
- }
+ @Autowired
+ public DMPDaoImpl(DatabaseService databaseService) {
+ super(databaseService);
+ }
- @Override
- public QueryableList getWithCriteria(DataManagementPlanCriteria criteria) {
- QueryableList query = getDatabaseService().getQueryable(DMP.getHints(), DMP.class);
- if (criteria.getLike() != null && !criteria.getLike().isEmpty())
- query.where((builder, root) -> builder.or(
- builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
- builder.like(builder.upper(root.get("description")), "%" + criteria.getLike().toUpperCase() + "%")));
- if (criteria.getPeriodEnd() != null)
- query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd()));
- if (criteria.getPeriodStart() != null)
- query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
- if (criteria.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.subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(
- builder1.equal(externalRoot.get("groupId"), nestedRoot.get("groupId")),
- builder1.notEqual(nestedRoot.get("status"), DMP.DMPStatus.DELETED.getValue())), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class)));
- if (criteria.getGroupIds() != null && !criteria.getGroupIds().isEmpty())
- query.where((builder, root) -> root.get("groupId").in(criteria.getGroupIds()));
- if (criteria.getStatus() != null) {
- if (criteria.getStatus() == DMP.DMPStatus.FINALISED.getValue()) {
- query.where((builder, root) -> builder.equal(root.get("status"), DMP.DMPStatus.FINALISED.getValue()));
- } else if (criteria.getStatus() == DMP.DMPStatus.ACTIVE.getValue()) {
- query.where((builder, root) -> builder.equal(root.get("status"), DMP.DMPStatus.ACTIVE.getValue()));
- }
- }
- if (criteria.getIsPublic()) {
- query.where(((builder, root) -> builder.equal(root.get("isPublic"), criteria.getIsPublic())));
- }
+ @Override
+ public QueryableList getWithCriteria(DataManagementPlanCriteria criteria) {
+ QueryableList query = getDatabaseService().getQueryable(DMP.getHints(), DMP.class);
+ if (criteria.getLike() != null && !criteria.getLike().isEmpty())
+ query.where((builder, root) -> builder.or(
+ builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
+ builder.like(builder.upper(root.get("description")), "%" + criteria.getLike().toUpperCase() + "%")));
+ if (criteria.getPeriodEnd() != null)
+ query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd()));
+ if (criteria.getPeriodStart() != null)
+ query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
+ if (criteria.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.subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(
+ builder1.equal(externalRoot.get("groupId"), nestedRoot.get("groupId")),
+ builder1.notEqual(nestedRoot.get("status"), DMP.DMPStatus.DELETED.getValue())), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), Integer.class)));
+ if (criteria.getGroupIds() != null && !criteria.getGroupIds().isEmpty())
+ query.where((builder, root) -> root.get("groupId").in(criteria.getGroupIds()));
+ if (criteria.getStatus() != null) {
+ if (criteria.getStatus() == DMP.DMPStatus.FINALISED.getValue()) {
+ query.where((builder, root) -> builder.equal(root.get("status"), DMP.DMPStatus.FINALISED.getValue()));
+ } else if (criteria.getStatus() == DMP.DMPStatus.ACTIVE.getValue()) {
+ query.where((builder, root) -> builder.equal(root.get("status"), DMP.DMPStatus.ACTIVE.getValue()));
+ }
+ }
+ if (criteria.getIsPublic()) {
+ query.where(((builder, root) -> builder.equal(root.get("isPublic"), criteria.getIsPublic())));
+ }
/*if (criteria.getRole() != null) {
if (criteria.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())) {
query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).get("role"), UserDMP.UserDMPRoles.OWNER.getValue()));
@@ -68,82 +68,82 @@ public class DMPDaoImpl extends DatabaseAccess implements DMPDao {
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()));
- }
- if (criteria.getGrantStatus() != null) {
- if (criteria.getGrantStatus().equals(GrantStateType.FINISHED.getValue().shortValue()))
- query.where((builder, root) -> builder.lessThan(root.get("grant").get("enddate"), new Date()));
- if (criteria.getGrantStatus().equals(GrantStateType.ONGOING.getValue().shortValue()))
- query.where((builder, root) ->
- builder.or(builder.greaterThan(root.get("grant").get("enddate"), new Date())
- , builder.isNull(root.get("grant").get("enddate"))));
- }
+ if (criteria.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()));
+ }
+ if (criteria.getGrantStatus() != null) {
+ if (criteria.getGrantStatus().equals(GrantStateType.FINISHED.getValue().shortValue()))
+ query.where((builder, root) -> builder.lessThan(root.get("grant").get("enddate"), new Date()));
+ if (criteria.getGrantStatus().equals(GrantStateType.ONGOING.getValue().shortValue()))
+ query.where((builder, root) ->
+ builder.or(builder.greaterThan(root.get("grant").get("enddate"), new Date())
+ , builder.isNull(root.get("grant").get("enddate"))));
+ }
- if (criteria.hasDoi()) {
- query.where((builder, root) -> builder.not(builder.isNull(root.join("dois").get("id"))));
- }
- query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue()));
- return query;
- }
+ if (criteria.hasDoi()) {
+ query.where((builder, root) -> builder.not(builder.isNull(root.join("dois").get("id"))));
+ }
+ query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue()));
+ return query;
+ }
- public QueryableList getAuthenticated(QueryableList query, UUID principal, List roles) {
- if (roles != null && !roles.isEmpty()) {
- query.where((builder, root) -> {
- Join userJoin = root.join("users", JoinType.LEFT);
- return builder.and(builder.equal(userJoin.join("user", JoinType.LEFT).get("id"), principal), userJoin.get("role").in(roles));
- });
- } else {
- query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id"), principal));
- }
+ public QueryableList getAuthenticated(QueryableList query, UUID principal, List roles) {
+ if (roles != null && !roles.isEmpty()) {
+ query.where((builder, root) -> {
+ Join userJoin = root.join("users", JoinType.LEFT);
+ return builder.and(builder.equal(userJoin.join("user", JoinType.LEFT).get("id"), principal), userJoin.get("role").in(roles));
+ });
+ } else {
+ query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id"), principal));
+ }
- return query;
- }
+ return query;
+ }
- @Override
- @Transactional
- public DMP createOrUpdate(DMP item) {
- return this.getDatabaseService().createOrUpdate(item, DMP.class);
- }
+ @Override
+ @Transactional
+ public DMP createOrUpdate(DMP item) {
+ return this.getDatabaseService().createOrUpdate(item, DMP.class);
+ }
- @Override
- public DMP find(UUID id) {
- return getDatabaseService().getQueryable(DMP.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
- }
+ @Override
+ public DMP find(UUID id) {
+ return getDatabaseService().getQueryable(DMP.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
+ }
- @Override
- public QueryableList getUserDmps(DatasetWizardUserDmpCriteria datasetWizardUserDmpCriteria, UserInfo userInfo) {
- QueryableList query = getDatabaseService().getQueryable(DMP.class).where((builder, root) -> builder.or(builder.equal(root.get("creator"), userInfo), builder.isMember(userInfo, root.get("users"))));
- if (datasetWizardUserDmpCriteria.getLike() != null && !datasetWizardUserDmpCriteria.getLike().isEmpty()) {
- query.where((builder, root) -> builder.like(root.get("label"), "%" + datasetWizardUserDmpCriteria.getLike() + "%"));
- }
- return query;
- }
+ @Override
+ public QueryableList getUserDmps(DatasetWizardUserDmpCriteria datasetWizardUserDmpCriteria, UserInfo userInfo) {
+ QueryableList query = getDatabaseService().getQueryable(DMP.class).where((builder, root) -> builder.or(builder.equal(root.get("creator"), userInfo), builder.isMember(userInfo, root.get("users"))));
+ if (datasetWizardUserDmpCriteria.getLike() != null && !datasetWizardUserDmpCriteria.getLike().isEmpty()) {
+ query.where((builder, root) -> builder.like(root.get("label"), "%" + datasetWizardUserDmpCriteria.getLike() + "%"));
+ }
+ return query;
+ }
- @Override
- public void delete(DMP item) {
- this.getDatabaseService().delete(item);
- }
+ @Override
+ public void delete(DMP item) {
+ this.getDatabaseService().delete(item);
+ }
- @Override
- public QueryableList asQueryable() {
- return this.getDatabaseService().getQueryable(DMP.class);
- }
+ @Override
+ public QueryableList asQueryable() {
+ return this.getDatabaseService().getQueryable(DMP.class);
+ }
- @Async
- @Override
- public CompletableFuture createOrUpdateAsync(DMP item) {
- return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
- }
+ @Async
+ @Override
+ public CompletableFuture createOrUpdateAsync(DMP item) {
+ return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
+ }
- @Override
- public DMP find(UUID id, String hint) {
- throw new UnsupportedOperationException();
- }
+ @Override
+ public DMP find(UUID id, String hint) {
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetDaoImpl.java
index d996ea95e..841c2c08c 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetDaoImpl.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetDaoImpl.java
@@ -15,8 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.JoinType;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.JoinType;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -52,7 +52,7 @@ public class DatasetDaoImpl extends DatabaseAccess implements DatasetDa
if (criteria.getPeriodStart() != null)
query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
if (!criteria.getAllVersions())
- query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"), query.subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")), builder1.notEqual(nestedRoot.get("dmp").get("status"), DMP.DMPStatus.DELETED.getValue())), Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));
+ query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"), query.subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")), builder1.notEqual(nestedRoot.get("dmp").get("status"), DMP.DMPStatus.DELETED.getValue())), Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), Integer.class)));
if (criteria.getGroupIds() != null && !criteria.getGroupIds().isEmpty())
query.where((builder, root) -> root.get("dmp").get("groupId").in(criteria.getGroupIds()));
if (criteria.getDmpIds() != null && !criteria.getDmpIds().isEmpty())
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetProfileDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetProfileDaoImpl.java
index 3ba9fe758..d0d77b877 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetProfileDaoImpl.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetProfileDaoImpl.java
@@ -12,8 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.JoinType;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.JoinType;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -35,8 +35,8 @@ public class DatasetProfileDaoImpl extends DatabaseAccess i
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.subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("groupId"),
- nestedRoot.get("groupId")), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class)));
+ query.subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("groupId"),
+ nestedRoot.get("groupId")), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), Integer.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) {
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DescriptionTemplateTypeDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DescriptionTemplateTypeDaoImpl.java
index f93afb383..518332c01 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DescriptionTemplateTypeDaoImpl.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DescriptionTemplateTypeDaoImpl.java
@@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
-import javax.transaction.Transactional;
+import jakarta.transaction.Transactional;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/GrantDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/GrantDaoImpl.java
index 84674491b..a148f3644 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/GrantDaoImpl.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/GrantDaoImpl.java
@@ -13,7 +13,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import schemasMicrosoftComOfficeOffice.LeftDocument;
-import javax.persistence.criteria.JoinType;
+import jakarta.persistence.criteria.JoinType;
import java.util.Date;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/OrganisationDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/OrganisationDaoImpl.java
index 3892e7a04..82e6e7076 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/OrganisationDaoImpl.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/OrganisationDaoImpl.java
@@ -11,7 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
-import javax.persistence.criteria.JoinType;
+import jakarta.persistence.criteria.JoinType;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ProjectDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ProjectDaoImpl.java
index 935bfe9de..cc9afd444 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ProjectDaoImpl.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ProjectDaoImpl.java
@@ -8,7 +8,7 @@ import eu.eudat.data.entities.UserInfo;
import eu.eudat.queryable.QueryableList;
import org.springframework.stereotype.Service;
-import javax.persistence.criteria.JoinType;
+import jakarta.persistence.criteria.JoinType;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Content.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Content.java
index bb08a574e..973ccbc80 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Content.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Content.java
@@ -4,7 +4,7 @@ import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Credential.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Credential.java
index ec6784281..69a5e2b46 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Credential.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Credential.java
@@ -4,7 +4,7 @@ import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java
index 60277ead5..e982d74ec 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java
@@ -5,7 +5,7 @@ import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.*;
import java.util.stream.Collectors;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPDatasetProfile.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPDatasetProfile.java
index 816ec0410..358a886f4 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPDatasetProfile.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPDatasetProfile.java
@@ -3,7 +3,7 @@ package eu.eudat.data.entities;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPOrganisation.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPOrganisation.java
index f0c23604b..6cbd8d1a1 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPOrganisation.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPOrganisation.java
@@ -3,7 +3,7 @@ package eu.eudat.data.entities;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.io.Serializable;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPProfile.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPProfile.java
index ea48c196a..85261b21a 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPProfile.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPProfile.java
@@ -7,7 +7,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
@@ -59,7 +59,7 @@ public class DMPProfile implements DataEntity {
@Column(name = "\"Label\"")
private String label;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPResearcher.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPResearcher.java
index 5c3e7e11e..eb1f08108 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPResearcher.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMPResearcher.java
@@ -4,7 +4,7 @@ package eu.eudat.data.entities;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.UUID;
@@ -18,11 +18,9 @@ public class DMPResearcher {
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
- @Type(type = "org.hibernate.type.PostgresUUIDType")
@Column(name = "\"DMP\"")
private UUID dmp;
- @Type(type = "org.hibernate.type.PostgresUUIDType")
@Column(name = "\"Researcher\"")
private UUID researcher;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DataRepository.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DataRepository.java
index 81ad45035..7f13aa58a 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DataRepository.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DataRepository.java
@@ -5,7 +5,7 @@ import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@@ -32,7 +32,7 @@ public class DataRepository implements Serializable, DataEntity {
@Column(name = "\"Uri\"")
private String uri;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Properties\"", columnDefinition = "xml")
private String properties;
@@ -115,7 +115,7 @@ public class Dataset implements DataEntity {
@JoinColumn(name = "\"Profile\"")
private DescriptionTemplate profile;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Reference\"", columnDefinition = "xml")
private String reference;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetDataRepository.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetDataRepository.java
index b99483a13..4142e4c02 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetDataRepository.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetDataRepository.java
@@ -4,7 +4,7 @@ import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetExternalDataset.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetExternalDataset.java
index dbcf75b4c..dbabee5ec 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetExternalDataset.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetExternalDataset.java
@@ -4,7 +4,7 @@ import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfileRuleset.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfileRuleset.java
index b235cf7d2..a97ba3a34 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfileRuleset.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfileRuleset.java
@@ -4,7 +4,7 @@ package eu.eudat.data.entities;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.io.Serializable;
import java.util.UUID;
@@ -23,7 +23,7 @@ public class DatasetProfileRuleset {
@Column(name = "\"Label\"")
private String label;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfileViewstyle.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfileViewstyle.java
index 03eac7b4c..1ffcfd7f2 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfileViewstyle.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfileViewstyle.java
@@ -4,7 +4,7 @@ package eu.eudat.data.entities;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.UUID;
@@ -23,7 +23,7 @@ public class DatasetProfileViewstyle {
@Column(name = "\"Label\"")
private String label;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetRegistry.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetRegistry.java
index 271c2d685..1523db218 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetRegistry.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetRegistry.java
@@ -4,7 +4,7 @@ package eu.eudat.data.entities;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.io.Serializable;
import java.util.UUID;
@@ -19,12 +19,11 @@ public class DatasetRegistry {
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
-
- @Type(type = "org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
+ //DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Dataset\"", nullable = false)
private UUID dataset;
- @Type(type = "org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
+ //DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Registry\"", nullable = false)
private UUID registry;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetService.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetService.java
index 401c13cf4..c9c52999d 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetService.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetService.java
@@ -4,7 +4,7 @@ package eu.eudat.data.entities;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DescriptionTemplate.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DescriptionTemplate.java
index 958934c72..993fc155c 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DescriptionTemplate.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DescriptionTemplate.java
@@ -6,7 +6,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
@@ -55,7 +55,7 @@ public class DescriptionTemplate implements DataEntity
@OneToMany(fetch = FetchType.LAZY, mappedBy = "profile")
private Set dataset;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DescriptionTemplateType.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DescriptionTemplateType.java
index 40a755c2f..9b466f862 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DescriptionTemplateType.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DescriptionTemplateType.java
@@ -3,7 +3,7 @@ package eu.eudat.data.entities;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/EmailConfirmation.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/EmailConfirmation.java
index 9bbee2886..2f891c627 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/EmailConfirmation.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/EmailConfirmation.java
@@ -4,7 +4,7 @@ import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/EntityDoi.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/EntityDoi.java
index a0b86c6c5..c153a7502 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/EntityDoi.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/EntityDoi.java
@@ -5,7 +5,7 @@ import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -24,7 +24,6 @@ public class EntityDoi implements DataEntity {
private UUID id;
@Enumerated(EnumType.STRING)
- @Type(type = "eu.eudat.configurations.typedefinition.PostgreSQLEnumType")
@Column(name = "\"EntityType\"", nullable = false)
private EntityType entityType;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/ExternalDataset.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/ExternalDataset.java
index 199bacff3..42a322fa2 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/ExternalDataset.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/ExternalDataset.java
@@ -5,7 +5,7 @@ import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/FileUpload.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/FileUpload.java
index 394bebfe5..81204dfe4 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/FileUpload.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/FileUpload.java
@@ -5,7 +5,7 @@ import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@@ -32,7 +32,6 @@ public class FileUpload implements DataEntity {
private UUID entityId;
@Enumerated(EnumType.STRING)
- @Type(type = "eu.eudat.configurations.typedefinition.PostgreSQLEnumType")
@Column(name = "\"EntityType\"", nullable = false)
private EntityType entityType;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Funder.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Funder.java
index d57e91136..8ccfa3b9a 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Funder.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Funder.java
@@ -4,7 +4,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@@ -74,11 +74,11 @@ public class Funder implements DataEntity {
@Column(name = "\"Label\"")
private String label;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
private String reference;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Grant.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Grant.java
index fd5c77164..705748a21 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Grant.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Grant.java
@@ -7,7 +7,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.*;
import java.util.stream.Collectors;
@@ -102,7 +102,7 @@ public class Grant implements DataEntity {
@Column(name = "\"Uri\"")
private String uri;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Invitation.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Invitation.java
index 10ffc769b..015b50f62 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Invitation.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Invitation.java
@@ -5,7 +5,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.List;
import java.util.UUID;
@@ -37,7 +37,7 @@ public class Invitation implements DataEntity {
@Column(name = "\"AcceptedInvitation\"", nullable = false)
private boolean acceptedInvitation;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Properties\"", columnDefinition = "xml", nullable = true)
private String properties;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Lock.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Lock.java
index 769ceff26..de4232f76 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Lock.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Lock.java
@@ -5,7 +5,7 @@ import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Notification.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Notification.java
index 39eb094a8..65647f617 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Notification.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Notification.java
@@ -7,7 +7,7 @@ import eu.eudat.data.enumeration.notification.NotifyState;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Organisation.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Organisation.java
index 94a8c8f33..0fa52bbac 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Organisation.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Organisation.java
@@ -6,7 +6,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@@ -35,14 +35,14 @@ public class Organisation implements Serializable, DataEntity
@Column(name = "\"Abbreviation\"")
private String abbreviation;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
private String reference;
@Column(name = "\"Uri\"")
private String uri;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Project.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Project.java
index 04c9d662c..6a815172f 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Project.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Project.java
@@ -6,7 +6,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.*;
import java.util.stream.Collectors;
@@ -87,7 +87,7 @@ public class Project implements DataEntity {
@Column(name = "\"Uri\"")
private String uri;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Registry.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Registry.java
index f1295d6ef..b61201bc8 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Registry.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Registry.java
@@ -6,7 +6,7 @@ import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
@@ -33,7 +33,7 @@ public class Registry implements DataEntity {
@Column(name = "\"Uri\"")
private String uri;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Researcher.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Researcher.java
index 0c5d853ba..f28f26394 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Researcher.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Researcher.java
@@ -7,7 +7,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
@@ -33,11 +33,11 @@ public class Researcher implements DataEntity {
@Column(name = "\"PrimaryEmail\"")
private String primaryEmail;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
private String definition;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
private String reference;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Service.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Service.java
index b3d43fba8..9f7b87144 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Service.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Service.java
@@ -5,7 +5,7 @@ import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
@@ -32,7 +32,7 @@ public class Service implements DataEntity {
@Column(name = "\"Uri\"")
private String uri;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserDMP.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserDMP.java
index 217b81821..060c83ad1 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserDMP.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserDMP.java
@@ -4,7 +4,7 @@ import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserDatasetProfile.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserDatasetProfile.java
index 4af7c2799..9369f0569 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserDatasetProfile.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserDatasetProfile.java
@@ -4,7 +4,7 @@ import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserInfo.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserInfo.java
index 7c243b3a5..18e4f9949 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserInfo.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserInfo.java
@@ -6,7 +6,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.*;
@@ -55,7 +55,7 @@ public class UserInfo implements DataEntity {
private Date lastloggedin = null;
- @Type(type = "eu.eudat.configurations.typedefinition.XMLType")
+ @Type(eu.eudat.configurations.typedefinition.XMLType.class)
@Column(name = "additionalinfo", nullable = true)
private String additionalinfo;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserRole.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserRole.java
index 43633c237..1d00d08c4 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserRole.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserRole.java
@@ -4,7 +4,7 @@ import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserToken.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserToken.java
index ec49d0bbb..f668ebbee 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserToken.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserToken.java
@@ -4,7 +4,7 @@ import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.data.entities.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/helpers/EntityBinder.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/helpers/EntityBinder.java
index 775c17ce2..c640e6d42 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/helpers/EntityBinder.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/helpers/EntityBinder.java
@@ -1,6 +1,6 @@
package eu.eudat.data.entities.helpers;
-import javax.persistence.Tuple;
+import jakarta.persistence.Tuple;
import java.util.List;
public class EntityBinder {
diff --git a/dmp-backend/data/src/main/java/eu/eudat/query/DMPQuery.java b/dmp-backend/data/src/main/java/eu/eudat/query/DMPQuery.java
index 0c96b700b..d47412e99 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/query/DMPQuery.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/query/DMPQuery.java
@@ -9,7 +9,7 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
-import javax.persistence.criteria.Subquery;
+import jakarta.persistence.criteria.Subquery;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/query/DatasetQuery.java b/dmp-backend/data/src/main/java/eu/eudat/query/DatasetQuery.java
index 7dce8d313..aecf08155 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/query/DatasetQuery.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/query/DatasetQuery.java
@@ -7,7 +7,7 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
-import javax.persistence.criteria.Subquery;
+import jakarta.persistence.criteria.Subquery;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/query/GrantQuery.java b/dmp-backend/data/src/main/java/eu/eudat/query/GrantQuery.java
index 9c19dfc4c..d48365036 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/query/GrantQuery.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/query/GrantQuery.java
@@ -7,7 +7,7 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
-import javax.persistence.criteria.Subquery;
+import jakarta.persistence.criteria.Subquery;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
diff --git a/dmp-backend/data/src/main/java/eu/eudat/query/LockQuery.java b/dmp-backend/data/src/main/java/eu/eudat/query/LockQuery.java
index b0f28676d..8f58687de 100644
--- a/dmp-backend/data/src/main/java/eu/eudat/query/LockQuery.java
+++ b/dmp-backend/data/src/main/java/eu/eudat/query/LockQuery.java
@@ -7,7 +7,7 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
-import javax.persistence.criteria.Subquery;
+import jakarta.persistence.criteria.Subquery;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
diff --git a/dmp-backend/pom.xml b/dmp-backend/pom.xml
index 56aad0165..5d693e51f 100644
--- a/dmp-backend/pom.xml
+++ b/dmp-backend/pom.xml
@@ -10,7 +10,7 @@
org.springframework.boot
spring-boot-starter-parent
- 2.5.2
+ 3.1.2
@@ -18,36 +18,24 @@
web
data
elastic
+ core
1.19.0
1.19.0
0.2.0
- 1.8
+ 17
0.0.1-SNAPSHOT
- 5.3.8
-
- 5.3.10.RELEASE
-
-
-
-
- 5.5.3.Final
1.9
4.11
1.2.17
2.15.0
- 1.7.15
-
- 1.2.3
-
-
+
+ 17
+ 17
@@ -55,12 +43,11 @@
org.json
json
- 20160810
+ 20230227
org.springframework
spring-context-support
- ${org.springframework.version}
org.springframework.boot
@@ -89,15 +76,13 @@
- org.apache.httpcomponents
- httpclient
- 4.5.12
+ org.apache.httpcomponents.client5
+ httpclient5
org.apache.httpcomponents
httpcore-nio
- 4.4.13
@@ -112,22 +97,20 @@
7.6.0
- org.hibernate
+ org.hibernate.orm
hibernate-core
- ${hibernate.version}
- org.hibernate
+ org.hibernate.orm
hibernate-c3p0
- ${hibernate.version}
com.google.api-client
google-api-client
- 1.23.0
+ 1.35.2
@@ -141,7 +124,6 @@
com.fasterxml.jackson.dataformat
jackson-dataformat-xml
- 2.12.3
@@ -149,13 +131,16 @@
com.fasterxml.jackson.core
jackson-core
- 2.12.3
com.fasterxml.jackson.core
jackson-databind
- 2.12.3
+
+
+
+ com.fasterxml.jackson.module
+ jackson-module-jaxb-annotations
@@ -173,13 +158,13 @@
org.apache.poi
poi-ooxml
- 4.1.1
+ 4.1.2
org.apache.poi
poi
- 4.1.1
+ 4.1.2
@@ -192,7 +177,7 @@
org.jsoup
jsoup
- 1.14.3
+ 1.15.3
@@ -210,7 +195,7 @@
fr.opensagres.xdocreport
fr.opensagres.xdocreport.itext.extension
- 2.0.1
+ 2.0.4
@@ -236,7 +221,7 @@
2.8.2
-->
-
+
javax.xml.bind
jaxb-api
@@ -247,62 +232,66 @@
org.glassfish.jaxb
jaxb-core
- 2.3.0
+ 4.0.3
org.glassfish.jaxb
jaxb-runtime
- 2.3.1
+ 4.0.3
-
+
- javax.annotation
- javax.annotation-api
- 1.3.1
+ jakarta.annotation
+ jakarta.annotation-api
-
+
- javax.validation
- validation-api
- 2.0.1.Final
+ jakarta.validation
+ jakarta.validation-api
+
+
+
+ jakarta.persistence
+ jakarta.persistence-api
+ 3.1.0
-
-
- io.prometheus
- simpleclient
- 0.11.0
-
-
-
- io.prometheus
- simpleclient_hotspot
- 0.11.0
-
-
-
- io.prometheus
- simpleclient_httpserver
- 0.11.0
-
-
-
- io.prometheus
- simpleclient_pushgateway
- 0.11.0
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
io.micrometer
micrometer-registry-prometheus
- 1.7.1
+ 1.11.2
org.springframework.boot
@@ -314,8 +303,19 @@
micrometer-core
-
+
+
+ gr.cite
+ data-tools
+ 2.1.0
+
+
+ gr.cite
+ exceptions
+ 2.1.0
+
+
@@ -327,18 +327,17 @@
jar
-
- intellij-properties-launcher
+
+
-
-
- org.springframework.boot
- spring-boot-loader
- 2.5.2
-
-
+
+
+
+
+
+
-
+
production
diff --git a/dmp-backend/queryable/src/main/java/eu/eudat/queryable/QueryableList.java b/dmp-backend/queryable/src/main/java/eu/eudat/queryable/QueryableList.java
index 9d36e802c..45858815a 100644
--- a/dmp-backend/queryable/src/main/java/eu/eudat/queryable/QueryableList.java
+++ b/dmp-backend/queryable/src/main/java/eu/eudat/queryable/QueryableList.java
@@ -4,9 +4,9 @@ import eu.eudat.queryable.jpa.predicates.*;
import eu.eudat.queryable.queryableentity.DataEntity;
import eu.eudat.queryable.types.SelectionField;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.JoinType;
-import javax.persistence.criteria.Subquery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.JoinType;
+import jakarta.persistence.criteria.Subquery;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
diff --git a/dmp-backend/queryable/src/main/java/eu/eudat/queryable/collector/Collector.java b/dmp-backend/queryable/src/main/java/eu/eudat/queryable/collector/Collector.java
index a6d710b11..e3b654418 100644
--- a/dmp-backend/queryable/src/main/java/eu/eudat/queryable/collector/Collector.java
+++ b/dmp-backend/queryable/src/main/java/eu/eudat/queryable/collector/Collector.java
@@ -2,7 +2,7 @@ package eu.eudat.queryable.collector;
import com.fasterxml.jackson.databind.ObjectMapper;
-import javax.persistence.Tuple;
+import jakarta.persistence.Tuple;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
diff --git a/dmp-backend/queryable/src/main/java/eu/eudat/queryable/collector/ProjectionField.java b/dmp-backend/queryable/src/main/java/eu/eudat/queryable/collector/ProjectionField.java
index d76e33c0c..96aff8a79 100644
--- a/dmp-backend/queryable/src/main/java/eu/eudat/queryable/collector/ProjectionField.java
+++ b/dmp-backend/queryable/src/main/java/eu/eudat/queryable/collector/ProjectionField.java
@@ -2,7 +2,7 @@ package eu.eudat.queryable.collector;
import com.google.common.collect.Lists;
-import javax.persistence.Tuple;
+import jakarta.persistence.Tuple;
import java.util.*;
import java.util.stream.Collectors;
diff --git a/dmp-backend/queryable/src/main/java/eu/eudat/queryable/jpa/hibernatequeryablelist/QueryableHibernateList.java b/dmp-backend/queryable/src/main/java/eu/eudat/queryable/jpa/hibernatequeryablelist/QueryableHibernateList.java
index 54800f43a..0e46d9df5 100644
--- a/dmp-backend/queryable/src/main/java/eu/eudat/queryable/jpa/hibernatequeryablelist/QueryableHibernateList.java
+++ b/dmp-backend/queryable/src/main/java/eu/eudat/queryable/jpa/hibernatequeryablelist/QueryableHibernateList.java
@@ -8,500 +8,568 @@ import eu.eudat.queryable.jpa.predicates.*;
import eu.eudat.queryable.queryableentity.DataEntity;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.Tuple;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
-import javax.persistence.EntityManager;
-import javax.persistence.Tuple;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.*;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
public class QueryableHibernateList implements QueryableList {
- private static final Logger logger = LoggerFactory.getLogger(QueryableHibernateList.class);
- private Collector collector = new Collector();
- private EntityManager manager;
- private CriteriaQuery query;
- private Class tClass;
- private Root root;
- private Root nestedQueryRoot;
- private Subquery subquery;
- private List> singlePredicates = new LinkedList<>();
- private List> nestedPredicates = new LinkedList<>();
- private boolean distinct = false;
- private List> orderings = new LinkedList<>();
- private List> groupings = new LinkedList<>();
- private List fields = new LinkedList<>();
- private Integer length;
- private Integer offset;
- private Set hints;
- private String hint;
- private Map joinsMap = new HashMap<>();
+ private static final Logger logger = LoggerFactory.getLogger(QueryableHibernateList.class);
- public QueryableHibernateList(EntityManager manager, Class tClass) {
- this.manager = manager;
- this.tClass = tClass;
- }
+ private Collector collector = new Collector();
- public QueryableHibernateList setManager(EntityManager manager) {
- this.manager = manager;
- return this;
- }
+ private EntityManager manager;
- public QueryableList withHint(String hint) {
- this.hint = hint;
- return this;
- }
+ private CriteriaQuery query;
- @Override
- public QueryableList withFields(List fields) {
- this.fields = fields;
- return this;
- }
+ private Class tClass;
- private QueryableList selectFields() {
- List rootFields = fields.stream().map(this::convertFieldToPath).filter(Objects::nonNull).collect(Collectors.toList());
- this.query.select(this.manager.getCriteriaBuilder().tuple(rootFields.toArray(new Selection[rootFields.size()])));
- return this;
- }
+ private Root root;
- private Path convertFieldToPath(String field) {
- if (!field.contains(".")) {
- Path path = this.root.get(field);
- path.alias(field);
- return path;
- } else {
- String[] fields = field.split("\\.");
- Path path = this.root.get(fields[0]);
- Join join = null;
- path.alias(fields[0]);
- for (int i = 1; i < fields.length; i++) {
- join = join != null ? join.join(fields[i - 1], JoinType.LEFT) : this.getJoin(fields[i - 1], JoinType.LEFT);
- path = join.get(fields[i]);
- path.alias(String.join(".", Arrays.asList(fields).subList(0, i + 1)));
- }
- return path;
- }
- }
+ private Root nestedQueryRoot;
- private Join getJoin(String field, String path, Join joined, JoinType type) {
- if (this.joinsMap.containsKey(path)) return this.joinsMap.get(path);
- Join join = joined.join(path, type);
- this.joinsMap.put(path, join);
- return join;
- }
+ private Subquery subquery;
- public Join getJoin(String field, JoinType type) {
- if (this.joinsMap.containsKey(field)) return this.joinsMap.get(field);
- Join join = this.root.join(field, type);
- this.joinsMap.put(field, join);
- return join;
- }
+ private List> singlePredicates = new LinkedList<>();
- public QueryableHibernateList setEntity(Class type) {
+ private List> nestedPredicates = new LinkedList<>();
- return this;
- }
+ private boolean distinct = false;
- public void initiateQueryableList(Class type) {
- CriteriaBuilder builder = this.manager.getCriteriaBuilder();
- this.query = builder.createQuery(type);
- }
+ private List> orderings = new LinkedList<>();
- @Override
- public QueryableList skip(Integer offset) {
- this.offset = offset;
- return this;
- }
+ private List> groupings = new LinkedList<>();
- @Override
- public QueryableList take(Integer length) {
- this.length = length;
- return this;
- }
+ private List fields = new LinkedList<>();
- public QueryableList where(SinglePredicate predicate) {
- this.singlePredicates.add(predicate);
- return this;
- }
+ private Integer length;
- public QueryableList where(NestedQuerySinglePredicate predicate) {
- this.nestedPredicates.add(predicate);
- return this;
- }
+ private Integer offset;
- public List select(SelectPredicate predicate) {
- return this.toList().stream().map(predicate::applySelection).collect(Collectors.toList());
- }
+ private Set hints;
- public CompletableFuture> selectAsync(SelectPredicate predicate) {
- return this.toListAsync().thenApplyAsync(items -> items.stream().map(predicate::applySelection).collect(Collectors.toList()));
- }
+ private String hint;
- public QueryableList distinct() {
- this.distinct = true;
- return this;
- }
+ private Map joinsMap = new HashMap<>();
- public QueryableList orderBy(OrderByPredicate predicate) {
- this.orderings.add(predicate);
- return this;
- }
+ public QueryableHibernateList(EntityManager manager, Class tClass) {
+ this.manager = manager;
+ this.tClass = tClass;
+ }
- public QueryableList groupBy(GroupByPredicate predicate) {
- this.groupings.add(predicate);
- return this;
- }
+ public QueryableHibernateList setManager(EntityManager manager) {
+ this.manager = manager;
+ return this;
+ }
- public Long count() {
- CriteriaBuilder criteriaBuilder = this.manager.getCriteriaBuilder();
- CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
- this.root = criteriaQuery.from(tClass);
- if (distinct) criteriaQuery.select(criteriaBuilder.countDistinct(this.root.get("id")));
- else criteriaQuery.select(criteriaBuilder.count(this.root));
- criteriaQuery.where(this.generateWherePredicates(this.singlePredicates, this.root, this.nestedPredicates, this.nestedQueryRoot));
- if (!this.groupings.isEmpty()) criteriaQuery.groupBy(this.generateGroupPredicates(this.groupings, this.root));
- //if (distinct) criteriaQuery.distinct(true);
+ public QueryableList withHint(String hint) {
+ this.hint = hint;
+ return this;
+ }
- //GK: Group By special case. When group by is used, since it will result in a list of how many elements have the grouped field common
- // then it will instead return the number of the distinct values of the grouped field
- if (this.groupings.isEmpty()) {
- return this.manager.createQuery(criteriaQuery).getSingleResult();
- } else {
- return (long) this.manager.createQuery(criteriaQuery).getResultList().size();
- }
- }
+ @Override
+ public QueryableList withFields(List fields) {
+ this.fields = fields;
+ return this;
+ }
- @Async
- public CompletableFuture countAsync() {
- CriteriaBuilder criteriaBuilder = this.manager.getCriteriaBuilder();
- CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Long.class);
- this.root = criteriaQuery.from(tClass);
- if (distinct) criteriaQuery.select(criteriaBuilder.countDistinct(this.root.get("id")));
- else criteriaQuery.select(criteriaBuilder.count(this.root));
- criteriaQuery.where(this.generateWherePredicates(this.singlePredicates, this.root, this.nestedPredicates, this.nestedQueryRoot));
- if (!this.groupings.isEmpty()) criteriaQuery.groupBy(this.generateGroupPredicates(this.groupings, this.root));
- //if (distinct) criteriaQuery.distinct(true);
- return CompletableFuture.supplyAsync(() -> {
- if (this.groupings.isEmpty()) {
- return this.manager.createQuery(criteriaQuery).getSingleResult();
- } else {
- return (long) this.manager.createQuery(criteriaQuery).getResultList().size();
- }
- });
- }
+ private QueryableList selectFields() {
+ List rootFields = fields.stream().map(this::convertFieldToPath).filter(Objects::nonNull).collect(Collectors.toList());
+ this.query.select(this.manager.getCriteriaBuilder().tuple(rootFields.toArray(new Selection[rootFields.size()])));
+ return this;
+ }
+ private Path convertFieldToPath(String field) {
+ if (!field.contains(".")) {
+ Path path = this.root.get(field);
+ path.alias(field);
+ return path;
+ } else {
+ String[] fields = field.split("\\.");
+ Path path = this.root.get(fields[0]);
+ Join join = null;
+ path.alias(fields[0]);
+ for (int i = 1; i < fields.length; i++) {
+ join = join != null ? join.join(fields[i - 1], JoinType.LEFT) : this.getJoin(fields[i - 1], JoinType.LEFT);
+ path = join.get(fields[i]);
+ path.alias(String.join(".", Arrays.asList(fields).subList(0, i + 1)));
+ }
+ return path;
+ }
+ }
- private Predicate[] generateWherePredicates(List> singlePredicates, Root root, List> nestedPredicates, Root nestedQueryRoot) {
- List predicates = new LinkedList<>();
- predicates.addAll(Arrays.asList(this.generateSingleWherePredicates(singlePredicates, root)));
- predicates.addAll(Arrays.asList(this.generateNestedWherePredicates(nestedPredicates, root, nestedQueryRoot)));
- return predicates.toArray(new Predicate[predicates.size()]);
- }
+ private Join getJoin(String field, String path, Join joined, JoinType type) {
+ if (this.joinsMap.containsKey(path))
+ return this.joinsMap.get(path);
+ Join join = joined.join(path, type);
+ this.joinsMap.put(path, join);
+ return join;
+ }
- private Predicate[] generateSingleWherePredicates(List> singlePredicates, Root root) {
- List predicates = new LinkedList<>();
- for (SinglePredicate singlePredicate : singlePredicates) {
- predicates.add(singlePredicate.applyPredicate(this.manager.getCriteriaBuilder(), root));
- }
- return predicates.toArray(new Predicate[predicates.size()]);
- }
+ public Join getJoin(String field, JoinType type) {
+ if (this.joinsMap.containsKey(field))
+ return this.joinsMap.get(field);
+ Join join = this.root.join(field, type);
+ this.joinsMap.put(field, join);
+ return join;
+ }
- private Predicate[] generateNestedWherePredicates(List> nestedPredicates, Root root, Root nestedQueryRoot) {
- List predicates = new LinkedList<>();
- for (NestedQuerySinglePredicate singlePredicate : nestedPredicates) {
- predicates.add(singlePredicate.applyPredicate(this.manager.getCriteriaBuilder(), root, nestedQueryRoot));
- }
- return predicates.toArray(new Predicate[predicates.size()]);
- }
+ public QueryableHibernateList setEntity(Class type) {
- private Order[] generateOrderPredicates(List> orderByPredicates, Root root) {
- List predicates = new LinkedList<>();
- for (OrderByPredicate orderPredicate : orderByPredicates) {
- predicates.add(orderPredicate.applyPredicate(this.manager.getCriteriaBuilder(), root));
- }
- return predicates.toArray(new Order[predicates.size()]);
- }
+ return this;
+ }
- private Expression[] generateGroupPredicates(List> groupByPredicates, Root root) {
- List predicates = new LinkedList<>();
- for (GroupByPredicate groupPredicate : groupByPredicates) {
- predicates.add(groupPredicate.applyPredicate(this.manager.getCriteriaBuilder(), root));
- }
- return predicates.toArray(new Expression[predicates.size()]);
- }
+ public void initiateQueryableList(Class type) {
+ CriteriaBuilder builder = this.manager.getCriteriaBuilder();
+ this.query = builder.createQuery(type);
+ }
- public List toList() {
- CriteriaBuilder builder = this.manager.getCriteriaBuilder();
- if (!this.fields.isEmpty()) this.query = builder.createTupleQuery();
- else this.query = builder.createQuery(this.tClass);
- this.root = this.query.from(this.tClass);
- this.query.where(this.generateWherePredicates(this.singlePredicates, this.root, this.nestedPredicates, this.nestedQueryRoot));
- if (!this.orderings.isEmpty()) this.query.orderBy(this.generateOrderPredicates(this.orderings, this.root));
- if (!this.groupings.isEmpty()) this.query.groupBy(this.generateGroupPredicates(this.groupings, this.root));
- if (!this.fields.isEmpty()) this.selectFields();
- if (distinct) this.query.distinct(true);
- //if (!this.fields.isEmpty()) this.query.multiselect(this.parseFields(this.fields));
- ObjectMapper mapper = new ObjectMapper();
- if (!this.fields.isEmpty()) return this.toListWithFields().stream().map(m -> mapper.convertValue(m, this.tClass)).collect(Collectors.toList());
- return this.toListWithOutFields();
- }
+ @Override
+ public QueryableList skip(Integer offset) {
+ this.offset = offset;
+ return this;
+ }
- public List