no message
This commit is contained in:
parent
24ce69db63
commit
6a93ed8ef8
|
@ -25,28 +25,22 @@ export class FormComponent {
|
|||
|
||||
constructor(public restBase: RestBase, private datasetProfileService: DatasetProfileService, private route: ActivatedRoute) {
|
||||
this.profileID = route.snapshot.params['id'];
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.dataModel = new JsonSerializer<DatasetProfileModel>().fromJSONObject(new DatasetProfileModel(), DatasetProfileModel);
|
||||
this.form = this.dataModel.buildForm();
|
||||
this.dataModel = new JsonSerializer<DatasetProfileModel>().fromJSONObject(new DatasetProfileModel(), DatasetProfileModel);
|
||||
this.form = this.dataModel.buildForm();
|
||||
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();
|
||||
this.addPage(0);
|
||||
else {
|
||||
this.addSection();
|
||||
this.addPage(0);
|
||||
}
|
||||
|
||||
// this.dataModel = new JsonSerializer<DatasetProfileModel>().fromJSONObject(TestModel, DatasetProfileModel);
|
||||
// this.form = this.dataModel.buildForm();
|
||||
}
|
||||
|
||||
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
|
||||
|
@ -63,31 +57,31 @@ export class FormComponent {
|
|||
}
|
||||
|
||||
addPage(number) {
|
||||
let page: Page = new Page(this.dataModel.pages.length);
|
||||
this.dataModel.pages.push(page);
|
||||
(<FormArray>this.form.get("pages")).push(page.buildForm());
|
||||
let page: Page = new Page(this.dataModel.pages.length);
|
||||
this.dataModel.pages.push(page);
|
||||
(<FormArray>this.form.get("pages")).push(page.buildForm());
|
||||
}
|
||||
|
||||
DeleteSection(index) {
|
||||
this.dataModel.sections.splice(index,1);
|
||||
this.dataModel.sections.splice(index, 1);
|
||||
(<FormArray>this.form.get("sections")).removeAt(index)
|
||||
}
|
||||
|
||||
DeletePage(index) {
|
||||
this.dataModel.pages.splice(index, 1);
|
||||
(<FormArray>this.form.get("pages")).removeAt(index)
|
||||
this.dataModel.pages.splice(index, 1);
|
||||
(<FormArray>this.form.get("pages")).removeAt(index)
|
||||
}
|
||||
|
||||
createForm(data) {
|
||||
return this.restBase.post("/admin/addDmp", data);
|
||||
}
|
||||
updateForm(id,data) {
|
||||
return this.restBase.post("/admin/addDmp/"+id, data);
|
||||
updateForm(id, data) {
|
||||
return this.restBase.post("/admin/addDmp/" + id, data);
|
||||
}
|
||||
onSubmit() {
|
||||
let data = this.form.value;
|
||||
|
||||
if(this.profileID) this.updateForm(this.profileID, data).subscribe();
|
||||
|
||||
if (this.profileID) this.updateForm(this.profileID, data).subscribe();
|
||||
else this.createForm(data).subscribe();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, OnInit, Input, ViewEncapsulation } from '@angular/core';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { Section } from 'app/models/DataSetProfile/Section';
|
||||
import { FieldGroup } from 'app/models/DataSetProfile/FieldGroup';
|
||||
import { FormArray } from '@angular/forms/src/model';
|
||||
|
@ -24,36 +24,21 @@ export class SectionFormComponent {
|
|||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
var self = this;
|
||||
|
||||
this.form.root.get("pages").valueChanges.subscribe(function(value) {
|
||||
self.keepPageSelectionValid(value);
|
||||
});
|
||||
var self = this;
|
||||
this.form.root.get("pages").valueChanges.subscribe(function (value) {
|
||||
self.keepPageSelectionValid(value);
|
||||
});
|
||||
}
|
||||
|
||||
// addGroupField() {
|
||||
// let fieldGroup: FieldGroup = new FieldGroup();
|
||||
// if (this.dataModel.fieldGroups)
|
||||
// this.dataModel.fieldGroups.push(fieldGroup);
|
||||
// (<FormArray>this.form.get("fieldGroups")).push(fieldGroup.buildForm());
|
||||
// }
|
||||
|
||||
addField() {
|
||||
let fieldSet: FieldSet = new FieldSet();
|
||||
let field: Field = new Field();
|
||||
//let fieldGroup: FieldGroup = new FieldGroup();
|
||||
fieldSet.fields.push(field);
|
||||
//fieldGroup.compositeFields.push(fieldSet);
|
||||
if (this.dataModel.fieldSets)
|
||||
this.dataModel.fieldSets.push(fieldSet);
|
||||
(<FormArray>this.form.get("fieldSets")).push(fieldSet.buildForm());
|
||||
}
|
||||
|
||||
// DeleteFieldGroup(index) {
|
||||
// this.dataModel.fieldGroups.splice(index, 1);
|
||||
// (<FormArray>this.form.get("fieldGroups")).removeAt(index)
|
||||
// }
|
||||
|
||||
addSectioninSection() {
|
||||
let section: Section = new Section();
|
||||
this.dataModel.sections.push(section);
|
||||
|
@ -65,15 +50,15 @@ export class SectionFormComponent {
|
|||
(<FormArray>this.form.get("sections")).removeAt(index);
|
||||
}
|
||||
|
||||
DeleteFieldSet(index){
|
||||
DeleteFieldSet(index) {
|
||||
this.dataModel.fieldSets.splice(index, 1);
|
||||
(<FormArray>this.form.get("fieldSets")).removeAt(index);
|
||||
}
|
||||
|
||||
keepPageSelectionValid(pagesJson: Array<any>) {
|
||||
let selectedPage = this.form.get("page").value as number;
|
||||
let pages: Array<Page> = new JsonSerializer<Page>().fromJSONArray(pagesJson, Page);
|
||||
if (!isNaN(selectedPage) && pages.find(elem => elem.id === selectedPage) === undefined)
|
||||
this.form.get("page").reset();
|
||||
let selectedPage = this.form.get("page").value as String;
|
||||
let pages: Array<Page> = new JsonSerializer<Page>().fromJSONArray(pagesJson, Page);
|
||||
if (pages.find(elem => elem.id === selectedPage) === undefined)
|
||||
this.form.get("page").reset();
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
<div class="col-sm-6 col-md-4 col-md-offset-4">
|
||||
<h1 class="text-center login-title"></h1>
|
||||
<div class="account-wall">
|
||||
<img class="profile-img" src="/admin-ui/assets/icons/user-icon.png">
|
||||
<img class="profile-img" src="assets/icons/user-icon.png">
|
||||
<form class="form-signin" [formGroup]="nativeLoginForm">
|
||||
<input type="text" class="form-control" [(ngModel)]="creds.username" formControlName="username" placeholder="Username or Email" required autofocus>
|
||||
<input type="password" class="form-control" [(ngModel)]="creds.password" formControlName="password" placeholder="Password" required>
|
||||
|
|
|
@ -5,25 +5,28 @@ import { Serializable } from '../interfaces/Serializable';
|
|||
|
||||
export class Page extends BaseModel implements Serializable<Page>, FormGenerator<FormGroup>{
|
||||
public title: string;
|
||||
public id: number;
|
||||
public id: string;
|
||||
public ordinal: number;
|
||||
|
||||
constructor(id?: number) {
|
||||
constructor(ordinal?: number) {
|
||||
super();
|
||||
if (isNaN(id)) this.id = 0;
|
||||
else this.id = id;
|
||||
if (isNaN(ordinal)) this.ordinal = 0;
|
||||
else this.ordinal = ordinal;
|
||||
this.id = "page_" + this.ordinal;
|
||||
}
|
||||
|
||||
fromJSONObject(item: any): Page {
|
||||
this.title = item.title;
|
||||
this.id = item.id;
|
||||
this.ordinal = item.ordinal;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm(): FormGroup {
|
||||
let formGroup = this.formBuilder.group({
|
||||
title: [this.title],
|
||||
id: [this.id]
|
||||
|
||||
id: [this.id],
|
||||
ordinal: [this.ordinal]
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>DmpAdmin</title>
|
||||
<base href="/admin-ui/">
|
||||
<base href="/">
|
||||
<meta name="csrf-token" content="2c64def7de30197c40276fe1a7ea874ca8871f70be7d7dc3305465a4d5c565e4">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
|
@ -27,17 +27,17 @@
|
|||
|
||||
|
||||
<!-- XML to json and vice versa lib -->
|
||||
<script src="/admin-ui/assets/xml2json.min.js"></script>
|
||||
<script src="assets/xml2json.min.js"></script>
|
||||
|
||||
<!-- Json formatter lib -->
|
||||
<link rel="stylesheet" type="text/css" href="/admin-ui/assets/jquery.json-viewer.css">
|
||||
<script src="/admin-ui/assets/jquery.json-viewer.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="assets/jquery.json-viewer.css">
|
||||
<script src="assets/jquery.json-viewer.js"></script>
|
||||
|
||||
<!-- lib 4 pretty-printing xml and json -->
|
||||
<script src="/admin-ui/assets/vkbeautify.0.99.00.js"></script>
|
||||
<script src="assets/vkbeautify.0.99.00.js"></script>
|
||||
|
||||
<!-- Nice BS notifications -->
|
||||
<script src="/admin-ui/assets/bootstrap-notify.min.js"></script>
|
||||
<script src="assets/bootstrap-notify.min.js"></script>
|
||||
|
||||
<!-- that's google sign in library -->
|
||||
<script src="https://apis.google.com/js/platform.js"></script>
|
||||
|
@ -47,8 +47,8 @@
|
|||
|
||||
|
||||
<!-- my custom global code and css -->
|
||||
<link rel="stylesheet" type="text/css" href="/admin-ui/assets/custom.css">
|
||||
<script src="/admin-ui/assets/custom.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="assets/custom.css">
|
||||
<script src="assets/custom.js"></script>
|
||||
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
|
|
|
@ -31,19 +31,19 @@ import java.util.Map;
|
|||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping( value = { "/datasetwizard" })
|
||||
public class DatasetWizardController extends BaseController{
|
||||
@RequestMapping(value = {"/datasetwizard"})
|
||||
public class DatasetWizardController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
public DatasetWizardController(ApiContext apiContext) {
|
||||
super(apiContext);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/userDmps" }, produces="application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/userDmps"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseItem<List<DataManagentPlanListingModel>> getUserDmps(@RequestBody DatasetWizardAutocompleteRequest datasetWizardAutocompleteRequest, Principal principal) {
|
||||
try {
|
||||
List<DataManagentPlanListingModel> dataManagementPlans = DatasetWizardManager.getUserDmps(this.getApiContext().getDatabaseRepository().getDmpDao(),datasetWizardAutocompleteRequest,principal);
|
||||
List<DataManagentPlanListingModel> dataManagementPlans = DatasetWizardManager.getUserDmps(this.getApiContext().getDatabaseRepository().getDmpDao(), datasetWizardAutocompleteRequest, principal);
|
||||
return new ResponseItem<List<DataManagentPlanListingModel>>().status(HttpStatus.OK).payload(dataManagementPlans);
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
@ -52,10 +52,11 @@ public class DatasetWizardController extends BaseController{
|
|||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/getAvailableProfiles" }, produces="application/json")
|
||||
public @ResponseBody ResponseItem<List<AssociatedProfile>> getAvailableProfiles(@RequestBody DatasetProfileWizardAutocompleteRequest datasetProfileWizardAutocompleteRequest, Principal principal) {
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/getAvailableProfiles"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseItem<List<AssociatedProfile>> getAvailableProfiles(@RequestBody DatasetProfileWizardAutocompleteRequest datasetProfileWizardAutocompleteRequest, Principal principal) {
|
||||
try {
|
||||
List<AssociatedProfile> dataManagementPlans = DatasetWizardManager.getAvailableProfiles(this.getApiContext().getDatabaseRepository().getDmpDao(),datasetProfileWizardAutocompleteRequest);
|
||||
List<AssociatedProfile> dataManagementPlans = DatasetWizardManager.getAvailableProfiles(this.getApiContext().getDatabaseRepository().getDmpDao(), datasetProfileWizardAutocompleteRequest);
|
||||
return new ResponseItem<List<AssociatedProfile>>().status(HttpStatus.OK).payload(dataManagementPlans);
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
@ -64,11 +65,11 @@ public class DatasetWizardController extends BaseController{
|
|||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/getSingle/{id}" }, produces="application/json")
|
||||
public @ResponseBody ResponseItem<DatasetWizardModel> getPaged(@PathVariable String id,Principal principal) {
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getSingle/{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseItem<DatasetWizardModel> getPaged(@PathVariable String id, Principal principal) {
|
||||
try {
|
||||
DatasetWizardModel dataset = new DatasetManager().getSingle(this.getApiContext().getDatabaseRepository().getDatasetDao(), id);
|
||||
|
||||
return new ResponseItem<DatasetWizardModel>().status(HttpStatus.OK).payload(dataset);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
@ -77,10 +78,11 @@ public class DatasetWizardController extends BaseController{
|
|||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/createOrUpdate" }, consumes = "application/json",produces="application/json")
|
||||
public @ResponseBody ResponseItem<eu.eudat.entities.Dataset> createOrUpdate(@RequestBody DatasetWizardModel profile,Principal principal) {
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/createOrUpdate"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseItem<eu.eudat.entities.Dataset> createOrUpdate(@RequestBody DatasetWizardModel profile, Principal principal) {
|
||||
try {
|
||||
eu.eudat.entities.Dataset dataset= DatasetManager.createOrUpdate(this.getApiContext(),profile);
|
||||
eu.eudat.entities.Dataset dataset = DatasetManager.createOrUpdate(this.getApiContext(), profile);
|
||||
return new ResponseItem<eu.eudat.entities.Dataset>().status(HttpStatus.OK).payload(dataset);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
|
|
@ -56,7 +56,7 @@ public class DMPDaoImpl implements DMPDao {
|
|||
|
||||
@Override
|
||||
public DMP find(UUID id) {
|
||||
return databaseService.getQueryable(DMP.class).where((builder, root) -> builder.equal((root.get("id")),id)).toList().get(0);
|
||||
return databaseService.getQueryable(DMP.class).where((builder, root) -> builder.equal((root.get("id")),id)).getSingle();
|
||||
}
|
||||
|
||||
public Long count(){
|
||||
|
|
|
@ -48,7 +48,7 @@ public class DatasetDaoImpl implements DatasetDao {
|
|||
|
||||
@Override
|
||||
public Dataset find(UUID id) {
|
||||
return databaseService.getQueryable(Dataset.class).where((builder, root) -> builder.equal((root.get("id")), id)).toList().get(0);
|
||||
return databaseService.getQueryable(Dataset.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
|
||||
}
|
||||
|
||||
public Long count() {
|
||||
|
|
|
@ -39,7 +39,7 @@ public class DatasetProfileDaoImpl implements DatasetProfileDao {
|
|||
|
||||
@Override
|
||||
public DatasetProfile find(UUID id) {
|
||||
return databaseService.getQueryable(DatasetProfile.class).where((builder, root) -> builder.equal(root.get("id"),id)).toList().get(0);
|
||||
return databaseService.getQueryable(DatasetProfile.class).where((builder, root) -> builder.equal(root.get("id"),id)).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,7 @@ public class ExternalDatasetDaoImpl implements ExternalDatasetDao {
|
|||
|
||||
@Override
|
||||
public ExternalDataset find(UUID id) {
|
||||
return this.databaseService.getQueryable(ExternalDataset.class).where((builder, root) -> builder.equal(root.get("id"),id)).toList().get(0);
|
||||
return this.databaseService.getQueryable(ExternalDataset.class).where((builder, root) -> builder.equal(root.get("id"),id)).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,7 @@ public class InvitationDaoImpl implements InvitationDao{
|
|||
|
||||
@Override
|
||||
public Invitation find(UUID id) {
|
||||
return this.databaseService.getQueryable(Invitation.class).where((builder, root) -> builder.equal(root.get("id"),id)).toList().get(0);
|
||||
return this.databaseService.getQueryable(Invitation.class).where((builder, root) -> builder.equal(root.get("id"),id)).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ProjectDaoImpl implements ProjectDao {
|
|||
|
||||
@Override
|
||||
public Project find(UUID id) {
|
||||
return databaseService.getQueryable(Project.class).where((builder, root) -> builder.equal((root.get("id")),id)).toList().get(0);
|
||||
return databaseService.getQueryable(Project.class).where((builder, root) -> builder.equal((root.get("id")),id)).getSingle();
|
||||
}
|
||||
|
||||
public Long count(){
|
||||
|
|
|
@ -40,7 +40,7 @@ public class UserInfoDaoImpl implements UserInfoDao {
|
|||
|
||||
@Override
|
||||
public UserInfo find(UUID id) {
|
||||
return this.databaseService.getQueryable(UserInfo.class).where((builder, root) -> builder.equal(root.get("id"),id)).toList().get(0);
|
||||
return this.databaseService.getQueryable(UserInfo.class).where((builder, root) -> builder.equal(root.get("id"),id)).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,8 +17,10 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
|||
@Table(name = "\"DMP\"")
|
||||
@NamedEntityGraphs({
|
||||
@NamedEntityGraph(
|
||||
name = "organisationsAndResearchers",
|
||||
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers")}),
|
||||
name = "dataManagementPlanListingModel",
|
||||
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"),
|
||||
@NamedAttributeNode("project"), @NamedAttributeNode("profile")}
|
||||
),
|
||||
@NamedEntityGraph(
|
||||
name = "fullyDetailed",
|
||||
attributeNodes = {
|
||||
|
@ -31,7 +33,7 @@ public class DMP implements Serializable, DataEntity<DMP> {
|
|||
return hints;
|
||||
}
|
||||
|
||||
private static final Set<String> hints = new HashSet<>(Arrays.asList("organisationsAndResearchers", "fullyDetailed"));
|
||||
private static final Set<String> hints = new HashSet<>(Arrays.asList("dataManagementPlanListingModel", "fullyDetailed"));
|
||||
private static final long serialVersionUID = -8263056535208547615L;
|
||||
|
||||
|
||||
|
@ -272,7 +274,7 @@ public class DMP implements Serializable, DataEntity<DMP> {
|
|||
|
||||
|
||||
/*
|
||||
public String toString() {
|
||||
public String toString() {
|
||||
try {
|
||||
return new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(this);
|
||||
} catch (JsonProcessingException e) {
|
||||
|
|
|
@ -16,20 +16,16 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
|||
@Table(name="\"Dataset\"")
|
||||
@NamedEntityGraphs({
|
||||
@NamedEntityGraph(
|
||||
name = "datasetreferences",
|
||||
attributeNodes = {@NamedAttributeNode("services"),@NamedAttributeNode("dataRepositories"),@NamedAttributeNode("registries")}),
|
||||
@NamedEntityGraph(
|
||||
name = "datasetFullyDetailed",
|
||||
attributeNodes = {
|
||||
@NamedAttributeNode("dmp"),@NamedAttributeNode("profile"),@NamedAttributeNode("creator"),
|
||||
@NamedAttributeNode("services"),@NamedAttributeNode("dataRepositories"),@NamedAttributeNode("registries")})
|
||||
name = "datasetListingModel",
|
||||
attributeNodes = {@NamedAttributeNode("services"),@NamedAttributeNode("dataRepositories"),@NamedAttributeNode("registries"),
|
||||
@NamedAttributeNode("dmp"),@NamedAttributeNode("profile")})
|
||||
})
|
||||
public class Dataset implements DataEntity<Dataset> {
|
||||
|
||||
public static Set<String> getHints() {
|
||||
return hints;
|
||||
}
|
||||
private static final Set<String> hints = new HashSet<>(Arrays.asList("datasetreferences", "datasetFullyDetailed"));
|
||||
private static final Set<String> hints = new HashSet<>(Arrays.asList("datasetListingModel"));
|
||||
|
||||
private static final long serialVersionUID = 3575723814399553259L;
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
|
||||
|
||||
import eu.eudat.utilities.XmlSerializable;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 1/19/2018.
|
||||
*/
|
||||
public class Page implements DatabaseViewStyleDefinition,XmlSerializable<Page> {
|
||||
private String id;
|
||||
private int ordinal;
|
||||
private String title;
|
||||
|
||||
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 String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("page");
|
||||
root.setAttribute("title",this.title);
|
||||
root.setAttribute("ordinal",""+this.ordinal);
|
||||
root.setAttribute("id",this.id);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page fromXml(Element item) {
|
||||
this.ordinal = Integer.parseInt(item.getAttribute("ordinal"));
|
||||
this.id = item.getAttribute("id");
|
||||
this.title = item.getAttribute("title");
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Sect
|
|||
private String id;
|
||||
private int ordinal;
|
||||
private boolean defaultVisibility;
|
||||
private int page;
|
||||
private String page;
|
||||
private String title;
|
||||
private String description;
|
||||
private String extendedDescription;
|
||||
|
@ -39,10 +39,10 @@ public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Sect
|
|||
public void setDefaultVisibility(boolean defaultVisibility) {
|
||||
this.defaultVisibility = defaultVisibility;
|
||||
}
|
||||
public int getPage() {
|
||||
public String getPage() {
|
||||
return page;
|
||||
}
|
||||
public void setPage(int page) {
|
||||
public void setPage(String page) {
|
||||
this.page = page;
|
||||
}
|
||||
public String getTitle() {
|
||||
|
@ -124,7 +124,7 @@ public class Section implements DatabaseViewStyleDefinition,XmlSerializable<Sect
|
|||
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"));
|
||||
this.page = element.getAttribute("page");
|
||||
|
||||
Element description = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"description");
|
||||
if(description!=null) this.description = description.getTextContent();
|
||||
|
|
|
@ -2,7 +2,6 @@ package eu.eudat.entities.xmlmodels.datasetprofiledefinition;
|
|||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -11,46 +10,71 @@ import org.w3c.dom.NodeList;
|
|||
import eu.eudat.utilities.XmlSerializable;
|
||||
import eu.eudat.utilities.builders.XmlBuilder;
|
||||
|
||||
public class ViewStyleModel implements XmlSerializable<ViewStyleModel>{
|
||||
private List<Section> sections;
|
||||
public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
|
||||
private List<Section> sections;
|
||||
private List<Page> pages;
|
||||
|
||||
public List<Section> getSections() {
|
||||
return sections;
|
||||
}
|
||||
public List<Section> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<Section> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
public void setSections(List<Section> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
public List<Page> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(List<Page> pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("root");
|
||||
Element sections = doc.createElement("sections");
|
||||
Element pages = doc.createElement("pages");
|
||||
for (Section section : this.sections) {
|
||||
sections.appendChild(section.toXml(doc));
|
||||
}
|
||||
|
||||
for (Page page : this.pages) {
|
||||
pages.appendChild(page.toXml(doc));
|
||||
}
|
||||
|
||||
root.appendChild(pages);
|
||||
root.appendChild(sections);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewStyleModel fromXml(Element element) {
|
||||
|
||||
this.sections = new LinkedList();
|
||||
Element sections = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "sections");
|
||||
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.pages = new LinkedList<>();
|
||||
Element pages = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"pages");
|
||||
if(pages!=null){
|
||||
NodeList pagesElements = sections.getChildNodes();
|
||||
for (int temp = 0; temp < pagesElements.getLength(); temp++) {
|
||||
Node pageElement = pagesElements.item(temp);
|
||||
if (pageElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
this.pages.add(new Page().fromXml((Element) pageElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@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)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "sections");
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ public class AdminManager {
|
|||
public static eu.eudat.entities.DatasetProfile generateViewStyleDefinition(DatasetProfile profile){
|
||||
ViewStyleModel viewStyleModel = new ViewStyleModel();
|
||||
viewStyleModel.setSections(new ModelBuilder().toViewStyleDefinition(profile.getSections(), eu.eudat.entities.xmlmodels.datasetprofiledefinition.Section.class));
|
||||
viewStyleModel.setPages(new ModelBuilder().toViewStyleDefinition(profile.getPages(), eu.eudat.entities.xmlmodels.datasetprofiledefinition.Page.class));
|
||||
Document viewStyleDoc = XmlBuilder.getDocument();
|
||||
Element elementViewStyle = viewStyleModel.toXml(viewStyleDoc);
|
||||
viewStyleDoc.appendChild(elementViewStyle);
|
||||
|
|
|
@ -10,6 +10,7 @@ import eu.eudat.entities.DMP;
|
|||
import eu.eudat.entities.Project;
|
||||
import eu.eudat.entities.UserInfo;
|
||||
import eu.eudat.exceptions.UnauthorisedException;
|
||||
import eu.eudat.models.HintedModelFactory;
|
||||
import eu.eudat.models.criteria.DataManagementPlanCriteria;
|
||||
import eu.eudat.models.criteria.OrganisationCriteria;
|
||||
import eu.eudat.models.criteria.ProjectCriteria;
|
||||
|
@ -33,8 +34,7 @@ public class DataManagementPlanManager {
|
|||
QueryableList<DMP> authItems = apiContext.getDatabaseRepository().getDmpDao().getAuthenticated(items, userInfo);
|
||||
QueryableList<DMP> pagedItems = PaginationManager.applyPaging(authItems, dataManagementPlanTableRequest);
|
||||
|
||||
if (dataManagementPlanTableRequest.getWithHint()) pagedItems.withHint("fullyDetailed");
|
||||
List<DataManagementPlanListingModel> datamanagementPlans = new DomainModelConverter<eu.eudat.entities.DMP, DataManagementPlanListingModel>().fromDataModel(pagedItems.toList(), DataManagementPlanListingModel.class);
|
||||
List<DataManagementPlanListingModel> datamanagementPlans = new DomainModelConverter<eu.eudat.entities.DMP, DataManagementPlanListingModel>().fromDataModel(pagedItems.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class)).toList(), DataManagementPlanListingModel.class);
|
||||
DataTableData<DataManagementPlanListingModel> dataTable = new DataTableData<DataManagementPlanListingModel>();
|
||||
dataTable.setData(datamanagementPlans);
|
||||
dataTable.setTotalCount(items.count());
|
||||
|
@ -43,7 +43,7 @@ public class DataManagementPlanManager {
|
|||
|
||||
public eu.eudat.models.dmp.DataManagementPlan getSingle(DMPDao dmpsRepository, String id, Principal principal) throws InstantiationException, IllegalAccessException {
|
||||
DMP dataManagementPlanEntity = dmpsRepository.find(UUID.fromString(id));
|
||||
if (dataManagementPlanEntity.getCreator().getId()!=principal.getId()&&dataManagementPlanEntity.getUsers().stream().filter(userInfo -> userInfo.getId() == principal.getId()).collect(Collectors.toList()).size() == 0)
|
||||
if (dataManagementPlanEntity.getCreator().getId() != principal.getId() && dataManagementPlanEntity.getUsers().stream().filter(userInfo -> userInfo.getId() == principal.getId()).collect(Collectors.toList()).size() == 0)
|
||||
throw new UnauthorisedException();
|
||||
eu.eudat.models.dmp.DataManagementPlan datamanagementPlan = new eu.eudat.models.dmp.DataManagementPlan();
|
||||
datamanagementPlan.fromDataModel(dataManagementPlanEntity);
|
||||
|
|
|
@ -2,6 +2,7 @@ package eu.eudat.managers;
|
|||
|
||||
import eu.eudat.dao.entities.*;
|
||||
import eu.eudat.entities.UserInfo;
|
||||
import eu.eudat.models.HintedModelFactory;
|
||||
import eu.eudat.models.criteria.DataRepositoryCriteria;
|
||||
import eu.eudat.models.criteria.RegistryCriteria;
|
||||
import eu.eudat.models.criteria.ServiceCriteria;
|
||||
|
@ -13,6 +14,7 @@ import eu.eudat.models.listingmodels.DatasetListingModel;
|
|||
import eu.eudat.models.project.Project;
|
||||
import eu.eudat.models.project.ProjectTableRequest;
|
||||
import eu.eudat.models.security.Principal;
|
||||
import eu.eudat.models.user.composite.PagedDatasetProfile;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.services.ApiContext;
|
||||
import eu.eudat.utilities.builders.DomainModelConverter;
|
||||
|
@ -34,8 +36,7 @@ public class DatasetManager {
|
|||
QueryableList<eu.eudat.entities.Dataset> items = apiContext.getDatabaseRepository().getDatasetDao().getWithCriteria(datasetTableRequest.getCriteria());
|
||||
QueryableList<eu.eudat.entities.Dataset> authItems = apiContext.getDatabaseRepository().getDatasetDao().getAuthenticated(items,userInfo);
|
||||
QueryableList<eu.eudat.entities.Dataset> pagedItems = PaginationManager.applyPaging( authItems ,datasetTableRequest);
|
||||
if(datasetTableRequest.getWithHint())pagedItems.withHint("datasetFullyDetailed");
|
||||
List<DatasetListingModel> datasets = new DomainModelConverter<eu.eudat.entities.Dataset, DatasetListingModel>().fromDataModel( pagedItems.toList(), DatasetListingModel.class);
|
||||
List<DatasetListingModel> datasets = new DomainModelConverter<eu.eudat.entities.Dataset, DatasetListingModel>().fromDataModel( pagedItems.withHint(HintedModelFactory.getHint(DatasetListingModel.class)).toList(), DatasetListingModel.class);
|
||||
DataTableData<DatasetListingModel> dataTable = new DataTableData<DatasetListingModel>();
|
||||
dataTable.setData(datasets);
|
||||
dataTable.setTotalCount(items.count());
|
||||
|
@ -52,7 +53,9 @@ public class DatasetManager {
|
|||
Map<String,Object> properties = (Map<String, Object>)jobject.toMap();
|
||||
datasetprofile.fromJsonObject(properties);
|
||||
}
|
||||
dataset.setDatasetProfileDefinition(datasetprofile);
|
||||
PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile();
|
||||
pagedDatasetProfile.buildPagedDatasetProfile(datasetprofile);
|
||||
dataset.setDatasetProfileDefinition(pagedDatasetProfile);
|
||||
dataset.fromDataModel(datasetEntity);
|
||||
return dataset;
|
||||
}
|
||||
|
|
|
@ -5,4 +5,5 @@ import eu.eudat.entities.DataEntity;
|
|||
public interface DataModel<T extends DataEntity> {
|
||||
void fromDataModel(T entity) throws InstantiationException, IllegalAccessException;
|
||||
T toDataModel() throws Exception;
|
||||
String getHint();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.models;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 1/18/2018.
|
||||
*/
|
||||
public class HintedModelFactory {
|
||||
|
||||
public static <T extends DataModel> String getHint(Class<T> clazz) {
|
||||
try {
|
||||
return clazz.newInstance().getHint();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package eu.eudat.models.admin.components.datasetprofile;
|
||||
|
||||
import eu.eudat.entities.xmlmodels.datasetprofiledefinition.*;
|
||||
import eu.eudat.utilities.ViewStyleDefinition;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 1/19/2018.
|
||||
*/
|
||||
public class Page implements Comparable,ViewStyleDefinition<eu.eudat.entities.xmlmodels.datasetprofiledefinition.Page> {
|
||||
private String id;
|
||||
private Integer ordinal;
|
||||
private String title;
|
||||
|
||||
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 String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public eu.eudat.entities.xmlmodels.datasetprofiledefinition.Page toDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.Page item) {
|
||||
item.setId(this.id);
|
||||
item.setOrdinal(this.ordinal);
|
||||
item.setTitle(this.title);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.Page item) {
|
||||
this.title = item.getTitle();
|
||||
this.ordinal = item.getOrdinal();
|
||||
this.id = item.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object o) {
|
||||
return this.ordinal.compareTo((Integer)o);
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities
|
|||
private List<Section> sections;
|
||||
private List<FieldSet> fieldSets;
|
||||
private Boolean defaultVisibility;
|
||||
private int page;
|
||||
private String page;
|
||||
private Integer ordinal;
|
||||
private String id;
|
||||
private String title;
|
||||
|
@ -37,10 +37,10 @@ public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities
|
|||
public void setDefaultVisibility(Boolean defaultVisibility) {
|
||||
this.defaultVisibility = defaultVisibility;
|
||||
}
|
||||
public int getPage() {
|
||||
public String getPage() {
|
||||
return page;
|
||||
}
|
||||
public void setPage(int page) {
|
||||
public void setPage(String page) {
|
||||
this.page = page;
|
||||
}
|
||||
public String getId() {
|
||||
|
|
|
@ -10,7 +10,7 @@ import eu.eudat.models.admin.components.datasetprofile.*;
|
|||
public class DatasetProfile {
|
||||
private String label;
|
||||
private List<Section> sections;
|
||||
|
||||
private List<Page> pages;
|
||||
public List<Section> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
@ -30,6 +30,12 @@ public class DatasetProfile {
|
|||
public void buildProfile(eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle){
|
||||
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
||||
}
|
||||
|
||||
|
||||
public List<Page> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(List<Page> pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,4 +55,9 @@ public class DataRepository implements DataModel<eu.eudat.entities.DataRepositor
|
|||
public String generateLabel() {
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,5 +163,9 @@ public class Dataset implements DataModel<eu.eudat.entities.Dataset>{
|
|||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,4 +81,9 @@ public class Registry implements DataModel<eu.eudat.entities.Registry>,LabelGene
|
|||
eu.eudat.entities.Registry entity = new eu.eudat.entities.Registry();
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,4 +85,9 @@ public class Service implements DataModel<eu.eudat.entities.Service>,LabelGenera
|
|||
public String generateLabel() {
|
||||
return this.label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,4 +42,9 @@ public class DatasetProfileAutocompleteItem implements DataModel<DatasetProfile>
|
|||
profile.setId(this.id);
|
||||
return profile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,4 +94,9 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile> {
|
|||
profile.setId(this.id);
|
||||
return profile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,4 +37,9 @@ public class DataManagentPlanListingModel implements DataModel<DMP>{
|
|||
public DMP toDataModel() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import eu.eudat.models.dmp.DataManagementPlan;
|
|||
import eu.eudat.models.externaldataset.ExternalDatasetListingModel;
|
||||
import eu.eudat.models.listingmodels.DatasetListingModel;
|
||||
import eu.eudat.models.user.composite.DatasetProfile;
|
||||
import eu.eudat.models.user.composite.PagedDatasetProfile;
|
||||
import eu.eudat.utilities.builders.DomainModelConverter;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -31,7 +32,7 @@ public class DatasetWizardModel implements DataModel<Dataset> {
|
|||
private String properties;
|
||||
private Date created;
|
||||
private DataManagementPlan dmp;
|
||||
private eu.eudat.models.user.composite.DatasetProfile datasetProfileDefinition;
|
||||
private PagedDatasetProfile datasetProfileDefinition;
|
||||
private List<Registry> registries;
|
||||
private List<Service> services;
|
||||
private List<DataRepository> dataRepositories;
|
||||
|
@ -110,11 +111,11 @@ public class DatasetWizardModel implements DataModel<Dataset> {
|
|||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
public DatasetProfile getDatasetProfileDefinition() {
|
||||
public PagedDatasetProfile getDatasetProfileDefinition() {
|
||||
return datasetProfileDefinition;
|
||||
}
|
||||
|
||||
public void setDatasetProfileDefinition(DatasetProfile datasetProfileDefinition) {
|
||||
public void setDatasetProfileDefinition(PagedDatasetProfile datasetProfileDefinition) {
|
||||
this.datasetProfileDefinition = datasetProfileDefinition;
|
||||
}
|
||||
|
||||
|
@ -163,6 +164,7 @@ public class DatasetWizardModel implements DataModel<Dataset> {
|
|||
this.id = entity.getId();
|
||||
this.label = entity.getLabel();
|
||||
this.properties = entity.getProperties();
|
||||
this.status = entity.getStatus();
|
||||
this.reference = entity.getReference();
|
||||
this.description = entity.getDescription();
|
||||
this.profile = new DatasetProfileListingModel();
|
||||
|
@ -218,4 +220,9 @@ public class DatasetWizardModel implements DataModel<Dataset> {
|
|||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,4 +178,9 @@ public class DataManagementPlan implements DataModel<DMP>{
|
|||
dataManagementPlanEntity.setCreated(this.created!=null?this.created:new Date());
|
||||
return dataManagementPlanEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,4 +65,9 @@ public class Organisation implements DataModel<eu.eudat.entities.Organisation>,L
|
|||
public String generateLabel() {
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,4 +66,9 @@ public class Researcher implements DataModel<eu.eudat.entities.Researcher>,Label
|
|||
public String generateLabel() {
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,4 +88,9 @@ public class ExternalDatasetListingModel implements DataModel<ExternalDataset> {
|
|||
externalDataset.setReference(this.reference);
|
||||
return externalDataset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,5 +96,8 @@ public class DataManagementPlanListingModel implements DataModel<DMP> {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return "dataManagementPlanListingModel";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,4 +134,9 @@ public class DatasetListingModel implements DataModel<Dataset> {
|
|||
public Dataset toDataModel() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return "datasetListingModel";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -215,4 +215,9 @@ public class Project implements DataModel<eu.eudat.entities.Project> {
|
|||
entity.setDescription(this.description);
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,4 +31,9 @@ public class ProjectCriteriaModel implements DataModel<eu.eudat.entities.Project
|
|||
project.setId(this.id);
|
||||
return project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,4 +202,9 @@ public class ProjectListingModel implements DataModel<eu.eudat.entities.Project>
|
|||
public eu.eudat.entities.Project toDataModel() throws Exception {
|
||||
throw new Exception("Not Implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities
|
|||
private List<Section> sections;
|
||||
private List<FieldSet> fieldSets;
|
||||
private Boolean defaultVisibility;
|
||||
private int page;
|
||||
private String page;
|
||||
private Integer ordinal;
|
||||
private String id;
|
||||
private String title;
|
||||
|
@ -39,10 +39,10 @@ public class Section implements Comparable,ViewStyleDefinition<eu.eudat.entities
|
|||
public void setDefaultVisibility(Boolean defaultVisibility) {
|
||||
this.defaultVisibility = defaultVisibility;
|
||||
}
|
||||
public int getPage() {
|
||||
public String getPage() {
|
||||
return page;
|
||||
}
|
||||
public void setPage(int page) {
|
||||
public void setPage(String page) {
|
||||
this.page = page;
|
||||
}
|
||||
public String getId() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package eu.eudat.models.user.composite;
|
||||
|
||||
import eu.eudat.models.admin.components.datasetprofile.Page;
|
||||
import eu.eudat.utilities.builders.ModelBuilder;
|
||||
import eu.eudat.utilities.helpers.ModelBuilderCollector;
|
||||
|
||||
|
@ -12,6 +13,7 @@ import eu.eudat.models.user.components.commons.Rule;
|
|||
public class DatasetProfile implements PropertiesModelBuilder{
|
||||
private List<Section> sections;
|
||||
private List<Rule> rules;
|
||||
private List<Page> pages;
|
||||
private int status;
|
||||
public List<Section> getSections() {
|
||||
return sections;
|
||||
|
@ -38,8 +40,17 @@ public class DatasetProfile implements PropertiesModelBuilder{
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
public void buildProfile( eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle){
|
||||
public List<Page> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(List<Page> pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
public void buildProfile(eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle){
|
||||
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
||||
this.pages = new ModelBuilder().fromViewStyleDefinition(viewStyle.getPages(), Page.class);
|
||||
this.rules = ModelBuilderCollector.collectRules(viewStyle.getSections());
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package eu.eudat.models.user.composite;
|
||||
|
||||
import eu.eudat.models.user.components.datasetprofile.Section;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 1/19/2018.
|
||||
*/
|
||||
public class DatasetProfilePage {
|
||||
private Integer ordinal;
|
||||
private String title;
|
||||
private List<Section> sections;
|
||||
|
||||
public Integer getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(Integer ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public List<Section> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<Section> sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package eu.eudat.models.user.composite;
|
||||
|
||||
import eu.eudat.models.admin.components.datasetprofile.Page;
|
||||
import eu.eudat.models.user.components.commons.Rule;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 1/19/2018.
|
||||
*/
|
||||
public class PagedDatasetProfile {
|
||||
private List<DatasetProfilePage> pages;
|
||||
private List<Rule> rules;
|
||||
private int status;
|
||||
|
||||
public List<DatasetProfilePage> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(List<DatasetProfilePage> pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
public List<Rule> getRules() {
|
||||
return rules;
|
||||
}
|
||||
|
||||
public void setRules(List<Rule> rules) {
|
||||
this.rules = rules;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public PagedDatasetProfile buildPagedDatasetProfile(DatasetProfile profile) {
|
||||
this.status = profile.getStatus();
|
||||
this.rules = profile.getRules();
|
||||
this.pages = new LinkedList<>();
|
||||
List<Page> pages = profile.getPages();
|
||||
for (Page page : pages) {
|
||||
DatasetProfilePage datasetProfilePage = new DatasetProfilePage();
|
||||
datasetProfilePage.setOrdinal(page.getOrdinal());
|
||||
datasetProfilePage.setTitle(page.getTitle());
|
||||
datasetProfilePage.setSections(profile.getSections().stream().filter(item -> item.getPage().equals(page.getId())).collect(Collectors.toList()));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -109,6 +109,9 @@ public class UserInfo implements DataModel<eu.eudat.entities.UserInfo>{
|
|||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,4 +53,9 @@ public class UserInfoInvitationModel implements DataModel<eu.eudat.entities.User
|
|||
userInfo.setName(this.name);
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ public interface QueryableList<T extends DataEntity<T>> {
|
|||
|
||||
List<T> toList();
|
||||
|
||||
T getSingle();
|
||||
|
||||
QueryableList<T> skip(Integer offset);
|
||||
|
||||
QueryableList<T> take(Integer length);
|
||||
|
@ -26,6 +28,6 @@ public interface QueryableList<T extends DataEntity<T>> {
|
|||
QueryableList<T> orderByAsc(OrderByPredicate<T> predicate);
|
||||
QueryableList<T> orderByDesc(OrderByPredicate<T> predicate);
|
||||
QueryableList<T> setHints(Set<String> hints);
|
||||
void withHint(String hint);
|
||||
QueryableList<T> withHint(String hint);
|
||||
Long count();
|
||||
}
|
||||
|
|
|
@ -40,8 +40,9 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
|
|||
return this;
|
||||
}
|
||||
|
||||
public void withHint(String hint) {
|
||||
public QueryableList<T> withHint(String hint) {
|
||||
this.hint = hint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueryableList<T> setHints(Set<String> hints) {
|
||||
|
@ -122,11 +123,20 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
|
|||
if (this.length != null) typedQuery.setMaxResults(this.length);
|
||||
if (this.hint != null && this.hints.contains(hint)) {
|
||||
List ids = typedQuery.getResultList().stream().map(item -> item.getKeys()[0]).collect(Collectors.toList());
|
||||
typedQuery = queryWithHint(ids);
|
||||
if (ids != null && !ids.isEmpty()) typedQuery = queryWithHint(ids);
|
||||
}
|
||||
return typedQuery.getResultList();
|
||||
}
|
||||
|
||||
public T getSingle() {
|
||||
Predicate[] array = new Predicate[this.predicates.size()];
|
||||
this.predicates.toArray(array);
|
||||
this.query.where(array);
|
||||
|
||||
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
|
||||
return typedQuery.getSingleResult();
|
||||
}
|
||||
|
||||
private TypedQuery<T> queryWithHint(List ids) {
|
||||
CriteriaBuilder criteriaBuilder = this.manager.getCriteriaBuilder();
|
||||
CriteriaQuery<T> criteriaQuery = criteriaBuilder.createQuery(tClass);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export const HostConfiguration = {
|
||||
Server: 'http://dl043.madgik.di.uoa.gr:8080/',
|
||||
App: 'http://dl043.madgik.di.uoa.gr:8080/'
|
||||
Server: 'http://localhost:8080/',
|
||||
App: 'http://localhost:8080/'
|
||||
//CASHost: 'https://login-devel.uoa.gr/login',
|
||||
//Service: 'http://elkefinman/login'
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
</auto-complete> -->
|
||||
<mat-form-field>
|
||||
<mat-select placeholder=" {{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}" formControlName="profile">
|
||||
<mat-option *ngFor="let profile of availableProfiles" [value]=" formGroup.get('profile').value">
|
||||
<mat-option *ngFor="let profile of availableProfiles" [value]="profile">
|
||||
{{profile.label}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
|
|
|
@ -7,7 +7,6 @@ import { Serializable } from "../Serializable";
|
|||
export class DatasetProfileModel implements Serializable<DatasetProfileModel> {
|
||||
public id: String;
|
||||
public label: String;
|
||||
public errorModel: BaseErrorModel = new BaseErrorModel();
|
||||
|
||||
fromJSONObject(item: any): DatasetProfileModel {
|
||||
this.id = item.id;
|
||||
|
@ -19,7 +18,7 @@ export class DatasetProfileModel implements Serializable<DatasetProfileModel> {
|
|||
if (context == null) { context = this.createValidationContext(); }
|
||||
|
||||
const formGroup = new FormBuilder().group({
|
||||
id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators]
|
||||
id: [{ value: this.id, disabled: disabled }]
|
||||
});
|
||||
|
||||
return formGroup;
|
||||
|
@ -27,7 +26,7 @@ export class DatasetProfileModel implements Serializable<DatasetProfileModel> {
|
|||
|
||||
createValidationContext(): ValidationContext {
|
||||
const baseContext: ValidationContext = new ValidationContext();
|
||||
baseContext.validation.push({ key: 'id', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'id')] });
|
||||
//baseContext.validation.push({ key: 'id', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'id')] });
|
||||
return baseContext;
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ import { ExternalDatasetModel } from '@app/models/external-dataset/ExternalDatas
|
|||
export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
|
||||
public id: String;
|
||||
public label: String;
|
||||
public profile: DatasetProfileModel = new DatasetProfileModel;
|
||||
public profile: DatasetProfileModel = new DatasetProfileModel();
|
||||
public uri: String;
|
||||
public status: String;
|
||||
public description: String;
|
||||
|
@ -39,7 +39,7 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
|
|||
this.registries = JsonSerializer.fromJSONArray(item.registries, RegisterModel);
|
||||
this.dataRepositories = JsonSerializer.fromJSONArray(item.dataRepositories, DataRepositoryModel);
|
||||
this.dmp = JsonSerializer.fromJSONObject(item.dmp, DataManagementPlanModel);
|
||||
this.profile = JsonSerializer.fromJSONObject(item.profile, DatasetWizardModel);
|
||||
this.profile = JsonSerializer.fromJSONObject(item.profile, DatasetProfileModel);
|
||||
this.datasetProfileDefinition = JsonSerializer.fromJSONObject(item.datasetProfileDefinition, DatasetProfileDefinitionModel);
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue