Added DMP Entity (not integrated)

This commit is contained in:
Thomas Georgios Giannos 2023-10-20 16:48:55 +03:00
parent 7d4b4c171b
commit a94cce47e8
14 changed files with 373 additions and 2 deletions

View File

@ -0,0 +1,29 @@
package eu.eudat.commons.enums;
import eu.eudat.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum DMPStatus implements DatabaseEnum<Short> {
ACTIVE((short) 0), FINALISED((short) 1),DELETED((short) 99);
private final Short value;
DMPStatus(Short value) {
this.value = value;
}
@Override
public Short getValue() {
return null;
}
private static final Map<Short, DMPStatus> map = EnumUtils.getEnumValueMap(DMPStatus.class);
public static DMPStatus of(Short i) {
return map.get(i);
}
}

View File

@ -0,0 +1,285 @@
package eu.eudat.data;
import eu.eudat.commons.enums.DMPStatus;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.data.converters.enums.IsActiveConverter;
import jakarta.persistence.*;
import org.hibernate.annotations.GenericGenerator;
import java.time.Instant;
import java.util.UUID;
//TODO: (thgiannos) Wire up when all other dependent entities are refactored
//@Entity
//@Table(name = "\"DMP\"")
public class DMPEntity {
@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 = "label")
private String label;
public static final String _label = "label";
@Column(name = "version")
private Integer version;
public static final String _version = "version";
@Enumerated(EnumType.STRING)
@Column(name = "status", nullable = false)
private DMPStatus status;
public static final String _status = "status";
@Column(name = "properties")
private String properties;
public static final String _properties = "properties";
@Column(name = "dmp_properties")
private String dmpProperties;
public static final String _dmpProperties = "dmpProperties";
@Column(name = "group_id", columnDefinition = "BINARY(16)")
private UUID groupId;
public static final String _groupId = "groupId";
@Column(name = "description")
private String description;
public static final String _description = "description";
@Column(name = "is_public", nullable = false)
private boolean isPublic;
public static final String _isPublic = "isPublic";
@Column(name = "extra_properties")
private String extraProperties;
public static final String _extraProperties = "extraProperties";
@Column(name = "created_at")
@Convert(converter = DateToUTCConverter.class)
private Instant createdAt;
public static final String _createdAt = "createdAt";
@Column(name = "updated_at")
@Convert(converter = DateToUTCConverter.class)
private Instant updatedAt;
public static final String _updatedAt = "updatedAt";
@Column(name = "is_active", nullable = false)
@Convert(converter = IsActiveConverter.class)
private IsActive isActive;
public static final String _isActive = "isActive";
//TODO: (thgiannos) Handle using the DMPEntity builder
// @OneToMany(mappedBy = "dmp", fetch = FetchType.LAZY)
// private Set<Dataset> dataset;
// @ManyToOne(fetch = FetchType.LAZY)
// @JoinColumn(name = "\"Grant\"")
//TODO: (thgiannos) Previously 'Grant'
private UUID grant;
//TODO: (thgiannos) Handle using the DMPEntity builder
// @OneToMany(fetch = FetchType.LAZY, mappedBy = "dmp")
// private Set<DMPDatasetProfile> associatedDmps;
// @ManyToOne(fetch = FetchType.LAZY)
// @JoinColumn(name = "\"Profile\"")
//TODO: (thgiannos) Previously 'DMPProfile'
private UUID profile;
// @ManyToOne(fetch = FetchType.LAZY)
// @JoinColumn(name = "\"Creator\"")
//TODO: (thgiannos) Previously 'UserInfo'
private UUID creator;
//TODO: (thgiannos) Handle using the DMPEntity builder
// @OneToMany(mappedBy = "entityId", fetch = FetchType.LAZY)
// private Set<EntityDoiEntity> dois;
// @ManyToOne(fetch = FetchType.LAZY)
// @JoinColumn(name = "\"Project\"")
//TODO: (thgiannos) Previously 'Project'
private UUID project;
// TODO: (thgiannos) Implement join entity
// @OneToMany(fetch = FetchType.LAZY)
// @JoinTable(name = "\"DMPOrganisation\"",
// joinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")},
// inverseJoinColumns = {@JoinColumn(name = "\"Organisation\"", referencedColumnName = "\"ID\"")}
// )
// private Set<Organisation> organisations;
// TODO: (thgiannos) Implement join entity
// @OneToMany(fetch = FetchType.LAZY)
// @JoinTable(name = "\"DMPResearcher\"",
// joinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")},
// inverseJoinColumns = {@JoinColumn(name = "\"Researcher\"", referencedColumnName = "\"ID\"")}
// )
// private Set<Researcher> researchers;
//TODO: (thgiannos) Handle using the DMPEntity builder
// private Set<UserDMP> users;
// @Column(name = "\"FinalizedAt\"")
// @Convert(converter = DateToUTCConverter.class)
// private Date finalizedAt;
//
// @Column(name = "\"PublishedAt\"")
// @Convert(converter = DateToUTCConverter.class)
// private Date publishedAt;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public DMPStatus getStatus() {
return status;
}
public void setStatus(DMPStatus status) {
this.status = status;
}
public String getProperties() {
return properties;
}
public void setProperties(String properties) {
this.properties = properties;
}
public String getDmpProperties() {
return dmpProperties;
}
public void setDmpProperties(String dmpProperties) {
this.dmpProperties = dmpProperties;
}
public UUID getGroupId() {
return groupId;
}
public void setGroupId(UUID groupId) {
this.groupId = groupId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean getPublic() {
return isPublic;
}
public void setPublic(boolean aPublic) {
isPublic = aPublic;
}
public String getExtraProperties() {
return extraProperties;
}
public void setExtraProperties(String extraProperties) {
this.extraProperties = extraProperties;
}
public Instant getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Instant createdAt) {
this.createdAt = createdAt;
}
public Instant getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Instant updatedAt) {
this.updatedAt = updatedAt;
}
public IsActive getIsActive() {
return isActive;
}
public void setIsActive(IsActive isActive) {
this.isActive = isActive;
}
public UUID getGrant() {
return grant;
}
public void setGrant(UUID grant) {
this.grant = grant;
}
public UUID getProfile() {
return profile;
}
public void setProfile(UUID profile) {
this.profile = profile;
}
public UUID getCreator() {
return creator;
}
public void setCreator(UUID creator) {
this.creator = creator;
}
public UUID getProject() {
return project;
}
public void setProject(UUID project) {
this.project = project;
}
}

