Adds "Creation User" on DataRepository, ExternalDataset, Registry, Service. (Issue #168)
This commit is contained in:
parent
6d14b7b452
commit
446717da97
|
@ -36,11 +36,9 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,
|
|||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "dataRepository", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetDataRepository> datasetDataRepositories;
|
||||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
@ -50,41 +48,35 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,
|
|||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"CreationUser\"", nullable = true)
|
||||
private UserInfo creationUser;
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -92,7 +84,6 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,
|
|||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
@ -100,7 +91,6 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,
|
|||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
@ -108,7 +98,6 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,
|
|||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
@ -116,7 +105,6 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,
|
|||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
@ -124,7 +112,6 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,
|
|||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
@ -132,11 +119,17 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,
|
|||
public Set<DatasetDataRepository> getDatasetDataRepositories() {
|
||||
return datasetDataRepositories;
|
||||
}
|
||||
|
||||
public void setDatasetDataRepositories(Set<DatasetDataRepository> datasetDataRepositories) {
|
||||
this.datasetDataRepositories = datasetDataRepositories;
|
||||
}
|
||||
|
||||
public UserInfo getCreationUser() {
|
||||
return creationUser;
|
||||
}
|
||||
public void setCreationUser(UserInfo creationUser) {
|
||||
this.creationUser = creationUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DataRepository entity) {
|
||||
|
||||
|
|
|
@ -40,10 +40,14 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
|
|||
@OneToMany(mappedBy = "externalDataset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetExternalDataset> datasets;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"CreationUser\"", nullable = true)
|
||||
private UserInfo creationUser;
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -51,7 +55,6 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
|
|||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
@ -59,7 +62,6 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
|
|||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
@ -67,7 +69,6 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
|
|||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
@ -75,7 +76,6 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
|
|||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
@ -83,7 +83,6 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
|
|||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
@ -91,16 +90,23 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
|
|||
public Set<DatasetExternalDataset> getDatasets() {
|
||||
return datasets;
|
||||
}
|
||||
|
||||
public void setDatasets(Set<DatasetExternalDataset> datasets) {
|
||||
this.datasets = datasets;
|
||||
}
|
||||
|
||||
public UserInfo getCreationUser() {
|
||||
return creationUser;
|
||||
}
|
||||
public void setCreationUser(UserInfo creationUser) {
|
||||
this.creationUser = creationUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ExternalDataset entity) {
|
||||
this.label = entity.getLabel();
|
||||
this.abbreviation = entity.getAbbreviation();
|
||||
this.modified = new Date();
|
||||
this.creationUser = entity.getCreationUser();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.UUID;
|
|||
@Table(name = "\"Registry\"")
|
||||
public class Registry implements DataEntity<Registry, UUID> {
|
||||
|
||||
|
||||
@Id
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
@ -38,7 +37,6 @@ public class Registry implements DataEntity<Registry, UUID> {
|
|||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "\"DatasetRegistry\"",
|
||||
joinColumns = {@JoinColumn(name = "\"Registry\"", referencedColumnName = "\"ID\"")},
|
||||
|
@ -46,11 +44,9 @@ public class Registry implements DataEntity<Registry, UUID> {
|
|||
)
|
||||
private Set<Dataset> datasets;
|
||||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date created = null;
|
||||
|
@ -59,32 +55,28 @@ public class Registry implements DataEntity<Registry, UUID> {
|
|||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date modified = new Date();
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"CreationUser\"", nullable = true)
|
||||
private UserInfo creationUser;
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -92,7 +84,6 @@ public class Registry implements DataEntity<Registry, UUID> {
|
|||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -100,7 +91,6 @@ public class Registry implements DataEntity<Registry, UUID> {
|
|||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
@ -108,7 +98,6 @@ public class Registry implements DataEntity<Registry, UUID> {
|
|||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
@ -116,7 +105,6 @@ public class Registry implements DataEntity<Registry, UUID> {
|
|||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
@ -124,7 +112,6 @@ public class Registry implements DataEntity<Registry, UUID> {
|
|||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
@ -132,7 +119,6 @@ public class Registry implements DataEntity<Registry, UUID> {
|
|||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
@ -140,11 +126,16 @@ public class Registry implements DataEntity<Registry, UUID> {
|
|||
public Set<Dataset> getDatasets() {
|
||||
return datasets;
|
||||
}
|
||||
|
||||
public void setDatasets(Set<Dataset> datasets) {
|
||||
this.datasets = datasets;
|
||||
}
|
||||
|
||||
public UserInfo getCreationUser() {
|
||||
return creationUser;
|
||||
}
|
||||
public void setCreationUser(UserInfo creationUser) {
|
||||
this.creationUser = creationUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Registry entity) {
|
||||
|
|
|
@ -20,7 +20,6 @@ public class Service implements DataEntity<Service, UUID> {
|
|||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
|
@ -37,15 +36,12 @@ public class Service implements DataEntity<Service, UUID> {
|
|||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
||||
private String definition;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "service", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<DatasetService> services;
|
||||
|
||||
|
||||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date created = null;
|
||||
|
@ -54,41 +50,35 @@ public class Service implements DataEntity<Service, UUID> {
|
|||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Date modified = new Date();
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"CreationUser\"", nullable = true)
|
||||
private UserInfo creationUser;
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(Short status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -96,7 +86,6 @@ public class Service implements DataEntity<Service, UUID> {
|
|||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
@ -104,7 +93,6 @@ public class Service implements DataEntity<Service, UUID> {
|
|||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
@ -112,7 +100,6 @@ public class Service implements DataEntity<Service, UUID> {
|
|||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
@ -120,7 +107,6 @@ public class Service implements DataEntity<Service, UUID> {
|
|||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
@ -128,7 +114,6 @@ public class Service implements DataEntity<Service, UUID> {
|
|||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
@ -136,11 +121,17 @@ public class Service implements DataEntity<Service, UUID> {
|
|||
public Set<DatasetService> getServices() {
|
||||
return services;
|
||||
}
|
||||
|
||||
public void setServices(Set<DatasetService> services) {
|
||||
this.services = services;
|
||||
}
|
||||
|
||||
public UserInfo getCreationUser() {
|
||||
return creationUser;
|
||||
}
|
||||
public void setCreationUser(UserInfo creationUser) {
|
||||
this.creationUser = creationUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Service entity) {
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class DataRepositories extends BaseController {
|
|||
@RequestMapping(method = RequestMethod.POST, 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 = this.dataRepositoryManager.create(dataRepositoryModel);
|
||||
DataRepository dataRepository = this.dataRepositoryManager.create(dataRepositoryModel, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataRepository>().payload(dataRepository).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class ExternalDatasets extends BaseController {
|
|||
@RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets"}, 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 = this.externalDatasetManager.create(externalDatasetModel);
|
||||
ExternalDataset externalDataset = this.externalDatasetManager.create(externalDatasetModel, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<ExternalDataset>().payload(externalDataset).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class Registries extends BaseController {
|
|||
@RequestMapping(method = RequestMethod.POST, value = {"/registries"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Registry>> create(@RequestBody RegistryModel registryModel, Principal principal) throws Exception {
|
||||
Registry registry = this.registryManager.create(registryModel);
|
||||
Registry registry = this.registryManager.create(registryModel, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Registry>().payload(registry).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class Services extends BaseController {
|
|||
@RequestMapping(method = RequestMethod.POST, value = {"/services"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Service>> create(@RequestBody ServiceModel serviceModel, Principal principal) throws Exception {
|
||||
Service service = serviceManager.create(serviceModel);
|
||||
Service service = serviceManager.create(serviceModel, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Service>().payload(service).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
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;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -19,8 +18,9 @@ public class DataRepositoryManager {
|
|||
this.apiContext = apiContext;
|
||||
}
|
||||
|
||||
public DataRepository create(eu.eudat.models.data.datarepository.DataRepositoryModel dataRepositoryModel) throws Exception {
|
||||
public DataRepository create(eu.eudat.models.data.datarepository.DataRepositoryModel dataRepositoryModel, Principal principal) throws Exception {
|
||||
DataRepository dataRepository = dataRepositoryModel.toDataModel();
|
||||
dataRepository.getCreationUser().setId(principal.getId());
|
||||
return apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().createOrUpdate(dataRepository);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package eu.eudat.logic.managers;
|
|||
|
||||
import eu.eudat.logic.builders.model.criteria.ExternalDatasetCriteriaBuilder;
|
||||
import eu.eudat.logic.builders.model.models.DataTableDataBuilder;
|
||||
import eu.eudat.data.dao.entities.ExternalDatasetDao;
|
||||
import eu.eudat.data.entities.ExternalDataset;
|
||||
import eu.eudat.data.dao.criteria.ExternalDatasetCriteria;
|
||||
import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||
|
@ -12,6 +11,7 @@ import eu.eudat.models.data.helpers.common.DataTableData;
|
|||
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
||||
import eu.eudat.logic.proxy.fetching.RemoteFetcher;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -54,8 +54,9 @@ public class ExternalDatasetManager {
|
|||
return externalDatasetModel;
|
||||
}
|
||||
|
||||
public ExternalDataset create(eu.eudat.models.data.externaldataset.ExternalDatasetModel externalDatasetModel) throws Exception {
|
||||
public ExternalDataset create(eu.eudat.models.data.externaldataset.ExternalDatasetModel externalDatasetModel, Principal principal) throws Exception {
|
||||
ExternalDataset externalDataset = externalDatasetModel.toDataModel();
|
||||
externalDataset.getCreationUser().setId(principal.getId());
|
||||
return apiContext.getOperationsContext().getDatabaseRepository().getExternalDatasetDao().createOrUpdate(externalDataset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
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;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -18,8 +17,9 @@ public class RegistryManager {
|
|||
this.apiContext = apiContext;
|
||||
}
|
||||
|
||||
public Registry create(RegistryModel registryModel) throws Exception {
|
||||
public Registry create(RegistryModel registryModel, Principal principal) throws Exception {
|
||||
Registry registry = registryModel.toDataModel();
|
||||
registry.getCreationUser().setId(principal.getId());
|
||||
return apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao().createOrUpdate(registry);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
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.security.Principal;
|
||||
import eu.eudat.models.data.services.ServiceModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -21,8 +20,9 @@ public class ServiceManager {
|
|||
this.apiContext = apiContext;
|
||||
}
|
||||
|
||||
public Service create(ServiceModel serviceModel) throws Exception {
|
||||
public Service create(ServiceModel serviceModel, Principal principal) throws Exception {
|
||||
Service service = serviceModel.toDataModel();
|
||||
service.getCreationUser().setId(principal.getId());
|
||||
return apiContext.getOperationsContext().getDatabaseRepository().getServiceDao().createOrUpdate(service);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.models.data.datarepository;
|
||||
|
||||
import eu.eudat.data.entities.DataRepository;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.models.DataModel;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -20,7 +21,6 @@ public class DataRepositoryModel implements DataModel<DataRepository, DataReposi
|
|||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ public class DataRepositoryModel implements DataModel<DataRepository, DataReposi
|
|||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
@ -36,7 +35,6 @@ public class DataRepositoryModel implements DataModel<DataRepository, DataReposi
|
|||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
@ -44,7 +42,6 @@ public class DataRepositoryModel implements DataModel<DataRepository, DataReposi
|
|||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
@ -52,7 +49,6 @@ public class DataRepositoryModel implements DataModel<DataRepository, DataReposi
|
|||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
@ -60,7 +56,6 @@ public class DataRepositoryModel implements DataModel<DataRepository, DataReposi
|
|||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
@ -85,6 +80,7 @@ public class DataRepositoryModel implements DataModel<DataRepository, DataReposi
|
|||
dataRepository.setReference("dmpdata/" + dataRepository.getId());
|
||||
dataRepository.setUri(this.uri);
|
||||
dataRepository.setStatus((short) 0);
|
||||
dataRepository.setCreationUser(new UserInfo());
|
||||
return dataRepository;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.models.data.externaldataset;
|
||||
|
||||
import eu.eudat.data.entities.ExternalDataset;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.models.DataModel;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -75,6 +76,7 @@ public class ExternalDatasetModel implements DataModel<ExternalDataset, External
|
|||
externalDataset.setId(this.id != null ? this.id : UUID.randomUUID());
|
||||
externalDataset.setLabel(this.label);
|
||||
externalDataset.setReference("dmpdata/" + externalDataset.getId());
|
||||
externalDataset.setCreationUser(new UserInfo());
|
||||
return externalDataset;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.models.data.registries;
|
||||
|
||||
import eu.eudat.data.entities.Registry;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.models.DataModel;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -20,7 +21,6 @@ public class RegistryModel implements DataModel<Registry, RegistryModel> {
|
|||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ public class RegistryModel implements DataModel<Registry, RegistryModel> {
|
|||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
@ -36,7 +35,6 @@ public class RegistryModel implements DataModel<Registry, RegistryModel> {
|
|||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
@ -44,7 +42,6 @@ public class RegistryModel implements DataModel<Registry, RegistryModel> {
|
|||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
@ -52,7 +49,6 @@ public class RegistryModel implements DataModel<Registry, RegistryModel> {
|
|||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
@ -60,7 +56,6 @@ public class RegistryModel implements DataModel<Registry, RegistryModel> {
|
|||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
@ -87,6 +82,7 @@ public class RegistryModel implements DataModel<Registry, RegistryModel> {
|
|||
registry.setModified(new Date());
|
||||
registry.setReference("dmpdata/" + registry.getId());
|
||||
registry.setStatus((short)0);
|
||||
registry.setCreationUser(new UserInfo());
|
||||
return registry;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.models.data.services;
|
||||
|
||||
import eu.eudat.data.entities.Service;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.models.DataModel;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -88,6 +89,7 @@ public class ServiceModel implements DataModel<Service, ServiceModel> {
|
|||
service.setReference("innerdata/" + service.getId());
|
||||
service.setModified(new Date());
|
||||
service.setStatus((short)0);
|
||||
service.setCreationUser(new UserInfo());
|
||||
return service;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
ALTER TABLE "DataRepository"
|
||||
ADD COLUMN "CreationUser" uuid
|
||||
|
||||
ALTER TABLE "ExternalDataset"
|
||||
ADD COLUMN "CreationUser" uuid
|
||||
|
||||
ALTER TABLE "Registry"
|
||||
ADD COLUMN "CreationUser" uuid
|
||||
|
||||
ALTER TABLE "Service"
|
||||
ADD COLUMN "CreationUser" uuid
|
Loading…
Reference in New Issue