no message
This commit is contained in:
parent
7159460f7a
commit
bfdcdff33a
|
@ -16,8 +16,6 @@ import java.util.UUID;
|
|||
public class DataRepository implements Serializable, DataEntity<DataRepository,UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@ import java.util.UUID;
|
|||
public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@ public class Registry implements DataEntity<Registry,UUID> {
|
|||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@ import java.util.UUID;
|
|||
public class Service implements DataEntity<Service, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.data.entities.DataRepository;
|
||||
import eu.eudat.logic.managers.DataRepositoryManager;
|
||||
import eu.eudat.logic.managers.ResearcherManager;
|
||||
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.datarepository.DataRepositoryModel;
|
||||
import eu.eudat.models.data.dmp.Researcher;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
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.*;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -33,5 +40,13 @@ public class DataRepositories extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Map<String, String>>>().status(ApiMessageCode.NO_MESSAGE).payload(remoteRepos));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/datarepos/create"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataRepository>> create(@RequestBody eu.eudat.models.data.datarepository.DataRepositoryModel dataRepositoryModel, Principal principal) throws Exception {
|
||||
DataRepository dataRepository = DataRepositoryManager.create(this.getApiContext(), dataRepositoryModel);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataRepository>().payload(dataRepository).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.data.entities.ExternalDataset;
|
||||
import eu.eudat.data.query.items.table.externaldataset.ExternalDatasetTableRequest;
|
||||
import eu.eudat.logic.managers.DataRepositoryManager;
|
||||
import eu.eudat.logic.managers.ExternalDatasetManager;
|
||||
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.datarepository.DataRepositoryModel;
|
||||
import eu.eudat.models.data.externaldataset.ExternalDatasetListingModel;
|
||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
|
@ -13,6 +16,7 @@ import eu.eudat.types.ApiMessageCode;
|
|||
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.*;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -51,4 +55,12 @@ public class ExternalDatasets extends BaseController {
|
|||
ExternalDatasetListingModel externalDatasetModel = new ExternalDatasetManager().getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getExternalDatasetDao(), id);
|
||||
return new ResponseItem<ExternalDatasetListingModel>().payload(externalDatasetModel).status(ApiMessageCode.NO_MESSAGE);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets/create"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<ExternalDataset>> create(@RequestBody eu.eudat.models.data.externaldataset.ExternalDatasetModel externalDatasetModel, Principal principal) throws Exception {
|
||||
ExternalDataset externalDataset = ExternalDatasetManager.create(this.getApiContext(), externalDatasetModel);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<ExternalDataset>().payload(externalDataset).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.data.entities.Registry;
|
||||
import eu.eudat.logic.managers.RegistryManager;
|
||||
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.registries.RegistryModel;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import org.apache.regexp.RE;
|
||||
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.*;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -32,5 +38,13 @@ public class Registries extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Map<String, String>>>().payload(remoteRepos).status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/registries/create"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Registry>> create(@RequestBody RegistryModel registryModel, Principal principal) throws Exception {
|
||||
Registry registry = RegistryManager.create(this.getApiContext(), registryModel);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Registry>().payload(registry).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.data.entities.Service;
|
||||
import eu.eudat.logic.managers.RegistryManager;
|
||||
import eu.eudat.logic.managers.ServiceManager;
|
||||
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.models.data.services.ServiceModel;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
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.*;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -33,5 +39,12 @@ public class Services extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Map<String, String>>>().payload(remoteRepos).status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/services/create"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Service>> create(@RequestBody ServiceModel serviceModel, Principal principal) throws Exception {
|
||||
Service service = ServiceManager.create(this.getApiContext(), serviceModel);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Service>().payload(service).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package eu.eudat.logic.managers;
|
||||
|
||||
import eu.eudat.data.entities.DataRepository;
|
||||
import eu.eudat.data.entities.Researcher;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.datarepository.DataRepositoryModel;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 9/3/2018.
|
||||
*/
|
||||
public class DataRepositoryManager {
|
||||
public static DataRepository create(ApiContext apiContext, eu.eudat.models.data.datarepository.DataRepositoryModel dataRepositoryModel) throws Exception {
|
||||
DataRepository dataRepository = dataRepositoryModel.toDataModel();
|
||||
return apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().createOrUpdate(dataRepository);
|
||||
}
|
||||
}
|
|
@ -254,6 +254,7 @@ public class DatasetManager {
|
|||
datasetDataRepository.setDataset(dataset);
|
||||
dataset.getDatasetDataRepositories().add(datasetDataRepository);
|
||||
} else {
|
||||
datasetDataRepository.getDataRepository().setId(UUID.randomUUID());
|
||||
DataRepository dataRepository = dataRepositoryDao.createOrUpdate(datasetDataRepository.getDataRepository());
|
||||
datasetDataRepository.setDataRepository(dataRepository);
|
||||
dataset.getDatasetDataRepositories().add(datasetDataRepository);
|
||||
|
|
|
@ -40,4 +40,9 @@ public class ExternalDatasetManager {
|
|||
externalDatasetModel.fromDataModel(externalDataset);
|
||||
return externalDatasetModel;
|
||||
}
|
||||
|
||||
public static ExternalDataset create(ApiContext apiContext, eu.eudat.models.data.externaldataset.ExternalDatasetModel externalDatasetModel) throws Exception {
|
||||
ExternalDataset externalDataset = externalDatasetModel.toDataModel();
|
||||
return apiContext.getOperationsContext().getDatabaseRepository().getExternalDatasetDao().createOrUpdate(externalDataset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package eu.eudat.logic.managers;
|
||||
|
||||
import eu.eudat.data.entities.DataRepository;
|
||||
import eu.eudat.data.entities.Registry;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.datarepository.DataRepositoryModel;
|
||||
import eu.eudat.models.data.registries.RegistryModel;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 9/3/2018.
|
||||
*/
|
||||
public class RegistryManager {
|
||||
public static Registry create(ApiContext apiContext, RegistryModel registryModel) throws Exception {
|
||||
Registry registry = registryModel.toDataModel();
|
||||
return apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao().createOrUpdate(registry);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package eu.eudat.logic.managers;
|
||||
|
||||
import eu.eudat.data.entities.Registry;
|
||||
import eu.eudat.data.entities.Service;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.registries.RegistryModel;
|
||||
import eu.eudat.models.data.services.ServiceModel;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 9/3/2018.
|
||||
*/
|
||||
public class ServiceManager {
|
||||
public static Service create(ApiContext apiContext, ServiceModel serviceModel) throws Exception {
|
||||
Service service = serviceModel.toDataModel();
|
||||
return apiContext.getOperationsContext().getDatabaseRepository().getServiceDao().createOrUpdate(service);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package eu.eudat.models.data.datarepository;
|
||||
|
||||
import eu.eudat.data.entities.DataRepository;
|
||||
import eu.eudat.models.DataModel;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 9/3/2018.
|
||||
*/
|
||||
public class DataRepositoryModel implements DataModel<DataRepository, DataRepositoryModel> {
|
||||
public UUID id;
|
||||
public String label;
|
||||
public String abbreviation;
|
||||
public String uri;
|
||||
public Date created;
|
||||
public Date modified;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataRepositoryModel fromDataModel(DataRepository entity) {
|
||||
this.setAbbreviation(entity.getAbbreviation());
|
||||
this.setLabel(entity.getLabel());
|
||||
this.setUri(entity.getUri());
|
||||
this.setId(entity.getId());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataRepository toDataModel() throws Exception {
|
||||
DataRepository dataRepository = new DataRepository();
|
||||
dataRepository.setId(this.id != null ? this.id : UUID.randomUUID());
|
||||
dataRepository.setAbbreviation(this.abbreviation);
|
||||
dataRepository.setCreated(this.created != null ? this.created : new Date());
|
||||
dataRepository.setModified(new Date());
|
||||
dataRepository.setLabel(this.label);
|
||||
dataRepository.setReference("dmpdata/" + dataRepository.getId());
|
||||
dataRepository.setUri(this.uri);
|
||||
dataRepository.setStatus((short) 0);
|
||||
return dataRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -7,9 +7,10 @@ import java.util.Date;
|
|||
|
||||
public class DataRepository implements DataModel<eu.eudat.data.entities.DataRepository, DataRepository>, LabelGenerator {
|
||||
private String pid;
|
||||
private String name;
|
||||
private String label;
|
||||
private String uri;
|
||||
private String info;
|
||||
private String reference;
|
||||
|
||||
public String getPid() {
|
||||
return pid;
|
||||
|
@ -19,12 +20,12 @@ public class DataRepository implements DataModel<eu.eudat.data.entities.DataRepo
|
|||
this.pid = pid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
|
@ -43,27 +44,37 @@ public class DataRepository implements DataModel<eu.eudat.data.entities.DataRepo
|
|||
this.info = info;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public DataRepository fromDataModel(eu.eudat.data.entities.DataRepository entity) {
|
||||
this.pid = entity.getReference();
|
||||
this.name = entity.getLabel();
|
||||
this.label = entity.getLabel();
|
||||
this.uri = entity.getUri();
|
||||
this.reference = entity.getReference();
|
||||
return this;
|
||||
}
|
||||
|
||||
public eu.eudat.data.entities.DataRepository toDataModel() {
|
||||
eu.eudat.data.entities.DataRepository entity = new eu.eudat.data.entities.DataRepository();
|
||||
entity.setReference(this.pid);
|
||||
entity.setLabel(this.name);
|
||||
entity.setLabel(this.label);
|
||||
entity.setUri(this.uri);
|
||||
entity.setCreated(new Date());
|
||||
entity.setModified(new Date());
|
||||
entity.setStatus((short) 0);
|
||||
entity.setReference(this.reference);
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateLabel() {
|
||||
return this.getName();
|
||||
return this.getLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
package eu.eudat.models.data.externaldataset;
|
||||
|
||||
import eu.eudat.data.entities.ExternalDataset;
|
||||
import eu.eudat.models.DataModel;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 9/3/2018.
|
||||
*/
|
||||
public class ExternalDatasetModel implements DataModel<ExternalDataset, ExternalDatasetModel> {
|
||||
public UUID id;
|
||||
public String label;
|
||||
public String abbreviation;
|
||||
public Date created;
|
||||
public Date modified;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExternalDatasetModel fromDataModel(ExternalDataset entity) {
|
||||
this.id = entity.getId();
|
||||
this.label = entity.getLabel();
|
||||
this.abbreviation = entity.getAbbreviation();
|
||||
this.created = entity.getCreated();
|
||||
this.modified = new Date();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExternalDataset toDataModel() throws Exception {
|
||||
ExternalDataset externalDataset = new ExternalDataset();
|
||||
externalDataset.setAbbreviation(this.abbreviation);
|
||||
externalDataset.setCreated(this.created != null ? this.created : new Date());
|
||||
externalDataset.setModified(new Date());
|
||||
externalDataset.setId(this.id != null ? this.id : UUID.randomUUID());
|
||||
externalDataset.setLabel(this.label);
|
||||
externalDataset.setReference("dmpdata/" + externalDataset.getId());
|
||||
return externalDataset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package eu.eudat.models.data.registries;
|
||||
|
||||
import eu.eudat.data.entities.Registry;
|
||||
import eu.eudat.models.DataModel;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 9/3/2018.
|
||||
*/
|
||||
public class RegistryModel implements DataModel<Registry, RegistryModel> {
|
||||
public UUID id;
|
||||
public String label;
|
||||
public String abbreviation;
|
||||
public String uri;
|
||||
public Date created;
|
||||
public Date modified;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegistryModel fromDataModel(Registry entity) {
|
||||
this.id = entity.getId();
|
||||
this.abbreviation = entity.getAbbreviation();
|
||||
this.created = entity.getCreated();
|
||||
this.label = entity.getLabel();
|
||||
this.modified = entity.getModified();
|
||||
this.uri = entity.getUri();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Registry toDataModel() throws Exception {
|
||||
Registry registry = new Registry();
|
||||
registry.setAbbreviation(this.abbreviation);
|
||||
registry.setCreated(this.created != null ? this.created : new Date());
|
||||
registry.setId(this.id != null ? this.id : UUID.randomUUID());
|
||||
registry.setLabel(this.label);
|
||||
registry.setUri(this.uri);
|
||||
registry.setModified(new Date());
|
||||
registry.setReference("dmpdata/" + registry.getId());
|
||||
registry.setStatus((short)0);
|
||||
return registry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package eu.eudat.models.data.services;
|
||||
|
||||
import eu.eudat.data.entities.Service;
|
||||
import eu.eudat.models.DataModel;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 9/3/2018.
|
||||
*/
|
||||
public class ServiceModel implements DataModel<Service, ServiceModel> {
|
||||
public UUID id;
|
||||
public String label;
|
||||
public String abbreviation;
|
||||
public String uri;
|
||||
public Date created;
|
||||
public Date modified;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServiceModel fromDataModel(Service entity) {
|
||||
this.abbreviation = entity.getAbbreviation();
|
||||
this.created = entity.getCreated();
|
||||
this.id = entity.getId();
|
||||
this.label = entity.getLabel();
|
||||
this.modified = entity.getModified();
|
||||
this.uri = entity.getUri();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Service toDataModel() throws Exception {
|
||||
Service service = new Service();
|
||||
service.setId(this.id != null ? this.id : UUID.randomUUID());
|
||||
service.setAbbreviation(this.abbreviation);
|
||||
service.setCreated(this.created != null ? this.created : new Date());
|
||||
service.setLabel(this.label);
|
||||
service.setModified(new Date());
|
||||
service.setUri(this.uri);
|
||||
service.setReference("innerdata/" + service.getId());
|
||||
service.setModified(new Date());
|
||||
service.setStatus((short)0);
|
||||
return service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,12 @@
|
|||
package eu.eudat.models.validators;
|
||||
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
|
||||
import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||
import eu.eudat.models.data.dmp.DataManagementPlanNewVersionModel;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.validators.fluentvalidator.FluentValidator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.Validator;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -17,13 +16,29 @@ import java.util.UUID;
|
|||
* Created by ikalyvas on 3/7/2018.
|
||||
*/
|
||||
@Component("dataManagementPlanNewVersionValidator")
|
||||
public class DataManagementPlanNewVersionValidator implements Validator {
|
||||
public class DataManagementPlanNewVersionValidator extends FluentValidator<DataManagementPlanNewVersionModel> {
|
||||
|
||||
private ApiContext apiContext;
|
||||
private DatabaseRepository databaseRepository;
|
||||
|
||||
@Autowired
|
||||
public DataManagementPlanNewVersionValidator(ApiContext apiContext) {
|
||||
this.apiContext = apiContext;
|
||||
public DataManagementPlanNewVersionValidator(DatabaseRepository databaseRepository) {
|
||||
this.databaseRepository = databaseRepository;
|
||||
|
||||
ruleFor(x -> {
|
||||
DataManagementPlanCriteria criteria = new DataManagementPlanCriteria();
|
||||
List<UUID> groupIds = Arrays.asList(x.getGroupId());
|
||||
criteria.setGroupIds(groupIds);
|
||||
return this.databaseRepository.getDmpDao().getWithCriteria(criteria).getSingleOrDefault().getVersion();
|
||||
}).compareAs(x -> x.getVersion(), ((leftItem, rightItem) -> leftItem > rightItem))
|
||||
.withName("version").withMessage("datamanagementplannewversion.version.notacceptable");
|
||||
|
||||
ruleFor(x -> {
|
||||
DataManagementPlanCriteria criteria = new DataManagementPlanCriteria();
|
||||
List<UUID> groupIds = Arrays.asList(x.getGroupId());
|
||||
criteria.setGroupIds(groupIds);
|
||||
return this.databaseRepository.getDmpDao().getWithCriteria(criteria).getSingleOrDefault().getVersion() + 1;
|
||||
}).compareAs(x -> x.getVersion(), ((leftItem, rightItem) -> !leftItem.equals(rightItem)))
|
||||
.withName("version").withMessage("datamanagementplannewversion.version.notnext");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,20 +46,6 @@ public class DataManagementPlanNewVersionValidator implements Validator {
|
|||
return DataManagementPlanNewVersionModel.class.equals(aClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(Object obj, Errors errors) {
|
||||
DataManagementPlanNewVersionModel dataManagementPlanNewVersionModel = (DataManagementPlanNewVersionModel) obj;
|
||||
DataManagementPlanCriteria criteria = new DataManagementPlanCriteria();
|
||||
List<UUID> groupIds = Arrays.asList(dataManagementPlanNewVersionModel.getGroupId());
|
||||
criteria.setGroupIds(groupIds);
|
||||
DMP latestDmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria).getSingleOrDefault();
|
||||
if (latestDmp.getVersion() >= dataManagementPlanNewVersionModel.getVersion()) {
|
||||
errors.rejectValue("version", "datamanagementplannewversion.version.notacceptable");
|
||||
}
|
||||
else if (latestDmp.getVersion() + 1 != dataManagementPlanNewVersionModel.getVersion()) {
|
||||
errors.rejectValue("version", "datamanagementplannewversion.version.notnext");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean supportsType(Class<?> aClass) {
|
||||
return DataManagementPlanNewVersionModel.class.equals(aClass);
|
||||
|
|
|
@ -4091,7 +4091,8 @@
|
|||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
|
@ -4112,12 +4113,14 @@
|
|||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
@ -4132,17 +4135,20 @@
|
|||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
@ -4259,7 +4265,8 @@
|
|||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
|
@ -4271,6 +4278,7 @@
|
|||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
|
@ -4285,6 +4293,7 @@
|
|||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
|
@ -4292,12 +4301,14 @@
|
|||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.2.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.1",
|
||||
"yallist": "^3.0.0"
|
||||
|
@ -4316,6 +4327,7 @@
|
|||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
|
@ -4396,7 +4408,8 @@
|
|||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
|
@ -4408,6 +4421,7 @@
|
|||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
@ -4493,7 +4507,8 @@
|
|||
"safe-buffer": {
|
||||
"version": "5.1.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
|
@ -4529,6 +4544,7 @@
|
|||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
|
@ -4548,6 +4564,7 @@
|
|||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
|
@ -4591,12 +4608,14 @@
|
|||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -10085,17 +10104,17 @@
|
|||
}
|
||||
},
|
||||
"rxjs": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.1.tgz",
|
||||
"integrity": "sha512-OwMxHxmnmHTUpgO+V7dZChf3Tixf4ih95cmXjzzadULziVl/FKhHScGLj4goEw9weePVOH2Q0+GcCBUhKCZc/g==",
|
||||
"version": "6.2.2",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.2.tgz",
|
||||
"integrity": "sha512-0MI8+mkKAXZUF9vMrEoPnaoHkfzBPP4IGwUYRJhIRJF6/w3uByO1e91bEHn8zd43RdkTMKiooYKmwz7RH6zfOQ==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"rxjs-compat": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.2.1.tgz",
|
||||
"integrity": "sha512-Pst0lkAwVodBbBOIZic9aM1vY9asJ2u8GfKN115+goIH83PAlizJDyvixuxPAuQ1UtkmBuro7+0PqKQ3PSkhEg=="
|
||||
"version": "6.2.2",
|
||||
"resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.2.2.tgz",
|
||||
"integrity": "sha512-h113JzEXnqBd6JQ8TYg33oDuM3baZ9WKS49rtbMX0gBW2Kz0z4wDZ0/pCA0T9sRJM1HkZT6mt45gpYOJ2MqWYQ=="
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
|
|
|
@ -12,52 +12,52 @@
|
|||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "6.0.7",
|
||||
"@angular/cdk": "6.1.0",
|
||||
"@angular/common": "6.0.7",
|
||||
"@angular/compiler": "6.0.7",
|
||||
"@angular/core": "6.0.7",
|
||||
"@angular/flex-layout": "6.0.0-beta.16",
|
||||
"@angular/forms": "6.0.7",
|
||||
"@angular/http": "6.0.7",
|
||||
"@angular/material": "6.4.6",
|
||||
"@angular/material-moment-adapter": "6.4.6",
|
||||
"@angular/platform-browser": "6.0.7",
|
||||
"@angular/platform-browser-dynamic": "6.0.7",
|
||||
"@angular/router": "6.0.7",
|
||||
"@covalent/core": "2.0.0-beta.2",
|
||||
"@ngx-translate/core": "10.0.1",
|
||||
"@ngx-translate/http-loader": "3.0.1",
|
||||
"@swimlane/ngx-datatable": "13.0.1",
|
||||
"@types/file-saver": "1.3.0",
|
||||
"@angular/animations": "^6.0.7",
|
||||
"@angular/cdk": "^6.1.0",
|
||||
"@angular/common": "^6.0.7",
|
||||
"@angular/compiler": "^6.0.7",
|
||||
"@angular/core": "^6.0.7",
|
||||
"@angular/flex-layout": "^6.0.0-beta.16",
|
||||
"@angular/forms": "^6.0.7",
|
||||
"@angular/http": "^6.0.7",
|
||||
"@angular/material": "^6.4.6",
|
||||
"@angular/material-moment-adapter": "^6.4.6",
|
||||
"@angular/platform-browser": "^6.0.7",
|
||||
"@angular/platform-browser-dynamic": "^6.0.7",
|
||||
"@angular/router": "^6.0.7",
|
||||
"@covalent/core": "^2.0.0-beta.2",
|
||||
"@ngx-translate/core": "^10.0.1",
|
||||
"@ngx-translate/http-loader": "^3.0.1",
|
||||
"@swimlane/ngx-datatable": "^13.0.1",
|
||||
"@types/file-saver": "^1.3.0",
|
||||
"bootstrap": "^4.1.2",
|
||||
"core-js": "^2.4.1",
|
||||
"file-saver": "1.3.3",
|
||||
"moment": "^2.22.2",
|
||||
"moment-timezone": "^0.5.21",
|
||||
"rxjs": "^6.2.1",
|
||||
"rxjs-compat": "^6.1.0",
|
||||
"rxjs": "6.2.2",
|
||||
"rxjs-compat": "6.2.2",
|
||||
"zone.js": "^0.8.26"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/cli": "^6.0.8",
|
||||
"@angular/compiler-cli": "6.0.7",
|
||||
"@angular/language-service": "6.0.7",
|
||||
"@types/jasmine": "~2.8.3",
|
||||
"@types/jasminewd2": "~2.0.2",
|
||||
"@types/node": "~6.0.60",
|
||||
"@angular/compiler-cli": "^6.0.7",
|
||||
"@angular/language-service": "^6.0.7",
|
||||
"@types/jasmine": "^2.8.3",
|
||||
"@types/jasminewd2": "^2.0.2",
|
||||
"@types/node": "^6.0.60",
|
||||
"codelyzer": "^4.0.1",
|
||||
"jasmine-core": "~2.8.0",
|
||||
"jasmine-spec-reporter": "~4.2.1",
|
||||
"karma": "~2.0.0",
|
||||
"karma-chrome-launcher": "~2.2.0",
|
||||
"jasmine-core": "^2.8.0",
|
||||
"jasmine-spec-reporter": "^4.2.1",
|
||||
"karma": "^2.0.0",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-coverage-istanbul-reporter": "^1.2.1",
|
||||
"karma-jasmine": "~1.1.0",
|
||||
"karma-jasmine": "^1.1.0",
|
||||
"karma-jasmine-html-reporter": "^0.2.2",
|
||||
"protractor": "5.4.0",
|
||||
"ts-node": "~4.1.0",
|
||||
"tslint": "~5.9.1",
|
||||
"typescript": "2.7.2",
|
||||
"@angular-devkit/build-angular": "~0.6.8"
|
||||
"protractor": "^5.4.0",
|
||||
"ts-node": "^4.1.0",
|
||||
"tslint": "^5.9.1",
|
||||
"typescript": "^2.7.2",
|
||||
"@angular-devkit/build-angular": "^0.6.8"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ export class AppComponent implements OnInit {
|
|||
// this language will be used as a fallback when a translation isn't found in the current language
|
||||
this.translate.setDefaultLang('en');
|
||||
|
||||
this.authentication.current() ? this.cultureService.cultureSelected(this.authentication.current().culture) : this.cultureService.cultureSelected(environment.defaultCulture);
|
||||
this.authentication.current() && this.authentication.current().culture ? this.cultureService.cultureSelected(this.authentication.current().culture) : this.cultureService.cultureSelected(environment.defaultCulture);
|
||||
|
||||
//this.setupChangeListeners();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<form *ngIf="formGroup" [formGroup]="formGroup">
|
||||
<h1 mat-dialog-title>{{'DATASET-REFERENCED-MODELS.DATA-REPOSITORY.TITLE' | translate}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="label" placeholder="{{'DATASET-REFERENCED-MODELS.DATA-REPOSITORY.LABEL' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="abbreviation" placeholder="{{'DATASET-REFERENCED-MODELS.DATA-REPOSITORY.ABBREVIATION' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('abbreviation').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="uri" placeholder="{{'DATASET-REFERENCED-MODELS.DATA-REPOSITORY.URI' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('uri').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<div layout="row" class="full-width text-right" align="end">
|
||||
<button mat-raised-button color="primary" (click)="send()" type="button">Save</button>
|
||||
<button mat-button mat-dialog-close mat-raised-button color="primary">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,36 @@
|
|||
import { Component, ViewEncapsulation, OnInit, Inject } from "@angular/core";
|
||||
import { FormGroup } from "@angular/forms";
|
||||
import { DataRepositoryService } from "../../../services/datarepository/datarepository.service";
|
||||
import { Router, ActivatedRoute } from "@angular/router";
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
|
||||
import { DataRepositoryModel } from "../../../models/dataRepositories/DataRepositoryModel";
|
||||
|
||||
@Component({
|
||||
selector: 'app-datarepository-referenced-model-helper',
|
||||
templateUrl: 'datarepository-referenced-model-helper.component.html',
|
||||
styleUrls: ['./datarepository-referenced-model-helper.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class DataRepositoryReferencedModelHelperComponent implements OnInit {
|
||||
public formGroup: FormGroup;
|
||||
|
||||
constructor(
|
||||
private dataRepositoryService: DataRepositoryService,
|
||||
private route: ActivatedRoute,
|
||||
public router: Router,
|
||||
public dialogRef: MatDialogRef<DataRepositoryReferencedModelHelperComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
let datarepo = new DataRepositoryModel();
|
||||
this.formGroup = datarepo.buildForm();
|
||||
}
|
||||
|
||||
|
||||
send(value: any) {
|
||||
this.dataRepositoryService.create(this.formGroup.value).subscribe(
|
||||
(item)=> this.dialogRef.close(item)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<form *ngIf="formGroup" [formGroup]="formGroup">
|
||||
<h1 mat-dialog-title>{{'DATASET-REFERENCED-MODELS.EXTERNAL-DATASET.TITLE' | translate}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="label" placeholder="{{'DATASET-REFERENCED-MODELS.EXTERNAL-DATASET.LABEL' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="abbreviation" placeholder="{{'DATASET-REFERENCED-MODELS.EXTERNAL-DATASET.ABBREVIATION' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('abbreviation').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<div layout="row" class="full-width text-right" align="end">
|
||||
<button mat-raised-button color="primary" (click)="send()" type="button">Save</button>
|
||||
<button mat-button mat-dialog-close mat-raised-button color="primary">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,36 @@
|
|||
import { ExternalDatasetModel } from "../../../models/external-dataset/ExternalDatasetModel";
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
|
||||
import { Inject, ViewEncapsulation, Component, OnInit } from "@angular/core";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { ExternalDatasetService } from "../../../services/external-dataset/external-dataset.service";
|
||||
import { FormGroup } from "@angular/forms";
|
||||
|
||||
@Component({
|
||||
selector: 'app-externaldataset-referenced-model-helper',
|
||||
templateUrl: 'externaldataset-referenced-model-helper.component.html',
|
||||
styleUrls: ['./externaldataset-referenced-model-helper.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class ExternalDatasetReferencedModelHelperComponent implements OnInit {
|
||||
public formGroup: FormGroup;
|
||||
|
||||
constructor(
|
||||
private externalDatasetService: ExternalDatasetService,
|
||||
private route: ActivatedRoute,
|
||||
public router: Router,
|
||||
public dialogRef: MatDialogRef<ExternalDatasetReferencedModelHelperComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
let externalDatasetModel = new ExternalDatasetModel();
|
||||
this.formGroup = externalDatasetModel.buildForm();
|
||||
}
|
||||
|
||||
|
||||
send(value: any) {
|
||||
this.externalDatasetService.create(this.formGroup.value).subscribe(
|
||||
(item)=> this.dialogRef.close(item)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<form *ngIf="formGroup" [formGroup]="formGroup">
|
||||
<h1 mat-dialog-title>{{'DATASET-REFERENCED-MODELS.REGISTRY.TITLE' | translate}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="label" placeholder="{{'DATASET-REFERENCED-MODELS.REGISTRY.LABEL' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="abbreviation" placeholder="{{'DATASET-REFERENCED-MODELS.REGISTRY.ABBREVIATION' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('abbreviation').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="uri" placeholder="{{'DATASET-REFERENCED-MODELS.REGISTRY.URI' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('uri').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<div layout="row" class="full-width text-right" align="end">
|
||||
<button mat-raised-button color="primary" (click)="send()" type="button">Save</button>
|
||||
<button mat-button mat-dialog-close mat-raised-button color="primary">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,36 @@
|
|||
import { Component, ViewEncapsulation, OnInit, Inject } from "@angular/core";
|
||||
import { FormGroup } from "@angular/forms";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
|
||||
import { RegisterModel } from "../../../models/registers/RegisterModel";
|
||||
import { RegistryService } from "../../../services/registries/registry.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-registry-referenced-model-helper',
|
||||
templateUrl: 'registry-referenced-model-helper.component.html',
|
||||
styleUrls: ['./registry-referenced-model-helper.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class RegistryReferencedModelHelperComponent implements OnInit {
|
||||
public formGroup: FormGroup;
|
||||
|
||||
constructor(
|
||||
private registryService: RegistryService,
|
||||
private route: ActivatedRoute,
|
||||
public router: Router,
|
||||
public dialogRef: MatDialogRef<RegistryReferencedModelHelperComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
let registryModel = new RegisterModel();
|
||||
this.formGroup = registryModel.buildForm();
|
||||
}
|
||||
|
||||
|
||||
send(value: any) {
|
||||
this.registryService.create(this.formGroup.value).subscribe(
|
||||
(item)=> this.dialogRef.close(item)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<form *ngIf="formGroup" [formGroup]="formGroup">
|
||||
<h1 mat-dialog-title>{{'DATASET-REFERENCED-MODELS.SERVICES.TITLE' | translate}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="label" placeholder="{{'DATASET-REFERENCED-MODELS.SERVICES.LABEL' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="abbreviation" placeholder="{{'DATASET-REFERENCED-MODELS.SERVICES.ABBREVIATION' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('abbreviation').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="uri" placeholder="{{'DATASET-REFERENCED-MODELS.SERVICES.URI' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('uri').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<div layout="row" class="full-width text-right" align="end">
|
||||
<button mat-raised-button color="primary" (click)="send()" type="button">Save</button>
|
||||
<button mat-button mat-dialog-close mat-raised-button color="primary">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,36 @@
|
|||
import { ViewEncapsulation, Component, OnInit, Inject } from "@angular/core";
|
||||
import { FormGroup } from "@angular/forms";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
|
||||
import { ServiceModel } from "../../../models/services/ServiceModel";
|
||||
import { ServicesDataService } from "../../../services/services/services-data.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-services-referenced-model-helper',
|
||||
templateUrl: 'services-referenced-model-helper.component.html',
|
||||
styleUrls: ['./services-referenced-model-helper.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class ServicesReferencedModelHelperComponent implements OnInit {
|
||||
public formGroup: FormGroup;
|
||||
|
||||
constructor(
|
||||
private registryService: ServicesDataService,
|
||||
private route: ActivatedRoute,
|
||||
public router: Router,
|
||||
public dialogRef: MatDialogRef<ServicesReferencedModelHelperComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
let serviceModel = new ServiceModel();
|
||||
this.formGroup = serviceModel.buildForm();
|
||||
}
|
||||
|
||||
|
||||
send() {
|
||||
this.registryService.create(this.formGroup.value).subscribe(
|
||||
(item)=> this.dialogRef.close(item)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -37,7 +37,8 @@
|
|||
<app-dataset-editor-component [formGroup]="formGroup"></app-dataset-editor-component>
|
||||
<div class="navigation-buttons-container">
|
||||
<button matStepperNext mat-raised-button style="float:right;" color="primary">{{'DATASET-WIZARD.ACTIONS.NEXT' |
|
||||
translate}}</button>
|
||||
translate}}
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
@ -50,6 +51,9 @@
|
|||
<mat-card-header>
|
||||
<mat-card-title class="thick">
|
||||
{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES' | translate}}
|
||||
<button mat-raised-button color="primary" (click)="addDataRepository()">
|
||||
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
|
||||
</button>
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<app-external-item-listing *ngIf="formGroup.get('dataRepositories') && dataRepositoriesTemplate && externalSourcesConfiguration"
|
||||
|
@ -57,19 +61,17 @@
|
|||
[parentTemplate]='dataRepositoriesTemplate' [displayFunction]='dataRepositoryDisplayFunc' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc'
|
||||
[formGroup]="formGroup.get('dataRepositories')" [viewOnly]='viewOnly' [autoCompleteConfiguration]="dataRepositoriesAutoCompleteConfiguration"
|
||||
(onItemChange)="dataRepositoriesOnItemChange($event)">
|
||||
|
||||
</app-external-item-listing>
|
||||
|
||||
<ng-template #dataRepositoriesTemplate let-suggestion let-i="index" let-callback="function">
|
||||
<div>
|
||||
<p>
|
||||
{{i+1}}) {{suggestion.get('name').value}}
|
||||
{{i+1}}) {{suggestion.get('label').value}}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES-INFO' | translate}}" type="text" name="info" [formControl]="suggestion.get('info')">
|
||||
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div>
|
||||
|
@ -83,6 +85,9 @@
|
|||
<mat-card-header>
|
||||
<mat-card-title class="thick">
|
||||
{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASETS' | translate}}
|
||||
<button mat-raised-button color="primary" (click)="addExternalDataset()">
|
||||
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
|
||||
</button>
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<app-external-item-listing *ngIf="formGroup.get('externalDatasets') && externalDatasetsTemplate && externalSourcesConfiguration"
|
||||
|
@ -90,7 +95,6 @@
|
|||
[parentTemplate]='externalDatasetsTemplate' [displayFunction]='externalDatasetDisplayFunc' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc'
|
||||
[formGroup]="formGroup.get('externalDatasets')" [viewOnly]='viewOnly' [autoCompleteConfiguration]="externalDatasetAutoCompleteConfiguration"
|
||||
(onItemChange)="externalDatasetsOnItemChange($event)">
|
||||
|
||||
</app-external-item-listing>
|
||||
|
||||
<ng-template #externalDatasetsTemplate let-suggestion let-i="index" let-callback="function">
|
||||
|
@ -102,7 +106,6 @@
|
|||
<div>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASET-INFO' | translate}}" type="text" name="info" [formControl]="suggestion.get('info')">
|
||||
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
|
@ -126,12 +129,15 @@
|
|||
<mat-card-header>
|
||||
<mat-card-title class="thick">
|
||||
{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}
|
||||
<button mat-raised-button color="primary" (click)="addRegistry()">
|
||||
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
|
||||
</button>
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<app-external-item-listing *ngIf="formGroup.get('registries') && registriesTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.registries"
|
||||
placeholder="{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}" [parentTemplate]='registriesTemplate' [displayFunction]='registriesDisplayFunc'
|
||||
[formGroup]="formGroup.get('registries')" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="registriesAutoCompleteConfiguration"
|
||||
(onItemChange)="registriesOnItemChange($event)">
|
||||
[formGroup]="formGroup.get('registries')" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc'
|
||||
[autoCompleteConfiguration]="registriesAutoCompleteConfiguration" (onItemChange)="registriesOnItemChange($event)">
|
||||
|
||||
</app-external-item-listing>
|
||||
|
||||
|
@ -153,12 +159,15 @@
|
|||
<mat-card-header>
|
||||
<mat-card-title class="thick">
|
||||
{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}
|
||||
<button mat-raised-button color="primary" (click)="addService()">
|
||||
{{'DATASET-EDITOR.FIELDS.CREATE'|translate}}
|
||||
</button>
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<app-external-item-listing *ngIf="formGroup.get('services') && servicesTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.services"
|
||||
placeholder="{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}" [parentTemplate]='servicesTemplate' [displayFunction]='servicesDisplayFunc'
|
||||
[formGroup]="formGroup.get('services')" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="servicesAutoCompleteConfiguration"
|
||||
(onItemChange)="servicesOnItemChange($event)">
|
||||
[formGroup]="formGroup.get('services')" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc'
|
||||
[autoCompleteConfiguration]="servicesAutoCompleteConfiguration" (onItemChange)="servicesOnItemChange($event)">
|
||||
|
||||
</app-external-item-listing>
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import { ActivatedRoute, Router, Params } from '@angular/router';
|
|||
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation, TemplateRef } from "@angular/core";
|
||||
import { FormGroup, Validators, FormBuilder, FormArray } from "@angular/forms";
|
||||
import * as FileSaver from 'file-saver';
|
||||
import { MatPaginator, MatSort, MatSnackBar, MatStepper } from "@angular/material";
|
||||
import { MatPaginator, MatSort, MatSnackBar, MatStepper, MatDialog } from "@angular/material";
|
||||
import { ExternalDatasetCriteria } from '../../models/criteria/external-dataset/ExternalDatasetCriteria';
|
||||
import { ExternalDatasetModel } from '../../models/external-dataset/ExternalDatasetModel';
|
||||
import { RegistryCriteria } from '../../models/criteria/registry/RegistryCriteria';
|
||||
|
@ -37,6 +37,10 @@ import { TagModel } from '../../models/tags/TagModel';
|
|||
import { AutoCompleteConfiguration } from '../../shared/components/auto-complete/AutoCompleteConfiguration';
|
||||
import { SingleAutoCompleteConfiguration } from '../../shared/components/autocompletes/single/single-auto-complete-configuration';
|
||||
import { DataManagementPlanListingModel } from '../../models/data-managemnt-plans/DataManagementPlanListingModel';
|
||||
import { DataRepositoryReferencedModelHelperComponent } from '../dataset-referenced-models-helper/datarepository/datarepository-referenced-model-helper.component';
|
||||
import { RegistryReferencedModelHelperComponent } from '../dataset-referenced-models-helper/registry/registry-referenced-model-helper.component';
|
||||
import { ExternalDatasetReferencedModelHelperComponent } from '../dataset-referenced-models-helper/externalDataset/externaldataset-referenced-model-helper.component';
|
||||
import { ServicesReferencedModelHelperComponent } from '../dataset-referenced-models-helper/services/services-referenced-model-helper.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dataset-wizard-component',
|
||||
|
@ -90,6 +94,7 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
|||
public language: TranslateService,
|
||||
public externalSourcesService: ExternalSourcesService,
|
||||
public dataManagementPlanService: DataManagementPlanService,
|
||||
public dialog: MatDialog,
|
||||
public externalSourcesConfigurationService: ExternalSourcesConfigurationService
|
||||
) {
|
||||
|
||||
|
@ -381,7 +386,67 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
|||
|
||||
|
||||
dataRepositoriesOnItemChange(event) {
|
||||
let dataRepositoryModel = new DataRepositoryModel(event.id, event.name, event.pid, event.uri);
|
||||
let dataRepositoryModel = new DataRepositoryModel(event.id, event.name, event.abbreviation, event.uri, event.pid);
|
||||
(<FormArray>this.formGroup.get("dataRepositories")).push(dataRepositoryModel.buildForm());
|
||||
}
|
||||
|
||||
addDataRepository() {
|
||||
let dialogRef = this.dialog.open(DataRepositoryReferencedModelHelperComponent, {
|
||||
height: '255px',
|
||||
width: '700px',
|
||||
data: {
|
||||
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (!result) return
|
||||
let dataRepositoryModel = new DataRepositoryModel(result.id, result.label, result.pid, result.uri, result.reference);
|
||||
(<FormArray>this.formGroup.get("dataRepositories")).push(dataRepositoryModel.buildForm());
|
||||
});
|
||||
}
|
||||
|
||||
addRegistry() {
|
||||
let dialogRef = this.dialog.open(RegistryReferencedModelHelperComponent, {
|
||||
height: '255px',
|
||||
width: '700px',
|
||||
data: {
|
||||
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (!result) return
|
||||
let registryModel = new RegisterModel(result.abbreviation, result.definition, result.id, result.label, result.reference, result.uri);
|
||||
(<FormArray>this.formGroup.get("registries")).push(registryModel.buildForm());
|
||||
});
|
||||
}
|
||||
|
||||
addExternalDataset() {
|
||||
let dialogRef = this.dialog.open(ExternalDatasetReferencedModelHelperComponent, {
|
||||
height: '255px',
|
||||
width: '700px',
|
||||
data: {
|
||||
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (!result) return
|
||||
let externalDatasetModel = new ExternalDatasetModel(result.id, result.abbreviation, result.label, result.reference);
|
||||
(<FormArray>this.formGroup.get("externalDatasets")).push(externalDatasetModel.buildForm());
|
||||
});
|
||||
}
|
||||
|
||||
addService() {
|
||||
let dialogRef = this.dialog.open(ServicesReferencedModelHelperComponent, {
|
||||
height: '255px',
|
||||
width: '700px',
|
||||
data: {
|
||||
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (!result) return
|
||||
let serviceModel = new ServiceModel(result.id, result.abbreviation, result.definition, result.uri, result.label, result.reference);
|
||||
(<FormArray>this.formGroup.get("services")).push(serviceModel.buildForm());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,14 @@ import { DatasetWizardService } from '../services/dataset-wizard/dataset-wizard.
|
|||
import { ExternalSourcesService } from '../services/external-sources/external-sources.service';
|
||||
import { ExternalSourcesConfigurationService } from '../services/external-sources/external-sources-configuration.service';
|
||||
import { DatasetPublicListingComponent } from './dataset-public/dataset-public-listing.component';
|
||||
import { DataRepositoryReferencedModelHelperComponent } from './dataset-referenced-models-helper/datarepository/datarepository-referenced-model-helper.component';
|
||||
import { ExternalDatasetReferencedModelHelperComponent } from './dataset-referenced-models-helper/externalDataset/externaldataset-referenced-model-helper.component';
|
||||
import { ServicesReferencedModelHelperComponent } from './dataset-referenced-models-helper/services/services-referenced-model-helper.component';
|
||||
import { RegistryReferencedModelHelperComponent } from './dataset-referenced-models-helper/registry/registry-referenced-model-helper.component';
|
||||
import { RegistryService } from '../services/registries/registry.service';
|
||||
import { ServicesDataService } from '../services/services/services-data.service';
|
||||
import { DataRepositoryService } from '../services/datarepository/datarepository.service';
|
||||
import { ExternalDatasetService } from '../services/external-dataset/external-dataset.service';
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
|
@ -45,13 +53,21 @@ import { DatasetPublicListingComponent } from './dataset-public/dataset-public-l
|
|||
DatasetListingComponent,
|
||||
DatasetEditorComponent,
|
||||
DatasetWizardComponent,
|
||||
DatasetPublicListingComponent
|
||||
DatasetPublicListingComponent,
|
||||
DataRepositoryReferencedModelHelperComponent,
|
||||
ExternalDatasetReferencedModelHelperComponent,
|
||||
ServicesReferencedModelHelperComponent,
|
||||
RegistryReferencedModelHelperComponent,
|
||||
],
|
||||
|
||||
exports: [
|
||||
DatasetListingComponent,
|
||||
DatasetEditorComponent,
|
||||
DatasetWizardComponent,
|
||||
DataRepositoryReferencedModelHelperComponent,
|
||||
ExternalDatasetReferencedModelHelperComponent,
|
||||
ServicesReferencedModelHelperComponent,
|
||||
RegistryReferencedModelHelperComponent,
|
||||
DatasetPublicListingComponent,
|
||||
RouterModule
|
||||
],
|
||||
|
@ -60,7 +76,17 @@ import { DatasetPublicListingComponent } from './dataset-public/dataset-public-l
|
|||
ExternalSourcesService,
|
||||
ExternalSourcesConfigurationService,
|
||||
DataManagementPlanService,
|
||||
DatasetService
|
||||
DatasetService,
|
||||
DataRepositoryService,
|
||||
ExternalDatasetService,
|
||||
ServicesDataService,
|
||||
RegistryService
|
||||
],
|
||||
entryComponents:[
|
||||
DataRepositoryReferencedModelHelperComponent,
|
||||
ExternalDatasetReferencedModelHelperComponent,
|
||||
ServicesReferencedModelHelperComponent,
|
||||
RegistryReferencedModelHelperComponent
|
||||
]
|
||||
})
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import { VisibilityRulesService } from '../../utilities/visibility-rules/visibil
|
|||
styleUrls: [
|
||||
'./dynamic-form-field.component.css'
|
||||
],
|
||||
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
|
||||
|
|
|
@ -3,36 +3,41 @@ import { ValidationContext } from "../../utilities/validators/ValidationContext"
|
|||
import { FormBuilder, FormGroup } from "@angular/forms";
|
||||
|
||||
export class DataRepositoryModel implements Serializable<DataRepositoryModel> {
|
||||
public id: String;
|
||||
public name: String;
|
||||
public pid: String;
|
||||
public uri: String;
|
||||
public info: String;
|
||||
public id: string;
|
||||
public label: string;
|
||||
public abbreviation: string;
|
||||
public uri: string;
|
||||
public reference: string;
|
||||
public info: string;
|
||||
public created: Date;
|
||||
public modified: Date;
|
||||
|
||||
constructor(id?: String, name?: String, pid?: String, uri?: String, info?: String
|
||||
constructor(id?: string, label?: string, abbreviation?: string, uri?: string, reference?: string
|
||||
) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.pid = pid;
|
||||
this.label = label;
|
||||
this.abbreviation = abbreviation;
|
||||
this.uri = uri;
|
||||
this.info = info;
|
||||
this.reference = reference;
|
||||
}
|
||||
fromJSONObject(item: any): DataRepositoryModel {
|
||||
this.id = item.id;
|
||||
this.name = item.name;
|
||||
this.pid = item.pid;
|
||||
this.label = item.label;
|
||||
this.abbreviation = item.abbreviation;
|
||||
this.uri = item.uri;
|
||||
this.info = item.info;
|
||||
this.reference = item.pid;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
||||
return new FormBuilder().group({
|
||||
id: [this.id],
|
||||
name: [this.name],
|
||||
pid: [this.pid],
|
||||
label: [this.label],
|
||||
abbreviation: [this.abbreviation],
|
||||
uri: [this.uri],
|
||||
info: [this.info]
|
||||
info: [this.info],
|
||||
reference: [this.reference]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,17 +52,7 @@ import { MAT_DATE_LOCALE } from '@angular/material';
|
|||
ProjectService,
|
||||
ProjectFileUploaderService,
|
||||
/* ProjectResolver */
|
||||
CultureService,
|
||||
{
|
||||
provide: MAT_DATE_LOCALE,
|
||||
deps: [CultureService],
|
||||
useFactory: (cultureService) => cultureService.getCurrentCulture()
|
||||
},
|
||||
{
|
||||
provide: LOCALE_ID,
|
||||
deps: [CultureService],
|
||||
useFactory: (cultureService) => cultureService.getCurrentCulture()
|
||||
}
|
||||
|
||||
]
|
||||
})
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
import { DataRepositoryModel } from "../../models/dataRepositories/DataRepositoryModel";
|
||||
import { Observable } from "rxjs";
|
||||
import { HttpHeaders } from "@angular/common/http";
|
||||
import { HostConfiguration } from "../../app.constants";
|
||||
import { BaseHttpService } from "../../utilities/cite-http-service-module/base-http.service";
|
||||
import { Injectable } from "@angular/core";
|
||||
|
||||
@Injectable()
|
||||
export class DataRepositoryService {
|
||||
|
||||
private actionUrl: string;
|
||||
private headers: HttpHeaders;
|
||||
|
||||
constructor(private http: BaseHttpService) {
|
||||
|
||||
this.actionUrl = HostConfiguration.Server + 'datarepos/';
|
||||
|
||||
this.headers = new HttpHeaders();
|
||||
this.headers = this.headers.set('Content-Type', 'application/json');
|
||||
this.headers = this.headers.set('Accept', 'application/json');
|
||||
}
|
||||
|
||||
create(dataRepoModel: DataRepositoryModel): Observable<DataRepositoryModel> {
|
||||
return this.http.post<DataRepositoryModel>(this.actionUrl + 'create', dataRepoModel, { headers: this.headers })
|
||||
}
|
||||
|
||||
}
|
|
@ -41,4 +41,8 @@ export class ExternalDatasetService {
|
|||
getSingle(id: string): Observable<ExternalDatasetModel> {
|
||||
return this.http.get<ExternalDatasetModel>(this.actionUrl + 'getSingle/' + id, { headers: this.headers });
|
||||
}
|
||||
|
||||
create(externalDatasetModel: ExternalDatasetModel): Observable<ExternalDatasetModel> {
|
||||
return this.http.post<ExternalDatasetModel>(this.actionUrl + 'create', externalDatasetModel, { headers: this.headers })
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
import { RegisterModel } from "../../models/registers/RegisterModel";
|
||||
import { Observable } from "rxjs";
|
||||
import { HttpHeaders } from "@angular/common/http";
|
||||
import { HostConfiguration } from "../../app.constants";
|
||||
import { BaseHttpService } from "../../utilities/cite-http-service-module/base-http.service";
|
||||
import { Injectable } from "@angular/core";
|
||||
|
||||
@Injectable()
|
||||
export class RegistryService {
|
||||
|
||||
private actionUrl: string;
|
||||
private headers: HttpHeaders;
|
||||
|
||||
constructor(private http: BaseHttpService) {
|
||||
|
||||
this.actionUrl = HostConfiguration.Server + 'registries/';
|
||||
|
||||
this.headers = new HttpHeaders();
|
||||
this.headers = this.headers.set('Content-Type', 'application/json');
|
||||
this.headers = this.headers.set('Accept', 'application/json');
|
||||
}
|
||||
|
||||
create(registerModel: RegisterModel): Observable<RegisterModel> {
|
||||
return this.http.post<RegisterModel>(this.actionUrl + 'create', registerModel, { headers: this.headers })
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
import { Injectable } from "@angular/core";
|
||||
import { HttpHeaders } from "@angular/common/http";
|
||||
import { BaseHttpService } from "../../utilities/cite-http-service-module/base-http.service";
|
||||
import { HostConfiguration } from "../../app.constants";
|
||||
import { ServiceModel } from "../../models/services/ServiceModel";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
@Injectable()
|
||||
export class ServicesDataService {
|
||||
|
||||
private actionUrl: string;
|
||||
private headers: HttpHeaders;
|
||||
|
||||
constructor(private http: BaseHttpService) {
|
||||
|
||||
this.actionUrl = HostConfiguration.Server + 'services/';
|
||||
|
||||
this.headers = new HttpHeaders();
|
||||
this.headers = this.headers.set('Content-Type', 'application/json');
|
||||
this.headers = this.headers.set('Accept', 'application/json');
|
||||
}
|
||||
|
||||
create(serviceModel: ServiceModel): Observable<ServiceModel> {
|
||||
return this.http.post<ServiceModel>(this.actionUrl + 'create', serviceModel, { headers: this.headers })
|
||||
}
|
||||
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
<div class="card-content">
|
||||
<p class="category">{{ category | translate }}</p>
|
||||
<h3 class="title">{{ title }}</h3>
|
||||
<button *ngIf="isAuthenticated()" mat-raised-button color="primary" (click)="createNew()" >{{buttonTitle}}</button>
|
||||
<button *ngIf="isAuthenticated()" mat-raised-button color="primary" (click)="createNew()"><mat-icon>create_new_folder</mat-icon></button>
|
||||
</div>
|
||||
<div *ngIf="hasFootContent" class="card-footer">
|
||||
</div>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<span class="navbar-spacer"></span>
|
||||
<div fxFlex *ngIf="search && this.isAuthenticated()">
|
||||
<mat-form-field class="full-width">
|
||||
<mat-form-field class="full-width" floatLabel="never">
|
||||
<input type="text" placeholder="{{'DASHBOARD.SEARCH' | translate}}" matInput [formControl]="searchControl" [matAutocomplete]="auto">
|
||||
<mat-autocomplete autoActiveFirstOption #auto="matAutocomplete" (optionSelected)="onOptionSelected($event)">
|
||||
<mat-option *ngFor="let option of filteredOptions | async" [value]="option">
|
||||
|
|
|
@ -41,11 +41,11 @@ export class UserDialogComponent implements OnInit {
|
|||
}
|
||||
|
||||
public principalHasAvatar(): boolean {
|
||||
return this.authentication.current().avatarUrl != null;
|
||||
return this.authentication.current() && this.authentication.current().avatarUrl != null;
|
||||
}
|
||||
|
||||
public getPrincipalAvatar(): string {
|
||||
return this.authentication.current().avatarUrl;
|
||||
return this.authentication.current() && this.authentication.current().avatarUrl;
|
||||
}
|
||||
|
||||
public navigateToProfile() {
|
||||
|
|
|
@ -220,7 +220,7 @@ export class LoginService {
|
|||
data: { message: 'GENERAL.SNACK-BAR.SUCCESSFUL-LOGIN', language: this.language },
|
||||
duration: 3000,
|
||||
});
|
||||
this.cultureService.cultureSelected(this.authService.current().culture)
|
||||
if (this.authService.current().culture) this.cultureService.cultureSelected(this.authService.current().culture)
|
||||
let params = this.router["rawUrlTree"].queryParams;
|
||||
let redirectUrl = params['returnUrl'] ? params['returnUrl'] : '/';
|
||||
this.zone.run(() => this.router.navigate([redirectUrl]));
|
||||
|
|
|
@ -219,7 +219,8 @@
|
|||
"EXTERNAL-DATASET-TYPE": "External Datasets Type",
|
||||
"EXTERNAL-DATASET-INFO": "External Datasets Info",
|
||||
"DATAREPOSITORIES-INFO": "Data Repositories Info",
|
||||
"TAGS": "Tags"
|
||||
"TAGS": "Tags",
|
||||
"CREATE": "Create New"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"SAVE": "Save",
|
||||
|
@ -337,5 +338,30 @@
|
|||
"CREATOR": "Creator",
|
||||
"MEMBER": "Member"
|
||||
}
|
||||
},
|
||||
"DATASET-REFERENCED-MODELS": {
|
||||
"SERVICES": {
|
||||
"TITLE": "Add New Service",
|
||||
"LABEL": "Label",
|
||||
"ABBREVIATION": "Abbreviation",
|
||||
"URI": "Uri"
|
||||
},
|
||||
"DATA-REPOSITORY": {
|
||||
"TITLE": "Add New Service",
|
||||
"LABEL": "Label",
|
||||
"ABBREVIATION": "Abbreviation",
|
||||
"URI": "Uri"
|
||||
},
|
||||
"EXTERNAL-DATASET": {
|
||||
"TITLE": "Add New Service",
|
||||
"LABEL": "Label",
|
||||
"ABBREVIATION": "Abbreviation"
|
||||
},
|
||||
"REGISTRY": {
|
||||
"TITLE": "Add New Service",
|
||||
"LABEL": "Label",
|
||||
"ABBREVIATION": "Abbreviation",
|
||||
"URI": "Uri"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@ export const environment = {
|
|||
production: true,
|
||||
Server: 'http://dl043.madgik.di.uoa.gr:8080/api/',
|
||||
App: 'http://dl043.madgik.di.uoa.gr/',
|
||||
HelpServiceUrl: 'http://dl043.madgik.di.uoa.gr:5555/'
|
||||
HelpServiceUrl: 'http://dl043.madgik.di.uoa.gr:5555/',
|
||||
defaultCulture: "en-GB"
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue