Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Sofia Papacharalampous 2024-05-22 16:58:21 +03:00
commit 334e8e182e
3 changed files with 9 additions and 9 deletions

View File

@ -21,7 +21,7 @@ public enum DmpUserRole implements DatabaseEnum<Short> {
@Override
@JsonValue
public Short getValue() {
return value;
return this.value;
}
private static final Map<Short, DmpUserRole> map = EnumUtils.getEnumValueMap(DmpUserRole.class);

View File

@ -14,7 +14,7 @@ public class PropertyDefinitionFieldSetItem {
private Integer ordinal;
public Map<String, Field> getFields() {
return fields;
return this.fields;
}
public void setFields(Map<String, Field> fields) {
@ -22,7 +22,7 @@ public class PropertyDefinitionFieldSetItem {
}
public String getComment() {
return comment;
return this.comment;
}
public void setComment(String comment) {
@ -30,7 +30,7 @@ public class PropertyDefinitionFieldSetItem {
}
public Integer getOrdinal() {
return ordinal;
return this.ordinal;
}
public void setOrdinal(Integer ordinal) {

View File

@ -422,10 +422,10 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
List<FieldEntity> issuedFieldEntities = definition.getAllField().stream().filter(x -> x.getSchematics() != null && x.getSchematics().contains("rda.dataset.issued")).toList();
if (!this.conventionService.isListNullOrEmpty(issuedFieldEntities)) {
String issuedIdNode = issuedFieldEntities.getFirst().getId();
String issuedValue = this.conventionService.isNullOrEmpty(issuedIdNode) ? null : description.getProperties().getFieldSets().values().stream().map(PropertyDefinitionFieldSet::getItems).flatMap(List::stream)
.filter(x -> x.getFields() != null && x.getFields().containsKey(issuedIdNode)).map(x -> x.getFields().get(issuedIdNode).getTextValue()).filter(Objects::nonNull).findFirst().orElse(null);
Instant issuedValue = this.conventionService.isNullOrEmpty(issuedIdNode) ? null : description.getProperties().getFieldSets().values().stream().map(PropertyDefinitionFieldSet::getItems).flatMap(List::stream)
.filter(x -> x.getFields() != null && x.getFields().containsKey(issuedIdNode)).map(x -> x.getFields().get(issuedIdNode).getDateValue()).filter(Objects::nonNull).findFirst().orElse(null);
if (!this.conventionService.isNullOrEmpty(issuedValue)) {
if (issuedValue != null) {
List<FieldSetEntity> licStartFieldSetsEntities = definition.getAllFieldSets().stream().filter(x -> x.getAllField() != null && x.getAllField().stream().anyMatch(y -> y.getSchematics() != null && y.getSchematics().contains("rda.dataset.distribution.license.start_date"))).toList();
for (FieldSetEntity licStartFieldSetEntity : licStartFieldSetsEntities) {
List<FieldEntity> licStartEntities = licStartFieldSetEntity.getAllField().stream().filter(x -> x.getSchematics() != null && x.getSchematics().contains("rda.dataset.distribution.license.start_date")).toList();
@ -433,7 +433,7 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
this.ensureFieldSetEntity(description, licStartFieldSetEntity);
for (FieldEntity licStartDateNode : licStartEntities) {
description.getProperties().getFieldSets().get(licStartFieldSetEntity.getId()).getItems().getFirst().getFields().put(licStartDateNode.getId(), this.buildPropertyDefinitionFieldItemValue(descriptionReferences,licStartDateNode, semanticTarget, issuedValue, type));
description.getProperties().getFieldSets().get(licStartFieldSetEntity.getId()).getItems().getFirst().getFields().put(licStartDateNode.getId(), this.buildPropertyDefinitionFieldItemValue(descriptionReferences,licStartDateNode, semanticTarget, issuedValue.toString(), type));
}
}
}
@ -497,7 +497,7 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
if (fieldEntity == null || fieldEntity.getData() == null || fieldEntity.getData().getFieldType() == null || this.conventionService.isNullOrEmpty(value)) return field;
try{
switch (fieldEntity.getData().getFieldType()){
case FREE_TEXT, TEXT_AREA, RICH_TEXT_AREA, RADIO_BOX -> field.setTextValue(value.toLowerCase(Locale.ROOT));
case FREE_TEXT, TEXT_AREA, RICH_TEXT_AREA, RADIO_BOX -> field.setTextValue(value);
case CHECK_BOX, BOOLEAN_DECISION ->{
if (!this.conventionService.isNullOrEmpty(value)) {
field.setBooleanValue("true".equals(value.trim().toLowerCase(Locale.ROOT)));