View File

@ -0,0 +1,14 @@
package eu.eudat.data.converters.enums;
import eu.eudat.commons.enums.DMPStatus;
import jakarta.persistence.Converter;
@Converter
public class DMPStatusConverter extends DatabaseEnumConverter<DMPStatus, Short> {
@Override
protected DMPStatus of(Short i) {
return DMPStatus.of(i);
}
}

View File

@ -341,7 +341,6 @@ public class DMP implements DataEntity<DMP, UUID> {
this.publishedAt = publishedAt;
}
//TODO: Dois will no longer be fetched by hibernate but using the query builders eventually. Use builder where this is called.
public Set<EntityDoiEntity> getDois() {
return dois;
}

View File

@ -0,0 +1,5 @@
package eu.eudat.model;
public class DMP {
}

View File

@ -0,0 +1,5 @@
package eu.eudat.model.builder;
public class DMPBuilder {
}

View File

@ -0,0 +1,5 @@
package eu.eudat.model.censorship;
public class DMPCensor {
}

View File

@ -0,0 +1,5 @@
package eu.eudat.model.deleter;
public class DMPDeleter {
}

View File

@ -0,0 +1,5 @@
package eu.eudat.model.persist;
public class DMPPersist {
}

View File

@ -0,0 +1,5 @@
package eu.eudat.query;
public class DMPQueryV2 {
}

View File

@ -0,0 +1,5 @@
package eu.eudat.query.lookup;
public class DMPLookup {
}

View File

@ -0,0 +1,5 @@
package eu.eudat.service;
public interface DMPService {
}

View File

@ -0,0 +1,5 @@
package eu.eudat.service;
public class DMPServiceImpl implements DMPService {
}

View File

@ -39,7 +39,6 @@ import java.util.List;
import java.util.UUID;
@Service
@RequestScope
public class DescriptionTemplateTypeServiceImpl implements DescriptionTemplateTypeService {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DescriptionTemplateTypeServiceImpl.class));