Merge branch 'ui-redesign' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot into ui-redesign

This commit is contained in:
apapachristou 2020-09-11 18:35:38 +03:00
commit 13f41dfd8b
3 changed files with 9 additions and 3 deletions

View File

@ -199,7 +199,10 @@ public class DatasetProfileManager {
public eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile createDatasetProfileFromXml(MultipartFile multiPartFile) { public eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile createDatasetProfileFromXml(MultipartFile multiPartFile) {
ImportXmlBuilderDatasetProfile xmlBuilder = new ImportXmlBuilderDatasetProfile(); ImportXmlBuilderDatasetProfile xmlBuilder = new ImportXmlBuilderDatasetProfile();
try { try {
return xmlBuilder.build(convert(multiPartFile)); File localFile = convert(multiPartFile);
eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile profile = xmlBuilder.build(localFile);
Files.deleteIfExists(localFile.toPath());
return profile;
} catch (IOException e) { } catch (IOException e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }

View File

@ -205,6 +205,7 @@ public class ExportXmlBuilderDatasetProfile {
WordListData wordListDataObject = (WordListData) field.getData(); WordListData wordListDataObject = (WordListData) field.getData();
dataOut.setAttribute("label", wordListDataObject.getLabel()); dataOut.setAttribute("label", wordListDataObject.getLabel());
dataOut.setAttribute("type", wordListDataObject.getType()); dataOut.setAttribute("type", wordListDataObject.getType());
dataOut.setAttribute("multiList", wordListDataObject.getMultiList().toString());
Element options = element.createElement("options"); Element options = element.createElement("options");
wordListDataObject.getOptions().forEach(optionChildFor -> { wordListDataObject.getOptions().forEach(optionChildFor -> {
Element optionChild = element.createElement("option"); Element optionChild = element.createElement("option");

View File

@ -33,7 +33,7 @@ public class WordListData extends ComboBoxData<WordListData> {
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element root = super.toXml(doc); Element root = super.toXml(doc);
root.setAttribute("multiList", this.multiList.toString()); root.setAttribute("multiList", this.multiList != null ? this.multiList.toString() : "false");
Element element = doc.createElement("options"); Element element = doc.createElement("options");
if (this.options != null) { if (this.options != null) {
for (Option option : this.options) { for (Option option : this.options) {
@ -78,7 +78,8 @@ public class WordListData extends ComboBoxData<WordListData> {
this.options.add(newOption); this.options.add(newOption);
} }
} }
this.multiList = (Boolean) ((Map<String, Object>) data).get("multiList"); Object multiList1 = ((Map<String, Object>) data).get("multiList");
this.multiList = multiList1 instanceof String ? Boolean.parseBoolean((String) multiList1) : (Boolean) multiList1;
} }
return this; return this;
} }
@ -92,6 +93,7 @@ public class WordListData extends ComboBoxData<WordListData> {
@Override @Override
public Map<String, Object> toMap(Element item) { public Map<String, Object> toMap(Element item) {
HashMap dataMap = new HashMap(); HashMap dataMap = new HashMap();
dataMap.put("multiList", item != null ? item.getAttribute("multiList") : "false");
dataMap.put("label", item != null ? item.getAttribute("label") : ""); dataMap.put("label", item != null ? item.getAttribute("label") : "");
dataMap.put("type", item != null ? item.getAttribute("type") : "wordlist"); dataMap.put("type", item != null ? item.getAttribute("type") : "wordlist");
Element optionsElement = (Element) item.getElementsByTagName("options").item(0); Element optionsElement = (Element) item.getElementsByTagName("options").item(0);