Allignment with core changes
This commit is contained in:
parent
4d01463c72
commit
eb9ae3af48
|
@ -4,8 +4,6 @@ import eu.eudat.commons.enums.DmpAccessType;
|
|||
import eu.eudat.commons.enums.DmpStatus;
|
||||
import eu.eudat.commons.enums.DmpVersionStatus;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.converters.InstantToUTCConverter;
|
||||
import eu.eudat.data.converters.enums.DmpAccessTypeConverter;
|
||||
import eu.eudat.data.converters.enums.DmpStatusConverter;
|
||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||
|
@ -64,13 +62,11 @@ public class DmpEntity implements DataEntity<DmpEntity, UUID> {
|
|||
public static final String _description = "description";
|
||||
|
||||
@Column(name = "created_at")
|
||||
@Convert(converter = InstantToUTCConverter.class)
|
||||
private Instant createdAt;
|
||||
|
||||
public static final String _createdAt = "createdAt";
|
||||
|
||||
@Column(name = "updated_at")
|
||||
@Convert(converter = InstantToUTCConverter.class)
|
||||
private Instant updatedAt;
|
||||
|
||||
public static final String _updatedAt = "updatedAt";
|
||||
|
@ -82,7 +78,6 @@ public class DmpEntity implements DataEntity<DmpEntity, UUID> {
|
|||
public static final String _isActive = "isActive";
|
||||
|
||||
@Column(name = "finalized_at")
|
||||
@Convert(converter = InstantToUTCConverter.class)
|
||||
private Instant finalizedAt;
|
||||
|
||||
public static final String _finalizedAt = "finalizedAt";
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
package eu.eudat.data.converters;
|
||||
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
import jakarta.persistence.Converter;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Date;
|
||||
|
||||
@Converter
|
||||
public class InstantToUTCConverter implements AttributeConverter<Instant, Date> {
|
||||
|
||||
@Override
|
||||
public Date convertToDatabaseColumn(Instant attribute) {
|
||||
if(attribute == null) return null;
|
||||
return Date.from(attribute);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instant convertToEntityAttribute(Date dbData) {
|
||||
if (dbData == null) return null;
|
||||
return dbData.toInstant();
|
||||
}
|
||||
}
|
|
@ -68,7 +68,7 @@ public class MigrationController {
|
|||
dmpEntity.setDescription(dataManagementPlan.getDescription());
|
||||
dmpEntity.setAccessType(dataManagementPlan.getPublic() ? DmpAccessType.Public : DmpAccessType.Restricted);
|
||||
if (dataManagementPlan.getCreator() != null)
|
||||
dmpEntity.setCreator(dataManagementPlan.getCreator().getId());
|
||||
dmpEntity.setCreatorId(dataManagementPlan.getCreator().getId());
|
||||
dmpEntity.setGroupId(dataManagementPlan.getGroupId());
|
||||
dmpEntity.setVersion((short) dataManagementPlan.getVersion());
|
||||
dmpEntity.setVersionStatus(DmpVersionStatus.of((short) dataManagementPlan.getVersionStatus()));
|
||||
|
@ -78,7 +78,7 @@ public class MigrationController {
|
|||
dmpEntity.setUpdatedAt(dataManagementPlan.getModified().toInstant());
|
||||
if (dataManagementPlan.getFinalized() != null)
|
||||
dmpEntity.setFinalizedAt(dataManagementPlan.getFinalized().toInstant());
|
||||
dmpEntity.setBlueprint(dataManagementPlan.getProfile().getId());
|
||||
dmpEntity.setBlueprintId(dataManagementPlan.getProfile().getId());
|
||||
if (dataManagementPlan.getExtraProperties().containsKey("language") && dataManagementPlan.getExtraProperties().get("language") != null)
|
||||
dmpEntity.setLanguage((String) dataManagementPlan.getExtraProperties().get("language"));
|
||||
if (dataManagementPlan.getStatus() == 99) {
|
||||
|
|
Loading…
Reference in New Issue