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");
List dataArray = (List) theOBJFieldValue;
//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));
MetadataFieldWrapper mfw = cloned.get(0);
//Duplicating MetadataFieldWrapper for data list with isMultiSelection==false
if(!mfw.isMultiSelection()) {
mfw.setCurrentValues(dataArray.get(j)+"");
// From the second repeated field settings
// mandatory false and one instance
// In case of array, from the first to second-last one, repeated field is set to 'false'
// These properties are managed properly with the
// first occurrence of the field
if (j >= 1) {
// last one field
if (j < dataSize-1) {
mfw.setMandatory(false);
mfw.setMaxOccurs(1);
}