Add type to External Datasets Data

This commit is contained in:
George Kalampokis 2021-06-22 18:29:58 +03:00
parent 42a22b4a65
commit 11b4d462cf
2 changed files with 16 additions and 0 deletions

View File

@ -290,6 +290,7 @@ public class ExportXmlBuilderDatasetProfile {
ExternalDatasetsData externalDatasetsData = (ExternalDatasetsData) field.getData();
dataOut.setAttribute("label", externalDatasetsData.getLabel());
dataOut.setAttribute("multiAutocomplete", externalDatasetsData.getMultiAutoComplete().toString());
dataOut.setAttribute("type", externalDatasetsData.getType());
break;
case DATA_REPOSITORIES:
DataRepositoriesData dataRepositoriesData = (DataRepositoriesData) field.getData();

View File

@ -8,6 +8,7 @@ import java.util.Map;
public class ExternalDatasetsData extends FieldData<ExternalDatasetsData> {
private Boolean multiAutoComplete;
private String type;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
@ -17,11 +18,20 @@ public class ExternalDatasetsData extends FieldData<ExternalDatasetsData> {
this.multiAutoComplete = multiAutoComplete;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public ExternalDatasetsData fromData(Object data) {
if (data != null) {
this.setLabel((String) ((Map<String, Object>) data).get("label"));
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean( ((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
this.setType(((Map<String, Object>) data).get("type") != null && !((Map<String, Object>) data).get("type").toString().isEmpty()? ((Map<String, Object>) data).get("type").toString() : "other");
}
return this;
}
@ -38,6 +48,9 @@ public class ExternalDatasetsData extends FieldData<ExternalDatasetsData> {
if (this.getMultiAutoComplete() != null) {
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
}
if (this.getType() != null) {
root.setAttribute("type", this.getType());
}
return root;
}
@ -45,6 +58,7 @@ public class ExternalDatasetsData extends FieldData<ExternalDatasetsData> {
public ExternalDatasetsData fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
this.setType(item.getAttribute("type") != null ? item.getAttribute("type"): "other");
return this;
}
@ -53,6 +67,7 @@ public class ExternalDatasetsData extends FieldData<ExternalDatasetsData> {
HashMap dataMap = new HashMap();
dataMap.put("label", item != null && item.getAttributes().getLength() > 0? item.getAttribute("label") : "");
dataMap.put("multiAutoComplete", item != null && item.getAttributes().getLength() > 0? Boolean.parseBoolean(item.getAttribute("multiAutocomplete")) : false);
dataMap.put("type", item != null && item.getAttributes().getLength() > 0? item.getAttribute("type") : "other");
return dataMap;
}
}