no message

This commit is contained in:
annampak 2018-01-19 15:59:48 +02:00
commit 62c4fb0547
66 changed files with 691 additions and 357 deletions

View File

@ -1,6 +1,6 @@
<div class="container">
<div style="background-color: #f5f5f5;border: 1px solid #e3e3e3;padding: 24px;">
<form novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
<form *ngIf="form" novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
<div class="row">
<div class="form-group col-md-12">
<label>Label</label>

View File

@ -25,7 +25,6 @@ export class FormComponent {
constructor(public restBase: RestBase, private datasetProfileService: DatasetProfileService, private route: ActivatedRoute) {
this.profileID = route.snapshot.params['id'];
}
ngOnInit() {
@ -34,19 +33,14 @@ export class FormComponent {
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);
}
// this.dataModel = new JsonSerializer<DatasetProfileModel>().fromJSONObject(TestModel, DatasetProfileModel);
// this.form = this.dataModel.buildForm();
}
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {

View File

@ -25,35 +25,20 @@ export class SectionFormComponent {
ngOnInit() {
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);
@ -71,9 +56,9 @@ export class SectionFormComponent {
}
keepPageSelectionValid(pagesJson: Array<any>) {
let selectedPage = this.form.get("page").value as number;
let selectedPage = this.form.get("page").value as String;
let pages: Array<Page> = new JsonSerializer<Page>().fromJSONArray(pagesJson, Page);
if (!isNaN(selectedPage) && pages.find(elem => elem.id === selectedPage) === undefined)
if (pages.find(elem => elem.id === selectedPage) === undefined)
this.form.get("page").reset();
}
}

View File

@ -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>

View File

@ -30,10 +30,10 @@ export class DatasetProfileModel extends BaseModel implements Serializable<Datas
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
let pagesFormArray = new Array<FormGroup>();
// this.pages.forEach(item => {
// let form: FormGroup = item.buildForm();
// pagesFormArray.push(form)
// })
this.pages.forEach(item => {
let form: FormGroup = item.buildForm();
pagesFormArray.push(form)
})
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
formGroup.addControl('label', new FormControl(this.label, Validators.required));

View File

@ -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;
}

View File

