Reverting changes on join DMP <-> EntityDoiEntity for now in order for the app to be able to run

This commit is contained in:
Thomas Georgios Giannos 2023-10-19 16:52:41 +03:00
parent 16604a8a50
commit 727702023f
6 changed files with 16 additions and 10 deletions

View File

@ -4,6 +4,7 @@ import eu.eudat.commons.enums.EntityType;
import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.DateToUTCConverter; import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.data.converters.enums.IsActiveConverter; import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.old.DMP;
import jakarta.persistence.*; import jakarta.persistence.*;
import java.time.Instant; import java.time.Instant;
@ -54,8 +55,9 @@ public class EntityDoiEntity {
public static final String _isActive = "isActive"; public static final String _isActive = "isActive";
@Column(name = "entity_id", columnDefinition = "BINARY(16)") @ManyToOne(fetch = FetchType.LAZY)
private UUID entityId; @JoinColumn(name = "entity_id", nullable = false)
private DMP entityId;
public static final String _entityId = "entityId"; public static final String _entityId = "entityId";
@ -115,11 +117,11 @@ public class EntityDoiEntity {
this.isActive = isActive; this.isActive = isActive;
} }
public UUID getEntityId() { public DMP getEntityId() {
return entityId; return entityId;
} }
public void setEntityId(UUID entityId) { public void setEntityId(DMP entityId) {
this.entityId = entityId; this.entityId = entityId;
} }

View File

@ -183,8 +183,7 @@ public class DMP implements DataEntity<DMP, UUID> {
@Convert(converter = DateToUTCConverter.class) @Convert(converter = DateToUTCConverter.class)
private Date publishedAt; private Date publishedAt;
// @OneToMany(mappedBy = "entityId", fetch = FetchType.LAZY) @OneToMany(mappedBy = "entityId", fetch = FetchType.LAZY)
@Transient
private Set<EntityDoiEntity> dois; private Set<EntityDoiEntity> dois;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)

View File

@ -48,7 +48,7 @@ public class EntityDoiBuilder extends BaseBuilder<EntityDoi, EntityDoiEntity> {
if (fields.hasField(this.asIndexer(EntityDoi._doi))) if (fields.hasField(this.asIndexer(EntityDoi._doi)))
m.setDoi(d.getDoi()); m.setDoi(d.getDoi());
if (fields.hasField(this.asIndexer(EntityDoi._entityId))) if (fields.hasField(this.asIndexer(EntityDoi._entityId)))
m.setEntityId(d.getEntityId()); m.setEntityId(d.getEntityId().getId());
if (fields.hasField(this.asIndexer(EntityDoi._entityType))) if (fields.hasField(this.asIndexer(EntityDoi._entityType)))
m.setEntityType(d.getEntityType()); m.setEntityType(d.getEntityType());
if (fields.hasField(this.asIndexer(EntityDoi._repositoryId))) if (fields.hasField(this.asIndexer(EntityDoi._repositoryId)))

View File

@ -5,6 +5,7 @@ import eu.eudat.commons.enums.EntityType;
import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.IsActive;
import eu.eudat.commons.scope.user.UserScope; import eu.eudat.commons.scope.user.UserScope;
import eu.eudat.data.EntityDoiEntity; import eu.eudat.data.EntityDoiEntity;
import eu.eudat.data.old.DMP;
import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.commons.web.authz.service.AuthorizationService;
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;
@ -185,7 +186,7 @@ public class EntityDoiQuery extends QueryBase<EntityDoiEntity> {
item.setId(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._id, UUID.class)); item.setId(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._id, UUID.class));
item.setDoi(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._doi, String.class)); item.setDoi(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._doi, String.class));
item.setRepositoryId(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._repositoryId, String.class)); item.setRepositoryId(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._repositoryId, String.class));
item.setEntityId(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._entityId, UUID.class)); item.setEntityId(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._entityId, DMP.class));
item.setEntityType(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._entityType, EntityType.class)); item.setEntityType(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._entityType, EntityType.class));
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._createdAt, Instant.class)); item.setCreatedAt(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._createdAt, Instant.class));
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._updatedAt, Instant.class)); item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, EntityDoiEntity._updatedAt, Instant.class));

View File

@ -8,6 +8,7 @@ import eu.eudat.commons.enums.IsActive;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.data.DescriptionTemplateTypeEntity; import eu.eudat.data.DescriptionTemplateTypeEntity;
import eu.eudat.data.EntityDoiEntity; import eu.eudat.data.EntityDoiEntity;
import eu.eudat.data.old.DMP;
import eu.eudat.errorcode.ErrorThesaurusProperties; import eu.eudat.errorcode.ErrorThesaurusProperties;
import eu.eudat.event.DescriptionTemplateTypeTouchedEvent; import eu.eudat.event.DescriptionTemplateTypeTouchedEvent;
import eu.eudat.event.EntityDoiTouchedEvent; import eu.eudat.event.EntityDoiTouchedEvent;
@ -42,6 +43,7 @@ import javax.management.InvalidApplicationException;
import java.time.Instant; import java.time.Instant;
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;
public class EntityDoiServiceImpl implements EntityDoiService { public class EntityDoiServiceImpl implements EntityDoiService {
@ -112,7 +114,9 @@ public class EntityDoiServiceImpl implements EntityDoiService {
} }
data.setEntityType(EntityType.DMP); data.setEntityType(EntityType.DMP);
data.setEntityId(model.getEntityId()); DMP dmp = new DMP();
dmp.setId(model.getEntityId());
data.setEntityId(dmp);
data.setRepositoryId(model.getRepositoryId()); data.setRepositoryId(model.getRepositoryId());
data.setDoi(model.getDoi()); data.setDoi(model.getDoi());
data.setUpdatedAt(Instant.now()); data.setUpdatedAt(Instant.now());

View File

@ -2538,7 +2538,7 @@ public class DataManagementPlanManager {
doiEntity.setRepositoryId(depositRequest.getRepositoryId()); doiEntity.setRepositoryId(depositRequest.getRepositoryId());
doiEntity.setCreatedAt(Instant.now()); doiEntity.setCreatedAt(Instant.now());
doiEntity.setUpdatedAt(Instant.now()); doiEntity.setUpdatedAt(Instant.now());
doiEntity.setEntityId(dmp.getId()); doiEntity.setEntityId(dmp);
//TODO: Save doi //TODO: Save doi
// apiContext.getOperationsContext().getDatabaseRepository().getEntityDoiDao().createOrUpdate(doiEntity); // apiContext.getOperationsContext().getDatabaseRepository().getEntityDoiDao().createOrUpdate(doiEntity);