update logging, db configurations
This commit is contained in:
parent
e22ba13caf
commit
0bbad595f5
|
@ -50,3 +50,4 @@ bin/
|
||||||
openDMP/dmp-backend/uploads/
|
openDMP/dmp-backend/uploads/
|
||||||
openDMP/dmp-backend/tmp/
|
openDMP/dmp-backend/tmp/
|
||||||
storage/
|
storage/
|
||||||
|
logs/
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
package eu.eudat.configurations.typedefinition;
|
|
||||||
|
|
||||||
public enum DataType {
|
|
||||||
TINY,
|
|
||||||
SHORT,
|
|
||||||
INTEGER,
|
|
||||||
LONG,
|
|
||||||
DOUBLE,
|
|
||||||
FLOAT,
|
|
||||||
DATE,
|
|
||||||
STRING,
|
|
||||||
TEXT
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
package eu.eudat.configurations.typedefinition;
|
|
||||||
|
|
||||||
public interface DatabaseColumnType {
|
|
||||||
public String getType(DataType dt);
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
package eu.eudat.configurations.typedefinition;
|
|
||||||
|
|
||||||
public class PostgreSQLDatabaseColumnType implements DatabaseColumnType {
|
|
||||||
|
|
||||||
public String getType(DataType dt) {
|
|
||||||
switch (dt) {
|
|
||||||
case TINY:
|
|
||||||
case SHORT:
|
|
||||||
case INTEGER:
|
|
||||||
return "integer";
|
|
||||||
case LONG:
|
|
||||||
return "bigint";
|
|
||||||
case FLOAT:
|
|
||||||
case DOUBLE:
|
|
||||||
return "numeric";
|
|
||||||
case DATE:
|
|
||||||
return "timestamp";
|
|
||||||
case STRING:
|
|
||||||
return "character varying(250)";
|
|
||||||
case TEXT:
|
|
||||||
return "text";
|
|
||||||
}
|
|
||||||
return "character varying(250)";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package eu.eudat.configurations.typedefinition;
|
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Types;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated hibernate's abstract class is depricated and those type of conversions and checks
|
|
||||||
* are done by hibernate itself
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class PostgreSQLEnumType extends org.hibernate.type.EnumType {
|
|
||||||
|
|
||||||
public void nullSafeSet(
|
|
||||||
PreparedStatement st,
|
|
||||||
Object value,
|
|
||||||
int index,
|
|
||||||
SharedSessionContractImplementor session)
|
|
||||||
throws HibernateException, SQLException {
|
|
||||||
st.setObject(
|
|
||||||
index,
|
|
||||||
value != null ?
|
|
||||||
((Enum) value).name() :
|
|
||||||
null,
|
|
||||||
Types.OTHER
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,118 +0,0 @@
|
||||||
package eu.eudat.configurations.typedefinition;
|
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
|
||||||
import org.hibernate.usertype.UserType;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Types;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Currently not used
|
|
||||||
*/
|
|
||||||
public class UUIDType implements UserType<UUID> {
|
|
||||||
private final int[] sqlTypesSupported = new int[]{Types.NUMERIC};
|
|
||||||
private final String CAST_EXCEPTION_TEXT = " cannot be cast to a java.util.UUID";
|
|
||||||
|
|
||||||
public int[] sqlTypes() {
|
|
||||||
return sqlTypesSupported;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSqlType() {
|
|
||||||
return sqlTypesSupported[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public Class<UUID> returnedClass() {
|
|
||||||
return UUID.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(UUID x, UUID y) throws HibernateException {
|
|
||||||
if (x == null) return y == null;
|
|
||||||
else return x.equals(y);
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
|
||||||
assert (position >= 0);
|
|
||||||
Object value = rs.getObject(position);
|
|
||||||
if (value == null) return null;
|
|
||||||
|
|
||||||
UUID uuid = UUID.fromString(rs.getString(position));
|
|
||||||
return rs.wasNull() ? null : uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
|
|
||||||
assert (names.length == 1);
|
|
||||||
Object value = rs.getObject(names[0]);
|
|
||||||
if (value == null) return null;
|
|
||||||
|
|
||||||
UUID uuid = UUID.fromString(rs.getString(names[0]));
|
|
||||||
return rs.wasNull() ? null : uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
|
|
||||||
if (value == null) {
|
|
||||||
st.setNull(index, Types.NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!UUID.class.isAssignableFrom(value.getClass()))
|
|
||||||
throw new HibernateException(value.getClass().toString() + CAST_EXCEPTION_TEXT);
|
|
||||||
|
|
||||||
UUID uuid = (UUID) value;
|
|
||||||
st.setObject(index, uuid, Types.OTHER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID deepCopy(UUID value) throws HibernateException {
|
|
||||||
if (value == null) return null;
|
|
||||||
return new UUID(value.getMostSignificantBits(), value.getLeastSignificantBits());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMutable() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Serializable disassemble(UUID value) throws HibernateException {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID assemble(Serializable cached, Object owner) throws HibernateException {
|
|
||||||
return (UUID) cached;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID replace(UUID original, Object target, Object owner) throws HibernateException {
|
|
||||||
return original;
|
|
||||||
}
|
|
||||||
|
|
||||||
// public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
|
|
||||||
// throws HibernateException, SQLException
|
|
||||||
// {
|
|
||||||
// return nullSafeGet(rs, names, owner);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
|
|
||||||
// throws HibernateException, SQLException
|
|
||||||
// {
|
|
||||||
// nullSafeSet(st, value, index);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
|
|
||||||
throws HibernateException, SQLException {
|
|
||||||
return nullSafeGet(rs, names, owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void nullSafeSet(PreparedStatement st, UUID value, int index, SharedSessionContractImplementor session)
|
|
||||||
throws HibernateException, SQLException {
|
|
||||||
nullSafeSet(st, value, index);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,95 +0,0 @@
|
||||||
package eu.eudat.configurations.typedefinition;
|
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
|
||||||
import org.hibernate.usertype.UserType;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Types;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store and retrieve a PostgreSQL "xml" column as a Java string.
|
|
||||||
*/
|
|
||||||
public class XMLType implements UserType<String> {
|
|
||||||
|
|
||||||
private final int[] sqlTypesSupported = new int[]{Types.VARCHAR};
|
|
||||||
|
|
||||||
public int[] sqlTypes() {
|
|
||||||
return sqlTypesSupported;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSqlType() {
|
|
||||||
return sqlTypesSupported[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public Class<String> returnedClass() {
|
|
||||||
return String.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(String x, String y) throws HibernateException {
|
|
||||||
if (x == null) {
|
|
||||||
return y == null;
|
|
||||||
} else {
|
|
||||||
return x.equals(y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
|
||||||
assert (i >= 0);
|
|
||||||
String xmldoc = resultSet.getString(i);
|
|
||||||
return resultSet.wasNull() ? null : xmldoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
|
|
||||||
assert (names.length == 1);
|
|
||||||
String xmldoc = rs.getString(names[0]);
|
|
||||||
return rs.wasNull() ? null : xmldoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
|
|
||||||
if (value == null) {
|
|
||||||
st.setNull(index, Types.OTHER);
|
|
||||||
} else {
|
|
||||||
st.setObject(index, value, Types.OTHER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String deepCopy(String value) throws HibernateException {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMutable() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Serializable disassemble(String value) throws HibernateException {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String assemble(Serializable cached, Object owner) throws HibernateException {
|
|
||||||
return (String) cached;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String replace(String original, String target, Object owner) throws HibernateException {
|
|
||||||
return original;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
|
|
||||||
throws HibernateException, SQLException {
|
|
||||||
return nullSafeGet(rs, names, owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void nullSafeSet(PreparedStatement st, String value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
|
|
||||||
nullSafeSet(st, value, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -7,10 +7,10 @@ import eu.eudat.data.converters.enums.DescriptionTemplateStatusConverter;
|
||||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -26,8 +26,7 @@ public class DescriptionTemplateEntity implements DataEntity<DescriptionTemplate
|
||||||
public static final String _label = "label";
|
public static final String _label = "label";
|
||||||
public static final int _labelLength = 250;
|
public static final int _labelLength = 250;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"definition\"", nullable = false)
|
||||||
@Column(name = "\"definition\"", columnDefinition = "xml", nullable = false)
|
|
||||||
private String definition;
|
private String definition;
|
||||||
public static final String _definition = "definition";
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
|
|
|
@ -3,22 +3,11 @@ package eu.eudat.data;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
|
||||||
import eu.eudat.data.converters.enums.DescriptionTemplateTypeStatusConverter;
|
|
||||||
import eu.eudat.data.converters.enums.DmpBlueprintStatusConverter;
|
import eu.eudat.data.converters.enums.DmpBlueprintStatusConverter;
|
||||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||||
import eu.eudat.data.old.DMP;
|
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,8 +24,7 @@ public class DmpBlueprintEntity {
|
||||||
public static final String _label = "label";
|
public static final String _label = "label";
|
||||||
public static final int _labelLength = 250;
|
public static final int _labelLength = 250;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"definition\"", nullable = true)
|
||||||
@Column(name = "\"definition\"", columnDefinition = "xml", nullable = true)
|
|
||||||
private String definition;
|
private String definition;
|
||||||
public static final String _definition = "definition";
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import jakarta.persistence.*;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Entity
|
||||||
@Table(name = "\"DmpUser\"")
|
@Table(name = "\"DmpUser\"")
|
||||||
public class DmpUserEntity {
|
public class DmpUserEntity {
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import eu.eudat.data.converters.enums.ReferenceSourceTypeConverter;
|
||||||
import eu.eudat.data.converters.enums.ReferenceTypeConverter;
|
import eu.eudat.data.converters.enums.ReferenceTypeConverter;
|
||||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -34,8 +33,7 @@ public class ReferenceEntity {
|
||||||
private String description;
|
private String description;
|
||||||
public static final String _description = "description";
|
public static final String _description = "description";
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "definition")
|
||||||
@Column(name = "definition", columnDefinition = "xml")
|
|
||||||
private String definition;
|
private String definition;
|
||||||
public static final String _definition = "definition";
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package eu.eudat.data;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -25,8 +24,7 @@ public class ReferenceTypeEntity {
|
||||||
private String code;
|
private String code;
|
||||||
public static final String _code = "code";
|
public static final String _code = "code";
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "definition")
|
||||||
@Column(name = "definition", columnDefinition = "xml")
|
|
||||||
private String definition;
|
private String definition;
|
||||||
public static final String _definition = "definition";
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
package eu.eudat.data;
|
package eu.eudat.data;
|
||||||
|
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DescriptionTemplateStatus;
|
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.data.converters.enums.DescriptionTemplateStatusConverter;
|
|
||||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package eu.eudat.data.old;
|
||||||
|
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -65,7 +64,6 @@ public class Content implements DataEntity<Content, UUID> { //IGNORE ME
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import eu.eudat.data.DmpBlueprintEntity;
|
||||||
import eu.eudat.data.EntityDoiEntity;
|
import eu.eudat.data.EntityDoiEntity;
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -90,7 +89,6 @@ public class DMP implements DataEntity<DMP, UUID> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package eu.eudat.data.old;
|
||||||
|
|
||||||
import eu.eudat.data.DescriptionTemplateEntity;
|
import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -14,7 +13,6 @@ public class DMPDatasetProfile implements DataEntity<DMPDatasetProfile, UUID> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package eu.eudat.data.old;
|
package eu.eudat.data.old;
|
||||||
|
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -14,7 +12,6 @@ public class DMPOrganisation {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package eu.eudat.data.old;
|
package eu.eudat.data.old;
|
||||||
|
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -14,7 +12,6 @@ public class DMPResearcher {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,11 @@ package eu.eudat.data.old;
|
||||||
|
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -32,8 +30,7 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,
|
||||||
@Column(name = "\"Uri\"")
|
@Column(name = "\"Uri\"")
|
||||||
private String uri;
|
private String uri;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"Definition\"")
|
||||||
@Column(name = "\"Definition\"", columnDefinition = "xml")
|
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
@Column(name = "\"Status\"", nullable = false)
|
@Column(name = "\"Status\"", nullable = false)
|
||||||
|
|
|
@ -2,7 +2,6 @@ package eu.eudat.data.old;
|
||||||
|
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -15,7 +14,6 @@ public class EmailConfirmation implements DataEntity<EmailConfirmation, UUID> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "\"ID\"", updatable = false, nullable = false)
|
@Column(name = "\"ID\"", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package eu.eudat.data.old;
|
package eu.eudat.data.old;
|
||||||
|
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -73,12 +72,10 @@ public class Funder implements DataEntity<Funder, UUID> {
|
||||||
@Column(name = "\"Label\"")
|
@Column(name = "\"Label\"")
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"Reference\"", nullable = true)
|
||||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
|
||||||
private String reference;
|
private String reference;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"Definition\"", nullable = true)
|
||||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
@Column(name = "\"Status\"", nullable = false)
|
@Column(name = "\"Status\"", nullable = false)
|
||||||
|
|
|
@ -4,7 +4,6 @@ package eu.eudat.data.old;
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -101,7 +100,6 @@ public class Grant implements DataEntity<Grant, UUID> {
|
||||||
@Column(name = "\"Uri\"")
|
@Column(name = "\"Uri\"")
|
||||||
private String uri;
|
private String uri;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
|
||||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@ package eu.eudat.data.old;
|
||||||
|
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -16,7 +14,6 @@ public class Invitation implements DataEntity<Invitation, UUID> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "\"Id\"", updatable = false, nullable = false)
|
@Column(name = "\"Id\"", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
@ -37,8 +34,7 @@ public class Invitation implements DataEntity<Invitation, UUID> {
|
||||||
@Column(name = "\"AcceptedInvitation\"", nullable = false)
|
@Column(name = "\"AcceptedInvitation\"", nullable = false)
|
||||||
private boolean acceptedInvitation;
|
private boolean acceptedInvitation;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"Properties\"", nullable = true)
|
||||||
@Column(name = "\"Properties\"", columnDefinition = "xml", nullable = true)
|
|
||||||
private String properties;
|
private String properties;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package eu.eudat.data.old;
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -16,7 +15,6 @@ public class Lock implements DataEntity<Lock, UUID> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import eu.eudat.commons.enums.old.notification.ContactType;
|
||||||
import eu.eudat.commons.enums.old.notification.NotificationType;
|
import eu.eudat.commons.enums.old.notification.NotificationType;
|
||||||
import eu.eudat.commons.enums.old.notification.NotifyState;
|
import eu.eudat.commons.enums.old.notification.NotifyState;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -18,7 +17,6 @@ public class Notification implements DataEntity<Notification, UUID> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@ package eu.eudat.data.old;
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -25,7 +23,6 @@ public class Organisation implements Serializable, DataEntity<Organisation,UUID>
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
@ -35,15 +32,13 @@ public class Organisation implements Serializable, DataEntity<Organisation,UUID>
|
||||||
@Column(name = "\"Abbreviation\"")
|
@Column(name = "\"Abbreviation\"")
|
||||||
private String abbreviation;
|
private String abbreviation;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"Reference\"", nullable = true)
|
||||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
|
||||||
private String reference;
|
private String reference;
|
||||||
|
|
||||||
@Column(name = "\"Uri\"")
|
@Column(name = "\"Uri\"")
|
||||||
private String uri;
|
private String uri;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"Definition\"", nullable = true)
|
||||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY)
|
@OneToMany(fetch = FetchType.LAZY)
|
||||||
|
|
|
@ -3,7 +3,6 @@ package eu.eudat.data.old;
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -80,14 +79,13 @@ public class Project implements DataEntity<Project, UUID> {
|
||||||
@Column(name = "\"Abbreviation\"")
|
@Column(name = "\"Abbreviation\"")
|
||||||
private String abbreviation;
|
private String abbreviation;
|
||||||
|
|
||||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
@Column(name = "\"Reference\"", nullable = true)
|
||||||
private String reference;
|
private String reference;
|
||||||
|
|
||||||
@Column(name = "\"Uri\"")
|
@Column(name = "\"Uri\"")
|
||||||
private String uri;
|
private String uri;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"Definition\"", nullable = true)
|
||||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
@Column(name = "\"StartDate\"", nullable = false)
|
@Column(name = "\"StartDate\"", nullable = false)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import eu.eudat.data.DescriptionEntity;
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -34,8 +33,7 @@ public class Registry implements DataEntity<Registry, UUID> {
|
||||||
@Column(name = "\"Uri\"")
|
@Column(name = "\"Uri\"")
|
||||||
private String uri;
|
private String uri;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"Definition\"", nullable = true)
|
||||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
|
|
|
@ -4,7 +4,6 @@ package eu.eudat.data.old;
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -18,8 +17,6 @@ import java.util.UUID;
|
||||||
public class Researcher implements DataEntity<Researcher, UUID> {
|
public class Researcher implements DataEntity<Researcher, UUID> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
/*@GeneratedValue
|
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")*/
|
|
||||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
@ -32,12 +29,10 @@ public class Researcher implements DataEntity<Researcher, UUID> {
|
||||||
@Column(name = "\"PrimaryEmail\"")
|
@Column(name = "\"PrimaryEmail\"")
|
||||||
private String primaryEmail;
|
private String primaryEmail;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"Definition\"", nullable = true)
|
||||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"Reference\"", nullable = true)
|
||||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
|
||||||
private String reference;
|
private String reference;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package eu.eudat.data.old;
|
||||||
|
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -32,8 +31,7 @@ public class Service implements DataEntity<Service, UUID> {
|
||||||
@Column(name = "\"Uri\"")
|
@Column(name = "\"Uri\"")
|
||||||
private String uri;
|
private String uri;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Column(name = "\"Definition\"", nullable = false)
|
||||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
@Column(name = "\"Status\"", nullable = false)
|
@Column(name = "\"Status\"", nullable = false)
|
||||||
|
|
|
@ -2,7 +2,6 @@ package eu.eudat.data.old;
|
||||||
|
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -49,7 +48,6 @@ public class UserDMP implements DataEntity<UserDMP, UUID> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,6 @@ import eu.eudat.data.CredentialEntity;
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -22,7 +20,6 @@ public class UserInfo implements DataEntity<UserInfo, UUID> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public final static String _id = "id";
|
public final static String _id = "id";
|
||||||
|
@ -65,7 +62,6 @@ public class UserInfo implements DataEntity<UserInfo, UUID> {
|
||||||
public final static String _lastloggedin = "lastloggedin";
|
public final static String _lastloggedin = "lastloggedin";
|
||||||
|
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
|
||||||
@Column(name = "additionalinfo", nullable = true)
|
@Column(name = "additionalinfo", nullable = true)
|
||||||
private String additionalinfo;
|
private String additionalinfo;
|
||||||
public final static String _additionalinfo = "additionalinfo";
|
public final static String _additionalinfo = "additionalinfo";
|
||||||
|
|
|
@ -2,7 +2,6 @@ package eu.eudat.data.old;
|
||||||
|
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -15,7 +14,6 @@ public class UserRole implements DataEntity<UserRole, UUID> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@ import eu.eudat.data.DescriptionEntity;
|
||||||
import eu.eudat.data.old.*;
|
import eu.eudat.data.old.*;
|
||||||
import eu.eudat.depositinterface.models.*;
|
import eu.eudat.depositinterface.models.*;
|
||||||
import eu.eudat.commons.types.xml.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import jakarta.transaction.Transactional;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
|
@ -24,9 +24,7 @@ import java.util.*;
|
||||||
@Component
|
@Component
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
||||||
|
|
||||||
private String like;
|
private String like;
|
||||||
|
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
private DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery;
|
private DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery;
|
||||||
private Collection<UUID> excludedIds;
|
private Collection<UUID> excludedIds;
|
||||||
|
@ -61,8 +59,6 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public DescriptionQuery dmpDescriptionTemplateSubQuery(DmpDescriptionTemplateQuery subQuery) {
|
public DescriptionQuery dmpDescriptionTemplateSubQuery(DmpDescriptionTemplateQuery subQuery) {
|
||||||
this.dmpDescriptionTemplateQuery = subQuery;
|
this.dmpDescriptionTemplateQuery = subQuery;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.data.DescriptionEntity;
|
import eu.eudat.data.DescriptionEntity;
|
||||||
import eu.eudat.data.DmpDescriptionTemplateEntity;
|
import eu.eudat.data.DmpDescriptionTemplateEntity;
|
||||||
|
import eu.eudat.data.DmpEntity;
|
||||||
import eu.eudat.model.DmpDescriptionTemplate;
|
import eu.eudat.model.DmpDescriptionTemplate;
|
||||||
import gr.cite.tools.data.query.FieldResolver;
|
import gr.cite.tools.data.query.FieldResolver;
|
||||||
import gr.cite.tools.data.query.QueryBase;
|
import gr.cite.tools.data.query.QueryBase;
|
||||||
|
@ -11,6 +12,7 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import jakarta.persistence.criteria.Subquery;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -25,6 +27,7 @@ public class DmpDescriptionTemplateQuery extends QueryBase<DmpDescriptionTemplat
|
||||||
private Collection<UUID> ids;
|
private Collection<UUID> ids;
|
||||||
|
|
||||||
private Collection<UUID> dmpIds;
|
private Collection<UUID> dmpIds;
|
||||||
|
private DmpQuery dmpQuery;
|
||||||
|
|
||||||
private Collection<UUID> descriptionTemplateIds;
|
private Collection<UUID> descriptionTemplateIds;
|
||||||
|
|
||||||
|
@ -95,6 +98,11 @@ public class DmpDescriptionTemplateQuery extends QueryBase<DmpDescriptionTemplat
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DmpDescriptionTemplateQuery dmpSubQuery(DmpQuery subQuery) {
|
||||||
|
this.dmpQuery = subQuery;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public DmpDescriptionTemplateQuery descriptionTemplateIds(UUID value) {
|
public DmpDescriptionTemplateQuery descriptionTemplateIds(UUID value) {
|
||||||
this.descriptionTemplateIds = List.of(value);
|
this.descriptionTemplateIds = List.of(value);
|
||||||
return this;
|
return this;
|
||||||
|
@ -126,7 +134,7 @@ public class DmpDescriptionTemplateQuery extends QueryBase<DmpDescriptionTemplat
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean isFalseQuery() {
|
protected Boolean isFalseQuery() {
|
||||||
return this.isEmpty(this.ids) || this.isEmpty(this.excludedIds) || this.isEmpty(this.isActives) || this.isEmpty(this.dmpIds) || this.isEmpty(this.descriptionTemplateIds);
|
return this.isEmpty(this.ids)|| this.isFalseQuery(this.dmpQuery) || this.isEmpty(this.excludedIds) || this.isEmpty(this.isActives) || this.isEmpty(this.dmpIds) || this.isEmpty(this.descriptionTemplateIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -139,11 +147,16 @@ public class DmpDescriptionTemplateQuery extends QueryBase<DmpDescriptionTemplat
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
if (this.excludedIds != null) {
|
if (this.excludedIds != null) {
|
||||||
CriteriaBuilder.In<UUID> notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._id));
|
CriteriaBuilder.In<UUID> notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._id));
|
||||||
for (UUID item : this.excludedIds)
|
for (UUID item : this.excludedIds)
|
||||||
notInClause.value(item);
|
notInClause.value(item);
|
||||||
predicates.add(notInClause.not());
|
predicates.add(notInClause.not());
|
||||||
}
|
}
|
||||||
|
if (this.dmpQuery != null) {
|
||||||
|
Subquery<DmpEntity> subQuery = queryContext.Query.subquery(this.dmpQuery.entityClass());
|
||||||
|
this.applySubQuery(this.dmpQuery, queryContext.CriteriaBuilder, subQuery);
|
||||||
|
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._dmpId)).value(subQuery));
|
||||||
|
}
|
||||||
if (this.dmpIds != null) {
|
if (this.dmpIds != null) {
|
||||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._dmpId));
|
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._dmpId));
|
||||||
for (UUID item : this.dmpIds)
|
for (UUID item : this.dmpIds)
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package eu.eudat.query;
|
package eu.eudat.query;
|
||||||
|
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.authorization.Permission;
|
||||||
|
import eu.eudat.commons.enums.DmpAccessType;
|
||||||
import eu.eudat.commons.enums.DmpUserRole;
|
import eu.eudat.commons.enums.DmpUserRole;
|
||||||
import eu.eudat.commons.scope.user.UserScope;
|
import eu.eudat.commons.scope.user.UserScope;
|
||||||
|
import eu.eudat.data.DmpDescriptionTemplateEntity;
|
||||||
|
import eu.eudat.data.DmpEntity;
|
||||||
import eu.eudat.data.DmpUserEntity;
|
import eu.eudat.data.DmpUserEntity;
|
||||||
import eu.eudat.model.DmpUser;
|
import eu.eudat.model.DmpUser;
|
||||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
@ -12,6 +16,7 @@ import gr.cite.tools.data.query.QueryContext;
|
||||||
import jakarta.persistence.Tuple;
|
import jakarta.persistence.Tuple;
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import jakarta.persistence.criteria.Subquery;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -121,6 +126,26 @@ public class DmpUserQuery extends QueryBase<DmpUserEntity> {
|
||||||
return this.isEmpty(this.ids) || this.isEmpty(this.dmpIds) || this.isEmpty(this.userIds);
|
return this.isEmpty(this.ids) || this.isEmpty(this.dmpIds) || this.isEmpty(this.userIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected <X, Y> Predicate applyAuthZ(QueryContext<X, Y> queryContext) {
|
||||||
|
if (this.authorize.contains(AuthorizationFlags.None)) return null;
|
||||||
|
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseDmp)) return null;
|
||||||
|
UUID ownerId = null;
|
||||||
|
if (this.authorize.contains(AuthorizationFlags.Owner)) ownerId = this.userScope.getUserIdSafe();
|
||||||
|
|
||||||
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
if (ownerId != null) {
|
||||||
|
predicates.add(queryContext.CriteriaBuilder.equal(queryContext.Root.get(DmpUserEntity._user), ownerId));
|
||||||
|
|
||||||
|
}
|
||||||
|
if (predicates.size() > 0) {
|
||||||
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
|
} else {
|
||||||
|
return queryContext.CriteriaBuilder.or(); //Creates a false query
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
|
|
@ -15,6 +15,7 @@ public class DmpDescriptionTemplateLookup extends Lookup {
|
||||||
private List<UUID> ids;
|
private List<UUID> ids;
|
||||||
private List<UUID> dmpIds;
|
private List<UUID> dmpIds;
|
||||||
private List<UUID> descriptionTemplateIds;
|
private List<UUID> descriptionTemplateIds;
|
||||||
|
private DmpLookup dmpSubQuery;
|
||||||
|
|
||||||
private List<UUID> excludedIds;
|
private List<UUID> excludedIds;
|
||||||
|
|
||||||
|
@ -60,6 +61,14 @@ public class DmpDescriptionTemplateLookup extends Lookup {
|
||||||
this.descriptionTemplateIds = descriptionTemplateIds;
|
this.descriptionTemplateIds = descriptionTemplateIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DmpLookup getDmpSubQuery() {
|
||||||
|
return dmpSubQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDmpSubQuery(DmpLookup dmpSubQuery) {
|
||||||
|
this.dmpSubQuery = dmpSubQuery;
|
||||||
|
}
|
||||||
|
|
||||||
public DmpDescriptionTemplateQuery enrich(QueryFactory queryFactory) {
|
public DmpDescriptionTemplateQuery enrich(QueryFactory queryFactory) {
|
||||||
DmpDescriptionTemplateQuery query = queryFactory.query(DmpDescriptionTemplateQuery.class);
|
DmpDescriptionTemplateQuery query = queryFactory.query(DmpDescriptionTemplateQuery.class);
|
||||||
if (this.ids != null) query.ids(this.ids);
|
if (this.ids != null) query.ids(this.ids);
|
||||||
|
@ -67,6 +76,7 @@ public class DmpDescriptionTemplateLookup extends Lookup {
|
||||||
if (this.descriptionTemplateIds != null) query.ids(this.descriptionTemplateIds);
|
if (this.descriptionTemplateIds != null) query.ids(this.descriptionTemplateIds);
|
||||||
if (this.excludedIds != null) query.excludedIds(this.excludedIds);
|
if (this.excludedIds != null) query.excludedIds(this.excludedIds);
|
||||||
if (this.isActive != null) query.isActive(this.isActive);
|
if (this.isActive != null) query.isActive(this.isActive);
|
||||||
|
if (this.dmpSubQuery != null) query.dmpSubQuery(this.dmpSubQuery.enrich(queryFactory));
|
||||||
|
|
||||||
this.enrichCommon(query);
|
this.enrichCommon(query);
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ import eu.eudat.queryable.QueryableList;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import jakarta.transaction.Transactional;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,10 @@ import eu.eudat.queryable.types.SelectionField;
|
||||||
import eu.eudat.types.grant.GrantStateType;
|
import eu.eudat.types.grant.GrantStateType;
|
||||||
import jakarta.persistence.criteria.Join;
|
import jakarta.persistence.criteria.Join;
|
||||||
import jakarta.persistence.criteria.JoinType;
|
import jakarta.persistence.criteria.JoinType;
|
||||||
import jakarta.transaction.Transactional;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.management.InvalidApplicationException;
|
import javax.management.InvalidApplicationException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
|
@ -99,6 +99,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hibernate.orm</groupId>
|
<groupId>org.hibernate.orm</groupId>
|
||||||
<artifactId>hibernate-core</artifactId>
|
<artifactId>hibernate-core</artifactId>
|
||||||
|
<version>6.3.1.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -102,7 +102,10 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
<version>42.6.0</version>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate.orm</groupId>
|
||||||
|
<artifactId>hibernate-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--<dependency>
|
<!--<dependency>
|
||||||
|
|
|
@ -22,6 +22,8 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
"gr.cite.tools",
|
"gr.cite.tools",
|
||||||
"gr.cite.commons"
|
"gr.cite.commons"
|
||||||
})
|
})
|
||||||
|
@EntityScan({
|
||||||
|
"eu.eudat.data"})
|
||||||
@EnableAsync
|
@EnableAsync
|
||||||
public class EuDatApplication extends SpringBootServletInitializer {
|
public class EuDatApplication extends SpringBootServletInitializer {
|
||||||
|
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
package eu.eudat.configurations;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
|
||||||
import org.springframework.context.annotation.*;
|
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
|
|
||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
|
||||||
import org.springframework.orm.jpa.JpaVendorAdapter;
|
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
|
||||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
||||||
|
|
||||||
import jakarta.persistence.EntityManagerFactory;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@EnableTransactionManagement
|
|
||||||
@Profile("devel")
|
|
||||||
@ComponentScan(basePackages = {"eu.eudat.data"})
|
|
||||||
public class DevelDatabaseConfiguration {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private Environment env;
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
|
||||||
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
|
|
||||||
em.setDataSource(dataSource());
|
|
||||||
em.setPackagesToScan("eu.eudat.data");
|
|
||||||
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
|
|
||||||
em.setJpaVendorAdapter(vendorAdapter);
|
|
||||||
em.setJpaProperties(additionalProperties());
|
|
||||||
return em;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@Primary
|
|
||||||
@ConfigurationProperties(prefix = "spring.datasource")
|
|
||||||
public DataSource dataSource() {
|
|
||||||
return DataSourceBuilder
|
|
||||||
.create()
|
|
||||||
.username(env.getProperty("database.username"))
|
|
||||||
.password(env.getProperty("database.password"))
|
|
||||||
.url(env.getProperty("database.url"))
|
|
||||||
.driverClassName(env.getProperty("database.driver-class-name"))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
|
|
||||||
JpaTransactionManager transactionManager = new JpaTransactionManager();
|
|
||||||
transactionManager.setEntityManagerFactory(emf);
|
|
||||||
return transactionManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
|
|
||||||
return new PersistenceExceptionTranslationPostProcessor();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Properties additionalProperties() {
|
|
||||||
Properties properties = new Properties();
|
|
||||||
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
|
|
||||||
properties.setProperty("hibernate.show_sql", "false");
|
|
||||||
properties.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
package eu.eudat.configurations;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.Profile;
|
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
|
|
||||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
|
||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
|
||||||
import org.springframework.orm.jpa.JpaVendorAdapter;
|
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
|
||||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
||||||
|
|
||||||
import jakarta.persistence.EntityManagerFactory;
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 2/9/2018.
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@EnableTransactionManagement
|
|
||||||
@Profile({ "production", "staging", "docker" })
|
|
||||||
@ComponentScan(basePackages = {"eu.eudat.data.entities"})
|
|
||||||
public class ProductionDatabaseConfiguration {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private Environment env;
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
|
||||||
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
|
|
||||||
em.setDataSource(dataSource());
|
|
||||||
em.setPackagesToScan(new String[]{"eu.eudat.data.entities"});
|
|
||||||
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
|
|
||||||
em.setJpaVendorAdapter(vendorAdapter);
|
|
||||||
em.setJpaProperties(additionalProperties());
|
|
||||||
|
|
||||||
return em;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public DataSource dataSource() {
|
|
||||||
DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
|
||||||
dataSource.setDriverClassName(env.getProperty("database.driver-class-name"));
|
|
||||||
dataSource.setUrl(env.getProperty("database.url"));
|
|
||||||
dataSource.setUsername(env.getProperty("database.username"));
|
|
||||||
dataSource.setPassword(env.getProperty("database.password"));
|
|
||||||
return dataSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
|
|
||||||
JpaTransactionManager transactionManager = new JpaTransactionManager();
|
|
||||||
transactionManager.setEntityManagerFactory(emf);
|
|
||||||
|
|
||||||
return transactionManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
|
|
||||||
return new PersistenceExceptionTranslationPostProcessor();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Properties additionalProperties() {
|
|
||||||
Properties properties = new Properties();
|
|
||||||
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQL92Dialect");
|
|
||||||
properties.setProperty("hibernate.show_sql", "true");
|
|
||||||
properties.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
audit:
|
|
||||||
enable: false
|
|
|
@ -3,3 +3,8 @@ spring:
|
||||||
maxIdle: 10
|
maxIdle: 10
|
||||||
minIdle: 5
|
minIdle: 5
|
||||||
maxActive: 10
|
maxActive: 10
|
||||||
|
jpa:
|
||||||
|
show-sql: true
|
||||||
|
properties:
|
||||||
|
hibernate:
|
||||||
|
format_sql: true
|
|
@ -1,6 +1,27 @@
|
||||||
database:
|
#database:
|
||||||
driver-class-name: org.postgresql.Driver
|
# driver-class-name: org.postgresql.Driver
|
||||||
lock-fail-interval: 120000
|
# lock-fail-interval: 120000
|
||||||
|
# url: ${DB_URL:}
|
||||||
|
# username: ${DB_USER:}
|
||||||
|
# password: ${DB_PASS:}
|
||||||
|
spring:
|
||||||
|
jpa:
|
||||||
|
properties:
|
||||||
|
hibernate:
|
||||||
|
ddl-auto: validate
|
||||||
|
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||||
|
hibernate:
|
||||||
|
naming:
|
||||||
|
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
||||||
|
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
|
||||||
|
datasource:
|
||||||
url: ${DB_URL:}
|
url: ${DB_URL:}
|
||||||
username: ${DB_USER:}
|
username: ${DB_USER:}
|
||||||
password: ${DB_PASS:}
|
password: ${DB_PASS:}
|
||||||
|
driver-class-name: org.postgresql.Driver
|
||||||
|
hikari:
|
||||||
|
connection-timeout: 30000
|
||||||
|
minimum-idle: 3
|
||||||
|
maximum-pool-size: 10
|
||||||
|
idle-timeout: 600000
|
||||||
|
max-lifetime: 1800000
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
logging:
|
||||||
|
config: classpath:logging/logback-${spring.profiles.active}.xml
|
||||||
|
context:
|
||||||
|
request:
|
||||||
|
requestIdKey: req.id
|
||||||
|
requestRemoteHostKey: req.remoteHost
|
||||||
|
requestUriKey: req.requestURI
|
||||||
|
requestQueryStringKey: req.queryString
|
||||||
|
requestUrlKey : req.requestURL
|
||||||
|
requestMethodKey: req.method
|
||||||
|
requestUserAgentKey: req.userAgent
|
||||||
|
requestForwardedForKey: req.xForwardedFor
|
||||||
|
requestSchemeKey: req.scheme
|
||||||
|
requestRemoteAddressKey: req.remoteAddr
|
||||||
|
requestRemotePortKey: req.remotePort
|
||||||
|
requestRemoteUserKey: req.remoteUser
|
||||||
|
principal:
|
||||||
|
subjectKey: usr.subject
|
||||||
|
nameKey: usr.name
|
||||||
|
clientKey: usr.client
|
||||||
|
audit:
|
||||||
|
enable: true
|
||||||
|
requestRemoteHostKey: req.remoteHost
|
||||||
|
requestUriKey: req.requestURI
|
||||||
|
requestQueryStringKey: req.queryString
|
||||||
|
requestUrlKey : req.requestURL
|
||||||
|
requestMethodKey: req.method
|
||||||
|
requestUserAgentKey: req.userAgent
|
||||||
|
requestForwardedForKey: req.xForwardedFor
|
||||||
|
requestSchemeKey: req.scheme
|
||||||
|
requestRemoteAddressKey: req.remoteAddr
|
||||||
|
requestRemotePortKey: req.remotePort
|
||||||
|
requestRemoteUserKey: req.remoteUser
|
||||||
|
principalSubjectKey: usr.subject
|
||||||
|
principalNameKey: usr.name
|
||||||
|
principalClientKey: usr.client
|
|
@ -1,2 +1,35 @@
|
||||||
logging:
|
logging:
|
||||||
config: classpath:logging/logback-${spring.profiles.active}.xml
|
context:
|
||||||
|
request:
|
||||||
|
requestIdKey: req.id
|
||||||
|
requestRemoteHostKey: req.remoteHost
|
||||||
|
requestUriKey: req.requestURI
|
||||||
|
requestQueryStringKey: req.queryString
|
||||||
|
requestUrlKey : req.requestURL
|
||||||
|
requestMethodKey: req.method
|
||||||
|
requestUserAgentKey: req.userAgent
|
||||||
|
requestForwardedForKey: req.xForwardedFor
|
||||||
|
requestSchemeKey: req.scheme
|
||||||
|
requestRemoteAddressKey: req.remoteAddr
|
||||||
|
requestRemotePortKey: req.remotePort
|
||||||
|
requestRemoteUserKey: req.remoteUser
|
||||||
|
principal:
|
||||||
|
subjectKey: usr.subject
|
||||||
|
nameKey: usr.name
|
||||||
|
clientKey: usr.client
|
||||||
|
audit:
|
||||||
|
enable: true
|
||||||
|
requestRemoteHostKey: req.remoteHost
|
||||||
|
requestUriKey: req.requestURI
|
||||||
|
requestQueryStringKey: req.queryString
|
||||||
|
requestUrlKey : req.requestURL
|
||||||
|
requestMethodKey: req.method
|
||||||
|
requestUserAgentKey: req.userAgent
|
||||||
|
requestForwardedForKey: req.xForwardedFor
|
||||||
|
requestSchemeKey: req.scheme
|
||||||
|
requestRemoteAddressKey: req.remoteAddr
|
||||||
|
requestRemotePortKey: req.remotePort
|
||||||
|
requestRemoteUserKey: req.remoteUser
|
||||||
|
principalSubjectKey: usr.subject
|
||||||
|
principalNameKey: usr.name
|
||||||
|
principalClientKey: usr.client
|
||||||
|
|
|
@ -1,33 +1,66 @@
|
||||||
<configuration debug="true">
|
<configuration debug="true">
|
||||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder>
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
<Pattern>%date{ISO8601} [%thread] %-5level %logger{36} [%X{req.id}] - %message%n</Pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="TROUBLESHOOTING" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<file>${user.home}/openDMP/logs/openDMP.log</file>
|
<file>logs/logging.log</file>
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
<fileNamePattern>${user.home}/openDMP/logs/openDMP-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
<fileNamePattern>logs/logging.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||||
<maxFileSize>100MB</maxFileSize>
|
<maxFileSize>100MB</maxFileSize>
|
||||||
</timeBasedFileNamingAndTriggeringPolicy>
|
</timeBasedFileNamingAndTriggeringPolicy>
|
||||||
<maxHistory>30</maxHistory>
|
<maxHistory>15</maxHistory>
|
||||||
<totalSizeCap>3GB</totalSizeCap>
|
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
<encoder>
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
<pattern>${FILE_LOG_PATTERN}</pattern>
|
<Pattern>%date{ISO8601} [%thread] %-5level %logger{36} [%X{req.id}] - %message%n</Pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<logger name="eu.eudat" level="DEBUG" additivity="false">
|
<appender name="AUDITING" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<appender-ref ref="FILE"/>
|
<file>logs/auditing.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>logs/auditing.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||||
|
<maxFileSize>100MB</maxFileSize>
|
||||||
|
</timeBasedFileNamingAndTriggeringPolicy>
|
||||||
|
<maxHistory>15</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<Pattern>%date{ISO8601} - %X{req.id} - %message%n</Pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
|
||||||
|
<logger name="org.springframework.web" level="INFO" additivity="false">
|
||||||
|
<appender-ref ref="TROUBLESHOOTING"/>
|
||||||
<appender-ref ref="STDOUT"/>
|
<appender-ref ref="STDOUT"/>
|
||||||
</logger>
|
</logger>
|
||||||
|
<logger name="org.hibernate" level="INFO" additivity="false">
|
||||||
<root level="info" additivity="false">
|
<appender-ref ref="TROUBLESHOOTING"/>
|
||||||
<appender-ref ref="FILE"/>
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="gr.cite" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="TROUBLESHOOTING"/>
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="eu.eudat" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="TROUBLESHOOTING"/>
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="org.springframework.data.elasticsearch.client.WIRE" level="TRACE" additivity="false">
|
||||||
|
<appender-ref ref="TROUBLESHOOTING"/>
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="audit" level="INFO" additivity="false">
|
||||||
|
<appender-ref ref="AUDITING"/>
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</logger>
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="TROUBLESHOOTING"/>
|
||||||
<appender-ref ref="STDOUT"/>
|
<appender-ref ref="STDOUT"/>
|
||||||
</root>
|
</root>
|
||||||
</configuration>
|
</configuration>
|
|
@ -1,33 +0,0 @@
|
||||||
<configuration debug="false">
|
|
||||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>logs/openDMP.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>logs/openDMP-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
|
||||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
|
||||||
<maxFileSize>100MB</maxFileSize>
|
|
||||||
</timeBasedFileNamingAndTriggeringPolicy>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
<totalSizeCap>3GB</totalSizeCap>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${FILE_LOG_PATTERN}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<logger name="eu.eudat" level="DEBUG" additivity="false">
|
|
||||||
<appender-ref ref="FILE"/>
|
|
||||||
<appender-ref ref="STDOUT"/>
|
|
||||||
</logger>
|
|
||||||
|
|
||||||
<root level="info" additivity="false">
|
|
||||||
<appender-ref ref="FILE"/>
|
|
||||||
<appender-ref ref="STDOUT"/>
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
|
@ -1,33 +0,0 @@
|
||||||
<configuration debug="false">
|
|
||||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>logs/openDMP.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>logs/openDMP-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
|
||||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
|
||||||
<maxFileSize>100MB</maxFileSize>
|
|
||||||
</timeBasedFileNamingAndTriggeringPolicy>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
<totalSizeCap>3GB</totalSizeCap>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${FILE_LOG_PATTERN}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<logger name="eu.eudat" level="INFO" additivity="false">
|
|
||||||
<appender-ref ref="FILE"/>
|
|
||||||
<appender-ref ref="STDOUT"/>
|
|
||||||
</logger>
|
|
||||||
|
|
||||||
<root level="info" additivity="false">
|
|
||||||
<appender-ref ref="FILE"/>
|
|
||||||
<appender-ref ref="STDOUT"/>
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
Loading…
Reference in New Issue