@ -18,7 +18,7 @@ export class RestBase {
/*
*/
protocol: string = "http";
hostname: string = "dl043.madgik.di.uoa.gr";
hostname: string = "localhost";
port: number = 8080;
webappname: string = "";
restpath: string = "";

View File

@ -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">

View File

@ -67,6 +67,7 @@ public class Admin extends BaseController{
try{
eu.eudat.entities.DatasetProfile profile = this.getApiContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
eu.eudat.models.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
datasetprofile.setLabel(profile.getLabel());
return ResponseEntity.status(HttpStatus.OK).body(datasetprofile);
}catch(Exception ex){
ex.printStackTrace();

View File

@ -1,25 +0,0 @@
package eu.eudat.controllers;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Created by ikalyvas on 1/16/2018.
*/
@Controller
public class CustomErrorController implements ErrorController{
@RequestMapping(value = "/error")
public String error(HttpServletRequest request, HttpServletResponse response) {
return "forward:/index.html";
}
@Override
public String getErrorPath() {
return "/error";
}
}

View File

@ -53,7 +53,8 @@ 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) {
public @ResponseBody
ResponseItem<List<AssociatedProfile>> getAvailableProfiles(@RequestBody DatasetProfileWizardAutocompleteRequest datasetProfileWizardAutocompleteRequest, Principal principal) {
try {
List<AssociatedProfile> dataManagementPlans = DatasetWizardManager.getAvailableProfiles(this.getApiContext().getDatabaseRepository().getDmpDao(), datasetProfileWizardAutocompleteRequest);
return new ResponseItem<List<AssociatedProfile>>().status(HttpStatus.OK).payload(dataManagementPlans);
@ -65,10 +66,10 @@ 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) {
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();
@ -78,7 +79,8 @@ 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) {
public @ResponseBody
ResponseItem<eu.eudat.entities.Dataset> createOrUpdate(@RequestBody DatasetWizardModel profile, Principal principal) {
try {
eu.eudat.entities.Dataset dataset = DatasetManager.createOrUpdate(this.getApiContext(), profile);
return new ResponseItem<eu.eudat.entities.Dataset>().status(HttpStatus.OK).payload(dataset);

View File

@ -18,6 +18,7 @@ import eu.eudat.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
@ -27,25 +28,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import eu.eudat.dao.entities.DMPDao;
import eu.eudat.dao.entities.DMPProfileDao;
import eu.eudat.dao.entities.DataRepositoryDao;
import eu.eudat.dao.entities.DatasetDao;
import eu.eudat.dao.entities.DatasetProfileDao;
import eu.eudat.dao.entities.DatasetProfileRulesetDao;
import eu.eudat.dao.entities.DatasetProfileViewstyleDao;
import eu.eudat.dao.entities.OrganisationDao;
import eu.eudat.dao.entities.ProjectDao;
import eu.eudat.dao.entities.RegistryDao;
import eu.eudat.dao.entities.ResearcherDao;
import eu.eudat.dao.entities.ServiceDao;
import eu.eudat.dao.entities.UserInfoDao;
import eu.eudat.models.criteria.DataRepositoryCriteria;
import eu.eudat.models.criteria.RegistryCriteria;
import eu.eudat.models.criteria.ServiceCriteria;
import javax.transaction.Transactional;
@RestController
@CrossOrigin
@ -69,5 +51,18 @@ public class Datasets extends BaseController {
}
}
@Transactional
@RequestMapping(method = RequestMethod.GET, value = {"/datasets/makepublic/{id}"}, produces = "application/json")
public @ResponseBody ResponseItem<Dataset> makePublic(@PathVariable UUID id, Principal principal) {
try {
DatasetManager.makePublic(this.getApiContext().getDatabaseRepository().getDatasetDao(), id);
return new ResponseItem<Dataset>().status(HttpStatus.OK).message("Dataset Has Been Made Public");
} catch (Exception ex) {
ex.printStackTrace();
return new ResponseItem<Dataset>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
}
}
}

View File

@ -1,7 +0,0 @@
package eu.eudat.controllers.controllerhandler;
/**
* Created by ikalyvas on 1/17/2018.
*/
public class ExternalDatasets {
}

View File

@ -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(){

View File

@ -33,11 +33,16 @@ public class DatasetDaoImpl implements DatasetDao {
@Override
public QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria) {
QueryableList<Dataset> query = databaseService.getQueryable(Dataset.class, Dataset.getHints());
if (criteria.getLike() != null && !criteria.getLike().isEmpty())query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
if (criteria.getStatus() != null)query.where((builder, root) -> builder.equal(root.get("status"), criteria.getStatus()));
if (criteria.getPeriodEnd() != null)query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd()));
if (criteria.getPeriodStart() != null) query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
if (criteria.getDmpIds() != null && !criteria.getDmpIds().isEmpty()) query.where((builder, root) -> root.get("dmp").get("id").in( criteria.getDmpIds()));
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
if (criteria.getStatus() != null)
query.where((builder, root) -> builder.equal(root.get("status"), criteria.getStatus()));
if (criteria.getPeriodEnd() != null)
query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd()));
if (criteria.getPeriodStart() != null)
query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
if (criteria.getDmpIds() != null && !criteria.getDmpIds().isEmpty())
query.where((builder, root) -> root.get("dmp").get("id").in(criteria.getDmpIds()));
return query;
}
@ -48,7 +53,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() {
@ -57,7 +62,8 @@ public class DatasetDaoImpl implements DatasetDao {
@Override
public QueryableList<Dataset> getAuthenticated(QueryableList<Dataset> query, UserInfo principal) {
query.where((builder, root) -> builder.or(builder.equal(root.get("dmp").get("creator"), principal), builder.isMember(principal, root.get("dmp").get("users"))));
query.where((builder, root) -> builder.or(builder.equal(root.get("dmp").get("creator"), principal), builder.isMember(principal, root.get("dmp").get("users"))
, builder.equal(root.get("isPublic"), true)));
return query;
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -33,7 +33,7 @@ public class ProjectDaoImpl implements ProjectDao {
if(criteria.getLike()!=null&&!criteria.getLike().isEmpty())query.where((builder, root) -> builder.like(root.get("label"),"%"+criteria.getLike()+"%"));
if(criteria.getPeriodEnd()!=null)query.where((builder, root) -> builder.lessThan(root.get("enddate"),criteria.getPeriodEnd()));
if(criteria.getPeriodStart()!=null)query.where((builder, root) -> builder.greaterThan(root.get("startdate"),criteria.getPeriodStart()));
query.where((builder, root) -> builder.notEqual(root.get("status"), eu.eudat.models.project.Project.Status.DELETED.getValue()));
query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue()));
return query;
}
@ -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(){

View File

@ -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

View File

@ -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;

View File

@ -6,6 +6,8 @@ import java.util.*;
import javax.persistence.*;
import eu.eudat.models.project.*;
import eu.eudat.models.project.Project;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
@ -16,23 +18,44 @@ 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;
public enum Status {
SAVED((short) 0), FINALISED((short) 1), DELETED((short) 99);
private short value;
private Status(short value) {
this.value = value;
}
public short getValue() {
return value;
}
public static Dataset.Status fromInteger(int value) {
switch (value) {
case 0:
return SAVED;
case 1:
return FINALISED;
default:
throw new RuntimeException("Unsupported Project Status");
}
}
}
public Dataset () {}
@ -103,6 +126,8 @@ public class Dataset implements DataEntity<Dataset> {
@Column(name = "\"Status\"", nullable = false)
private Short status;
@Column(name = "\"IsPublic\"", nullable = false)
private boolean isPublic;
@Column(name = "\"Created\"")
private Date created = null;
@ -272,6 +297,14 @@ public class Dataset implements DataEntity<Dataset> {
this.externalDatasets = externalDatasets;
}
public boolean isPublic() {
return isPublic;
}
public void setPublic(boolean aPublic) {
isPublic = aPublic;
}
@Override
public void update(Dataset entity) {
this.setRegistries(entity.getRegistries());
@ -280,6 +313,7 @@ public class Dataset implements DataEntity<Dataset> {
this.setLabel(entity.getLabel());
this.setProperties(entity.getProperties());
this.setExternalDatasets(entity.getExternalDatasets());
this.setStatus(entity.getStatus());
}
@Override

View File

@ -31,6 +31,32 @@ import com.fasterxml.jackson.databind.SerializationFeature;
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
public class Project implements DataEntity<Project> {
public enum Status {
ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99);
private short value;
private Status(short value) {
this.value = value;
}
public short getValue() {
return value;
}
public static Status fromInteger(int value) {
switch (value) {
case 0:
return ACTIVE;
case 1:
return INACTIVE;
case 99:
return DELETED;
default:
throw new RuntimeException("Unsupported Project Status");
}
}
}
public Project () {}

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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;
@ -13,6 +12,7 @@ import eu.eudat.utilities.builders.XmlBuilder;
public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
private List<Section> sections;
private List<Page> pages;
public List<Section> getSections() {
return sections;
@ -22,15 +22,28 @@ public class ViewStyleModel implements XmlSerializable<ViewStyleModel>{
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;
}
@ -49,6 +62,17 @@ public class ViewStyleModel implements XmlSerializable<ViewStyleModel>{
}
}
}
this.pages = new LinkedList<>();
Element pages = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"pages");
if(pages!=null){
NodeList pagesElements = pages.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;
}

View File

@ -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);
@ -41,9 +42,6 @@ public class AdminManager {
Element root = (Element)viewStyleDoc.getDocumentElement();
eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewstyle= new eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel().fromXml(root);
Document profileDoc = XmlBuilder.fromXml(profile.getDefinition());
root = (Element)profileDoc.getDocumentElement();
eu.eudat.models.admin.composite.DatasetProfile datasetprofile = new eu.eudat.models.admin.composite.DatasetProfile();
datasetprofile.buildProfile(viewstyle);

View File

@ -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());

View File

@ -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;
}
@ -102,5 +105,12 @@ public class DatasetManager {
}
}
public static void makePublic(DatasetDao datasetDao, UUID id) throws Exception {
eu.eudat.entities.Dataset dataset = datasetDao.find(id);
if (dataset.getStatus() != eu.eudat.entities.Dataset.Status.FINALISED.getValue())
throw new Exception("You cannot make public a Dataset That Has not Been Finalised");
dataset.setPublic(true);
datasetDao.createOrUpdate(dataset);
}
}

View File

@ -43,7 +43,7 @@ public class ProjectManager {
public eu.eudat.entities.Project inactivate(ProjectDao projectRepository, String id) throws InstantiationException, IllegalAccessException {
eu.eudat.entities.Project project = projectRepository.find(UUID.fromString(id));
project.setStatus(Project.Status.DELETED.getValue());
project.setStatus(eu.eudat.entities.Project.Status.DELETED.getValue());
project = projectRepository.createOrUpdate(project);
return project;
}

View File

@ -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();
}

View File

@ -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;
}
}
}

View File

@ -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);
}
}

View File

@ -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() {

View File

@ -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;
}
@ -27,9 +27,16 @@ public class DatasetProfile {
this.label = label;
}
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);
}
}

View File

@ -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;
}
}

View File

@ -164,4 +164,8 @@ public class Dataset implements DataModel<eu.eudat.entities.Dataset>{
return entity;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -42,4 +42,9 @@ public class DatasetProfileAutocompleteItem implements DataModel<DatasetProfile>
profile.setId(this.id);
return profile;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -94,4 +94,9 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile> {
profile.setId(this.id);
return profile;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -37,4 +37,9 @@ public class DataManagentPlanListingModel implements DataModel<DMP>{
public DMP toDataModel() {
return null;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -88,4 +88,9 @@ public class ExternalDatasetListingModel implements DataModel<ExternalDataset> {
externalDataset.setReference(this.reference);
return externalDataset;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -96,5 +96,8 @@ public class DataManagementPlanListingModel implements DataModel<DMP> {
return null;
}
@Override
public String getHint() {
return "dataManagementPlanListingModel";
}
}

View File

@ -134,4 +134,9 @@ public class DatasetListingModel implements DataModel<Dataset> {
public Dataset toDataModel() {
return null;
}
@Override
public String getHint() {
return "datasetListingModel";
}
}

View File

@ -12,32 +12,7 @@ import eu.eudat.models.dmp.DataManagementPlan;
public class Project implements DataModel<eu.eudat.entities.Project> {
public enum Status {
ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99);
private short value;
private Status(short value) {
this.value = value;
}
public short getValue() {
return value;
}
public static Status fromInteger(int value) {
switch (value) {
case 0:
return ACTIVE;
case 1:
return INACTIVE;
case 99:
return INACTIVE;
default:
throw new RuntimeException("Unsupported Project Status");
}
}
}
private UUID id;
@ -58,7 +33,7 @@ public class Project implements DataModel<eu.eudat.entities.Project> {
private Date endDate;
private Status status;
private eu.eudat.entities.Project.Status status;
private UserInfo creationUser;
@ -146,7 +121,7 @@ public class Project implements DataModel<eu.eudat.entities.Project> {
}
public void setStatus(Short status) {
this.status = Status.fromInteger(status);
this.status = eu.eudat.entities.Project.Status.fromInteger(status);
}
public UserInfo getCreationUser() {
@ -210,9 +185,14 @@ public class Project implements DataModel<eu.eudat.entities.Project> {
entity.setStartdate(this.startDate);
entity.setCreated(this.created == null ? new Date() : this.created);
entity.setEnddate(this.endDate);
entity.setStatus(this.status != null ? this.getStatus() : Status.ACTIVE.getValue());
entity.setStatus(this.status != null ? this.getStatus() : eu.eudat.entities.Project.Status.ACTIVE.getValue());
entity.setModified(new Date());
entity.setDescription(this.description);
return entity;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -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;
}
}

View File

@ -5,41 +5,14 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
import eu.eudat.entities.UserInfo;
import eu.eudat.entities.*;
import eu.eudat.entities.Project;
import eu.eudat.models.DataModel;
import eu.eudat.models.dmp.DataManagementPlan;
public class ProjectListingModel implements DataModel<eu.eudat.entities.Project> {
public enum Status {
ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99);
private short value;
private Status(short value) {
this.value = value;
}
public short getValue() {
return value;
}
public static Status fromInteger(int value) {
switch (value) {
case 0:
return ACTIVE;
case 1:
return INACTIVE;
case 99:
return INACTIVE;
default:
throw new RuntimeException("Unsupported Project Status");
}
}
}
private UUID id;
private List<DataManagementPlan> dmps;
@ -58,7 +31,7 @@ public class ProjectListingModel implements DataModel<eu.eudat.entities.Project>
private String endDate;
private Status status;
private Project.Status status;
private UserInfo creationUser;
@ -130,7 +103,7 @@ public class ProjectListingModel implements DataModel<eu.eudat.entities.Project>
}
public void setStatus(Short status) {
this.status = Status.fromInteger(status);
this.status = Project.Status.fromInteger(status);
}
public UserInfo getCreationUser() {
@ -202,4 +175,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;
}
}

View File

@ -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() {

View File

@ -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 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());
}

View File

@ -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;
}
}

View File

@ -0,0 +1,57 @@
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()));
this.pages.add(datasetProfilePage);
}
return this;
}
}

View File

@ -110,5 +110,8 @@ public class UserInfo implements DataModel<eu.eudat.entities.UserInfo>{
return null;
}
@Override
public String getHint() {
return null;
}
}

View File

@ -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;
}
}

View File

@ -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();
}

View File

@ -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);

View File

@ -14,7 +14,6 @@ database.password=dmpt00lu$r
eu.eudat.proxy.allowed.host=https://eestore.paas2.uninett.no
configuration.externalUrls=/classes/ExternalUrls.xml
#######################################################
spring.resources.add-mappings=true
########################/Email#############################
spring.mail.default-encoding=UTF-8
spring.mail.host=smtp.gmail.com

View File

@ -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'
}

View File

@ -5,15 +5,9 @@
<mat-step [stepControl]="formGroup">
<form *ngIf="formGroup" [formGroup]="formGroup">
<ng-template matStepLabel>{{'DATASET-WIZARD.FIRST-STEP.TITLE' | translate}}</ng-template>
<!-- <auto-complete class="mat-form-field-full-width" placeholder="{{'DATASET-WIZARD.FIRST-STEP.DMP' | translate}}" [configuration]="dmpAutoCompleteConfiguration"
titleKey="label" [control]="formGroup.get('dmp')" [required]="true">
</auto-complete> -->
<!-- <auto-complete class="mat-form-field-full-width" placeholder="{{'DATASET-WIZARD.FIRST-STEP.PROFILE' | translate}}" [configuration]="datasetProfileAutoCompleteConfiguration"
titleKey="label" [control]="formGroup.get('profile')" [required]="true" [disabled]="!formGroup.get('dmp').value">
</auto-complete> -->
<mat-form-field>
<mat-select placeholder=" {{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}" formControlName="profile">
<mat-option *ngFor="let profile of availableProfiles" [value]="profile">
<mat-form-field formGroupName="profile">
<mat-select placeholder=" {{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}" formControlName="id">
<mat-option *ngFor="let profile of availableProfiles" [value]="profile.id">
{{profile.label}}
</mat-option>
</mat-select>
@ -98,6 +92,4 @@
</div>
</mat-step>
</mat-horizontal-stepper>
<!-- <div *ngIf="formGroup"> {{ formGroup.value | json }}</div> -->
</div>

View File

@ -107,7 +107,7 @@ export class DatasetWizardComponent implements AfterViewInit {
datasetProfileRequestItem.criteria = new DatasetProfileCriteria();
datasetProfileRequestItem.criteria.id = this.datasetWizardModel.dmp.id;
this.datasetWizardService.getAvailableProfiles(datasetProfileRequestItem).subscribe(items => {
this.availableProfiles = items;
this.availableProfiles = JsonSerializer.fromJSONArray(items, DatasetProfileModel);
});
}
ngAfterViewInit() {

View File

@ -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;
}
}

View File

@ -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;
}
@ -57,9 +57,9 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
dataRepositories: [{ value: this.dataRepositories, disabled: disabled }, context.getValidation('dataRepositories').validators],
externalDatasets: [{ value: this.externalDatasets, disabled: disabled }, context.getValidation('externalDatasets').validators],
dmp: [{ value: this.dmp, disabled: disabled }, context.getValidation('dmp').validators],
profile: [{ value: this.profile, disabled: disabled }, context.getValidation('profile').validators],
});
formGroup.addControl("profile",this.profile.buildForm())
return formGroup;
}