Updated data-mapper for ProjectEdit

This commit is contained in:
Francesco Mangiacrapa 2023-05-05 14:57:13 +02:00
parent 8e2619a6d0
commit 0969af4f3d
1 changed files with 5 additions and 5 deletions

View File

@ -254,18 +254,18 @@ public class Geoportal_JSON_Mapper {
LOG.debug("It is an Array"); LOG.debug("It is an Array");
List dataArray = (List) theOBJFieldValue; List dataArray = (List) theOBJFieldValue;
//printList(dataArray); //printList(dataArray);
for (int j = 0; j < dataArray.size(); j++) { int dataSize = dataArray.size();
for (int j = 0; j < dataSize; j++) {
List<MetadataFieldWrapper> cloned = cloneList(Arrays.asList(metadataField)); List<MetadataFieldWrapper> cloned = cloneList(Arrays.asList(metadataField));
MetadataFieldWrapper mfw = cloned.get(0); MetadataFieldWrapper mfw = cloned.get(0);
//Duplicating MetadataFieldWrapper for data list with isMultiSelection==false //Duplicating MetadataFieldWrapper for data list with isMultiSelection==false
if(!mfw.isMultiSelection()) { if(!mfw.isMultiSelection()) {
mfw.setCurrentValues(dataArray.get(j)+""); mfw.setCurrentValues(dataArray.get(j)+"");
// From the second repeated field settings // In case of array, from the first to second-last one, repeated field is set to 'false'
// mandatory false and one instance
// These properties are managed properly with the // These properties are managed properly with the
// first occurrence of the field // last one field
if (j >= 1) { if (j < dataSize-1) {
mfw.setMandatory(false); mfw.setMandatory(false);
mfw.setMaxOccurs(1); mfw.setMaxOccurs(1);
} }