diff --git a/dmp-admin/src/app/app.component.html b/dmp-admin/src/app/app.component.html
index 8eda0142b..8033861af 100644
--- a/dmp-admin/src/app/app.component.html
+++ b/dmp-admin/src/app/app.component.html
@@ -39,8 +39,8 @@
-
-
+
+
diff --git a/dmp-admin/src/app/bootstrap/profile-editor/profile-editor.component.ts b/dmp-admin/src/app/bootstrap/profile-editor/profile-editor.component.ts
index 2e510c887..ef479a242 100644
--- a/dmp-admin/src/app/bootstrap/profile-editor/profile-editor.component.ts
+++ b/dmp-admin/src/app/bootstrap/profile-editor/profile-editor.component.ts
@@ -12,7 +12,7 @@ declare function simple_notifier(type: string, title: string, message:string): a
})
export class ProfileEditorComponent implements OnInit {
- @Input('profileID') profileID: string = null;
+ public profileID: string = null;
profile : any = new Array();
diff --git a/dmp-admin/src/app/datasets-viewer/datasets-viewer.component.html b/dmp-admin/src/app/datasets-viewer/datasets-viewer.component.html
index 5095aca05..a92228921 100644
--- a/dmp-admin/src/app/datasets-viewer/datasets-viewer.component.html
+++ b/dmp-admin/src/app/datasets-viewer/datasets-viewer.component.html
@@ -12,7 +12,7 @@
Manage Datasets
-
+
diff --git a/dmp-admin/src/app/field-form/field-form.component.html b/dmp-admin/src/app/field-form/field-form.component.html
index 1f606d9f8..724c598ac 100644
--- a/dmp-admin/src/app/field-form/field-form.component.html
+++ b/dmp-admin/src/app/field-form/field-form.component.html
@@ -67,7 +67,7 @@
-
+
\ No newline at end of file
diff --git a/dmp-admin/src/app/formBuilder/form.component.ts b/dmp-admin/src/app/formBuilder/form.component.ts
index 5de8e5a3c..ac8f4c1c7 100644
--- a/dmp-admin/src/app/formBuilder/form.component.ts
+++ b/dmp-admin/src/app/formBuilder/form.component.ts
@@ -1,3 +1,4 @@
+import { DatasetProfileService } from '../services/dataset-profile.service';
import { Component, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { JsonSerializer } from '../utilities/JsonSerializer';
@@ -7,7 +8,8 @@ import { FieldGroup } from '../models/FieldGroup';
import { DatasetProfileModel } from '../models/DatasetProfileModel';
import { TestModel } from '../testModel/testModel';
import { FormArray } from '@angular/forms/src/model';
-import {RestBase} from '../services/rest-base';
+import { RestBase } from '../services/rest-base';
+import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
@Component({
selector: 'form-comp',
@@ -17,37 +19,51 @@ import {RestBase} from '../services/rest-base';
export class FormComponent {
- dataModel: DatasetProfileModel ;
+ dataModel: DatasetProfileModel;
form: FormGroup;
+ private profileID: string;
- constructor(public restBase: RestBase){
- }
+ constructor(public restBase: RestBase, private datasetProfileService: DatasetProfileService, private route: ActivatedRoute) {
+ this.profileID = route.snapshot.params['id'];
- ngOnInit(){
- this.dataModel = new DatasetProfileModel();
- this.dataModel = new JsonSerializer().fromJSONObject(TestModel,DatasetProfileModel);
- this.form = this.dataModel.buildForm();
- //if (!this.dataModel) this.addSection();
}
-
- addSection(){
- let section:Section = new Section();
+
+ ngOnInit() {
+
+ this.dataModel = new JsonSerializer().fromJSONObject(new DatasetProfileModel(), DatasetProfileModel);
+ this.form = this.dataModel.buildForm();
+ if (this.profileID) {
+ this.datasetProfileService.getDatasetProfileById(this.profileID).subscribe((data) => {
+
+ this.dataModel = new JsonSerializer().fromJSONObject(data, DatasetProfileModel);
+ this.form = this.dataModel.buildForm();
+ });
+ }
+ else{
+
+ this.addSection();
+ }
+ }
+
+ addSection() {
+ let section: Section = new Section();
this.dataModel.sections.push(section);
(this.form.get("sections")).push(section.buildForm());
}
- DeleteSection(index){
+ DeleteSection(index) {
this.dataModel.sections.splice(index);
(this.form.get("sections")).removeAt(index)
}
- updateForm(data){
+ updateForm(data) {
return this.restBase.post("", data);
}
- onSubmit(){ debugger;
+ onSubmit() {
+ debugger;
let data = JSON.stringify(this.form.value);
this.updateForm(data).subscribe();
}
-
+
}
\ No newline at end of file
diff --git a/dmp-admin/src/app/managers/datasetprofile-editor/datasetprofile-editor.component.html b/dmp-admin/src/app/managers/datasetprofile-editor/datasetprofile-editor.component.html
index f600a06d3..4b6426bc9 100644
--- a/dmp-admin/src/app/managers/datasetprofile-editor/datasetprofile-editor.component.html
+++ b/dmp-admin/src/app/managers/datasetprofile-editor/datasetprofile-editor.component.html
@@ -13,6 +13,10 @@
+
+
+ |
+
ID |
@@ -20,6 +24,7 @@
Ruleset |
Viewstyle |
Definition |
+ |
@@ -30,6 +35,8 @@
{{datasetProfile?.ruleset?.label}} |
{{datasetProfile?.viewstyle?.label}} |
{{datasetProfile?.definition}} |
+ |
+
diff --git a/dmp-admin/src/app/routes.ts b/dmp-admin/src/app/routes.ts
index bf966523e..c0765cab2 100644
--- a/dmp-admin/src/app/routes.ts
+++ b/dmp-admin/src/app/routes.ts
@@ -1,3 +1,4 @@
+import { FormComponent } from './formBuilder/form.component';
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
@@ -74,6 +75,10 @@ export const routes: Routes = [
{
path: 'main',
component: MainWindowComponent
+ },
+ {
+ path: 'form/:id',
+ component: FormComponent
}
diff --git a/dmp-admin/src/app/services/dataset-profile.service.ts b/dmp-admin/src/app/services/dataset-profile.service.ts
index cdae154de..38a33c85b 100644
--- a/dmp-admin/src/app/services/dataset-profile.service.ts
+++ b/dmp-admin/src/app/services/dataset-profile.service.ts
@@ -21,7 +21,7 @@ export class DatasetProfileService implements OnInit {
}
getDatasetProfileById(datasetProfileID){
- return this.restBase.get("datasetprofile/"+datasetProfileID);
+ return this.restBase.get("admin/get//"+datasetProfileID);
}
createDatasetProfile(datasetProfile){
diff --git a/dmp-admin/src/app/services/rest-base.ts b/dmp-admin/src/app/services/rest-base.ts
index 4fdf398f2..bc80e0cae 100644
--- a/dmp-admin/src/app/services/rest-base.ts
+++ b/dmp-admin/src/app/services/rest-base.ts
@@ -18,8 +18,8 @@ export class RestBase {
/*
*/
protocol: string = "http";
- hostname: string = "dionysus.di.uoa.gr";
- port: number = 7070;
+ hostname: string = "localhost";
+ port: number = 8080;
webappname: string = "dmp-backend";
restpath: string = "rest";
diff --git a/dmp-backend/pom.xml b/dmp-backend/pom.xml
index e946c9595..ee6b72f9a 100644
--- a/dmp-backend/pom.xml
+++ b/dmp-backend/pom.xml
@@ -154,7 +154,11 @@
2.8.4
-
+
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-xml
+ 2.9.0
+
diff --git a/dmp-backend/src/main/java/entities/xmlmodels/modeldefinition/DatabaseModelDefinition.java b/dmp-backend/src/main/java/entities/xmlmodels/modeldefinition/DatabaseModelDefinition.java
new file mode 100644
index 000000000..5523ecd3e
--- /dev/null
+++ b/dmp-backend/src/main/java/entities/xmlmodels/modeldefinition/DatabaseModelDefinition.java
@@ -0,0 +1,7 @@
+package entities.xmlmodels.modeldefinition;
+
+import utilities.DatabaseDefinition;
+
+public interface DatabaseModelDefinition extends DatabaseDefinition{
+
+}
diff --git a/dmp-backend/src/main/java/entities/xmlmodels/modeldefinition/Field.java b/dmp-backend/src/main/java/entities/xmlmodels/modeldefinition/Field.java
new file mode 100644
index 000000000..b159c52d5
--- /dev/null
+++ b/dmp-backend/src/main/java/entities/xmlmodels/modeldefinition/Field.java
@@ -0,0 +1,91 @@
+package entities.xmlmodels.modeldefinition;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+
+import models.components.commons.DefaultValue;
+import models.components.commons.Multiplicity;
+import utilities.XmlSerializable;
+
+public class Field implements DatabaseModelDefinition,XmlSerializable{
+
+ private String id;
+ private String datatype;
+ private int ordinal;
+ private DefaultValue defaultValue;
+ private Multiplicity multiplicity;
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+ public String getDatatype() {
+ return datatype;
+ }
+ public void setDatatype(String datatype) {
+ this.datatype = datatype;
+ }
+ public int getOrdinal() {
+ return ordinal;
+ }
+ public void setOrdinal(int ordinal) {
+ this.ordinal = ordinal;
+ }
+
+ public DefaultValue getDefaultValue() {
+ return defaultValue;
+ }
+ public void setDefaultValue(DefaultValue defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public Multiplicity getMultiplicity() {
+ return multiplicity;
+ }
+ public void setMultiplicity(Multiplicity multiplicity) {
+ this.multiplicity = multiplicity;
+ }
+
+ @Override
+ public Element toXml(Document doc) {
+ Element element = doc.createElement("field");
+ element.setAttribute("id", this.id);
+ element.setAttribute("ordinal",""+this.ordinal);
+ element.setAttribute("datatype", this.datatype);
+
+ Element defaultValue = doc.createElement("defaultValue");
+ defaultValue.setAttribute("type", this.defaultValue.getType());
+ defaultValue.setAttribute("value",this.defaultValue.getValue());
+
+ Element multiplicity = doc.createElement("multiplicity");
+ multiplicity.setAttribute("min", ""+this.multiplicity.getMin());
+ multiplicity.setAttribute("max", ""+this.multiplicity.getMax());
+
+ element.appendChild(defaultValue);
+ element.appendChild(multiplicity);
+ return element;
+ }
+ @Override
+ public Field fromXml(Element item) {
+ this.id = item.getAttribute("id");
+ this.ordinal = Integer.parseInt(item.getAttribute("ordinal"));
+ this.datatype = item.getAttribute("datatype");
+
+ this.defaultValue = new DefaultValue();
+ Element defaultValue = (Element)item.getElementsByTagName("defaultValue").item(0);
+ this.defaultValue.setType(defaultValue.getAttribute("type"));
+ this.defaultValue.setValue(defaultValue.getAttribute("value"));
+
+ this.multiplicity = new Multiplicity();
+ Element multiplicity = (Element)item.getElementsByTagName("multiplicity").item(0);
+ this.multiplicity.setMin(Integer.parseInt(multiplicity.getAttribute("min")));
+ this.multiplicity.setMax(Integer.parseInt(multiplicity.getAttribute("max")));
+
+ return this;
+ }
+
+
+}
diff --git a/dmp-backend/src/main/java/entities/xmlmodels/modeldefinition/FieldGroup.java b/dmp-backend/src/main/java/entities/xmlmodels/modeldefinition/FieldGroup.java
new file mode 100644
index 000000000..64804d815
--- /dev/null
+++ b/dmp-backend/src/main/java/entities/xmlmodels/modeldefinition/FieldGroup.java
@@ -0,0 +1,54 @@
+package entities.xmlmodels.modeldefinition;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import utilities.XmlSerializable;
+
+public class FieldGroup implements DatabaseModelDefinition,XmlSerializable{
+ private List