migration fixes
This commit is contained in:
parent
c05f9e8fbd
commit
5e5efea33d
|
@ -438,7 +438,7 @@ public class DatasetMigrationService {
|
||||||
|
|
||||||
private FieldEntity buildField(Dataset item, org.opencdmp.commons.types.descriptiontemplate.FieldEntity currentField, Object propertyValue, Map<UUID, ReferenceTypeDefinitionEntity> referenceTypeDefinitionEntityMap, Map<ReferenceKey, ReferenceEntity> referenceMap, int ordinal, List<DescriptionReferenceEntity> createdDescriptionReferenceEntities){
|
private FieldEntity buildField(Dataset item, org.opencdmp.commons.types.descriptiontemplate.FieldEntity currentField, Object propertyValue, Map<UUID, ReferenceTypeDefinitionEntity> referenceTypeDefinitionEntityMap, Map<ReferenceKey, ReferenceEntity> referenceMap, int ordinal, List<DescriptionReferenceEntity> createdDescriptionReferenceEntities){
|
||||||
FieldEntity fieldEntity = new FieldEntity();
|
FieldEntity fieldEntity = new FieldEntity();
|
||||||
String textValue = propertyValue != null ? propertyValue.toString() : null;
|
String textValue = propertyValue != null ? propertyValue.toString() : null;
|
||||||
if (textValue == null || textValue.isEmpty()) return fieldEntity;
|
if (textValue == null || textValue.isEmpty()) return fieldEntity;
|
||||||
switch (currentField.getData().getFieldType()){
|
switch (currentField.getData().getFieldType()){
|
||||||
case FREE_TEXT, TEXT_AREA, RICH_TEXT_AREA, RADIO_BOX -> fieldEntity.setTextValue(textValue.trim());
|
case FREE_TEXT, TEXT_AREA, RICH_TEXT_AREA, RADIO_BOX -> fieldEntity.setTextValue(textValue.trim());
|
||||||
|
|
|
@ -188,7 +188,8 @@ public class DmpMigrationService {
|
||||||
switch (extraFieldEntity.getType()){
|
switch (extraFieldEntity.getType()){
|
||||||
case Date -> {
|
case Date -> {
|
||||||
try {
|
try {
|
||||||
valueEntity.setDateValue(Instant.parse((String) val));
|
if (((String) val).isBlank()) valueEntity.setDateValue(null);
|
||||||
|
else valueEntity.setDateValue(Instant.parse((String) val));
|
||||||
} catch (DateTimeParseException ex) {
|
} catch (DateTimeParseException ex) {
|
||||||
valueEntity.setDateValue(LocalDate.parse((String) val).atStartOfDay().toInstant(ZoneOffset.UTC));
|
valueEntity.setDateValue(LocalDate.parse((String) val).atStartOfDay().toInstant(ZoneOffset.UTC));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue