no message
This commit is contained in:
parent
6a93ed8ef8
commit
51e2deb180
|
@ -1,6 +1,6 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div style="background-color: #f5f5f5;border: 1px solid #e3e3e3;padding: 24px;">
|
<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="row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>Label</label>
|
<label>Label</label>
|
||||||
|
|
|
@ -30,10 +30,10 @@ export class DatasetProfileModel extends BaseModel implements Serializable<Datas
|
||||||
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
|
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
|
||||||
|
|
||||||
let pagesFormArray = new Array<FormGroup>();
|
let pagesFormArray = new Array<FormGroup>();
|
||||||
// this.pages.forEach(item => {
|
this.pages.forEach(item => {
|
||||||
// let form: FormGroup = item.buildForm();
|
let form: FormGroup = item.buildForm();
|
||||||
// pagesFormArray.push(form)
|
pagesFormArray.push(form)
|
||||||
// })
|
})
|
||||||
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
|
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
|
||||||
|
|
||||||
formGroup.addControl('label', new FormControl(this.label, Validators.required));
|
formGroup.addControl('label', new FormControl(this.label, Validators.required));
|
||||||
|
|
|
@ -18,7 +18,7 @@ export class RestBase {
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
protocol: string = "http";
|
protocol: string = "http";
|
||||||
hostname: string = "dl043.madgik.di.uoa.gr";
|
hostname: string = "localhost";
|
||||||
port: number = 8080;
|
port: number = 8080;
|
||||||
webappname: string = "";
|
webappname: string = "";
|
||||||
restpath: string = "";
|
restpath: string = "";
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class Admin extends BaseController{
|
||||||
try{
|
try{
|
||||||
eu.eudat.entities.DatasetProfile profile = this.getApiContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
eu.eudat.entities.DatasetProfile profile = this.getApiContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||||
eu.eudat.models.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
eu.eudat.models.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
||||||
|
datasetprofile.setLabel(profile.getLabel());
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(datasetprofile);
|
return ResponseEntity.status(HttpStatus.OK).body(datasetprofile);
|
||||||
}catch(Exception ex){
|
}catch(Exception ex){
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -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";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -18,6 +18,7 @@ import eu.eudat.services.ApiContext;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
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.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
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
|
@RestController
|
||||||
@CrossOrigin
|
@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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package eu.eudat.controllers.controllerhandler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 1/17/2018.
|
|
||||||
*/
|
|
||||||
public class ExternalDatasets {
|
|
||||||
}
|
|
|
@ -33,11 +33,16 @@ public class DatasetDaoImpl implements DatasetDao {
|
||||||
@Override
|
@Override
|
||||||
public QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria) {
|
public QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria) {
|
||||||
QueryableList<Dataset> query = databaseService.getQueryable(Dataset.class, Dataset.getHints());
|
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.getLike() != null && !criteria.getLike().isEmpty())
|
||||||
if (criteria.getStatus() != null)query.where((builder, root) -> builder.equal(root.get("status"), criteria.getStatus()));
|
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
|
||||||
if (criteria.getPeriodEnd() != null)query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd()));
|
if (criteria.getStatus() != null)
|
||||||
if (criteria.getPeriodStart() != null) query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart()));
|
query.where((builder, root) -> builder.equal(root.get("status"), criteria.getStatus()));
|
||||||
if (criteria.getDmpIds() != null && !criteria.getDmpIds().isEmpty()) query.where((builder, root) -> root.get("dmp").get("id").in( criteria.getDmpIds()));
|
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;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +62,8 @@ public class DatasetDaoImpl implements DatasetDao {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryableList<Dataset> getAuthenticated(QueryableList<Dataset> query, UserInfo principal) {
|
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;
|
return query;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.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.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()));
|
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;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ import java.util.*;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
import eu.eudat.models.project.*;
|
||||||
|
import eu.eudat.models.project.Project;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
@ -29,6 +31,31 @@ public class Dataset implements DataEntity<Dataset> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 3575723814399553259L;
|
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 () {}
|
public Dataset () {}
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,6 +126,8 @@ public class Dataset implements DataEntity<Dataset> {
|
||||||
@Column(name = "\"Status\"", nullable = false)
|
@Column(name = "\"Status\"", nullable = false)
|
||||||
private Short status;
|
private Short status;
|
||||||
|
|
||||||
|
@Column(name = "\"IsPublic\"", nullable = false)
|
||||||
|
private boolean isPublic;
|
||||||
|
|
||||||
@Column(name = "\"Created\"")
|
@Column(name = "\"Created\"")
|
||||||
private Date created = null;
|
private Date created = null;
|
||||||
|
@ -268,6 +297,14 @@ public class Dataset implements DataEntity<Dataset> {
|
||||||
this.externalDatasets = externalDatasets;
|
this.externalDatasets = externalDatasets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPublic() {
|
||||||
|
return isPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPublic(boolean aPublic) {
|
||||||
|
isPublic = aPublic;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Dataset entity) {
|
public void update(Dataset entity) {
|
||||||
this.setRegistries(entity.getRegistries());
|
this.setRegistries(entity.getRegistries());
|
||||||
|
@ -276,6 +313,7 @@ public class Dataset implements DataEntity<Dataset> {
|
||||||
this.setLabel(entity.getLabel());
|
this.setLabel(entity.getLabel());
|
||||||
this.setProperties(entity.getProperties());
|
this.setProperties(entity.getProperties());
|
||||||
this.setExternalDatasets(entity.getExternalDatasets());
|
this.setExternalDatasets(entity.getExternalDatasets());
|
||||||
|
this.setStatus(entity.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,6 +31,32 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||||
public class Project implements DataEntity<Project> {
|
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 () {}
|
public Project () {}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
|
||||||
this.pages = new LinkedList<>();
|
this.pages = new LinkedList<>();
|
||||||
Element pages = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"pages");
|
Element pages = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"pages");
|
||||||
if(pages!=null){
|
if(pages!=null){
|
||||||
NodeList pagesElements = sections.getChildNodes();
|
NodeList pagesElements = pages.getChildNodes();
|
||||||
for (int temp = 0; temp < pagesElements.getLength(); temp++) {
|
for (int temp = 0; temp < pagesElements.getLength(); temp++) {
|
||||||
Node pageElement = pagesElements.item(temp);
|
Node pageElement = pagesElements.item(temp);
|
||||||
if (pageElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (pageElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
|
|
|
@ -42,9 +42,6 @@ public class AdminManager {
|
||||||
Element root = (Element)viewStyleDoc.getDocumentElement();
|
Element root = (Element)viewStyleDoc.getDocumentElement();
|
||||||
eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewstyle= new eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel().fromXml(root);
|
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();
|
eu.eudat.models.admin.composite.DatasetProfile datasetprofile = new eu.eudat.models.admin.composite.DatasetProfile();
|
||||||
datasetprofile.buildProfile(viewstyle);
|
datasetprofile.buildProfile(viewstyle);
|
||||||
|
|
||||||
|
|
|
@ -105,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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class ProjectManager {
|
||||||
|
|
||||||
public eu.eudat.entities.Project inactivate(ProjectDao projectRepository, String id) throws InstantiationException, IllegalAccessException {
|
public eu.eudat.entities.Project inactivate(ProjectDao projectRepository, String id) throws InstantiationException, IllegalAccessException {
|
||||||
eu.eudat.entities.Project project = projectRepository.find(UUID.fromString(id));
|
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);
|
project = projectRepository.createOrUpdate(project);
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,6 @@ public class DatasetProfile {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildProfile(eu.eudat.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle){
|
|
||||||
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Page> getPages() {
|
public List<Page> getPages() {
|
||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
@ -38,4 +34,9 @@ public class DatasetProfile {
|
||||||
public void setPages(List<Page> pages) {
|
public void setPages(List<Page> pages) {
|
||||||
this.pages = 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,32 +12,7 @@ import eu.eudat.models.dmp.DataManagementPlan;
|
||||||
|
|
||||||
public class Project implements DataModel<eu.eudat.entities.Project> {
|
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;
|
private UUID id;
|
||||||
|
@ -58,7 +33,7 @@ public class Project implements DataModel<eu.eudat.entities.Project> {
|
||||||
|
|
||||||
private Date endDate;
|
private Date endDate;
|
||||||
|
|
||||||
private Status status;
|
private eu.eudat.entities.Project.Status status;
|
||||||
|
|
||||||
private UserInfo creationUser;
|
private UserInfo creationUser;
|
||||||
|
|
||||||
|
@ -146,7 +121,7 @@ public class Project implements DataModel<eu.eudat.entities.Project> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(Short status) {
|
public void setStatus(Short status) {
|
||||||
this.status = Status.fromInteger(status);
|
this.status = eu.eudat.entities.Project.Status.fromInteger(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserInfo getCreationUser() {
|
public UserInfo getCreationUser() {
|
||||||
|
@ -210,7 +185,7 @@ public class Project implements DataModel<eu.eudat.entities.Project> {
|
||||||
entity.setStartdate(this.startDate);
|
entity.setStartdate(this.startDate);
|
||||||
entity.setCreated(this.created == null ? new Date() : this.created);
|
entity.setCreated(this.created == null ? new Date() : this.created);
|
||||||
entity.setEnddate(this.endDate);
|
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.setModified(new Date());
|
||||||
entity.setDescription(this.description);
|
entity.setDescription(this.description);
|
||||||
return entity;
|
return entity;
|
||||||
|
|
|
@ -5,41 +5,14 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
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.DataModel;
|
||||||
import eu.eudat.models.dmp.DataManagementPlan;
|
import eu.eudat.models.dmp.DataManagementPlan;
|
||||||
|
|
||||||
|
|
||||||
public class ProjectListingModel implements DataModel<eu.eudat.entities.Project> {
|
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 UUID id;
|
||||||
|
|
||||||
private List<DataManagementPlan> dmps;
|
private List<DataManagementPlan> dmps;
|
||||||
|
@ -58,7 +31,7 @@ public class ProjectListingModel implements DataModel<eu.eudat.entities.Project>
|
||||||
|
|
||||||
private String endDate;
|
private String endDate;
|
||||||
|
|
||||||
private Status status;
|
private Project.Status status;
|
||||||
|
|
||||||
private UserInfo creationUser;
|
private UserInfo creationUser;
|
||||||
|
|
||||||
|
@ -130,7 +103,7 @@ public class ProjectListingModel implements DataModel<eu.eudat.entities.Project>
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(Short status) {
|
public void setStatus(Short status) {
|
||||||
this.status = Status.fromInteger(status);
|
this.status = Project.Status.fromInteger(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserInfo getCreationUser() {
|
public UserInfo getCreationUser() {
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class PagedDatasetProfile {
|
||||||
datasetProfilePage.setOrdinal(page.getOrdinal());
|
datasetProfilePage.setOrdinal(page.getOrdinal());
|
||||||
datasetProfilePage.setTitle(page.getTitle());
|
datasetProfilePage.setTitle(page.getTitle());
|
||||||
datasetProfilePage.setSections(profile.getSections().stream().filter(item -> item.getPage().equals(page.getId())).collect(Collectors.toList()));
|
datasetProfilePage.setSections(profile.getSections().stream().filter(item -> item.getPage().equals(page.getId())).collect(Collectors.toList()));
|
||||||
|
this.pages.add(datasetProfilePage);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ database.password=dmpt00lu$r
|
||||||
eu.eudat.proxy.allowed.host=https://eestore.paas2.uninett.no
|
eu.eudat.proxy.allowed.host=https://eestore.paas2.uninett.no
|
||||||
configuration.externalUrls=/classes/ExternalUrls.xml
|
configuration.externalUrls=/classes/ExternalUrls.xml
|
||||||
#######################################################
|
#######################################################
|
||||||
spring.resources.add-mappings=true
|
|
||||||
########################/Email#############################
|
########################/Email#############################
|
||||||
spring.mail.default-encoding=UTF-8
|
spring.mail.default-encoding=UTF-8
|
||||||
spring.mail.host=smtp.gmail.com
|
spring.mail.host=smtp.gmail.com
|
||||||
|
|
Loading…
Reference in New Issue