model serializers-deserializers between admin model and xml field definition
This commit is contained in:
parent
e5d31cb080
commit
767b1194b1
|
@ -39,8 +39,8 @@
|
|||
</div><!-- /.container-fluid -->
|
||||
</nav>
|
||||
|
||||
<form-comp></form-comp>
|
||||
<!-- <main-window [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]"></main-window> -->
|
||||
<!-- <form-comp></form-comp>-->
|
||||
<main-window [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]"></main-window>
|
||||
|
||||
<app-main-sign-in [ngClass]="{true:'invisible'}[tokenService.isLoggedIn() == true]"></app-main-sign-in>
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<h3 class="panel-title">Manage Datasets</h3>
|
||||
</div>
|
||||
<div class="col col-xs-6 text-right">
|
||||
<button type="button" class="btn btn-sm btn-primary btn-create" data-toggle="modal" data-target="#newdataset-modal-container">Create New</button>
|
||||
<button type="button" class="btn btn-sm btn-primary btn-create" data-toggle="modal" data-target="#newdataset-modal-container" >Create New</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
<div *ngFor="let rule of dataModel.rules let i=index;">
|
||||
<!-- <div *ngFor="let rule of dataModel.rules let i=index;">
|
||||
<h4 style="text-decoration: underline;">Rules <button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteRule(i);"><span class="glyphicon glyphicon-erase"></span></button></h4>
|
||||
<rule-form [form]="form.get('rules').get(''+i)" [dataModel]="rule"></rule-form>
|
||||
<div>
|
||||
|
@ -80,6 +80,6 @@
|
|||
<a (click)="addNewRule(form)" style="cursor: pointer">
|
||||
Add another rule +
|
||||
</a>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
</div>
|
|
@ -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,35 +19,49 @@ import {RestBase} from '../services/rest-base';
|
|||
|
||||
export class FormComponent {
|
||||
|
||||
dataModel: DatasetProfileModel ;
|
||||
dataModel: DatasetProfileModel;
|
||||
form: FormGroup;
|
||||
private profileID: string;
|
||||
|
||||
constructor(public restBase: RestBase, private datasetProfileService: DatasetProfileService, private route: ActivatedRoute) {
|
||||
this.profileID = route.snapshot.params['id'];
|
||||
|
||||
constructor(public restBase: RestBase){
|
||||
}
|
||||
|
||||
ngOnInit(){
|
||||
this.dataModel = new DatasetProfileModel();
|
||||
this.dataModel = new JsonSerializer<DatasetProfileModel>().fromJSONObject(TestModel,DatasetProfileModel);
|
||||
ngOnInit() {
|
||||
|
||||
this.dataModel = new JsonSerializer<DatasetProfileModel>().fromJSONObject(new DatasetProfileModel(), DatasetProfileModel);
|
||||
this.form = this.dataModel.buildForm();
|
||||
//if (!this.dataModel) this.addSection();
|
||||
if (this.profileID) {
|
||||
this.datasetProfileService.getDatasetProfileById(this.profileID).subscribe((data) => {
|
||||
|
||||
this.dataModel = new JsonSerializer<DatasetProfileModel>().fromJSONObject(data, DatasetProfileModel);
|
||||
this.form = this.dataModel.buildForm();
|
||||
});
|
||||
}
|
||||
else{
|
||||
|
||||
this.addSection();
|
||||
}
|
||||
}
|
||||
|
||||
addSection(){
|
||||
let section:Section = new Section();
|
||||
addSection() {
|
||||
let section: Section = new Section();
|
||||
this.dataModel.sections.push(section);
|
||||
(<FormArray>this.form.get("sections")).push(section.buildForm());
|
||||
}
|
||||
|
||||
DeleteSection(index){
|
||||
DeleteSection(index) {
|
||||
this.dataModel.sections.splice(index);
|
||||
(<FormArray>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();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
<span class="glyphicon glyphicon-refresh"></span>
|
||||
</button>
|
||||
</th>
|
||||
<th>
|
||||
<button type="button" class="btn btn-sm btn-primary btn-create" data-toggle="modal" data-target="#newdataset-modal-container" [routerLink]="['/form']">Create New</button>
|
||||
</th>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]"><mfDefaultSorter by="id">ID</mfDefaultSorter></th>
|
||||
|
@ -20,6 +24,7 @@
|
|||
<th><mfDefaultSorter by="ruleset">Ruleset</mfDefaultSorter></th>
|
||||
<th><mfDefaultSorter by="viewstyle">Viewstyle</mfDefaultSorter></th>
|
||||
<th><mfDefaultSorter by="definition">Definition</mfDefaultSorter></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -30,6 +35,8 @@
|
|||
<td>{{datasetProfile?.ruleset?.label}}</td>
|
||||
<td>{{datasetProfile?.viewstyle?.label}}</td>
|
||||
<td>{{datasetProfile?.definition}}</td>
|
||||
<td><button type="button" class="btn btn-sm btn-primary btn-create" data-toggle="modal" data-target="#newdataset-modal-container" [routerLink]="['/form/'+datasetProfile.id]">Go</button></td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -154,7 +154,11 @@
|
|||
<version>2.8.4</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>2.9.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Json <-> XML transformations -->
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package entities.xmlmodels.modeldefinition;
|
||||
|
||||
import utilities.DatabaseDefinition;
|
||||
|
||||
public interface DatabaseModelDefinition extends DatabaseDefinition{
|
||||
|
||||
}
|
|
@ -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<Field>{
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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<FieldGroup>{
|
||||
private List<FieldSet> fieldSets;
|
||||
|
||||
public List<FieldSet> getFieldSets() {
|
||||
return fieldSets;
|
||||
}
|
||||
|
||||
public void setFieldSets(List<FieldSet> fieldSets) {
|
||||
this.fieldSets = fieldSets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element rootElement = doc.createElement("root");
|
||||
Element fieldSetsElement = doc.createElement("fieldSets");
|
||||
for(FieldSet fieldSet : fieldSets){
|
||||
fieldSetsElement.appendChild(fieldSet.toXml(doc));
|
||||
}
|
||||
rootElement.appendChild(fieldSetsElement);
|
||||
doc.appendChild(rootElement);
|
||||
return rootElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldGroup fromXml(Element element) {
|
||||
this.fieldSets = new LinkedList();
|
||||
Element fieldSets = (Element)element.getElementsByTagName("fieldSets").item(0);
|
||||
if(fieldSets!=null){
|
||||
NodeList fieldSetElements = fieldSets.getChildNodes();
|
||||
for (int temp = 0; temp < fieldSetElements.getLength(); temp++) {
|
||||
Node fieldSetElement = fieldSetElements.item(temp);
|
||||
if (fieldSetElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.fieldSets.add(new FieldSet().fromXml((Element)fieldSetElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
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 com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
|
||||
import utilities.XmlSerializable;
|
||||
import utilities.builders.XmlBuilder;
|
||||
|
||||
public class FieldSet implements DatabaseModelDefinition,XmlSerializable<FieldSet>{
|
||||
|
||||
private String id;
|
||||
|
||||
private int ordinal;
|
||||
|
||||
private List<Field> fields;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
public List<Field> getFields() {
|
||||
return fields;
|
||||
}
|
||||
public void setFields(List<Field> fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
|
||||
Element rootElement = doc.createElement("fieldset");
|
||||
rootElement.setAttribute("id", this.id);
|
||||
rootElement.setAttribute("ordinal",""+this.ordinal);
|
||||
|
||||
Element fieldsElement = doc.createElement("fields");
|
||||
for(Field field:this.fields){
|
||||
fieldsElement.appendChild(field.toXml(doc));
|
||||
}
|
||||
rootElement.appendChild(fieldsElement);
|
||||
return rootElement;
|
||||
}
|
||||
@Override
|
||||
public FieldSet fromXml(Element element) {
|
||||
this.id = element.getAttribute("id");
|
||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||
|
||||
this.fields = new LinkedList();
|
||||
Element fields = (Element)element.getElementsByTagName("fields").item(0);
|
||||
if(fields!=null){
|
||||
NodeList fieldElements = fields.getChildNodes();
|
||||
for (int temp = 0; temp < fieldElements.getLength(); temp++) {
|
||||
Node fieldElement = fieldElements.item(temp);
|
||||
if (fieldElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.fields.add(new Field().fromXml((Element)fieldElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package entities.xmlmodels.viewstyledefinition;
|
||||
|
||||
import utilities.DatabaseDefinition;
|
||||
|
||||
public interface DatabaseViewStyleDefinition extends DatabaseDefinition{
|
||||
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
package entities.xmlmodels.viewstyledefinition;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||
import models.components.commons.ViewStyle;
|
||||
import models.components.commons.datafield.FieldData;
|
||||
import utilities.XmlSerializable;
|
||||
import utilities.builders.ModelBuilder;
|
||||
|
||||
public class Field implements DatabaseViewStyleDefinition,XmlSerializable<Field>{
|
||||
private String id;
|
||||
private int ordinal;
|
||||
private boolean defaultVisibility;
|
||||
private String title;
|
||||
private String description;
|
||||
private String extendedDescription;
|
||||
private ViewStyle viewStyle;
|
||||
private FieldData data;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
public boolean isDefaultVisibility() {
|
||||
return defaultVisibility;
|
||||
}
|
||||
public void setDefaultVisibility(boolean defaultVisibility) {
|
||||
this.defaultVisibility = defaultVisibility;
|
||||
}
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
public String getExtendedDescription() {
|
||||
return extendedDescription;
|
||||
}
|
||||
public void setExtendedDescription(String extendedDescription) {
|
||||
this.extendedDescription = extendedDescription;
|
||||
}
|
||||
public ViewStyle getViewStyle() {
|
||||
return viewStyle;
|
||||
}
|
||||
public void setViewStyle(ViewStyle viewStyle) {
|
||||
this.viewStyle = viewStyle;
|
||||
}
|
||||
|
||||
public FieldData getData() {
|
||||
return data;
|
||||
}
|
||||
public void setData(FieldData data) {
|
||||
this.data = data;
|
||||
}
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element rootElement = doc.createElement("field");
|
||||
rootElement.setAttribute("id", this.id);
|
||||
rootElement.setAttribute("ordinal", ""+this.ordinal);
|
||||
rootElement.setAttribute("defaultVisibility",""+this.defaultVisibility);
|
||||
|
||||
Element extendedDescription = doc.createElement("extendedDescription");
|
||||
extendedDescription.setTextContent(this.extendedDescription);
|
||||
|
||||
Element description = doc.createElement("description");
|
||||
description.setTextContent(this.description);
|
||||
|
||||
Element viewStyle = doc.createElement("viewStyle");
|
||||
viewStyle.setAttribute("renderstyle", this.viewStyle.getRenderStyle());
|
||||
viewStyle.setAttribute("cssClass", this.viewStyle.getCssClass());
|
||||
|
||||
rootElement.appendChild(extendedDescription);
|
||||
rootElement.appendChild(viewStyle);
|
||||
rootElement.appendChild(description);
|
||||
if(this.data!=null)rootElement.appendChild(this.data.toXml(doc));
|
||||
return rootElement;
|
||||
}
|
||||
@Override
|
||||
public Field fromXml(Element element) {
|
||||
this.id = element.getAttribute("id");
|
||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||
this.defaultVisibility = Boolean.getBoolean(element.getAttribute("defaultVisibility"));
|
||||
|
||||
Element extendedDescription = (Element)element.getElementsByTagName("extendedDescription").item(0);
|
||||
this.extendedDescription = extendedDescription.getTextContent();
|
||||
|
||||
Element description = (Element)element.getElementsByTagName("description").item(0);
|
||||
this.description = description.getTextContent();
|
||||
|
||||
this.viewStyle = new ViewStyle();
|
||||
Element viewStyle = (Element)element.getElementsByTagName("viewStyle").item(0);
|
||||
this.viewStyle.setRenderStyle(viewStyle.getAttribute("renderstyle"));
|
||||
this.viewStyle.setCssClass(viewStyle.getAttribute("cssClass"));
|
||||
|
||||
Element dataElement = (Element)element.getElementsByTagName("data").item(0);
|
||||
this.data = new ModelBuilder().toFieldData(null, this.viewStyle.getRenderStyle());
|
||||
if(this.data!=null)this.data.fromXml(dataElement);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
package entities.xmlmodels.viewstyledefinition;
|
||||
|
||||
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 entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||
import utilities.XmlSerializable;
|
||||
|
||||
public class FieldGroup implements DatabaseViewStyleDefinition,XmlSerializable<FieldGroup>{
|
||||
private String id;
|
||||
private int ordinal;
|
||||
private boolean defaultVisibility;
|
||||
private int page;
|
||||
private String description;
|
||||
private String title;
|
||||
private String extendedDescription;
|
||||
private List<FieldSet> fieldSets;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
public boolean isDefaultVisibility() {
|
||||
return defaultVisibility;
|
||||
}
|
||||
public void setDefaultVisibility(boolean defaultVisibility) {
|
||||
this.defaultVisibility = defaultVisibility;
|
||||
}
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
public String getExtendedDescription() {
|
||||
return extendedDescription;
|
||||
}
|
||||
public void setExtendedDescription(String extendedDescription) {
|
||||
this.extendedDescription = extendedDescription;
|
||||
}
|
||||
public List<FieldSet> getFieldSets() {
|
||||
return fieldSets;
|
||||
}
|
||||
public void setFieldSets(List<FieldSet> fieldSets) {
|
||||
this.fieldSets = fieldSets;
|
||||
}
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("fieldGroup");
|
||||
root.setAttribute("id", this.id);
|
||||
root.setAttribute("ordinal", ""+this.ordinal);
|
||||
root.setAttribute("defaultVisibility", ""+this.defaultVisibility);
|
||||
root.setAttribute("page", ""+this.page);
|
||||
|
||||
Element title = doc.createElement("title");
|
||||
title.setTextContent(this.title);
|
||||
|
||||
Element description = doc.createElement("description");
|
||||
description.setTextContent(this.description);
|
||||
|
||||
Element extendedDescription = doc.createElement("extendedDescription");
|
||||
extendedDescription.setTextContent(this.extendedDescription);
|
||||
|
||||
Element fieldSets = doc.createElement("fieldsets");
|
||||
for(FieldSet fieldSet : this.fieldSets){
|
||||
fieldSets.appendChild(fieldSet.toXml(doc));
|
||||
}
|
||||
|
||||
root.appendChild(fieldSets);
|
||||
root.appendChild(title);
|
||||
root.appendChild(description);
|
||||
root.appendChild(extendedDescription);
|
||||
|
||||
return root;
|
||||
}
|
||||
@Override
|
||||
public FieldGroup fromXml(Element element) {
|
||||
this.id = element.getAttribute("id");
|
||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||
this.defaultVisibility = Boolean.getBoolean(element.getAttribute("defaultVisibility"));
|
||||
this.page = Integer.parseInt(element.getAttribute("page"));
|
||||
|
||||
Element title = (Element)element.getElementsByTagName("title").item(0);
|
||||
this.title = title.getTextContent();
|
||||
|
||||
Element extendedDescription = (Element)element.getElementsByTagName("extendedDescription").item(0);
|
||||
this.extendedDescription = extendedDescription.getTextContent();
|
||||
|
||||
this.fieldSets = new LinkedList();
|
||||
Element fieldSets = (Element)element.getElementsByTagName("fieldsets").item(0);
|
||||
if(fieldSets!=null){
|
||||
NodeList fieldSetElements = fieldSets.getChildNodes();
|
||||
for (int temp = 0; temp < fieldSetElements.getLength(); temp++) {
|
||||
Node fieldSetElement = fieldSetElements.item(temp);
|
||||
if (fieldSetElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.fieldSets.add(new FieldSet().fromXml((Element)fieldSetElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package entities.xmlmodels.viewstyledefinition;
|
||||
|
||||
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 entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||
import utilities.XmlSerializable;
|
||||
|
||||
public class FieldSet implements DatabaseViewStyleDefinition,XmlSerializable<FieldSet>{
|
||||
private String id;
|
||||
private int ordinal;
|
||||
private List<Field> fields;
|
||||
|
||||
public List<Field> getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public void setFields(List<Field> fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element fieldSet = doc.createElement("fieldSet");
|
||||
fieldSet.setAttribute("id", this.id);
|
||||
fieldSet.setAttribute("ordinal", ""+this.ordinal);
|
||||
Element fieldsElement = doc.createElement("fields");
|
||||
for(Field field : fields){
|
||||
fieldsElement.appendChild(field.toXml(doc));
|
||||
}
|
||||
fieldSet.appendChild(fieldsElement);
|
||||
return fieldSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldSet fromXml(Element element) {
|
||||
this.id = element.getAttribute("id");
|
||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||
this.fields = new LinkedList();
|
||||
Element fields = (Element)element.getElementsByTagName("fields").item(0);
|
||||
if(fields!=null){
|
||||
NodeList fieldElements = fields.getChildNodes();
|
||||
for (int temp = 0; temp < fieldElements.getLength(); temp++) {
|
||||
Node fieldElement = fieldElements.item(temp);
|
||||
if (fieldElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.fields.add(new Field().fromXml((Element)fieldElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
package entities.xmlmodels.viewstyledefinition;
|
||||
|
||||
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 entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||
import utilities.XmlSerializable;
|
||||
|
||||
public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Section>{
|
||||
private String id;
|
||||
private int ordinal;
|
||||
private boolean defaultVisibility;
|
||||
private int page;
|
||||
private String title;
|
||||
private String description;
|
||||
private String extendedDescription;
|
||||
private List<Section> sections;
|
||||
private List<FieldGroup> fieldGroups;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
public boolean isDefaultVisibility() {
|
||||
return defaultVisibility;
|
||||
}
|
||||
public void setDefaultVisibility(boolean defaultVisibility) {
|
||||
this.defaultVisibility = defaultVisibility;
|
||||
}
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
public List<Section> getSections() {
|
||||
return sections;
|
||||
}
|
||||
public void setSections(List<Section> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
public List<FieldGroup> getFieldGroups() {
|
||||
return fieldGroups;
|
||||
}
|
||||
public void setFieldGroups(List<FieldGroup> fieldGroups) {
|
||||
this.fieldGroups = fieldGroups;
|
||||
}
|
||||
|
||||
public String getExtendedDescription() {
|
||||
return extendedDescription;
|
||||
}
|
||||
public void setExtendedDescription(String extendedDescription) {
|
||||
this.extendedDescription = extendedDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element rootElement = doc.createElement("section");
|
||||
rootElement.setAttribute("id", this.id);
|
||||
rootElement.setAttribute("ordinal", ""+this.ordinal);
|
||||
rootElement.setAttribute("defaultVisibility", ""+this.defaultVisibility);
|
||||
rootElement.setAttribute("page", ""+this.page);
|
||||
|
||||
Element description = doc.createElement("description");
|
||||
description.setTextContent(this.description);
|
||||
|
||||
Element extendedDescription = doc.createElement("extendedDescription");
|
||||
extendedDescription.setTextContent(this.extendedDescription);
|
||||
|
||||
if(sections!=null){
|
||||
Element sections = doc.createElement("sections");
|
||||
for(Section section : this.sections){
|
||||
sections.appendChild(section.toXml(doc));
|
||||
}
|
||||
rootElement.appendChild(sections);
|
||||
}
|
||||
|
||||
if(this.fieldGroups!=null){
|
||||
Element formGroups = doc.createElement("fieldGroups");
|
||||
for(FieldGroup fieldGroup : this.fieldGroups){
|
||||
formGroups.appendChild(fieldGroup.toXml(doc));
|
||||
}
|
||||
rootElement.appendChild(formGroups);
|
||||
}
|
||||
rootElement.appendChild(extendedDescription);
|
||||
rootElement.appendChild(description);
|
||||
|
||||
return rootElement;
|
||||
}
|
||||
@Override
|
||||
public Section fromXml(Element element) {
|
||||
|
||||
this.id = element.getAttribute("id");
|
||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||
this.defaultVisibility = Boolean.getBoolean(element.getAttribute("defaultVisibility"));
|
||||
this.page = Integer.parseInt(element.getAttribute("page"));
|
||||
|
||||
Element description = (Element)element.getElementsByTagName("description").item(0);
|
||||
if(description!=null) this.description = description.getTextContent();
|
||||
|
||||
Element extendedDescription = (Element)element.getElementsByTagName("extendedDescription").item(0);
|
||||
if(extendedDescription != null) this.extendedDescription = description.getTextContent();
|
||||
|
||||
this.sections = new LinkedList<Section>();
|
||||
Element sections = (Element)element.getElementsByTagName("sections").item(0);
|
||||
if(sections!=null){
|
||||
NodeList sectionElements = sections.getChildNodes();
|
||||
for (int temp = 0; temp < sectionElements.getLength(); temp++) {
|
||||
Node sectionElement = sectionElements.item(temp);
|
||||
if (sectionElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.sections.add(new Section().fromXml((Element)sectionElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.fieldGroups = new LinkedList<FieldGroup>();
|
||||
Element fieldGroups = (Element)element.getElementsByTagName("fieldGroups").item(0);
|
||||
if(fieldGroups!=null){
|
||||
NodeList fieldGroupElements = fieldGroups.getChildNodes();
|
||||
for (int temp = 0; temp < fieldGroupElements.getLength(); temp++) {
|
||||
Node fieldGroupElement = fieldGroupElements.item(temp);
|
||||
if (fieldGroupElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.fieldGroups.add(new FieldGroup().fromXml((Element)fieldGroupElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package entities.xmlmodels.viewstyledefinition;
|
||||
|
||||
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 entities.xmlmodels.modeldefinition.FieldSet;
|
||||
import utilities.XmlSerializable;
|
||||
|
||||
public class ViewStyleModel implements XmlSerializable<ViewStyleModel>{
|
||||
private List<Section> sections;
|
||||
|
||||
public List<Section> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<Section> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("root");
|
||||
Element sections = doc.createElement("sections");
|
||||
|
||||
for(Section section: this.sections){
|
||||
sections.appendChild(section.toXml(doc));
|
||||
}
|
||||
|
||||
root.appendChild(sections);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewStyleModel fromXml(Element element) {
|
||||
|
||||
this.sections = new LinkedList();
|
||||
Element sections = (Element)element.getElementsByTagName("sections").item(0);
|
||||
if(sections!=null){
|
||||
NodeList sectionElements = sections.getChildNodes();
|
||||
for (int temp = 0; temp < sectionElements.getLength(); temp++) {
|
||||
Node sectionElement = sectionElements.item(temp);
|
||||
if (sectionElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.sections.add(new Section().fromXml((Element)sectionElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package managers;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
|
||||
import entities.DatasetProfileViewstyle;
|
||||
import entities.xmlmodels.modeldefinition.FieldGroup;
|
||||
import entities.xmlmodels.viewstyledefinition.Section;
|
||||
import entities.xmlmodels.viewstyledefinition.ViewStyleModel;
|
||||
import models.components.datasetprofile.FieldSet;
|
||||
import models.composite.DatasetProfile;
|
||||
import utilities.builders.ModelBuilder;
|
||||
import utilities.builders.XmlBuilder;
|
||||
import utilities.helpers.ModelBuilderCollector;
|
||||
|
||||
public class AdminManager {
|
||||
public static entities.DatasetProfile generateModelDefinition(DatasetProfile profile){
|
||||
ObjectMapper xmlMapper = new XmlMapper();
|
||||
List<FieldSet> fieldSets = ModelBuilderCollector.collectCompositeFields(profile.getSections());
|
||||
FieldGroup fieldGroup = new FieldGroup();
|
||||
List<entities.xmlmodels.modeldefinition.FieldSet> fieldset = new ModelBuilder().toModelDefinition(fieldSets, entities.xmlmodels.modeldefinition.FieldSet.class);
|
||||
fieldGroup.setFieldSets(fieldset);
|
||||
Document modelDoc = XmlBuilder.getDocument();
|
||||
fieldGroup.toXml(modelDoc);
|
||||
String xml = XmlBuilder.generateXml(modelDoc);
|
||||
|
||||
entities.DatasetProfile datasetProfile = new entities.DatasetProfile();
|
||||
datasetProfile.setDefinition(xml);
|
||||
datasetProfile.setStatus((short)1);
|
||||
datasetProfile.setLabel("dasd");
|
||||
datasetProfile.setCreated(new Date());
|
||||
return datasetProfile;
|
||||
}
|
||||
|
||||
public static DatasetProfileViewstyle generateViewStyleDefinition(DatasetProfile profile){
|
||||
ViewStyleModel viewStyleModel = new ViewStyleModel();
|
||||
viewStyleModel.setSections(new ModelBuilder().toViewStyleDefinition(profile.getSections(), entities.xmlmodels.viewstyledefinition.Section.class));
|
||||
Document viewStyleDoc = XmlBuilder.getDocument();
|
||||
Element elementViewStyle = viewStyleModel.toXml(viewStyleDoc);
|
||||
viewStyleDoc.appendChild(elementViewStyle);
|
||||
String xml = XmlBuilder.generateXml(viewStyleDoc);
|
||||
|
||||
DatasetProfileViewstyle datasetProfileViewstyle = new DatasetProfileViewstyle();
|
||||
datasetProfileViewstyle.setDefinition(xml);
|
||||
datasetProfileViewstyle.setLabel("skdjal");
|
||||
return datasetProfileViewstyle;
|
||||
}
|
||||
|
||||
public static models.composite.DatasetProfile generateDatasetProfileModel(entities.DatasetProfile profile){
|
||||
Document viewStyleDoc = XmlBuilder.fromXml(profile.getViewstyle().getDefinition());
|
||||
Element root = (Element)viewStyleDoc.getDocumentElement();
|
||||
entities.xmlmodels.viewstyledefinition.ViewStyleModel viewstyle= new entities.xmlmodels.viewstyledefinition.ViewStyleModel().fromXml(root);
|
||||
|
||||
Document profileDoc = XmlBuilder.fromXml(profile.getDefinition());
|
||||
root = (Element)profileDoc.getDocumentElement();
|
||||
entities.xmlmodels.modeldefinition.FieldGroup fieldGroup = new entities.xmlmodels.modeldefinition.FieldGroup().fromXml(root);
|
||||
|
||||
models.composite.DatasetProfile datasetprofile = new models.composite.DatasetProfile();
|
||||
datasetprofile.buildProfile(fieldGroup, viewstyle);
|
||||
|
||||
return datasetprofile;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package models.components.commons;
|
||||
|
||||
public class DefaultValue {
|
||||
private String type;
|
||||
private String value;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package models.components.commons;
|
||||
|
||||
public class Multiplicity {
|
||||
|
||||
private int min;
|
||||
private int max;
|
||||
|
||||
public int getMin() {
|
||||
return min;
|
||||
}
|
||||
public void setMin(int min) {
|
||||
this.min = min;
|
||||
}
|
||||
public int getMax() {
|
||||
return max;
|
||||
}
|
||||
public void setMax(int max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package models.components.commons;
|
||||
|
||||
public class ViewStyle {
|
||||
private String renderStyle;
|
||||
private String cssClass;
|
||||
|
||||
public String getRenderStyle() {
|
||||
return renderStyle;
|
||||
}
|
||||
public void setRenderStyle(String renderStyle) {
|
||||
this.renderStyle = renderStyle;
|
||||
}
|
||||
public String getCssClass() {
|
||||
return cssClass;
|
||||
}
|
||||
public void setCssClass(String cssClass) {
|
||||
this.cssClass = cssClass;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package models.components.commons.datafield;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import utilities.XmlSerializable;
|
||||
|
||||
public class BooleanDecisionData extends FieldData<BooleanDecisionData>{
|
||||
|
||||
@Override
|
||||
public BooleanDecisionData fromData(Object data) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object toData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
|
||||
return doc.createElement("data");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BooleanDecisionData fromXml(Element item) {
|
||||
// TODO Auto-generated method stub
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package models.components.commons.datafield;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import utilities.XmlSerializable;
|
||||
|
||||
public class CheckBoxData extends FieldData<CheckBoxData>{
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
// TODO Auto-generated method stub
|
||||
return doc.createElement("data");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckBoxData fromXml(Element item) {
|
||||
// TODO Auto-generated method stub
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckBoxData fromData(Object data) {
|
||||
// TODO Auto-generated method stub
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object toData() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package models.components.commons.datafield;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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 ComboBoxData extends FieldData<ComboBoxData>{
|
||||
private class Option implements XmlSerializable<Option>{
|
||||
private String label;
|
||||
private String value;
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element option = doc.createElement("option");
|
||||
option.setAttribute("label", this.label);
|
||||
option.setAttribute("value",this.value);
|
||||
return option;
|
||||
}
|
||||
@Override
|
||||
public Option fromXml(Element item) {
|
||||
this.label = item.getAttribute("label");
|
||||
this.value = item.getAttribute("value");
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String type;
|
||||
private String url;
|
||||
private List<Option> options;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
public List<Option> getOptions() {
|
||||
return options;
|
||||
}
|
||||
public void setOptions(List<Option> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("data");
|
||||
root.setAttribute("type", this.type);
|
||||
root.setAttribute("url", this.url);
|
||||
|
||||
Element element = doc.createElement("options");
|
||||
if(this.options!=null){
|
||||
for(Option option : this.options){
|
||||
element.appendChild(option.toXml(doc));
|
||||
}
|
||||
}
|
||||
root.appendChild(element);
|
||||
return root;
|
||||
}
|
||||
@Override
|
||||
public ComboBoxData fromXml(Element item) {
|
||||
|
||||
this.url = item.getAttribute("url");
|
||||
this.type = item.getAttribute("type");
|
||||
this.options = new LinkedList<>();
|
||||
Element optionsElement = (Element)item.getElementsByTagName("options").item(0);
|
||||
|
||||
if(optionsElement!=null){
|
||||
NodeList optionElements = optionsElement.getChildNodes();
|
||||
for (int temp = 0; temp < optionElements.getLength(); temp++) {
|
||||
Node optionElement = optionElements.item(temp);
|
||||
if (optionElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.options.add(new Option().fromXml((Element)optionElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public ComboBoxData fromData(Object data) {
|
||||
if(data!=null){
|
||||
this.type = (String)((Map<String,Object>)data).get("type");
|
||||
this.url = (String)((Map<String,Object>)data).get("url");
|
||||
this.options = (List<Option>)((Map<String,Object>)data).get("options");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Object toData() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package models.components.commons.datafield;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import utilities.XmlSerializable;
|
||||
|
||||
public abstract class FieldData<T> implements XmlSerializable<T>{
|
||||
public T fromData(Object data) {
|
||||
return null;
|
||||
}
|
||||
public Object toData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Element toXml(Document doc) {
|
||||
return null;
|
||||
}
|
||||
public T fromXml(Element item) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package models.components.commons.datafield;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import utilities.XmlSerializable;
|
||||
|
||||
public class FreeTextData extends FieldData<FreeTextData>{
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
// TODO Auto-generated method stub
|
||||
return doc.createElement("data");
|
||||
}
|
||||
|
||||
@Override
|
||||
public FreeTextData fromXml(Element item) {
|
||||
// TODO Auto-generated method stub
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FreeTextData fromData(Object data) {
|
||||
// TODO Auto-generated method stub
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object toData() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package models.components.commons.datafield;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import entities.xmlmodels.viewstyledefinition.Section;
|
||||
import utilities.XmlSerializable;
|
||||
|
||||
public class RadioBoxData extends FieldData<RadioBoxData>{
|
||||
|
||||
private class Option implements XmlSerializable<Option>{
|
||||
private String label;
|
||||
private String value;
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element option = doc.createElement("option");
|
||||
option.setAttribute("label", this.label);
|
||||
option.setAttribute("value",this.value);
|
||||
return option;
|
||||
}
|
||||
@Override
|
||||
public Option fromXml(Element item) {
|
||||
this.label = item.getAttribute("label");
|
||||
this.value = item.getAttribute("value");
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<Option> options;
|
||||
|
||||
public List<Option> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(List<Option> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RadioBoxData fromData(Object data) {
|
||||
this.options = new LinkedList();
|
||||
if(data!=null){
|
||||
List<Map<String,String>> options = ((Map<String,List<Map<String,String>>>)data).get("options");
|
||||
for(Map<String,String> map : options){
|
||||
Option newOption = new Option();
|
||||
newOption.setLabel(map.get("label"));
|
||||
newOption.setValue(map.get("value"));
|
||||
this.options.add(newOption);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object toData() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("data");
|
||||
Element element = doc.createElement("options");
|
||||
for(Option option : this.options){
|
||||
element.appendChild(option.toXml(doc));
|
||||
}
|
||||
root.appendChild(element);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RadioBoxData fromXml(Element item) {
|
||||
|
||||
this.options = new LinkedList<>();
|
||||
Element optionsElement = (Element)item.getElementsByTagName("options").item(0);
|
||||
|
||||
if(optionsElement!=null){
|
||||
NodeList optionElements = optionsElement.getChildNodes();
|
||||
for (int temp = 0; temp < optionElements.getLength(); temp++) {
|
||||
Node optionElement = optionElements.item(temp);
|
||||
if (optionElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.options.add(new Option().fromXml((Element)optionElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,15 +1,32 @@
|
|||
package models.components.datasetprofile;
|
||||
|
||||
public class Field {
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
|
||||
import models.components.commons.DefaultValue;
|
||||
import models.components.commons.Multiplicity;
|
||||
import models.components.commons.ViewStyle;
|
||||
import utilities.ModelDefinition;
|
||||
import utilities.ViewStyleDefinition;
|
||||
import utilities.builders.ModelBuilder;
|
||||
|
||||
public class Field implements ModelDefinition<entities.xmlmodels.modeldefinition.Field>,ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.Field>{
|
||||
private String id;
|
||||
private int ordinal;
|
||||
private String title;
|
||||
private String value;
|
||||
private String description;
|
||||
private String extendedDescription;
|
||||
private String viewStyle;
|
||||
private ViewStyle viewStyle;
|
||||
private String datatype;
|
||||
private boolean defaultVisibility;
|
||||
private int page;
|
||||
public Object data;
|
||||
private DefaultValue defaultValue;
|
||||
private Multiplicity multiplicity;
|
||||
private Object data;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
@ -17,6 +34,14 @@ public class Field {
|
|||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getOrdinal(){
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(int ordinal){
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
@ -41,10 +66,10 @@ public class Field {
|
|||
public void setExtendedDescription(String extendedDescription) {
|
||||
this.extendedDescription = extendedDescription;
|
||||
}
|
||||
public String getViewStyle() {
|
||||
public ViewStyle getViewStyle() {
|
||||
return viewStyle;
|
||||
}
|
||||
public void setViewStyle(String viewStyle) {
|
||||
public void setViewStyle(ViewStyle viewStyle) {
|
||||
this.viewStyle = viewStyle;
|
||||
}
|
||||
public boolean isDefaultVisibility() {
|
||||
|
@ -60,5 +85,70 @@ public class Field {
|
|||
this.page = page;
|
||||
}
|
||||
|
||||
public DefaultValue getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
public void setDefaultValue(DefaultValue defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
public String getDatatype() {
|
||||
return datatype;
|
||||
}
|
||||
public void setDatatype(String datatype) {
|
||||
this.datatype = datatype;
|
||||
}
|
||||
|
||||
public Multiplicity getMultiplicity() {
|
||||
return multiplicity;
|
||||
}
|
||||
public void setMultiplicity(Multiplicity multiplicity) {
|
||||
this.multiplicity = multiplicity;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
@Override
|
||||
public entities.xmlmodels.modeldefinition.Field toDatabaseDefinition(entities.xmlmodels.modeldefinition.Field field) {
|
||||
field.setDatatype(this.datatype);
|
||||
field.setDefaultValue(this.defaultValue);
|
||||
field.setId(this.id);
|
||||
field.setMultiplicity(this.multiplicity);
|
||||
field.setOrdinal(this.ordinal);
|
||||
return field;
|
||||
}
|
||||
@Override
|
||||
public void fromDatabaseDefinition(entities.xmlmodels.modeldefinition.Field item) {
|
||||
this.datatype = item.getDatatype();
|
||||
this.defaultValue = item.getDefaultValue();
|
||||
this.multiplicity = item.getMultiplicity();
|
||||
}
|
||||
@Override
|
||||
public entities.xmlmodels.viewstyledefinition.Field toDatabaseDefinition(entities.xmlmodels.viewstyledefinition.Field field) {
|
||||
field.setDefaultVisibility(this.defaultVisibility);
|
||||
field.setDescription(this.description);
|
||||
field.setExtendedDescription(this.extendedDescription);
|
||||
field.setId(this.id);
|
||||
field.setOrdinal(this.ordinal);
|
||||
field.setTitle(this.title);
|
||||
field.setViewStyle(this.viewStyle);
|
||||
field.setData(new ModelBuilder().toFieldData(data, this.viewStyle.getRenderStyle()));
|
||||
return field;
|
||||
}
|
||||
@Override
|
||||
public void fromDatabaseDefinition(entities.xmlmodels.viewstyledefinition.Field item) {
|
||||
this.defaultVisibility = item.isDefaultVisibility();
|
||||
this.description = item.getDescription();
|
||||
this.extendedDescription = item.getExtendedDescription();
|
||||
this.id = item.getId();
|
||||
this.ordinal = item.getOrdinal();
|
||||
this.title = item.getTitle();
|
||||
this.viewStyle = item.getViewStyle();
|
||||
this.data = item.getData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
package models.components.datasetprofile;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class FieldSet {
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||
|
||||
import utilities.ModelDefinition;
|
||||
import utilities.ViewStyleDefinition;
|
||||
import utilities.builders.ModelBuilder;
|
||||
|
||||
public class FieldSet implements ModelDefinition<entities.xmlmodels.modeldefinition.FieldSet>,ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.FieldSet>{
|
||||
private String id;
|
||||
private int ordinal;
|
||||
|
||||
private List<Field> fields;
|
||||
|
||||
public List<Field> getFields() {
|
||||
|
@ -13,5 +23,48 @@ public class FieldSet {
|
|||
this.fields = fields;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public entities.xmlmodels.modeldefinition.FieldSet toDatabaseDefinition(entities.xmlmodels.modeldefinition.FieldSet fieldSet) {
|
||||
fieldSet.setId(this.id);
|
||||
fieldSet.setOrdinal(this.ordinal);
|
||||
List<entities.xmlmodels.modeldefinition.Field> modelfields = new ModelBuilder().toModelDefinition(this.fields, entities.xmlmodels.modeldefinition.Field.class);
|
||||
fieldSet.setFields(modelfields);
|
||||
return fieldSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromDatabaseDefinition(entities.xmlmodels.modeldefinition.FieldSet item) {
|
||||
this.id = item.getId();
|
||||
this.ordinal = item.getOrdinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public entities.xmlmodels.viewstyledefinition.FieldSet toDatabaseDefinition(entities.xmlmodels.viewstyledefinition.FieldSet item) {
|
||||
List<entities.xmlmodels.viewstyledefinition.Field> viewStylefields = new ModelBuilder().toViewStyleDefinition(this.fields, entities.xmlmodels.viewstyledefinition.Field.class);
|
||||
item.setFields(viewStylefields);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromDatabaseDefinition(entities.xmlmodels.viewstyledefinition.FieldSet item) {
|
||||
this.fields = new ModelBuilder().fromViewStyleDefinition(item.getFields(), Field.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,11 +2,19 @@ package models.components.datasetprofile;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class Group {
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||
|
||||
import entities.xmlmodels.viewstyledefinition.FieldGroup;
|
||||
import utilities.ModelDefinition;
|
||||
import utilities.ViewStyleDefinition;
|
||||
import utilities.builders.ModelBuilder;
|
||||
|
||||
public class Group implements ModelDefinition<entities.xmlmodels.modeldefinition.FieldGroup>,ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.FieldGroup>{
|
||||
private String id;
|
||||
private String title;
|
||||
private String section;
|
||||
private String value;
|
||||
private int ordinal;
|
||||
private String description;
|
||||
private String extendedDescription;
|
||||
private boolean defaultVisibility;
|
||||
|
@ -67,4 +75,44 @@ public class Group {
|
|||
public void setCompositeFields(List<FieldSet> compositeFields) {
|
||||
this.compositeFields = compositeFields;
|
||||
}
|
||||
|
||||
public int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
@Override
|
||||
public entities.xmlmodels.viewstyledefinition.FieldGroup toDatabaseDefinition(FieldGroup item) {
|
||||
item.setDefaultVisibility(this.defaultVisibility);
|
||||
item.setDescription(this.description);
|
||||
item.setExtendedDescription(this.extendedDescription);
|
||||
item.setFieldSets(new ModelBuilder().toViewStyleDefinition(this.compositeFields, entities.xmlmodels.viewstyledefinition.FieldSet.class));
|
||||
item.setId(this.id);
|
||||
item.setOrdinal(this.ordinal);
|
||||
item.setPage(this.page);
|
||||
item.setTitle(this.title);
|
||||
return item;
|
||||
}
|
||||
@Override
|
||||
public void fromDatabaseDefinition(FieldGroup item) {
|
||||
this.defaultVisibility = item.isDefaultVisibility();
|
||||
this.description = item.getDescription();
|
||||
this.extendedDescription = item.getExtendedDescription();
|
||||
this.compositeFields = new ModelBuilder().fromViewStyleDefinition(item.getFieldSets(), FieldSet.class);
|
||||
this.id = item.getId();
|
||||
this.ordinal = item.getOrdinal();
|
||||
this.page = item.getPage();
|
||||
this.title = item.getTitle();
|
||||
}
|
||||
@Override
|
||||
public entities.xmlmodels.modeldefinition.FieldGroup toDatabaseDefinition(entities.xmlmodels.modeldefinition.FieldGroup item) {
|
||||
item.setFieldSets(new ModelBuilder().toModelDefinition(this.compositeFields, entities.xmlmodels.modeldefinition.FieldSet.class));
|
||||
return item;
|
||||
}
|
||||
@Override
|
||||
public void fromDatabaseDefinition(entities.xmlmodels.modeldefinition.FieldGroup item) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,16 @@ package models.components.datasetprofile;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class Section {
|
||||
import utilities.ModelDefinition;
|
||||
import utilities.ViewStyleDefinition;
|
||||
import utilities.builders.ModelBuilder;
|
||||
|
||||
public class Section implements ViewStyleDefinition<entities.xmlmodels.viewstyledefinition.Section>{
|
||||
private List<Section> sections;
|
||||
private List<Group> fieldGroups;
|
||||
private Boolean defaultVisibility;
|
||||
private int page;
|
||||
private int ordinal;
|
||||
private String id;
|
||||
private String title;
|
||||
private String description;
|
||||
|
@ -53,5 +58,35 @@ public class Section {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
@Override
|
||||
public entities.xmlmodels.viewstyledefinition.Section toDatabaseDefinition(entities.xmlmodels.viewstyledefinition.Section item) {
|
||||
item.setDefaultVisibility(this.defaultVisibility);
|
||||
item.setDescription(this.description);
|
||||
if(this.fieldGroups!=null)item.setFieldGroups(new ModelBuilder().toViewStyleDefinition(this.fieldGroups, entities.xmlmodels.viewstyledefinition.FieldGroup.class));
|
||||
item.setId(this.id);
|
||||
item.setOrdinal(this.ordinal);
|
||||
item.setPage(this.page);
|
||||
if(this.sections!=null)item.setSections(new ModelBuilder().toViewStyleDefinition(this.sections, entities.xmlmodels.viewstyledefinition.Section.class));
|
||||
item.setTitle(this.title);
|
||||
return item;
|
||||
}
|
||||
@Override
|
||||
public void fromDatabaseDefinition(entities.xmlmodels.viewstyledefinition.Section item) {
|
||||
this.defaultVisibility = item.isDefaultVisibility();
|
||||
this.description = item.getDescription();
|
||||
this.fieldGroups = new ModelBuilder().fromViewStyleDefinition(item.getFieldGroups(),Group.class);
|
||||
this.id = item.getId();
|
||||
this.ordinal = item.getOrdinal();
|
||||
this.page = item.getPage();
|
||||
this.sections = new ModelBuilder().fromViewStyleDefinition(item.getSections(),Section.class);
|
||||
this.title = item.getTitle();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package models.composite;
|
||||
|
||||
import models.components.datasetprofile.*;
|
||||
import utilities.builders.ModelBuilder;
|
||||
import utilities.helpers.ModelBuilderCollector;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DatasetProfile {
|
||||
|
@ -14,4 +17,14 @@ public class DatasetProfile {
|
|||
this.sections = sections;
|
||||
}
|
||||
|
||||
|
||||
public void buildProfile(entities.xmlmodels.modeldefinition.FieldGroup fieldGroup,entities.xmlmodels.viewstyledefinition.ViewStyleModel viewStyle){
|
||||
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
||||
updateProfile(fieldGroup,viewStyle);
|
||||
}
|
||||
|
||||
private void updateProfile(entities.xmlmodels.modeldefinition.FieldGroup fieldGroup,entities.xmlmodels.viewstyledefinition.ViewStyleModel viewStyle){
|
||||
ModelBuilderCollector.mapSections(sections, fieldGroup.getFieldSets());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,26 +1,75 @@
|
|||
package rest.entities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
|
||||
import dao.entities.DatasetProfileDao;
|
||||
import dao.entities.DatasetProfileRulesetDao;
|
||||
import dao.entities.DatasetProfileViewstyleDao;
|
||||
import entities.DatasetProfileViewstyle;
|
||||
import entities.xmlmodels.modeldefinition.FieldGroup;
|
||||
import entities.xmlmodels.viewstyledefinition.Section;
|
||||
import managers.AdminManager;
|
||||
import models.components.datasetprofile.FieldSet;
|
||||
import models.composite.DatasetProfile;
|
||||
import utilities.builders.ModelBuilder;
|
||||
import utilities.builders.XmlBuilder;
|
||||
import utilities.helpers.ModelBuilderCollector;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
public class Admin {
|
||||
|
||||
@Autowired private DatasetProfileDao datasetProfileDao;
|
||||
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
|
||||
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/admin/addDmp" },consumes = "application/json", produces="application/json")
|
||||
public ResponseEntity<Object> addDmp(@RequestBody DatasetProfile profile){
|
||||
try{
|
||||
entities.DatasetProfile modelDefinition = AdminManager.generateModelDefinition(profile);
|
||||
entities.DatasetProfileViewstyle viewStyleDefinition = AdminManager.generateViewStyleDefinition(profile);
|
||||
|
||||
viewStyleDefinition = datasetProfileViewstyleDao.create(viewStyleDefinition);
|
||||
modelDefinition.setViewstyle(viewStyleDefinition);
|
||||
datasetProfileDao.create(modelDefinition);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(profile);
|
||||
}catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("{\"reason\":\""+ex.getMessage()+"\"}");
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/admin/get/{id}" }, produces="application/json")
|
||||
public ResponseEntity<Object> get(@PathVariable String id){
|
||||
try{
|
||||
entities.DatasetProfile profile = datasetProfileDao.read(UUID.fromString(id));
|
||||
models.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(datasetprofile);
|
||||
}catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("{\"reason\":\""+ex.getMessage()+"\"}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package utilities;
|
||||
|
||||
public interface DatabaseDefinition {
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package utilities;
|
||||
|
||||
import entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||
|
||||
public interface ModelDefinition<T extends DatabaseModelDefinition> {
|
||||
T toDatabaseDefinition(T item);
|
||||
void fromDatabaseDefinition(T item);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package utilities;
|
||||
|
||||
import entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||
import entities.xmlmodels.modeldefinition.Field;
|
||||
import entities.xmlmodels.viewstyledefinition.DatabaseViewStyleDefinition;
|
||||
|
||||
public interface ModelSerializer<T extends DatabaseViewStyleDefinition,U extends DatabaseModelDefinition> {
|
||||
void fromDatabaseDefinition(T viewStyle,U model);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package utilities;
|
||||
|
||||
import entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||
import entities.xmlmodels.viewstyledefinition.DatabaseViewStyleDefinition;
|
||||
|
||||
public interface ViewStyleDefinition<T extends DatabaseViewStyleDefinition>{
|
||||
T toDatabaseDefinition(T item);
|
||||
void fromDatabaseDefinition(T item);
|
||||
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
package utilities;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public interface XmlSerializable <T>{
|
||||
String toXml(T item);
|
||||
T fromXml(String xml);
|
||||
Element toXml(Document doc);
|
||||
T fromXml(Element item);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,73 @@
|
|||
package utilities.builders;
|
||||
|
||||
public class ModelBuilder {
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
|
||||
import entities.xmlmodels.viewstyledefinition.DatabaseViewStyleDefinition;
|
||||
import models.components.commons.datafield.ComboBoxData;
|
||||
import models.components.commons.datafield.FieldData;
|
||||
import models.components.commons.datafield.RadioBoxData;
|
||||
import utilities.ModelDefinition;
|
||||
import utilities.ViewStyleDefinition;
|
||||
|
||||
public class ModelBuilder {
|
||||
public <U extends ModelDefinition<T>,T extends DatabaseModelDefinition> List<T> toModelDefinition(List<U> items,Class<T> clazz){
|
||||
List<T> list = new LinkedList<T>();
|
||||
for(U item : items){
|
||||
try {
|
||||
list.add(item.toDatabaseDefinition(clazz.newInstance()));
|
||||
} catch (InstantiationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public <U extends ViewStyleDefinition<T>,T extends DatabaseViewStyleDefinition> List<T> toViewStyleDefinition(List<U> items,Class<T> clazz){
|
||||
List<T> list = new LinkedList<T>();
|
||||
for(U item : items){
|
||||
try {
|
||||
list.add(item.toDatabaseDefinition(clazz.newInstance()));
|
||||
} catch (InstantiationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public <U extends ViewStyleDefinition<T>,T extends DatabaseViewStyleDefinition> List<U> fromViewStyleDefinition(List<T> items,Class<U> clazz){
|
||||
List<U> list = new LinkedList<U>();
|
||||
for(T item : items){
|
||||
try {
|
||||
U modelItem = clazz.newInstance();
|
||||
modelItem.fromDatabaseDefinition(item);
|
||||
list.add(modelItem);
|
||||
} catch (InstantiationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public <U extends FieldData<U>> U toFieldData(Object data,String type){
|
||||
if(type.equals("combobox")) return (U) new ComboBoxData().fromData(data);
|
||||
if(type.equals("booleanDecision"))return null;
|
||||
if(type.equals("radiobox"))return (U) new RadioBoxData().fromData(data);
|
||||
if(type.equals("checkBox"))return null;
|
||||
if(type.equals("freetext"))return null;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
package utilities.builders;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
||||
public class XmlBuilder {
|
||||
|
||||
public static Document getDocument(){
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder docBuilder;
|
||||
try {
|
||||
docBuilder = docFactory.newDocumentBuilder();
|
||||
Document doc = docBuilder.newDocument();
|
||||
return doc;
|
||||
} catch (ParserConfigurationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String generateXml(Document doc){
|
||||
TransformerFactory tFact = TransformerFactory.newInstance();
|
||||
Transformer trans;
|
||||
try {
|
||||
trans = tFact.newTransformer();
|
||||
StringWriter writer = new StringWriter();
|
||||
StreamResult result = new StreamResult(writer);
|
||||
DOMSource source = new DOMSource(doc);
|
||||
trans.transform(source, result);
|
||||
return writer.toString();
|
||||
} catch (TransformerException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Document fromXml(String xml){
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder docBuilder;
|
||||
try {
|
||||
docBuilder = docFactory.newDocumentBuilder();
|
||||
InputSource inputStream = new InputSource(new StringReader(xml));
|
||||
Document doc = docBuilder.parse(inputStream);
|
||||
return doc;
|
||||
} catch (ParserConfigurationException | SAXException | IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package utilities.helpers;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
|
||||
import models.components.datasetprofile.FieldSet;
|
||||
import models.components.datasetprofile.Group;
|
||||
import models.components.datasetprofile.Section;
|
||||
import models.composite.DatasetProfile;
|
||||
|
||||
public class ModelBuilderCollector {
|
||||
|
||||
public static List<FieldSet> collectCompositeFields(List<Section> sections){
|
||||
List<FieldSet> fieldGroups = new LinkedList();
|
||||
for(Section section: sections){
|
||||
if(!section.getSections().isEmpty()){
|
||||
fieldGroups.addAll(collectCompositeFields(section.getSections()));
|
||||
}
|
||||
fieldGroups.addAll(
|
||||
sections.stream()
|
||||
.map(itemSection->itemSection.getFieldGroups())
|
||||
.filter(x->x!=null)
|
||||
.flatMap(List::stream)
|
||||
.map(group->group.getCompositeFields())
|
||||
.flatMap(List::stream)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
return fieldGroups;
|
||||
}
|
||||
|
||||
public static void mapSections(List<models.components.datasetprofile.Section> sections,List<entities.xmlmodels.modeldefinition.FieldSet> fieldGroups){
|
||||
for(Section section: sections){
|
||||
if(!section.getSections().isEmpty()){
|
||||
mapSections(section.getSections(),fieldGroups);
|
||||
}
|
||||
for(Group group: section.getFieldGroups()){
|
||||
if(!group.getCompositeFields().isEmpty()){
|
||||
mapCompositeFields(group.getCompositeFields(),fieldGroups);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private static void mapCompositeFields(List<models.components.datasetprofile.FieldSet> fieldSets,List<entities.xmlmodels.modeldefinition.FieldSet> fieldGroups){
|
||||
for(FieldSet fieldSet: fieldSets){
|
||||
if(!fieldSet.getFields().isEmpty()){
|
||||
mapFields(fieldSet.getFields(),fieldGroups);
|
||||
}
|
||||
for(entities.xmlmodels.modeldefinition.FieldSet fieldModelSet :fieldGroups){
|
||||
if(fieldSet.getId()!=null&&fieldSet.getId().equals(fieldModelSet.getId())){
|
||||
fieldSet.fromDatabaseDefinition(fieldModelSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private static void mapFields(List<models.components.datasetprofile.Field> fields,List<entities.xmlmodels.modeldefinition.FieldSet> fieldGroups){
|
||||
|
||||
for(models.components.datasetprofile.Field fielditem: fields){
|
||||
for(entities.xmlmodels.modeldefinition.FieldSet fieldSet:fieldGroups){
|
||||
for(entities.xmlmodels.modeldefinition.Field fieldmodelitem : fieldSet.getFields()){
|
||||
if(fielditem.getId()!=null&&fielditem.getId().equals(fieldmodelitem.getId())){
|
||||
fielditem.fromDatabaseDefinition(fieldmodelitem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -68,6 +68,8 @@ export const TestModel = {
|
|||
"page": "1",
|
||||
"title": "1 Data Summary",
|
||||
"description": " Fill in the fields to describe your data model ",
|
||||
"ordinal": "1",
|
||||
"extendedDescription": "",
|
||||
"sections": [],
|
||||
"fieldGroups":
|
||||
[
|
||||
|
@ -88,7 +90,18 @@ export const TestModel = {
|
|||
"title": "",
|
||||
"description": "",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "checkBox",
|
||||
"viewStyle": {
|
||||
"renderStyle": "checkBox",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
@ -99,7 +112,18 @@ export const TestModel = {
|
|||
"title": "",
|
||||
"description": "",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "radiobox",
|
||||
"viewStyle": {
|
||||
"renderStyle": "radiobox",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
"options": [
|
||||
{ "label": "Over 18", "value": "over18" },
|
||||
|
@ -119,12 +143,14 @@ export const TestModel = {
|
|||
"ordinal": "2",
|
||||
"defaultVisibility": "true",
|
||||
"page": "1",
|
||||
"extendedDescription": "",
|
||||
"title": "2 Fair Data",
|
||||
"sections": [
|
||||
{
|
||||
"id": "dataMetadata",
|
||||
"defaultVisibility": "true",
|
||||
"page": "1",
|
||||
"ordinal": 1,
|
||||
"title": "2.1 Making data findable, including provisions for metadata",
|
||||
"sections": [],
|
||||
"fieldGroups": [
|
||||
|
@ -146,7 +172,18 @@ export const TestModel = {
|
|||
"title": "Q2.1.1 Will you use metadata to describe the data?",
|
||||
"description": "User can select from a list of metadata standards. If they cannot find the standard in the list provided then they should choose \"not listed\". Selecting this will result in a field in which the user can insert the URL to the description of the metadata scheme used. A \"comments\" box should exist to allow users to add comments. They may select more than one metadata standard. They may specify more than one URL when selecting \"not listed\". They are also presented with a field in which to specify the location of the metadata service. Users can select the \"no metadata\" button to specify no metadata will be used to describe the data.",
|
||||
"extendedDescription": "FieldGroup Description",
|
||||
"viewStyle": "booleanDecision",
|
||||
"viewStyle": {
|
||||
"renderStyle": "booleanDecision",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
@ -162,7 +199,18 @@ export const TestModel = {
|
|||
"title": "Metadata standards",
|
||||
"description": "The data will be described by metadata that follows the metadata standards described in <url1>, <url2>, ? The data will be described by metadata that follows the metadata schema described in <not-listed-url1>, <not-listed-url2>. The metadata will be stored in the service located at <metadata-repo-url>",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "combobox",
|
||||
"viewStyle": {
|
||||
"renderStyle": "combobox",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
"type": "autocomplete",
|
||||
"url": "http://dionysus.di.uoa.gr:8080/dmp-backend/rest/external/datarepos?query=gree"
|
||||
|
@ -178,7 +226,18 @@ export const TestModel = {
|
|||
"title": "Not listed",
|
||||
"description": "",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "checkBox",
|
||||
"viewStyle": {
|
||||
"renderStyle": "checkBox",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
@ -194,7 +253,18 @@ export const TestModel = {
|
|||
"title": "Url",
|
||||
"description": "URL to the description of the metadata scheme used",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "freetext",
|
||||
"viewStyle": {
|
||||
"renderStyle": "freetext",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
@ -209,7 +279,18 @@ export const TestModel = {
|
|||
"title": "Comments",
|
||||
"description": "",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "freetext",
|
||||
"viewStyle": {
|
||||
"renderStyle": "freetext",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
@ -224,7 +305,18 @@ export const TestModel = {
|
|||
"title": "The data will not be described by any metadata.",
|
||||
"description": "",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "checkBox",
|
||||
"viewStyle": {
|
||||
"renderStyle": "checkBox",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
@ -237,6 +329,7 @@ export const TestModel = {
|
|||
"id": "VocabulariesGroup",
|
||||
"defaultVisibility": "true",
|
||||
"page": "1",
|
||||
"ordinal": 1,
|
||||
"title": "Vocabularies",
|
||||
"description": "Vocabularies",
|
||||
"extendedDescription": "FieldGroup Description",
|
||||
|
@ -249,7 +342,18 @@ export const TestModel = {
|
|||
"title": "Q2.1.2 Will your metadata use standardised vocabularies?",
|
||||
"description": "User selects from a drop-down list of existing standardised vocabularies or \"not listed\" or \"none\". There should be a \"comments\" fields for additional information. If \"not listed\" is selected the user is presented with two additional fields in which the user can put the URL to the new vocabulary along with a short description. The user should be allowed to select more than one option.",
|
||||
"extendedDescription": "FieldGroup Description",
|
||||
"viewStyle": "booleanDesicion",
|
||||
"viewStyle": {
|
||||
"renderStyle": "booleanDesicion",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
@ -263,7 +367,18 @@ export const TestModel = {
|
|||
"title": "Existing standardised vocabularies",
|
||||
"description": "The metadata will make use of the standardised vocabulary <url>",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "combobox",
|
||||
"viewStyle": {
|
||||
"renderStyle": "combobox",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
"type": "wordlist",
|
||||
"values": [
|
||||
|
@ -282,7 +397,18 @@ export const TestModel = {
|
|||
"title": "Not listed vocabulary",
|
||||
"description": "",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "checkBox",
|
||||
"viewStyle": {
|
||||
"renderStyle": "checkBox",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
@ -296,7 +422,18 @@ export const TestModel = {
|
|||
"title": "Vocabulary Url",
|
||||
"description": "The user can put the URL to the new vocabulary",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "freetext",
|
||||
"viewStyle": {
|
||||
"renderStyle": "freetext",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
@ -310,7 +447,18 @@ export const TestModel = {
|
|||
"title": "Comments",
|
||||
"description": "Vocabulary short description",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "freetext",
|
||||
"viewStyle": {
|
||||
"renderStyle": "freetext",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
@ -324,7 +472,18 @@ export const TestModel = {
|
|||
"title": "The metadata will not make use of any vocabulary",
|
||||
"description": "",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "checkBox",
|
||||
"viewStyle": {
|
||||
"renderStyle": "checkBox",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
@ -337,6 +496,7 @@ export const TestModel = {
|
|||
"id": "FreeOfChargeGroup",
|
||||
"defaultVisibility": "true",
|
||||
"page": "1",
|
||||
"ordinal": 1,
|
||||
"title": "Metadata Available",
|
||||
"description": "Metadata Available",
|
||||
"extendedDescription": "FieldGroup Description",
|
||||
|
@ -349,7 +509,18 @@ export const TestModel = {
|
|||
"title": "Q2.1.3 Will you use standardised formats for some or all of your data.",
|
||||
"description": "User is presented with a choice of ?yes?, ?no?. There should be a ?comments? field for additional information.",
|
||||
"extendedDescription": "Field Description",
|
||||
"viewStyle": "booleanDesicion",
|
||||
"viewStyle": {
|
||||
"renderStyle": "booleanDesicion",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
@ -363,7 +534,18 @@ export const TestModel = {
|
|||
"title": "Comments",
|
||||
"description": "",
|
||||
"extendedDescription": "",
|
||||
"viewStyle": "freetext",
|
||||
"viewStyle": {
|
||||
"renderStyle": "freetext",
|
||||
"cssClass": ""
|
||||
},
|
||||
"defaultValue":{
|
||||
"type":"any",
|
||||
"value":""
|
||||
},
|
||||
"multiplicity":{
|
||||
"min":"1",
|
||||
"max":"1"
|
||||
},
|
||||
"data": {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue