no message
This commit is contained in:
parent
6a93ed8ef8
commit
51e2deb180
|
@ -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>
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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 = "";
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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.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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -29,6 +31,31 @@ public class Dataset implements DataEntity<Dataset> {
|
|||
|
||||
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 () {}
|
||||
|
||||
|
||||
|
@ -97,9 +124,11 @@ public class Dataset implements DataEntity<Dataset> {
|
|||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
||||
private Short status;
|
||||
|
||||
@Column(name = "\"IsPublic\"", nullable = false)
|
||||
private boolean isPublic;
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
|
@ -268,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());
|
||||
|
@ -276,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
|
||||
|
|
|
@ -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 () {}
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
|
|||
this.pages = new LinkedList<>();
|
||||
Element pages = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(),"pages");
|
||||
if(pages!=null){
|
||||
NodeList pagesElements = sections.getChildNodes();
|
||||
NodeList pagesElements = pages.getChildNodes();
|
||||
for (int temp = 0; temp < pagesElements.getLength(); temp++) {
|
||||
Node pageElement = pagesElements.item(temp);
|
||||
if (pageElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||
|
|
|
@ -41,9 +41,6 @@ public class AdminManager {
|
|||
Document viewStyleDoc = XmlBuilder.fromXml(profile.getDefinition());
|
||||
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);
|
||||
|
|
|
@ -30,27 +30,27 @@ import java.util.UUID;
|
|||
*/
|
||||
public class DatasetManager {
|
||||
|
||||
public DataTableData<DatasetListingModel> getPaged(ApiContext apiContext, DatasetTableRequest datasetTableRequest, Principal principal) throws IllegalAccessException, InstantiationException{
|
||||
public DataTableData<DatasetListingModel> getPaged(ApiContext apiContext, DatasetTableRequest datasetTableRequest, Principal principal) throws IllegalAccessException, InstantiationException {
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setId(principal.getId());
|
||||
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);
|
||||
List<DatasetListingModel> datasets = new DomainModelConverter<eu.eudat.entities.Dataset, DatasetListingModel>().fromDataModel( pagedItems.withHint(HintedModelFactory.getHint(DatasetListingModel.class)).toList(), DatasetListingModel.class);
|
||||
QueryableList<eu.eudat.entities.Dataset> authItems = apiContext.getDatabaseRepository().getDatasetDao().getAuthenticated(items, userInfo);
|
||||
QueryableList<eu.eudat.entities.Dataset> pagedItems = PaginationManager.applyPaging(authItems, datasetTableRequest);
|
||||
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());
|
||||
return dataTable;
|
||||
}
|
||||
|
||||
public DatasetWizardModel getSingle(DatasetDao datatasetRepository, String id) throws InstantiationException, IllegalAccessException{
|
||||
public DatasetWizardModel getSingle(DatasetDao datatasetRepository, String id) throws InstantiationException, IllegalAccessException {
|
||||
DatasetWizardModel dataset = new DatasetWizardModel();
|
||||
eu.eudat.entities.Dataset datasetEntity = datatasetRepository.find(UUID.fromString(id));
|
||||
eu.eudat.models.user.composite.DatasetProfile datasetprofile = UserManager.generateDatasetProfileModel(datasetEntity.getProfile());
|
||||
datasetprofile.setStatus(dataset.getStatus());
|
||||
if(datasetEntity.getProperties()!=null){
|
||||
if (datasetEntity.getProperties() != null) {
|
||||
JSONObject jobject = new JSONObject(datasetEntity.getProperties());
|
||||
Map<String,Object> properties = (Map<String, Object>)jobject.toMap();
|
||||
Map<String, Object> properties = (Map<String, Object>) jobject.toMap();
|
||||
datasetprofile.fromJsonObject(properties);
|
||||
}
|
||||
PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile();
|
||||
|
@ -62,48 +62,55 @@ public class DatasetManager {
|
|||
|
||||
public static eu.eudat.entities.Dataset createOrUpdate(ApiContext apiContext, DatasetWizardModel profile) throws Exception {
|
||||
eu.eudat.entities.Dataset dataset = profile.toDataModel();
|
||||
createRegistriesIfTheyDontExist(apiContext.getDatabaseRepository().getRegistryDao(),dataset);
|
||||
createDataRepositoriesIfTheyDontExist(apiContext.getDatabaseRepository().getDataRepositoryDao(),dataset);
|
||||
createServicesIfTheyDontExist(apiContext.getDatabaseRepository().getServiceDao(),dataset);
|
||||
createRegistriesIfTheyDontExist(apiContext.getDatabaseRepository().getRegistryDao(), dataset);
|
||||
createDataRepositoriesIfTheyDontExist(apiContext.getDatabaseRepository().getDataRepositoryDao(), dataset);
|
||||
createServicesIfTheyDontExist(apiContext.getDatabaseRepository().getServiceDao(), dataset);
|
||||
return apiContext.getDatabaseRepository().getDatasetDao().createOrUpdate(dataset);
|
||||
}
|
||||
|
||||
|
||||
private static void createRegistriesIfTheyDontExist(RegistryDao registryDao, eu.eudat.entities.Dataset dataset){
|
||||
if(dataset.getRegistries()!=null&&!dataset.getRegistries().isEmpty()){
|
||||
for(eu.eudat.entities.Registry registry : dataset.getRegistries()){
|
||||
RegistryCriteria criteria = new RegistryCriteria();
|
||||
criteria.setLike(registry.getReference());
|
||||
List<eu.eudat.entities.Registry> entries = registryDao.listBy(criteria);
|
||||
if(entries!=null&&!entries.isEmpty())registry.setId( entries.get(0).getId());
|
||||
else registry = registryDao.create(registry);
|
||||
}
|
||||
}
|
||||
private static void createRegistriesIfTheyDontExist(RegistryDao registryDao, eu.eudat.entities.Dataset dataset) {
|
||||
if (dataset.getRegistries() != null && !dataset.getRegistries().isEmpty()) {
|
||||
for (eu.eudat.entities.Registry registry : dataset.getRegistries()) {
|
||||
RegistryCriteria criteria = new RegistryCriteria();
|
||||
criteria.setLike(registry.getReference());
|
||||
List<eu.eudat.entities.Registry> entries = registryDao.listBy(criteria);
|
||||
if (entries != null && !entries.isEmpty()) registry.setId(entries.get(0).getId());
|
||||
else registry = registryDao.create(registry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void createServicesIfTheyDontExist(ServiceDao serviceDao,eu.eudat.entities.Dataset dataset){
|
||||
if(dataset.getServices()!=null&&!dataset.getServices().isEmpty()){
|
||||
for(eu.eudat.entities.Service service : dataset.getServices()){
|
||||
ServiceCriteria criteria = new ServiceCriteria();
|
||||
criteria.setLike(service.getReference());
|
||||
List<eu.eudat.entities.Service> entries = serviceDao.listBy(criteria);
|
||||
if(entries!=null&&!entries.isEmpty())service.setId(entries.get(0).getId());
|
||||
else service = serviceDao.create(service);
|
||||
}
|
||||
}
|
||||
private static void createServicesIfTheyDontExist(ServiceDao serviceDao, eu.eudat.entities.Dataset dataset) {
|
||||
if (dataset.getServices() != null && !dataset.getServices().isEmpty()) {
|
||||
for (eu.eudat.entities.Service service : dataset.getServices()) {
|
||||
ServiceCriteria criteria = new ServiceCriteria();
|
||||
criteria.setLike(service.getReference());
|
||||
List<eu.eudat.entities.Service> entries = serviceDao.listBy(criteria);
|
||||
if (entries != null && !entries.isEmpty()) service.setId(entries.get(0).getId());
|
||||
else service = serviceDao.create(service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void createDataRepositoriesIfTheyDontExist(DataRepositoryDao dataRepositoryDao,eu.eudat.entities.Dataset dataset){
|
||||
if(dataset.getDataRepositories()!=null&&!dataset.getDataRepositories().isEmpty()){
|
||||
for(eu.eudat.entities.DataRepository dataRepo : dataset.getDataRepositories()){
|
||||
DataRepositoryCriteria criteria = new DataRepositoryCriteria();
|
||||
criteria.setLike(dataRepo.getReference());
|
||||
List<eu.eudat.entities.DataRepository> entries = dataRepositoryDao.listBy(criteria);
|
||||
if(entries!=null&&!entries.isEmpty())dataRepo.setId(entries.get(0).getId());
|
||||
else dataRepo = dataRepositoryDao.createOrUpdate(dataRepo);
|
||||
}
|
||||
}
|
||||
private static void createDataRepositoriesIfTheyDontExist(DataRepositoryDao dataRepositoryDao, eu.eudat.entities.Dataset dataset) {
|
||||
if (dataset.getDataRepositories() != null && !dataset.getDataRepositories().isEmpty()) {
|
||||
for (eu.eudat.entities.DataRepository dataRepo : dataset.getDataRepositories()) {
|
||||
DataRepositoryCriteria criteria = new DataRepositoryCriteria();
|
||||
criteria.setLike(dataRepo.getReference());
|
||||
List<eu.eudat.entities.DataRepository> entries = dataRepositoryDao.listBy(criteria);
|
||||
if (entries != null && !entries.isEmpty()) dataRepo.setId(entries.get(0).getId());
|
||||
else dataRepo = dataRepositoryDao.createOrUpdate(dataRepo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -27,10 +27,6 @@ public class DatasetProfile {
|
|||
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() {
|
||||
return pages;
|
||||
}
|
||||
|
@ -38,4 +34,9 @@ public class DatasetProfile {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,7 +185,7 @@ 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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -49,6 +49,7 @@ public class PagedDatasetProfile {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue