fix issue with upload field in xml export

This commit is contained in:
Bernaldo Mihasi 2022-03-31 17:02:27 +03:00
parent 07f499707e
commit db8f10ac1e
2 changed files with 20 additions and 1 deletions

View File

@ -246,6 +246,19 @@ public class ExportXmlBuilderDatasetProfile {
}
}
break;
case UPLOAD:
UploadData uploadDataObject = (UploadData) field.getData();
dataOut.setAttribute("label", uploadDataObject.getLabel());
dataOut.setAttribute("maxFileSizeInMB", String.valueOf(uploadDataObject.getMaxFileSizeInMB()));
Element types = element.createElement("types");
uploadDataObject.getTypes().forEach(type -> {
Element optionChild = element.createElement("option");
optionChild.setAttribute("label", type.getLabel());
optionChild.setAttribute("value", type.getValue());
types.appendChild(optionChild);
});
dataOut.appendChild(types);
break;
case BOOLEAN_DECISION:
BooleanDecisionData booleanDecisionDataObject = (BooleanDecisionData) field.getData();
dataOut.setAttribute("label", booleanDecisionDataObject.getLabel());

View File

@ -83,7 +83,13 @@ public class UploadData extends FieldData<UploadData> {
this.types.add(newOption);
}
this.setLabel(((Map<String, String>) data).get("label"));
this.setMaxFileSizeInMB(((Map<String, Integer>) data).get("maxFileSizeInMB"));
Object maxFileSizeInMB = ((Map<String, Object>) data).get("maxFileSizeInMB");
if(maxFileSizeInMB instanceof String){ // template export
this.setMaxFileSizeInMB(Integer.valueOf((String)maxFileSizeInMB));
}
else if(maxFileSizeInMB instanceof Integer){ // template preview
this.setMaxFileSizeInMB((Integer)maxFileSizeInMB);
}
}
return this;
}