fix prefiling
This commit is contained in:
parent
a5bc78f91d
commit
215eb25015
|
@ -21,7 +21,7 @@ public enum DmpUserRole implements DatabaseEnum<Short> {
|
||||||
@Override
|
@Override
|
||||||
@JsonValue
|
@JsonValue
|
||||||
public Short getValue() {
|
public Short getValue() {
|
||||||
return value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<Short, DmpUserRole> map = EnumUtils.getEnumValueMap(DmpUserRole.class);
|
private static final Map<Short, DmpUserRole> map = EnumUtils.getEnumValueMap(DmpUserRole.class);
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class PropertyDefinitionFieldSetItem {
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
|
|
||||||
public Map<String, Field> getFields() {
|
public Map<String, Field> getFields() {
|
||||||
return fields;
|
return this.fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFields(Map<String, Field> fields) {
|
public void setFields(Map<String, Field> fields) {
|
||||||
|
@ -22,7 +22,7 @@ public class PropertyDefinitionFieldSetItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getComment() {
|
public String getComment() {
|
||||||
return comment;
|
return this.comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setComment(String comment) {
|
public void setComment(String comment) {
|
||||||
|
@ -30,7 +30,7 @@ public class PropertyDefinitionFieldSetItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getOrdinal() {
|
public Integer getOrdinal() {
|
||||||
return ordinal;
|
return this.ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrdinal(Integer ordinal) {
|
public void setOrdinal(Integer ordinal) {
|
||||||
|
|
|
@ -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();
|
List<FieldEntity> issuedFieldEntities = definition.getAllField().stream().filter(x -> x.getSchematics() != null && x.getSchematics().contains("rda.dataset.issued")).toList();
|
||||||
if (!this.conventionService.isListNullOrEmpty(issuedFieldEntities)) {
|
if (!this.conventionService.isListNullOrEmpty(issuedFieldEntities)) {
|
||||||
String issuedIdNode = issuedFieldEntities.getFirst().getId();
|
String issuedIdNode = issuedFieldEntities.getFirst().getId();
|
||||||
String issuedValue = this.conventionService.isNullOrEmpty(issuedIdNode) ? null : description.getProperties().getFieldSets().values().stream().map(PropertyDefinitionFieldSet::getItems).flatMap(List::stream)
|
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).getTextValue()).filter(Objects::nonNull).findFirst().orElse(null);
|
.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();
|
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) {
|
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();
|
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);
|
this.ensureFieldSetEntity(description, licStartFieldSetEntity);
|
||||||
|
|
||||||
for (FieldEntity licStartDateNode : licStartEntities) {
|
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;
|
if (fieldEntity == null || fieldEntity.getData() == null || fieldEntity.getData().getFieldType() == null || this.conventionService.isNullOrEmpty(value)) return field;
|
||||||
try{
|
try{
|
||||||
switch (fieldEntity.getData().getFieldType()){
|
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 ->{
|
case CHECK_BOX, BOOLEAN_DECISION ->{
|
||||||
if (!this.conventionService.isNullOrEmpty(value)) {
|
if (!this.conventionService.isNullOrEmpty(value)) {
|
||||||
field.setBooleanValue("true".equals(value.trim().toLowerCase(Locale.ROOT)));
|
field.setBooleanValue("true".equals(value.trim().toLowerCase(Locale.ROOT)));
|
||||||
|
|
Loading…
Reference in New Issue