From 6c2c0a8700e45bcbb4a89659081a3a110eeba103 Mon Sep 17 00:00:00 2001 From: annabakouli Date: Wed, 13 Dec 2017 14:01:43 +0200 Subject: [PATCH] no message --- .../src/main/java/entities/UserInfo.java | 2 +- .../xmlmodels/viewstyledefinition/Field.java | 2 +- .../components/datasetprofile/Field.java | 4 +- .../components/datasetprofile/FieldSet.java | 4 +- .../components/datasetprofile/Group.java | 2 +- .../components/datasetprofile/Section.java | 2 +- .../commons/datafield/AutoCompleteData.java | 63 +++++++ .../commons/datafield/ComboBoxData.java | 63 +------ .../commons/datafield/WordListData.java | 79 +++++++++ .../java/models/dmp/DataManagementPlan.java | 14 +- .../src/main/java/models/dmp/Project.java | 16 +- .../src/main/java/models/dmp/UserInfo.java | 125 ++++++++++++++ .../entities/DatasetProfileController.java | 1 + .../src/main/java/rest/entities/Datasets.java | 2 +- .../java/utilities/builders/ModelBuilder.java | 13 +- dmp-frontend/package-lock.json | 5 + dmp-frontend/package.json | 19 ++- dmp-frontend/src/app/app.module.ts | 3 +- .../src/app/form/dynamic-form.component.html | 2 +- .../src/app/form/dynamic-form.component.ts | 158 ++++++++++++------ dmp-frontend/src/app/services/rest-base.ts | 2 +- .../dmp-detailed/dmp-detailed.component.html | 8 +- .../dmp-detailed/dmp-detailed.component.ts | 2 +- 23 files changed, 452 insertions(+), 139 deletions(-) create mode 100644 dmp-backend/src/main/java/models/components/commons/datafield/AutoCompleteData.java create mode 100644 dmp-backend/src/main/java/models/components/commons/datafield/WordListData.java create mode 100644 dmp-backend/src/main/java/models/dmp/UserInfo.java diff --git a/dmp-backend/src/main/java/entities/UserInfo.java b/dmp-backend/src/main/java/entities/UserInfo.java index 3910d160e..7e4215dd8 100644 --- a/dmp-backend/src/main/java/entities/UserInfo.java +++ b/dmp-backend/src/main/java/entities/UserInfo.java @@ -34,7 +34,7 @@ import entities.security.UserAuth; @Entity @Table(name="\"UserInfo\"") @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") -public class UserInfo implements Serializable{ +public class UserInfo implements Serializable,DataEntity{ private static final long serialVersionUID = 1225151430484658395L; diff --git a/dmp-backend/src/main/java/entities/xmlmodels/viewstyledefinition/Field.java b/dmp-backend/src/main/java/entities/xmlmodels/viewstyledefinition/Field.java index 067231b28..251093a12 100644 --- a/dmp-backend/src/main/java/entities/xmlmodels/viewstyledefinition/Field.java +++ b/dmp-backend/src/main/java/entities/xmlmodels/viewstyledefinition/Field.java @@ -137,7 +137,7 @@ public class Field implements DatabaseViewStyleDefinition,XmlSerializable Element dataElement = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "data"); - this.data = new ModelBuilder().toFieldData(null, this.viewStyle.getRenderStyle()); + this.data = new ModelBuilder().toFieldData(null, this.viewStyle.getRenderStyle(),dataElement); if(this.data!=null)this.data.fromXml(dataElement); return this; } diff --git a/dmp-backend/src/main/java/models/admin/components/datasetprofile/Field.java b/dmp-backend/src/main/java/models/admin/components/datasetprofile/Field.java index faf7d97b3..f3ab4e576 100644 --- a/dmp-backend/src/main/java/models/admin/components/datasetprofile/Field.java +++ b/dmp-backend/src/main/java/models/admin/components/datasetprofile/Field.java @@ -124,7 +124,7 @@ public class Field implements ModelDefinition viewStylefields = new ModelBuilder().toViewStyleDefinition(this.fields, entities.xmlmodels.viewstyledefinition.Field.class); item.setFields(viewStylefields); diff --git a/dmp-backend/src/main/java/models/admin/components/datasetprofile/Group.java b/dmp-backend/src/main/java/models/admin/components/datasetprofile/Group.java index a39c04f32..e2f25f7af 100644 --- a/dmp-backend/src/main/java/models/admin/components/datasetprofile/Group.java +++ b/dmp-backend/src/main/java/models/admin/components/datasetprofile/Group.java @@ -86,7 +86,7 @@ public class Group implements ModelDefinition{ + private String url; + private Option autoCompleteOptions; + + @Override + public Element toXml(Document doc) { + Element root = super.toXml(doc); + + root.setAttribute("url", this.url); + + Element element = doc.createElement("option"); + element.setAttribute("label", this.autoCompleteOptions.getLabel()); + element.setAttribute("value", autoCompleteOptions.getValue()); + root.appendChild(element); + return root; + } + @Override + public AutoCompleteData fromXml(Element item) { + super.fromXml(item); + this.url = item.getAttribute("url"); + Element optionElement = (Element)item.getElementsByTagName("option").item(0); + + if(optionElement!=null){ + this.autoCompleteOptions = new Option(); + this.autoCompleteOptions.setLabel(optionElement.getAttribute("label")); + this.autoCompleteOptions.setValue(optionElement.getAttribute("value")); + } + return this; + } + @Override + public AutoCompleteData fromData(Object data) { + super.fromData(data); + this.autoCompleteOptions = new Option(); + if(data!=null){ + this.url = (String)((Map)data).get("url"); + Map options = ((Map>)data).get("option"); + this.autoCompleteOptions.setLabel(options.get("label")); + this.autoCompleteOptions.setValue(options.get("value")); + } + + return this; + } + @Override + public Object toData() { + // TODO Auto-generated method stub + return null; + } + + +} diff --git a/dmp-backend/src/main/java/models/components/commons/datafield/ComboBoxData.java b/dmp-backend/src/main/java/models/components/commons/datafield/ComboBoxData.java index 258cc18b6..263b4f7c1 100644 --- a/dmp-backend/src/main/java/models/components/commons/datafield/ComboBoxData.java +++ b/dmp-backend/src/main/java/models/components/commons/datafield/ComboBoxData.java @@ -11,8 +11,8 @@ import org.w3c.dom.NodeList; import utilities.XmlSerializable; -public class ComboBoxData extends FieldData{ - private class Option implements XmlSerializable