migration fixes

This commit is contained in:
Efstratios Giannopoulos 2024-10-10 10:46:24 +03:00
parent 7e283e5aab
commit 0d9f3890af
5 changed files with 1 additions and 34 deletions

View File

@ -4,7 +4,6 @@ import java.util.Map;
public class PropertyDefinitionFieldSetItemEntity { public class PropertyDefinitionFieldSetItemEntity {
private Map<String, FieldEntity> fields; private Map<String, FieldEntity> fields;
private String comment;
private int ordinal; private int ordinal;
public Map<String, FieldEntity> getFields() { public Map<String, FieldEntity> getFields() {
@ -15,14 +14,6 @@ public class PropertyDefinitionFieldSetItemEntity {
this.fields = fields; this.fields = fields;
} }
public String getComment() {
return this.comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public int getOrdinal() { public int getOrdinal() {
return this.ordinal; return this.ordinal;
} }

View File

@ -58,7 +58,6 @@ public class PropertyDefinitionFieldSetItemBuilder extends BaseBuilder<PropertyD
List<PropertyDefinitionFieldSetItem> models = new ArrayList<>(); List<PropertyDefinitionFieldSetItem> models = new ArrayList<>();
for (PropertyDefinitionFieldSetItemEntity d : data) { for (PropertyDefinitionFieldSetItemEntity d : data) {
PropertyDefinitionFieldSetItem m = new PropertyDefinitionFieldSetItem(); PropertyDefinitionFieldSetItem m = new PropertyDefinitionFieldSetItem();
if (fields.hasField(this.asIndexer(PropertyDefinitionFieldSetItem._comment))) m.setComment(d.getComment());
if (fields.hasField(this.asIndexer(PropertyDefinitionFieldSetItem._ordinal))) m.setOrdinal(d.getOrdinal()); if (fields.hasField(this.asIndexer(PropertyDefinitionFieldSetItem._ordinal))) m.setOrdinal(d.getOrdinal());
if (!fieldsFields.isEmpty() && d.getFields() != null && !d.getFields().isEmpty()) { if (!fieldsFields.isEmpty() && d.getFields() != null && !d.getFields().isEmpty()) {
m.setFields(new HashMap<>()); m.setFields(new HashMap<>());

View File

@ -7,9 +7,6 @@ public class PropertyDefinitionFieldSetItem {
public final static String _fields = "fields"; public final static String _fields = "fields";
private Map<String, Field> fields; private Map<String, Field> fields;
public final static String _comment = "comment";
private String comment;
public final static String _ordinal = "ordinal"; public final static String _ordinal = "ordinal";
private Integer ordinal; private Integer ordinal;
@ -21,14 +18,6 @@ public class PropertyDefinitionFieldSetItem {
this.fields = fields; this.fields = fields;
} }
public String getComment() {
return this.comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public Integer getOrdinal() { public Integer getOrdinal() {
return this.ordinal; return this.ordinal;
} }

View File

@ -425,7 +425,6 @@ public class DescriptionServiceImpl implements DescriptionService {
if (data == null) return cleanData; if (data == null) return cleanData;
if (data.getFields() != null && !data.getFields().isEmpty()){ if (data.getFields() != null && !data.getFields().isEmpty()){
cleanData.setOrdinal(data.getOrdinal()); cleanData.setOrdinal(data.getOrdinal());
cleanData.setComment(data.getComment());
cleanData.setFields(new HashMap<>()); cleanData.setFields(new HashMap<>());
for (String key: data.getFields().keySet()) { for (String key: data.getFields().keySet()) {
org.opencdmp.commons.types.descriptiontemplate.FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getFieldById(key).stream().findFirst().orElse(null) : null; org.opencdmp.commons.types.descriptiontemplate.FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getFieldById(key).stream().findFirst().orElse(null) : null;

View File

@ -427,18 +427,7 @@ public class DatasetMigrationService {
propertyDefinitionFieldSetEntity.setItems(new ArrayList<>()); propertyDefinitionFieldSetEntity.setItems(new ArrayList<>());
propertyDefinitionEntity.getFieldSets().put(currentFieldSet.getId().trim(), propertyDefinitionFieldSetEntity); propertyDefinitionEntity.getFieldSets().put(currentFieldSet.getId().trim(), propertyDefinitionFieldSetEntity);
} }
propertyDefinitionFieldSetEntity.setComment(comment);
PropertyDefinitionFieldSetItemEntity propertyDefinitionFieldSetItemEntity;
if (this.conventionService.isListNullOrEmpty(propertyDefinitionFieldSetEntity.getItems())){
propertyDefinitionFieldSetItemEntity = new PropertyDefinitionFieldSetItemEntity();
propertyDefinitionFieldSetItemEntity.setFields(new HashMap<>());
propertyDefinitionFieldSetItemEntity.setOrdinal(SimpleFieldSetOrdinal);
propertyDefinitionFieldSetEntity.getItems().add(propertyDefinitionFieldSetItemEntity);
} else {
propertyDefinitionFieldSetItemEntity = propertyDefinitionFieldSetEntity.getItems().getFirst();
}
propertyDefinitionFieldSetItemEntity.setComment(comment);
} }
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, Map<TagKey, UUID> savedTagIdsByName, HashSet<UUID> existingTagIds){ 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, Map<TagKey, UUID> savedTagIdsByName, HashSet<UUID> existingTagIds){