diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileCriteria.java index de7119428..c859cb2c8 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileCriteria.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileCriteria.java @@ -1,13 +1,13 @@ package eu.eudat.data.dao.criteria; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import java.util.Date; import java.util.List; import java.util.UUID; -public class DatasetProfileCriteria extends Criteria { +public class DatasetProfileCriteria extends Criteria { public enum DatasetProfileFilter { DMPs((short) 0), Datasets((short) 1); @@ -25,7 +25,7 @@ public class DatasetProfileCriteria extends Criteria { case 1: return Datasets; default: - throw new RuntimeException("Unsupported DatasetProfile filter"); + throw new RuntimeException("Unsupported DescriptionTemplate filter"); } } } diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileWizardCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileWizardCriteria.java index df4978858..9e1d5d9e2 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileWizardCriteria.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileWizardCriteria.java @@ -1,11 +1,11 @@ package eu.eudat.data.dao.criteria; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import java.util.UUID; -public class DatasetProfileWizardCriteria extends Criteria { +public class DatasetProfileWizardCriteria extends Criteria { private UUID id; public UUID getId() { diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetExternalDatasetDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetExternalDatasetDaoImpl.java index ed76b6376..a0f7f6afa 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetExternalDatasetDaoImpl.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetExternalDatasetDaoImpl.java @@ -3,7 +3,6 @@ package eu.eudat.data.dao.entities; import eu.eudat.data.dao.DatabaseAccess; import eu.eudat.data.dao.databaselayer.service.DatabaseService; import eu.eudat.data.entities.DatasetExternalDataset; -import eu.eudat.data.entities.DatasetProfile; import eu.eudat.queryable.QueryableList; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetProfileDao.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetProfileDao.java index d2b712ea2..5365067fc 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetProfileDao.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetProfileDao.java @@ -2,20 +2,22 @@ package eu.eudat.data.dao.entities; import eu.eudat.data.dao.DatabaseAccessLayer; import eu.eudat.data.dao.criteria.DatasetProfileCriteria; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.queryable.QueryableList; import java.util.List; import java.util.UUID; -public interface DatasetProfileDao extends DatabaseAccessLayer { +public interface DatasetProfileDao extends DatabaseAccessLayer { - QueryableList getWithCriteria(DatasetProfileCriteria criteria); + QueryableList getWithCriteria(DatasetProfileCriteria criteria); - QueryableList getAll(); + QueryableList getAll(); - QueryableList getAuthenticated(QueryableList query, UUID principal, List roles); + QueryableList getAuthenticated(QueryableList query, UUID principal, List roles); - List getAllIds(); + List getAllIds(); + + Long countWithType(UUID id); } \ No newline at end of file diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetProfileDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetProfileDaoImpl.java index b6cbb445b..eae2be263 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetProfileDaoImpl.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetProfileDaoImpl.java @@ -3,8 +3,8 @@ package eu.eudat.data.dao.entities; import eu.eudat.data.dao.DatabaseAccess; import eu.eudat.data.dao.criteria.DatasetProfileCriteria; import eu.eudat.data.dao.databaselayer.service.DatabaseService; -import eu.eudat.data.entities.DMP; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; +import eu.eudat.data.entities.DescriptionTemplateType; import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.types.FieldSelectionType; import eu.eudat.queryable.types.SelectionField; @@ -21,16 +21,16 @@ import java.util.UUID; import java.util.concurrent.CompletableFuture; @Component("datasetProfileDao") -public class DatasetProfileDaoImpl extends DatabaseAccess implements DatasetProfileDao { +public class DatasetProfileDaoImpl extends DatabaseAccess implements DatasetProfileDao { @Autowired - public DatasetProfileDaoImpl(DatabaseService databaseService) { + public DatasetProfileDaoImpl(DatabaseService databaseService) { super(databaseService); } @Override - public QueryableList getWithCriteria(DatasetProfileCriteria criteria) { - QueryableList query = getDatabaseService().getQueryable(DatasetProfile.class); + public QueryableList getWithCriteria(DatasetProfileCriteria criteria) { + QueryableList query = getDatabaseService().getQueryable(DescriptionTemplate.class); if (criteria.getLike() != null && !criteria.getLike().isEmpty()) query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%")); if (!criteria.getAllVersions()) @@ -63,9 +63,9 @@ public class DatasetProfileDaoImpl extends DatabaseAccess implem query.where(((builder, root) -> root.get("id").in(criteria.getIds()))); } if (criteria.getFinalized()) { - query.where(((builder, root) -> builder.equal(root.get("status"), DatasetProfile.Status.FINALIZED.getValue()))); + query.where(((builder, root) -> builder.equal(root.get("status"), DescriptionTemplate.Status.FINALIZED.getValue()))); } else { - query.where(((builder, root) -> builder.notEqual(root.get("status"), DatasetProfile.Status.DELETED.getValue()))); + query.where(((builder, root) -> builder.notEqual(root.get("status"), DescriptionTemplate.Status.DELETED.getValue()))); } if (criteria.getPeriodStart() != null) query.where((builder, root) -> builder.greaterThanOrEqualTo(root.get("created"), criteria.getPeriodStart())); @@ -73,48 +73,48 @@ public class DatasetProfileDaoImpl extends DatabaseAccess implem } @Override - public DatasetProfile createOrUpdate(DatasetProfile item) { - return this.getDatabaseService().createOrUpdate(item, DatasetProfile.class); + public DescriptionTemplate createOrUpdate(DescriptionTemplate item) { + return this.getDatabaseService().createOrUpdate(item, DescriptionTemplate.class); } @Override - public DatasetProfile find(UUID id) { - return getDatabaseService().getQueryable(DatasetProfile.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle(); + public DescriptionTemplate find(UUID id) { + return getDatabaseService().getQueryable(DescriptionTemplate.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle(); } @Override - public QueryableList getAll() { - return getDatabaseService().getQueryable(DatasetProfile.class); + public QueryableList getAll() { + return getDatabaseService().getQueryable(DescriptionTemplate.class); } @Override - public List getAllIds(){ - return getDatabaseService().getQueryable(DatasetProfile.class).withFields(Collections.singletonList("id")).toList(); + public List getAllIds(){ + return getDatabaseService().getQueryable(DescriptionTemplate.class).withFields(Collections.singletonList("id")).toList(); } @Override - public void delete(DatasetProfile item) { + public void delete(DescriptionTemplate item) { this.getDatabaseService().delete(item); } @Override - public QueryableList asQueryable() { - return this.getDatabaseService().getQueryable(DatasetProfile.class); + public QueryableList asQueryable() { + return this.getDatabaseService().getQueryable(DescriptionTemplate.class); } @Async @Override - public CompletableFuture createOrUpdateAsync(DatasetProfile item) { + public CompletableFuture createOrUpdateAsync(DescriptionTemplate item) { return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item)); } @Override - public DatasetProfile find(UUID id, String hint) { + public DescriptionTemplate find(UUID id, String hint) { throw new UnsupportedOperationException(); } @Override - public QueryableList getAuthenticated(QueryableList query, UUID principal, List roles) { + public QueryableList getAuthenticated(QueryableList query, UUID principal, List roles) { if (roles != null && !roles.isEmpty()) { query.where((builder, root) -> { Join userJoin = root.join("users", JoinType.LEFT); @@ -126,4 +126,9 @@ public class DatasetProfileDaoImpl extends DatabaseAccess implem return query; } + + @Override + public Long countWithType(UUID id) { + return this.getDatabaseService().getQueryable(DescriptionTemplate.class).where((builder, root) -> builder.equal(root.get("type"), id)).count(); + } } diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetServiceDao.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetServiceDao.java index 9af289d34..3666d4014 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetServiceDao.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetServiceDao.java @@ -1,7 +1,6 @@ package eu.eudat.data.dao.entities; import eu.eudat.data.dao.DatabaseAccessLayer; -import eu.eudat.data.entities.DatasetProfile; import eu.eudat.data.entities.DatasetService; import java.util.UUID; diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetServiceDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetServiceDaoImpl.java index fd40d37ae..2f000f4f8 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetServiceDaoImpl.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DatasetServiceDaoImpl.java @@ -2,8 +2,6 @@ package eu.eudat.data.dao.entities; import eu.eudat.data.dao.DatabaseAccess; import eu.eudat.data.dao.databaselayer.service.DatabaseService; -import eu.eudat.data.entities.DatasetExternalDataset; -import eu.eudat.data.entities.DatasetProfile; import eu.eudat.data.entities.DatasetService; import eu.eudat.queryable.QueryableList; import org.springframework.beans.factory.annotation.Autowired; diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java index 036069e86..54beaeeb9 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java @@ -117,7 +117,7 @@ public class DMP implements DataEntity { joinColumns = {@JoinColumn(name = "\"dmp\"", referencedColumnName = "\"ID\"")}, inverseJoinColumns = {@JoinColumn(name = "\"datasetprofile\"", referencedColumnName = "\"ID\"")} ) - private Set associatedDmps; + private Set associatedDmps; @ManyToOne(fetch = FetchType.LAZY) @@ -274,10 +274,10 @@ public class DMP implements DataEntity { this.grant = grant; } - public Set getAssociatedDmps() { + public Set getAssociatedDmps() { return associatedDmps; } - public void setAssociatedDmps(Set associatedDmps) { + public void setAssociatedDmps(Set associatedDmps) { this.associatedDmps = associatedDmps; } diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Dataset.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Dataset.java index 4692571b0..7456b21d8 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Dataset.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Dataset.java @@ -110,7 +110,7 @@ public class Dataset implements DataEntity { @ManyToOne(fetch = FetchType.LAZY) //@Cascade(value=org.hibernate.annotations.CascadeType.ALL) @JoinColumn(name = "\"Profile\"") - private DatasetProfile profile; + private DescriptionTemplate profile; @Type(type = "eu.eudat.configurations.typedefinition.XMLType") @Column(name = "\"Reference\"", columnDefinition = "xml") @@ -249,10 +249,10 @@ public class Dataset implements DataEntity { } - public DatasetProfile getProfile() { + public DescriptionTemplate getProfile() { return profile; } - public void setProfile(DatasetProfile profile) { + public void setProfile(DescriptionTemplate profile) { this.profile = profile; } diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfile.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DescriptionTemplate.java similarity index 86% rename from dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfile.java rename to dmp-backend/data/src/main/java/eu/eudat/data/entities/DescriptionTemplate.java index a11316abd..c30018630 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfile.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DescriptionTemplate.java @@ -14,8 +14,8 @@ import java.util.UUID; @Entity -@Table(name = "\"DatasetProfile\"") -public class DatasetProfile implements DataEntity{ +@Table(name = "\"DescriptionTemplate\"") +public class DescriptionTemplate implements DataEntity{ public enum Status { SAVED((short) 0), FINALIZED((short) 1), DELETED((short) 99); @@ -89,7 +89,11 @@ public class DatasetProfile implements DataEntity{ @Column(name = "\"Language\"", nullable = false) private String language; - @OneToMany(mappedBy = "datasetProfile", fetch = FetchType.LAZY) + @OneToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "\"Type\"", nullable = false) + private DescriptionTemplateType type; + + @OneToMany(mappedBy = "descriptionTemplate", fetch = FetchType.LAZY) private Set users; @@ -156,26 +160,31 @@ public class DatasetProfile implements DataEntity{ public String getLanguage() { return language; } - public void setLanguage(String language) { this.language = language; } + public DescriptionTemplateType getType() { + return type; + } + public void setType(DescriptionTemplateType type) { + this.type = type; + } + public Set getUsers() { return users; } - public void setUsers(Set users) { this.users = users; } @Override public String toString() { - return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + ", version=" + version + ", language=" + language + "]"; + return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + ", version=" + version + ", language=" + language + ", type=" + type +"]"; } @Override - public void update(DatasetProfile entity) { + public void update(DescriptionTemplate entity) { } @Override @@ -184,7 +193,7 @@ public class DatasetProfile implements DataEntity{ } @Override - public DatasetProfile buildFromTuple(List tuple, List fields, String base) { + public DescriptionTemplate buildFromTuple(List tuple, List fields, String base) { this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id")); return this; } diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserDatasetProfile.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserDatasetProfile.java index 8388cdbc3..4af7c2799 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserDatasetProfile.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/UserDatasetProfile.java @@ -22,8 +22,8 @@ public class UserDatasetProfile implements DataEntity private UserInfo user; @OneToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "\"datasetProfile\"") - private DatasetProfile datasetProfile; + @JoinColumn(name = "\"descriptionTemplate\"") + private DescriptionTemplate descriptionTemplate; @Column(name = "role") private Integer role; @@ -44,12 +44,12 @@ public class UserDatasetProfile implements DataEntity this.user = user; } - public DatasetProfile getDatasetProfile() { - return datasetProfile; + public DescriptionTemplate getDatasetProfile() { + return descriptionTemplate; } - public void setDatasetProfile(DatasetProfile datasetProfile) { - this.datasetProfile = datasetProfile; + public void setDatasetProfile(DescriptionTemplate descriptionTemplate) { + this.descriptionTemplate = descriptionTemplate; } public Integer getRole() { diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/datasetprofile/DatasetProfileAutocompleteRequest.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/datasetprofile/DatasetProfileAutocompleteRequest.java index 2cda2c5cd..984d44073 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/datasetprofile/DatasetProfileAutocompleteRequest.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/datasetprofile/DatasetProfileAutocompleteRequest.java @@ -1,25 +1,24 @@ package eu.eudat.data.query.items.item.datasetprofile; import eu.eudat.data.dao.criteria.DatasetProfileCriteria; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.data.query.PaginationService; -import eu.eudat.data.query.definition.Query; import eu.eudat.data.query.definition.TableQuery; import eu.eudat.queryable.QueryableList; import java.util.UUID; -public class DatasetProfileAutocompleteRequest extends TableQuery { +public class DatasetProfileAutocompleteRequest extends TableQuery { @Override - public QueryableList applyCriteria() { - QueryableList query = this.getQuery(); + public QueryableList applyCriteria() { + QueryableList query = this.getQuery(); if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%")); return query; } @Override - public QueryableList applyPaging(QueryableList items) { + public QueryableList applyPaging(QueryableList items) { return PaginationService.applyPaging(items, this); } } diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/datasetprofile/DatasetProfileWizardAutocompleteRequest.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/datasetprofile/DatasetProfileWizardAutocompleteRequest.java index 2d7c0b393..c911fe3af 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/datasetprofile/DatasetProfileWizardAutocompleteRequest.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/datasetprofile/DatasetProfileWizardAutocompleteRequest.java @@ -1,15 +1,13 @@ package eu.eudat.data.query.items.item.datasetprofile; import eu.eudat.data.dao.criteria.DatasetProfileWizardCriteria; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.data.query.definition.Query; import eu.eudat.queryable.QueryableList; -import java.util.UUID; - -public class DatasetProfileWizardAutocompleteRequest extends Query { +public class DatasetProfileWizardAutocompleteRequest extends Query { @Override - public QueryableList applyCriteria() { + public QueryableList applyCriteria() { return null; } } diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/datasetprofile/DatasetProfileTableRequestItem.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/datasetprofile/DatasetProfileTableRequestItem.java index 1ff6faa88..17ad2a687 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/datasetprofile/DatasetProfileTableRequestItem.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/datasetprofile/DatasetProfileTableRequestItem.java @@ -1,23 +1,23 @@ package eu.eudat.data.query.items.table.datasetprofile; import eu.eudat.data.dao.criteria.DatasetProfileCriteria; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.data.query.definition.TableQuery; import eu.eudat.queryable.QueryableList; import java.util.UUID; -public class DatasetProfileTableRequestItem extends TableQuery { +public class DatasetProfileTableRequestItem extends TableQuery { @Override - public QueryableList applyCriteria() { - QueryableList query = this.getQuery(); + public QueryableList applyCriteria() { + QueryableList query = this.getQuery(); if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%")); return query; } @Override - public QueryableList applyPaging(QueryableList items) { + public QueryableList applyPaging(QueryableList items) { return null; } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Admin.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Admin.java index 7829f2fa9..f9a5cd03b 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Admin.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/Admin.java @@ -1,5 +1,6 @@ package eu.eudat.controllers; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.data.entities.UserDatasetProfile; import eu.eudat.data.entities.UserInfo; import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem; @@ -16,7 +17,6 @@ import eu.eudat.models.data.admin.composite.DatasetProfile; import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel; import eu.eudat.models.data.helpers.common.DataTableData; import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.models.data.listingmodels.UserInfoListingModel; import eu.eudat.models.data.security.Principal; import eu.eudat.models.data.user.composite.PagedDatasetProfile; import eu.eudat.types.ApiMessageCode; @@ -32,7 +32,6 @@ import javax.validation.Valid; import java.io.IOException; import java.util.List; import java.util.UUID; -import java.util.stream.Collectors; import static eu.eudat.types.Authorities.ADMIN; import static eu.eudat.types.Authorities.DATASET_PROFILE_MANAGER; @@ -61,20 +60,20 @@ public class Admin extends BaseController { public ResponseEntity addDmp(@Valid @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN ,DATASET_PROFILE_MANAGER}) Principal principal) { //this.getLoggerService().info(principal, "Admin Added Dataset Profile"); DatasetProfile shortenProfile = profile.toShort(); - eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(shortenProfile, getApiContext()); + DescriptionTemplate modelDefinition = AdminManager.generateViewStyleDefinition(shortenProfile, getApiContext()); modelDefinition.setGroupId(UUID.randomUUID()); modelDefinition.setVersion((short) 0); - eu.eudat.data.entities.DatasetProfile datasetProfile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition); + DescriptionTemplate descriptionTemplate = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition); UserDatasetProfile userDatasetProfile = new UserDatasetProfile(); - userDatasetProfile.setDatasetProfile(datasetProfile); + userDatasetProfile.setDatasetProfile(descriptionTemplate); UserInfo userInfo = getApiContext().getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId()); userDatasetProfile.setUser(userInfo); userDatasetProfile.setRole(0); getApiContext().getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile); - datasetProfileManager.storeDatasetProfileUsers(datasetProfile, profile); + datasetProfileManager.storeDatasetProfileUsers(descriptionTemplate, profile); - metricsManager.increaseValue(MetricNames.DATASET_TEMPLATE, 1, MetricsManager.datasetTemplateStatus.get(datasetProfile.getStatus()) ); + metricsManager.increaseValue(MetricNames.DATASET_TEMPLATE, 1, MetricsManager.datasetTemplateStatus.get(descriptionTemplate.getStatus()) ); return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId()); } @@ -82,17 +81,17 @@ public class Admin extends BaseController { @RequestMapping(method = RequestMethod.POST, value = {"/addDmp/{id}"}, consumes = "application/json", produces = "application/json") public ResponseEntity> updateDmp(@PathVariable String id, @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) { DatasetProfile shortenProfile = profile.toShort(); - eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(shortenProfile, getApiContext()); - eu.eudat.data.entities.DatasetProfile datasetprofile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); + DescriptionTemplate modelDefinition = AdminManager.generateViewStyleDefinition(shortenProfile, getApiContext()); + DescriptionTemplate datasetprofile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); datasetprofile.setDefinition(modelDefinition.getDefinition()); Short oldStatus = datasetprofile.getStatus(); datasetprofile.setStatus(modelDefinition.getStatus()); datasetprofile.setLabel(modelDefinition.getLabel()); datasetprofile.setDescription(modelDefinition.getDescription()); datasetprofile.setLanguage(modelDefinition.getLanguage()); - eu.eudat.data.entities.DatasetProfile datasetProfile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(datasetprofile); - datasetProfileManager.storeDatasetProfileUsers(datasetProfile, profile); - if (datasetProfile.getStatus() == 1 && oldStatus == 0) { + DescriptionTemplate descriptionTemplate = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(datasetprofile); + datasetProfileManager.storeDatasetProfileUsers(descriptionTemplate, profile); + if (descriptionTemplate.getStatus() == 1 && oldStatus == 0) { metricsManager.increaseValue(MetricNames.DATASET_TEMPLATE, 1, MetricNames.ACTIVE); } return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE)); @@ -102,7 +101,7 @@ public class Admin extends BaseController { @RequestMapping(method = RequestMethod.POST, value = {"/newVersion/{id}"}, produces = "application/json") public ResponseEntity newVersionDatasetProfile(@PathVariable String id, @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) throws Exception { try { - eu.eudat.data.entities.DatasetProfile modelDefinition = this.datasetProfileManager.createNewVersionDatasetProfile(id, profile); + DescriptionTemplate modelDefinition = this.datasetProfileManager.createNewVersionDatasetProfile(id, profile); return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId()); } catch (DatasetProfileNewVersionException exception) { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage())); @@ -125,7 +124,7 @@ public class Admin extends BaseController { @RequestMapping(method = RequestMethod.POST, value = {"/preview"}, consumes = "application/json", produces = "application/json") public ResponseEntity> getPreview(@RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) { - eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext()); + DescriptionTemplate modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext()); eu.eudat.models.data.user.composite.DatasetProfile datasetProfile = userManager.generateDatasetProfileModel(modelDefinition); PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile(); pagedDatasetProfile.buildPagedDatasetProfile(datasetProfile); @@ -145,7 +144,7 @@ public class Admin extends BaseController { public @ResponseBody ResponseEntity> inactivate(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) { try { - eu.eudat.data.entities.DatasetProfile ret = AdminManager.inactivate(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao(), this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao(), id); + DescriptionTemplate ret = AdminManager.inactivate(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao(), this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao(), id); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.SUCCESS_MESSAGE)); } catch (DatasetProfileWithDatasetsExeption exception) { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.UNSUCCESS_DELETE).message(exception.getMessage())); @@ -156,7 +155,7 @@ public class Admin extends BaseController { @RequestMapping(method = RequestMethod.GET, value = {"/getXml/{id}"}, produces = "application/json") public ResponseEntity getDatasetProfileXml(@PathVariable String id, @RequestHeader("Content-Type") String contentType, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) throws IllegalAccessException, IOException, InstantiationException { if (contentType.equals("application/xml")) { - eu.eudat.data.entities.DatasetProfile profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); + DescriptionTemplate profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); eu.eudat.models.data.user.composite.DatasetProfile datasetProfile = userManager.generateDatasetProfileModel(profile); datasetProfile.setStatus(profile.getStatus()); datasetProfile.setDescription(profile.getDescription()); @@ -173,12 +172,12 @@ public class Admin extends BaseController { @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) throws Exception { eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile datasetProfileModel = this.datasetProfileManager.createDatasetProfileFromXml(file); eu.eudat.models.data.admin.composite.DatasetProfile datasetProfileEntity = datasetProfileModel.toAdminCompositeModel(file.getOriginalFilename()); - eu.eudat.data.entities.DatasetProfile modelDefinition; + DescriptionTemplate modelDefinition; if (id == null) { modelDefinition = AdminManager.generateViewStyleDefinition(datasetProfileEntity, getApiContext()); - eu.eudat.data.entities.DatasetProfile datasetProfile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition); + DescriptionTemplate descriptionTemplate = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition); UserDatasetProfile userDatasetProfile = new UserDatasetProfile(); - userDatasetProfile.setDatasetProfile(datasetProfile); + userDatasetProfile.setDatasetProfile(descriptionTemplate); UserInfo userInfo = getApiContext().getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId()); userDatasetProfile.setUser(userInfo); userDatasetProfile.setRole(0); @@ -186,7 +185,7 @@ public class Admin extends BaseController { } else { modelDefinition = datasetProfileManager.createNewVersionDatasetProfile(id, datasetProfileEntity); } - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>() + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>() .status(ApiMessageCode.SUCCESS_MESSAGE).message("")); } diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/DMPProfileController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/DMPProfileController.java index 1a54587fa..a47a59ce7 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/DMPProfileController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/DMPProfileController.java @@ -2,6 +2,7 @@ package eu.eudat.controllers; import eu.eudat.data.dao.criteria.RequestItem; import eu.eudat.data.entities.DMPProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.data.query.items.table.dmpprofile.DataManagementPlanProfileTableRequest; import eu.eudat.logic.managers.DataManagementProfileManager; import eu.eudat.logic.security.claims.ClaimedAuthorities; @@ -82,7 +83,7 @@ public class DMPProfileController extends BaseController { eu.eudat.logic.utilities.documents.xml.dmpXml.dmpProfileModel.DmpProfile dmpProfileModel = this.dataManagementProfileManager.createDmpProfileFromXml(file); DataManagementPlanProfileListingModel dataManagementPlan = dmpProfileModel.toDmpProfileCompositeModel(file.getOriginalFilename()); this.dataManagementProfileManager.createOrUpdate(dataManagementPlan, principal); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>() + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>() .status(ApiMessageCode.SUCCESS_MESSAGE).message("")); } diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/DatasetProfileController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/DatasetProfileController.java index 5f16cb390..8fbe7c8f2 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/DatasetProfileController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/DatasetProfileController.java @@ -1,6 +1,7 @@ package eu.eudat.controllers; import eu.eudat.data.dao.criteria.RequestItem; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.logic.managers.AdminManager; import eu.eudat.logic.managers.DatasetProfileManager; import eu.eudat.logic.security.claims.ClaimedAuthorities; @@ -55,7 +56,7 @@ public class DatasetProfileController extends BaseController { @Transactional @RequestMapping(method = RequestMethod.POST, value = {"/datasetprofile/clone/{id}"}, consumes = "application/json", produces = "application/json") public ResponseEntity> clone(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN})Principal principal) { - eu.eudat.data.entities.DatasetProfile profile = this.datasetProfileManager.clone(id); + DescriptionTemplate profile = this.datasetProfileManager.clone(id); eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile); datasetprofile.setLabel(profile.getLabel() + " new "); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().payload(datasetprofile)); @@ -63,8 +64,8 @@ public class DatasetProfileController extends BaseController { @RequestMapping(method = RequestMethod.POST, value = {"/search/autocomplete"}, consumes = "application/json", produces = "application/json") public ResponseEntity getDataForAutocomplete(@RequestBody RequestItem lookupItem) throws XPathExpressionException { - eu.eudat.data.entities.DatasetProfile datasetProfile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(lookupItem.getCriteria().getProfileID())); - eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field modelfield = this.datasetProfileManager.queryForField(datasetProfile.getDefinition(), lookupItem.getCriteria().getFieldID()); + DescriptionTemplate descriptionTemplate = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(lookupItem.getCriteria().getProfileID())); + eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field modelfield = this.datasetProfileManager.queryForField(descriptionTemplate.getDefinition(), lookupItem.getCriteria().getFieldID()); AutoCompleteData data = (AutoCompleteData) modelfield.getData(); List items = this.datasetProfileManager.getAutocomplete(data, lookupItem.getCriteria().getLike()); return ResponseEntity.status(HttpStatus.OK).body(items); diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Datasets.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Datasets.java index 4b4a79d1e..5364cf9f0 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Datasets.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/Datasets.java @@ -1,6 +1,7 @@ package eu.eudat.controllers; import eu.eudat.data.entities.Dataset; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.data.query.items.item.dataset.DatasetWizardAutocompleteRequest; import eu.eudat.data.query.items.item.datasetprofile.DatasetProfileWizardAutocompleteRequest; import eu.eudat.data.query.items.table.dataset.DatasetPublicTableRequest; @@ -202,7 +203,7 @@ public class Datasets extends BaseController { @RequestMapping(method = RequestMethod.GET, value = {"/get/{id}"}, produces = "application/json") public ResponseEntity> getSingle(@PathVariable String id) { - eu.eudat.data.entities.DatasetProfile profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); + DescriptionTemplate profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = userManager.generateDatasetProfileModel(profile); PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile(); pagedDatasetProfile.buildPagedDatasetProfile(datasetprofile); diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/QuickWizardController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/QuickWizardController.java index e80a2c70d..082e9ade7 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/QuickWizardController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/QuickWizardController.java @@ -1,8 +1,7 @@ package eu.eudat.controllers; -import eu.eudat.data.entities.Dataset; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.data.entities.Funder; import eu.eudat.data.entities.Project; import eu.eudat.logic.managers.DatasetManager; @@ -23,7 +22,6 @@ import org.springframework.web.bind.annotation.*; import javax.transaction.Transactional; import javax.validation.Valid; -import java.util.UUID; @RestController @CrossOrigin @@ -88,7 +86,7 @@ public class QuickWizardController extends BaseController { quickWizard.getDmp().setId(dmpEntity.getId()); for (DatasetDescriptionQuickWizardModel dataset : quickWizard.getDatasets().getDatasetsList()) { DataManagementPlan dmp = quickWizard.getDmp().toDataDmp(grantEntity, projectEntity, principal); - DatasetProfile profile = quickWizard.getDmp().getDatasetProfile(); + DescriptionTemplate profile = quickWizard.getDmp().getDatasetProfile(); DatasetWizardModel datasetWizardModel = dataset.toDataModel(dmp, profile); this.datasetManager.createOrUpdate(datasetWizardModel, principal); } @@ -100,7 +98,7 @@ public class QuickWizardController extends BaseController { public @ResponseBody ResponseEntity> addDatasetWizard(@RequestBody DatasetCreateWizardModel datasetCreateWizardModel, Principal principal) throws Exception{ for(DatasetDescriptionQuickWizardModel dataset : datasetCreateWizardModel.getDatasets().getDatasetsList()){ - DatasetProfile profile = new DatasetProfile(); + DescriptionTemplate profile = new DescriptionTemplate(); profile.setId(datasetCreateWizardModel.getDmpMeta().getDatasetProfile().getId()); profile.setLabel(datasetCreateWizardModel.getDmpMeta().getDatasetProfile().getLabel()); this.datasetManager.createOrUpdate(dataset.toDataModel(datasetCreateWizardModel.getDmpMeta().getDmp(), profile), principal); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/DatasetProfileBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/DatasetProfileBuilder.java index add38bb38..59194d62f 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/DatasetProfileBuilder.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/DatasetProfileBuilder.java @@ -1,8 +1,8 @@ package eu.eudat.logic.builders.entity; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.logic.builders.Builder; import eu.eudat.data.entities.Dataset; -import eu.eudat.data.entities.DatasetProfile; import java.util.Date; import java.util.Set; @@ -11,7 +11,7 @@ import java.util.UUID; /** * Created by ikalyvas on 2/15/2018. */ -public class DatasetProfileBuilder extends Builder { +public class DatasetProfileBuilder extends Builder { private UUID id; @@ -77,17 +77,17 @@ public class DatasetProfileBuilder extends Builder { } @Override - public DatasetProfile build() { - DatasetProfile datasetProfile = new DatasetProfile(); - datasetProfile.setCreated(created); - datasetProfile.setStatus(status); - datasetProfile.setId(id); - datasetProfile.setDataset(dataset); - datasetProfile.setDefinition(definition); - datasetProfile.setDescription(description); - datasetProfile.setModified(modified); - datasetProfile.setLabel(label); - datasetProfile.setLanguage(language); - return datasetProfile; + public DescriptionTemplate build() { + DescriptionTemplate descriptionTemplate = new DescriptionTemplate(); + descriptionTemplate.setCreated(created); + descriptionTemplate.setStatus(status); + descriptionTemplate.setId(id); + descriptionTemplate.setDataset(dataset); + descriptionTemplate.setDefinition(definition); + descriptionTemplate.setDescription(description); + descriptionTemplate.setModified(modified); + descriptionTemplate.setLabel(label); + descriptionTemplate.setLanguage(language); + return descriptionTemplate; } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/AdminManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/AdminManager.java index 8d4b4382c..a7569ed82 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/AdminManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/AdminManager.java @@ -2,6 +2,7 @@ package eu.eudat.logic.managers; import eu.eudat.data.dao.entities.DatasetDao; import eu.eudat.data.dao.entities.DatasetProfileDao; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.exceptions.datasetprofile.DatasetProfileWithDatasetsExeption; import eu.eudat.logic.builders.entity.DatasetProfileBuilder; import eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel; @@ -17,7 +18,7 @@ import java.util.UUID; public class AdminManager { - public static eu.eudat.data.entities.DatasetProfile generateViewStyleDefinition(DatasetProfile profile, ApiContext apiContext) { + public static DescriptionTemplate generateViewStyleDefinition(DatasetProfile profile, ApiContext apiContext) { ViewStyleModel viewStyleModel = new ViewStyleModel(); viewStyleModel.setSections(new ModelBuilder().toViewStyleDefinition(profile.getSections(), eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section.class)); viewStyleModel.setPages(new ModelBuilder().toViewStyleDefinition(profile.getPages(), eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Page.class)); @@ -34,22 +35,22 @@ public class AdminManager { profile.setLanguage("en"); } - eu.eudat.data.entities.DatasetProfile datasetProfile = apiContext.getOperationsContext().getBuilderFactory().getBuilder(DatasetProfileBuilder.class).definition(xml).label(profile.getLabel()) + DescriptionTemplate descriptionTemplate = apiContext.getOperationsContext().getBuilderFactory().getBuilder(DatasetProfileBuilder.class).definition(xml).label(profile.getLabel()) .status(profile.getStatus()).created(new Date()).description(profile.getDescription()).language(profile.getLanguage()) .build(); - if (datasetProfile.getGroupId() == null) { - datasetProfile.setGroupId(UUID.randomUUID()); + if (descriptionTemplate.getGroupId() == null) { + descriptionTemplate.setGroupId(UUID.randomUUID()); } - if (datasetProfile.getVersion() == null) { - datasetProfile.setVersion((short)1); + if (descriptionTemplate.getVersion() == null) { + descriptionTemplate.setVersion((short)1); } - return datasetProfile; + return descriptionTemplate; } - public static eu.eudat.models.data.admin.composite.DatasetProfile generateDatasetProfileModel(eu.eudat.data.entities.DatasetProfile profile) { + public static eu.eudat.models.data.admin.composite.DatasetProfile generateDatasetProfileModel(DescriptionTemplate profile) { Document viewStyleDoc = XmlBuilder.fromXml(profile.getDefinition()); Element root = viewStyleDoc.getDocumentElement(); eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewstyle = new eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel().fromXml(root); @@ -60,12 +61,12 @@ public class AdminManager { } - public static eu.eudat.data.entities.DatasetProfile inactivate(DatasetProfileDao datasetProfileRepository, DatasetDao datasetDao, String id) { + public static DescriptionTemplate inactivate(DatasetProfileDao datasetProfileRepository, DatasetDao datasetDao, String id) { eu.eudat.data.dao.criteria.DatasetCriteria datasetsForThatDatasetProfile = new eu.eudat.data.dao.criteria.DatasetCriteria(); datasetsForThatDatasetProfile.setProfileDatasetId(UUID.fromString(id)); if (datasetDao.getWithCriteria(datasetsForThatDatasetProfile).count() == 0) { - eu.eudat.data.entities.DatasetProfile detasetProfile = datasetProfileRepository.find(UUID.fromString(id)); - detasetProfile.setStatus(eu.eudat.data.entities.DatasetProfile.Status.DELETED.getValue()); + DescriptionTemplate detasetProfile = datasetProfileRepository.find(UUID.fromString(id)); + detasetProfile.setStatus(DescriptionTemplate.Status.DELETED.getValue()); detasetProfile = datasetProfileRepository.createOrUpdate(detasetProfile); return detasetProfile; } else { diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java index df74d3258..9679bc857 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java @@ -25,7 +25,6 @@ import eu.eudat.elastic.entities.Tag; import eu.eudat.exceptions.datamanagementplan.DMPNewVersionException; import eu.eudat.exceptions.datamanagementplan.DMPWithDatasetsDeleteException; import eu.eudat.exceptions.security.ForbiddenException; -import eu.eudat.exceptions.security.NonValidTokenException; import eu.eudat.exceptions.security.UnauthorisedException; import eu.eudat.logic.builders.entity.UserInfoBuilder; import eu.eudat.logic.mapper.elastic.DmpMapper; @@ -65,7 +64,6 @@ import eu.eudat.models.data.userinfo.UserListingModel; import eu.eudat.queryable.QueryableList; import eu.eudat.types.Authorities; import eu.eudat.types.MetricNames; -import org.apache.commons.io.IOUtils; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFRun; @@ -87,7 +85,6 @@ import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import java.io.*; import java.math.BigInteger; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.time.Instant; import java.time.temporal.ChronoUnit; @@ -408,7 +405,7 @@ public class DataManagementPlanManager { datasetProfileTableRequestItem.getCriteria().setFilter(DatasetProfileCriteria.DatasetProfileFilter.DMPs.getValue()); datasetProfileTableRequestItem.getCriteria().setUserId(principal.getId()); - QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(datasetProfileTableRequestItem.getCriteria()); + QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(datasetProfileTableRequestItem.getCriteria()); List listingModels = items.select(item -> new DatasetProfileListingModel().fromDataModel(item)); DataTableData data = new DataTableData<>(); @@ -1603,19 +1600,19 @@ public class DataManagementPlanManager { Element profiles = xmlDoc.createElement("profiles"); // Get DatasetProfiles from DMP to add to XML. - for (DatasetProfile datasetProfile : dmp.getAssociatedDmps()) { + for (DescriptionTemplate descriptionTemplate : dmp.getAssociatedDmps()) { Element profile = xmlDoc.createElement("profile"); Element profileId = xmlDoc.createElement("profileId"); - profileId.setTextContent(datasetProfile.getId().toString()); + profileId.setTextContent(descriptionTemplate.getId().toString()); profile.appendChild(profileId); Element profileGroupId = xmlDoc.createElement("profileGroupId"); - profileGroupId.setTextContent(datasetProfile.getGroupId().toString()); + profileGroupId.setTextContent(descriptionTemplate.getGroupId().toString()); profile.appendChild(profileGroupId); Element profileLabel = xmlDoc.createElement("profileLabel"); - profileLabel.setTextContent(datasetProfile.getLabel()); + profileLabel.setTextContent(descriptionTemplate.getLabel()); profile.appendChild(profileLabel); Element profileVersion = xmlDoc.createElement("profileVersion"); - profileVersion.setTextContent(String.valueOf(datasetProfile.getVersion())); + profileVersion.setTextContent(String.valueOf(descriptionTemplate.getVersion())); profile.appendChild(profileVersion); profiles.appendChild(profile); } @@ -1755,7 +1752,7 @@ public class DataManagementPlanManager { List associatedProfiles = new LinkedList<>(); if (profiles != null && profiles.length > 0) { for (String profile : profiles) { - DatasetProfile exProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(profile)); + DescriptionTemplate exProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(profile)); AssociatedProfile associatedProfile = new AssociatedProfile().fromData(exProfile); associatedProfiles.add(associatedProfile); } @@ -1763,7 +1760,7 @@ public class DataManagementPlanManager { for (AssociatedProfileImportModels a : dataManagementPlans.get(0).getProfilesImportModels()) { try { - DatasetProfile exProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(a.getId()); + DescriptionTemplate exProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(a.getId()); AssociatedProfile associatedProfile = new AssociatedProfile().fromData(exProfile); associatedProfiles.add(associatedProfile); } catch (Exception ignored) { diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java index 9cc087e02..85a3228e6 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java @@ -300,7 +300,7 @@ public class DatasetManager { dataset.setDatasetProfileDefinition(getPagedProfile(dataset, datasetEntity)); dataset.fromDataModel(datasetEntity); - // Creates the Criteria to get all version of DatasetProfile in question. + // Creates the Criteria to get all version of DescriptionTemplate in question. DatasetProfileCriteria profileCriteria = new DatasetProfileCriteria(); UUID profileId = datasetEntity.getProfile().getGroupId(); List uuidList = new LinkedList<>(); @@ -308,13 +308,13 @@ public class DatasetManager { profileCriteria.setGroupIds(uuidList); profileCriteria.setAllVersions(true); - List profileVersions = databaseRepository.getDatasetProfileDao().getWithCriteria(profileCriteria) + List profileVersions = databaseRepository.getDatasetProfileDao().getWithCriteria(profileCriteria) .orderBy(((builder, root) -> builder.desc(root.get("version")))) .toList(); - List profileVersionsIncluded = new LinkedList<>(); + List profileVersionsIncluded = new LinkedList<>(); // Iterate through the versions and remove those that are not included in the DMP of the dataset in question. - for (DatasetProfile version : profileVersions) { + for (DescriptionTemplate version : profileVersions) { for (AssociatedProfile p : dataset.getDmp().getProfiles()) { if (version.getId().toString().equals(p.getId().toString())) { profileVersionsIncluded.add(version); @@ -323,14 +323,14 @@ public class DatasetManager { } // Sort the list with the included Versions. - Stream sorted = profileVersionsIncluded.stream().sorted(Comparator.comparing(DatasetProfile::getVersion).reversed()); + Stream sorted = profileVersionsIncluded.stream().sorted(Comparator.comparing(DescriptionTemplate::getVersion).reversed()); // Make the Stream into List and get the first item. - List profiles = sorted.collect(Collectors.toList()); + List profiles = sorted.collect(Collectors.toList()); if (profiles.isEmpty()) throw new NoSuchElementException("No profiles found for the specific Dataset"); - DatasetProfile profile = profiles.get(0); + DescriptionTemplate profile = profiles.get(0); // Check if the dataset is on the latest Version. boolean latestVersion = profile.getVersion().toString().equals(datasetEntity.getProfile().getVersion().toString()); @@ -717,7 +717,7 @@ public class DatasetManager { public String checkDatasetValidation(Dataset dataset) throws Exception { List datasetProfileValidators = new LinkedList<>(); - DatasetProfile profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(dataset.getProfile().getId()); + DescriptionTemplate profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(dataset.getProfile().getId()); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(new ByteArrayInputStream(profile.getDefinition().getBytes())); @@ -975,9 +975,9 @@ public class DatasetManager { // Checks if XML datasetProfileId GroupId matches the one selected. try { - eu.eudat.data.entities.DatasetProfile importDatasetProfile = databaseRepository.getDatasetProfileDao().find(UUID.fromString(importModel.getDatasetProfileId())); - eu.eudat.data.entities.DatasetProfile latestVersionDatasetProfile = databaseRepository.getDatasetProfileDao().find(UUID.fromString(datasetProfileId)); - if (latestVersionDatasetProfile.getGroupId() != importDatasetProfile.getGroupId()) { + DescriptionTemplate importDescriptionTemplate = databaseRepository.getDatasetProfileDao().find(UUID.fromString(importModel.getDatasetProfileId())); + DescriptionTemplate latestVersionDescriptionTemplate = databaseRepository.getDatasetProfileDao().find(UUID.fromString(datasetProfileId)); + if (latestVersionDescriptionTemplate.getGroupId() != importDescriptionTemplate.getGroupId()) { throw new Exception(); } } catch (Exception e) { @@ -1010,7 +1010,7 @@ public class DatasetManager { entity.setStatus((short) 0); entity.setCreated(new Date()); entity.setModified(new Date()); - DatasetProfile profile = new DatasetProfile(); + DescriptionTemplate profile = new DescriptionTemplate(); profile.setId(UUID.fromString(datasetProfileId)); entity.setProfile(profile); @@ -1045,7 +1045,7 @@ public class DatasetManager { dataset.setDatasetProfileDefinition(getPagedProfile(dataset, datasetEntity)); dataset.fromDataModel(datasetEntity); - // Creates the Criteria to get all version of DatasetProfile in question. + // Creates the Criteria to get all version of DescriptionTemplate in question. DatasetProfileCriteria profileCriteria = new DatasetProfileCriteria(); UUID profileId = datasetEntity.getProfile().getGroupId(); List uuidList = new LinkedList<>(); @@ -1053,7 +1053,7 @@ public class DatasetManager { profileCriteria.setGroupIds(uuidList); // Gets the latest version of the datasetProfile. - eu.eudat.data.entities.DatasetProfile item = databaseRepository.getDatasetProfileDao().getWithCriteria(profileCriteria).getSingle(); + DescriptionTemplate item = databaseRepository.getDatasetProfileDao().getWithCriteria(profileCriteria).getSingle(); // Sets the latest version of dataet Profile to the Dataset in question. dataset.setDatasetProfileDefinition(getLatestDatasetProfile(datasetEntity, item)); @@ -1071,7 +1071,7 @@ public class DatasetManager { return dataset; } - public PagedDatasetProfile getLatestDatasetProfile(Dataset datasetEntity, DatasetProfile profile) { + public PagedDatasetProfile getLatestDatasetProfile(Dataset datasetEntity, DescriptionTemplate profile) { eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = userManager.generateDatasetProfileModel(profile); datasetprofile.setStatus(datasetEntity.getStatus()); if (datasetEntity.getProperties() != null) { @@ -1088,7 +1088,7 @@ public class DatasetManager { datasetProfileTableRequestItem.getCriteria().setFilter(DatasetProfileCriteria.DatasetProfileFilter.Datasets.getValue()); datasetProfileTableRequestItem.getCriteria().setUserId(principal.getId()); - QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(datasetProfileTableRequestItem.getCriteria()); + QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(datasetProfileTableRequestItem.getCriteria()); List listingModels = items.select(item -> new DatasetProfileListingModel().fromDataModel(item)); DataTableData data = new DataTableData<>(); @@ -1183,10 +1183,10 @@ public class DatasetManager { DatasetListingModel listingModel = new DatasetListingModel().fromDataModel(item); /*DatasetProfileCriteria criteria = new DatasetProfileCriteria(); criteria.setGroupIds(Collections.singletonList(item.getProfile().getGroupId())); - List profiles = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria).toList(); + List profiles = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria).toList(); boolean islast = false; if (!profiles.isEmpty()) { - profiles = profiles.stream().sorted(Comparator.comparing(DatasetProfile::getVersion)).collect(Collectors.toList()); + profiles = profiles.stream().sorted(Comparator.comparing(DescriptionTemplate::getVersion)).collect(Collectors.toList()); islast = profiles.get(0).getId().equals(item.getProfile().getId()); } listingModel.setProfileLatestVersion(islast);*/ diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java index 3786dddb2..faf184cf8 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java @@ -3,7 +3,7 @@ package eu.eudat.logic.managers; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; import eu.eudat.data.dao.criteria.DatasetProfileCriteria; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.data.entities.UserDatasetProfile; import eu.eudat.data.entities.UserInfo; import eu.eudat.data.query.items.item.datasetprofile.DatasetProfileAutocompleteRequest; @@ -82,11 +82,12 @@ public class DatasetProfileManager { @Transactional public eu.eudat.models.data.admin.composite.DatasetProfile getDatasetProfile(String id) { - eu.eudat.data.entities.DatasetProfile profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); + DescriptionTemplate profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile); datasetprofile.setLabel(profile.getLabel()); datasetprofile.setStatus(profile.getStatus()); datasetprofile.setDescription(profile.getDescription()); + datasetprofile.setType(profile.getType().getName()); datasetprofile.setLanguage(profile.getLanguage()); datasetprofile.setUsers(new ArrayList<>()); retrieveUsers(profile, datasetprofile); @@ -94,35 +95,35 @@ public class DatasetProfileManager { } public List getWithCriteria(DatasetProfileAutocompleteRequest datasetProfileAutocompleteRequest) throws IllegalAccessException, InstantiationException { - QueryableList items = databaseRepository.getDatasetProfileDao().getWithCriteria(datasetProfileAutocompleteRequest.getCriteria()); - QueryableList pagedItems = datasetProfileAutocompleteRequest.applyPaging(items); + QueryableList items = databaseRepository.getDatasetProfileDao().getWithCriteria(datasetProfileAutocompleteRequest.getCriteria()); + QueryableList pagedItems = datasetProfileAutocompleteRequest.applyPaging(items); List datasetProfiles = pagedItems.select(item -> new DatasetProfileAutocompleteItem().fromDataModel(item)); return datasetProfiles; } - public DatasetProfile clone(String id) { - DatasetProfile profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); + public DescriptionTemplate clone(String id) { + DescriptionTemplate profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); apiContext.getOperationsContext().getDatabaseRepository().detachEntity(profile); profile.setId(null); return profile; } public DataTableData getPaged(DatasetProfileTableRequestItem datasetProfileTableRequestItem, Principal principal) throws Exception { - QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(datasetProfileTableRequestItem.getCriteria()); - QueryableList authItems = null; + QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(datasetProfileTableRequestItem.getCriteria()); + QueryableList authItems = null; if (principal.getAuthz().contains(Authorities.ADMIN)) { authItems = items; } else if (principal.getAuthz().contains(Authorities.DATASET_PROFILE_MANAGER)) { List roles = Arrays.asList(0, 1); authItems = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getAuthenticated(items, principal.getId(), roles); } - QueryableList pagedItems = PaginationManager.applyPaging(authItems, datasetProfileTableRequestItem); + QueryableList pagedItems = PaginationManager.applyPaging(authItems, datasetProfileTableRequestItem); List datasetProfiles = pagedItems.select(item -> new DatasetProfileListingModel().fromDataModel(item)); return apiContext.getOperationsContext().getBuilderFactory().getBuilder(DataTableDataBuilder.class).data(datasetProfiles).totalCount(items.count()).build(); } public List getAll(DatasetProfileTableRequestItem tableRequestItem) throws IllegalAccessException, InstantiationException { - QueryableList items = databaseRepository.getDatasetProfileDao().getWithCriteria(tableRequestItem.getCriteria()); + QueryableList items = databaseRepository.getDatasetProfileDao().getWithCriteria(tableRequestItem.getCriteria()); List datasetProfiles = items.select(item -> new DatasetProfileListingModel().fromDataModel(item)); return datasetProfiles; @@ -276,36 +277,36 @@ public class DatasetProfileManager { return convFile; } - public eu.eudat.data.entities.DatasetProfile createNewVersionDatasetProfile(String id, eu.eudat.models.data.admin.composite.DatasetProfile profile) throws Exception { - // Getting the DatasetProfile which we will create its new version. - eu.eudat.data.entities.DatasetProfile oldDatasetProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); + public DescriptionTemplate createNewVersionDatasetProfile(String id, eu.eudat.models.data.admin.composite.DatasetProfile profile) throws Exception { + // Getting the DescriptionTemplate which we will create its new version. + DescriptionTemplate oldDescriptionTemplate = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); - // Getting the DatasetProfile with the latest Version. + // Getting the DescriptionTemplate with the latest Version. DatasetProfileCriteria criteria = new DatasetProfileCriteria(); LinkedList list = new LinkedList<>(); - list.push(oldDatasetProfile.getGroupId()); + list.push(oldDescriptionTemplate.getGroupId()); criteria.setGroupIds(list); criteria.setAllVersions(false); - QueryableList datasetProfileQueryableList = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria); - eu.eudat.data.entities.DatasetProfile latestVersionDatasetProfile = datasetProfileQueryableList.getSingle(); + QueryableList datasetProfileQueryableList = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria); + DescriptionTemplate latestVersionDescriptionTemplate = datasetProfileQueryableList.getSingle(); - if (latestVersionDatasetProfile.getVersion().equals(oldDatasetProfile.getVersion())){ + if (latestVersionDescriptionTemplate.getVersion().equals(oldDescriptionTemplate.getVersion())){ eu.eudat.models.data.admin.composite.DatasetProfile sortedProfile = profile.toShort(); - eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(sortedProfile, apiContext); -// modelDefinition.setLabel(oldDatasetProfile.getLabel()); - modelDefinition.setVersion((short) (oldDatasetProfile.getVersion() + 1)); - modelDefinition.setGroupId(oldDatasetProfile.getGroupId()); -// modelDefinition.setLanguage(oldDatasetProfile.getLanguage()); + DescriptionTemplate modelDefinition = AdminManager.generateViewStyleDefinition(sortedProfile, apiContext); +// modelDefinition.setLabel(oldDescriptionTemplate.getLabel()); + modelDefinition.setVersion((short) (oldDescriptionTemplate.getVersion() + 1)); + modelDefinition.setGroupId(oldDescriptionTemplate.getGroupId()); +// modelDefinition.setLanguage(oldDescriptionTemplate.getLanguage()); apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition); - eu.eudat.data.entities.DatasetProfile datasetProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition); - this.storeDatasetProfileUsers(datasetProfile, profile); + DescriptionTemplate descriptionTemplate = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition); + this.storeDatasetProfileUsers(descriptionTemplate, profile); return modelDefinition; } else { throw new DatasetProfileNewVersionException("Version to update not the latest."); } } - public void storeDatasetProfileUsers(DatasetProfile entity, eu.eudat.models.data.admin.composite.DatasetProfile model) { + public void storeDatasetProfileUsers(DescriptionTemplate entity, eu.eudat.models.data.admin.composite.DatasetProfile model) { if (model.getUsers() != null && !model.getUsers().isEmpty()) { if (entity.getUsers() == null) { entity.setUsers(new HashSet<>()); @@ -340,7 +341,7 @@ public class DatasetProfileManager { } @Transactional - public void retrieveUsers(DatasetProfile entity, eu.eudat.models.data.admin.composite.DatasetProfile model) { + public void retrieveUsers(DescriptionTemplate entity, eu.eudat.models.data.admin.composite.DatasetProfile model) { if (entity.getUsers() != null && !entity.getUsers().isEmpty()) { model.setUsers(entity.getUsers().stream().filter(userDatasetProfile -> userDatasetProfile.getRole() < 2).map(userDatasetProfile -> { UserInfoListingModel userInfoListingModel = new UserInfoListingModel(); @@ -381,10 +382,10 @@ public class DatasetProfileManager { } public void addSemanticsInDatasetProfiles() throws XPathExpressionException { - List ids = this.databaseRepository.getDatasetProfileDao().getAllIds(); - for(DatasetProfile dp: ids){ - DatasetProfile datasetProfile = this.databaseRepository.getDatasetProfileDao().find(dp.getId()); - Document document = XmlBuilder.fromXml(datasetProfile.getDefinition()); + List ids = this.databaseRepository.getDatasetProfileDao().getAllIds(); + for(DescriptionTemplate dp: ids){ + DescriptionTemplate descriptionTemplate = this.databaseRepository.getDatasetProfileDao().find(dp.getId()); + Document document = XmlBuilder.fromXml(descriptionTemplate.getDefinition()); XPathFactory xpathFactory = XPathFactory.newInstance(); XPath xpath = xpathFactory.newXPath(); XPathExpression expr = xpath.compile("//rdaCommonStandard"); @@ -402,15 +403,15 @@ public class DatasetProfileManager { fieldParent.insertBefore(schematics, rdaPropertyNode); fieldParent.removeChild(rdaPropertyNode); } - this.updateDatasetProfileXml(document, datasetProfile); + this.updateDatasetProfileXml(document, descriptionTemplate); } } public void addRdaInSemanticsInDatasetProfiles() throws XPathExpressionException { - List ids = this.databaseRepository.getDatasetProfileDao().getAllIds(); - for(DatasetProfile dp: ids){ - DatasetProfile datasetProfile = this.databaseRepository.getDatasetProfileDao().find(dp.getId()); - Document document = XmlBuilder.fromXml(datasetProfile.getDefinition()); + List ids = this.databaseRepository.getDatasetProfileDao().getAllIds(); + for(DescriptionTemplate dp: ids){ + DescriptionTemplate descriptionTemplate = this.databaseRepository.getDatasetProfileDao().find(dp.getId()); + Document document = XmlBuilder.fromXml(descriptionTemplate.getDefinition()); XPathFactory xpathFactory = XPathFactory.newInstance(); XPath xpath = xpathFactory.newXPath(); XPathExpression expr = xpath.compile("//schematic"); @@ -422,11 +423,11 @@ public class DatasetProfileManager { schematicNode.setTextContent("rda." + schematicRda); } } - this.updateDatasetProfileXml(document, datasetProfile); + this.updateDatasetProfileXml(document, descriptionTemplate); } } - private void updateDatasetProfileXml(Document document, DatasetProfile datasetProfile) { + private void updateDatasetProfileXml(Document document, DescriptionTemplate descriptionTemplate) { try { DOMSource domSource = new DOMSource(document); StringWriter writer = new StringWriter(); @@ -437,8 +438,8 @@ public class DatasetProfileManager { transformer.transform(domSource, result); String newDefinition = writer.toString(); if(newDefinition != null){ - datasetProfile.setDefinition(newDefinition); - this.databaseRepository.getDatasetProfileDao().createOrUpdate(datasetProfile); + descriptionTemplate.setDefinition(newDefinition); + this.databaseRepository.getDatasetProfileDao().createOrUpdate(descriptionTemplate); } } catch(TransformerException ex) { diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetWizardManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetWizardManager.java index c3c347bcb..20cb2dc9c 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetWizardManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetWizardManager.java @@ -5,7 +5,7 @@ import eu.eudat.data.dao.entities.DMPDao; import eu.eudat.data.dao.entities.DatasetProfileDao; import eu.eudat.data.entities.DMP; import eu.eudat.data.entities.Dataset; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.data.entities.UserInfo; import eu.eudat.data.query.items.item.dataset.DatasetWizardAutocompleteRequest; import eu.eudat.data.query.items.item.datasetprofile.DatasetProfileWizardAutocompleteRequest; @@ -41,11 +41,11 @@ public class DatasetWizardManager { } DatasetProfileCriteria criteria = new DatasetProfileCriteria(); criteria.setIds(dataManagementPlan.getProfiles().stream().map(AssociatedProfile::getId).collect(Collectors.toList())); - List datasetProfiles = profileDao.getWithCriteria(criteria).toList(); + List descriptionTemplates = profileDao.getWithCriteria(criteria).toList(); criteria.setIds(null); - criteria.setGroupIds(datasetProfiles.stream().map(DatasetProfile::getGroupId).collect(Collectors.toList())); - datasetProfiles = profileDao.getWithCriteria(criteria).toList(); - List profiles = datasetProfiles.stream().map(profile -> new AssociatedProfile().fromData(profile)).collect(Collectors.toList()); + criteria.setGroupIds(descriptionTemplates.stream().map(DescriptionTemplate::getGroupId).collect(Collectors.toList())); + descriptionTemplates = profileDao.getWithCriteria(criteria).toList(); + List profiles = descriptionTemplates.stream().map(profile -> new AssociatedProfile().fromData(profile)).collect(Collectors.toList()); return profiles; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java index b39aebd6d..ba691c1fc 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java @@ -1,7 +1,7 @@ package eu.eudat.logic.managers; import eu.eudat.data.dao.criteria.*; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.logic.services.ApiContext; import eu.eudat.types.MetricNames; import io.micrometer.prometheus.PrometheusMeterRegistry; @@ -33,8 +33,8 @@ public class MetricsManager { private final Map gauges; public static final Map datasetTemplateStatus = Stream.of(new Object[][] { - { DatasetProfile.Status.SAVED.getValue(), MetricNames.DRAFT }, - { DatasetProfile.Status.FINALIZED.getValue(), MetricNames.ACTIVE }, + { DescriptionTemplate.Status.SAVED.getValue(), MetricNames.DRAFT }, + { DescriptionTemplate.Status.FINALIZED.getValue(), MetricNames.ACTIVE }, }).collect(Collectors.toMap(data -> (Short) data[0], data -> (String) data[1])); public void increaseValue(String name, int amount, String label) { @@ -404,9 +404,9 @@ public class MetricsManager { criteria.setStatus(1); criteria.setAllVersions(false); if (countNexus) criteria.setPeriodStart(getNexusDate()); - List datasetProfiles = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria).withFields(Collections.singletonList("id")).toList(); + List descriptionTemplates = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria).withFields(Collections.singletonList("id")).toList(); DatasetCriteria datasetCriteria = new DatasetCriteria(); - datasetCriteria.setDatasetTemplates(datasetProfiles.stream().map(DatasetProfile::getId).collect(Collectors.toList())); + datasetCriteria.setDatasetTemplates(descriptionTemplates.stream().map(DescriptionTemplate::getId).collect(Collectors.toList())); return apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().getWithCriteria(datasetCriteria).select(root -> root.getProfile().getId()).stream().distinct().count(); } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PrefillingManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PrefillingManager.java index 81d5fe3e0..10aef32fa 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PrefillingManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PrefillingManager.java @@ -1,7 +1,7 @@ package eu.eudat.logic.managers; import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.logic.mapper.prefilling.PrefillingMapper; import eu.eudat.logic.proxy.config.ExternalUrlCriteria; import eu.eudat.logic.proxy.config.configloaders.ConfigLoader; @@ -51,8 +51,8 @@ public class PrefillingManager { PrefillingConfig prefillingConfig = configLoader.getExternalUrls().getPrefillings().get(configId); PrefillingGet prefillingGet = prefillingConfig.getPrefillingGet(); Map prefillingEntity = getSingle(prefillingGet.getUrl(), prefillId); - DatasetProfile datasetProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(profileId); - return PrefillingMapper.mapPrefilledEntityToDatasetWizard(prefillingEntity, prefillingGet, prefillingConfig.getType(), datasetProfile, datasetManager, licenseManager); + DescriptionTemplate descriptionTemplate = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(profileId); + return PrefillingMapper.mapPrefilledEntityToDatasetWizard(prefillingEntity, prefillingGet, prefillingConfig.getType(), descriptionTemplate, datasetManager, licenseManager); } private Map getSingle(String url, String id) { diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/UserManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/UserManager.java index 3820bdfa7..138730ef4 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/UserManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/UserManager.java @@ -3,13 +3,8 @@ package eu.eudat.logic.managers; import com.fasterxml.jackson.databind.ObjectMapper; import eu.eudat.data.dao.criteria.DataManagementPlanCriteria; import eu.eudat.data.dao.entities.UserInfoDao; -import eu.eudat.data.entities.Credential; -import eu.eudat.data.entities.DMP; -import eu.eudat.data.entities.UserInfo; -import eu.eudat.data.entities.UserRole; +import eu.eudat.data.entities.*; import eu.eudat.data.query.items.table.userinfo.UserInfoTableRequestItem; -import eu.eudat.exceptions.security.ExpiredTokenException; -import eu.eudat.exceptions.security.NonValidTokenException; import eu.eudat.exceptions.security.NullEmailException; import eu.eudat.exceptions.security.UnauthorisedException; import eu.eudat.logic.builders.entity.UserRoleBuilder; @@ -72,7 +67,7 @@ public class UserManager { this.environment = environment; } - public eu.eudat.models.data.user.composite.DatasetProfile generateDatasetProfileModel(eu.eudat.data.entities.DatasetProfile profile) { + public eu.eudat.models.data.user.composite.DatasetProfile generateDatasetProfileModel(DescriptionTemplate profile) { Document viewStyleDoc = XmlBuilder.fromXml(profile.getDefinition()); Element root = (Element) viewStyleDoc.getDocumentElement(); eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewstyle = new eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel().fromXml(root); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/elastic/DatasetTemplateMapper.java b/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/elastic/DatasetTemplateMapper.java index 6545bb32b..65cd3f598 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/elastic/DatasetTemplateMapper.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/elastic/DatasetTemplateMapper.java @@ -1,11 +1,11 @@ package eu.eudat.logic.mapper.elastic; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.elastic.entities.DatasetTempalate; public class DatasetTemplateMapper { - public static DatasetTempalate toElastic(DatasetProfile profile) { + public static DatasetTempalate toElastic(DescriptionTemplate profile) { DatasetTempalate elastic = new DatasetTempalate(); elastic.setId(profile.getId()); elastic.setName(profile.getLabel()); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/prefilling/PrefillingMapper.java b/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/prefilling/PrefillingMapper.java index 9efc1e713..cb5054938 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/prefilling/PrefillingMapper.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/prefilling/PrefillingMapper.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import eu.eudat.data.entities.Dataset; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.elastic.entities.Tag; import eu.eudat.logic.managers.DatasetManager; import eu.eudat.logic.managers.DatasetProfileManager; @@ -37,7 +37,7 @@ public class PrefillingMapper { private static final ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); public static DatasetWizardModel mapPrefilledEntityToDatasetWizard(Map prefilledEntity, PrefillingGet prefillingGet, String type, - DatasetProfile profile, DatasetManager datasetManager, LicenseManager licenseManager) throws Exception { + DescriptionTemplate profile, DatasetManager datasetManager, LicenseManager licenseManager) throws Exception { DatasetWizardModel datasetWizardModel = new DatasetWizardModel(); datasetWizardModel.setProfile(new DatasetProfileOverviewModel().fromDataModel(profile)); Dataset dataset = new Dataset(); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/datasetProfileModel/DatasetProfile.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/datasetProfileModel/DatasetProfile.java index 2ae1a2d34..a7d29e30e 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/datasetProfileModel/DatasetProfile.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/datasetProfileModel/DatasetProfile.java @@ -1,6 +1,8 @@ package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel; +import eu.eudat.data.entities.DescriptionTemplate; + import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -45,7 +47,7 @@ public class DatasetProfile { public eu.eudat.models.data.admin.composite.DatasetProfile toAdminCompositeModel(String label){ eu.eudat.models.data.admin.composite.DatasetProfile newDatasetEntityProfile = new eu.eudat.models.data.admin.composite.DatasetProfile(); newDatasetEntityProfile.setLabel(label); - newDatasetEntityProfile.setStatus(eu.eudat.data.entities.DatasetProfile.Status.SAVED.getValue()); + newDatasetEntityProfile.setStatus(DescriptionTemplate.Status.SAVED.getValue()); newDatasetEntityProfile.setDescription(description); newDatasetEntityProfile.setLanguage(language); List pagesDatasetEntity = new LinkedList<>(); diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetprofile/DatasetProfileAutocompleteItem.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetprofile/DatasetProfileAutocompleteItem.java index 34eac149e..e359c41b6 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetprofile/DatasetProfileAutocompleteItem.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetprofile/DatasetProfileAutocompleteItem.java @@ -1,12 +1,12 @@ package eu.eudat.models.data.datasetprofile; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.models.DataModel; import java.util.UUID; -public class DatasetProfileAutocompleteItem implements DataModel { +public class DatasetProfileAutocompleteItem implements DataModel { private UUID id; private String label; @@ -34,7 +34,7 @@ public class DatasetProfileAutocompleteItem implements DataModel { +public class DatasetProfileListingModel implements DataModel { private UUID id; private String label; @@ -66,7 +66,7 @@ public class DatasetProfileListingModel implements DataModel { +public class DatasetProfileOverviewModel implements DataModel { private UUID id; private String label; @@ -24,15 +24,15 @@ public class DatasetProfileOverviewModel implements DataModel { return this; } - public DatasetProfile toData() { - DatasetProfile profile = new DatasetProfile(); + public DescriptionTemplate toData() { + DescriptionTemplate profile = new DescriptionTemplate(); profile.setId(this.id); profile.setLabel(this.label); return profile; } - public AssociatedProfile fromData(DatasetProfile entity) { + public AssociatedProfile fromData(DescriptionTemplate entity) { this.id = entity.getId(); this.label = entity.getLabel(); return this; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlan.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlan.java index 6c4018f81..f86cea599 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlan.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlan.java @@ -9,7 +9,6 @@ import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue; import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DataManagementPlanProfile; import eu.eudat.models.data.funder.Funder; import eu.eudat.models.data.helpermodels.Tuple; -import eu.eudat.models.data.listingmodels.DatasetListingModel; import eu.eudat.models.data.listingmodels.UserInfoListingModel; import eu.eudat.models.data.grant.Grant; import eu.eudat.models.data.project.Project; @@ -259,8 +258,8 @@ public class DataManagementPlan implements DataModel { if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) { this.profiles = new LinkedList<>(); - for (DatasetProfile datasetProfile: entity.getAssociatedDmps()) { - AssociatedProfile associatedProfile = new AssociatedProfile().fromData(datasetProfile); + for (DescriptionTemplate descriptionTemplate : entity.getAssociatedDmps()) { + AssociatedProfile associatedProfile = new AssociatedProfile().fromData(descriptionTemplate); this.profiles.add(associatedProfile); } } @@ -321,11 +320,11 @@ public class DataManagementPlan implements DataModel { dataManagementPlanEntity.setProject(this.project.toDataModel()); } if (this.profiles != null) { - Set datasetProfiles = new HashSet<>(); + Set descriptionTemplates = new HashSet<>(); for (AssociatedProfile profile : this.profiles) { - datasetProfiles.add(profile.toData()); + descriptionTemplates.add(profile.toData()); } - dataManagementPlanEntity.setAssociatedDmps(datasetProfiles); + dataManagementPlanEntity.setAssociatedDmps(descriptionTemplates); } dataManagementPlanEntity.setProperties(this.properties != null ? JSONObject.toJSONString(this.properties) : null); dataManagementPlanEntity.setGroupId(this.groupId != null ? this.groupId : UUID.randomUUID()); @@ -366,8 +365,8 @@ public class DataManagementPlan implements DataModel { if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) { this.profiles = new LinkedList<>(); - for (DatasetProfile datasetProfile: entity.getAssociatedDmps()) { - AssociatedProfile associatedProfile = new AssociatedProfile().fromData(datasetProfile); + for (DescriptionTemplate descriptionTemplate : entity.getAssociatedDmps()) { + AssociatedProfile associatedProfile = new AssociatedProfile().fromData(descriptionTemplate); this.profiles.add(associatedProfile); } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlanEditorModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlanEditorModel.java index 1eca8b81c..fc1cd7f84 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlanEditorModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlanEditorModel.java @@ -8,7 +8,6 @@ import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue; import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DataManagementPlanProfile; import eu.eudat.models.data.funder.FunderDMPEditorModel; import eu.eudat.models.data.helpermodels.Tuple; -import eu.eudat.models.data.listingmodels.DatasetListingModel; import eu.eudat.models.data.listingmodels.UserInfoListingModel; import eu.eudat.models.data.grant.GrantDMPEditorModel; import eu.eudat.models.data.project.ProjectDMPEditorModel; @@ -250,8 +249,8 @@ public class DataManagementPlanEditorModel implements DataModel(); - for (DatasetProfile datasetProfile: entity.getAssociatedDmps()) { - AssociatedProfile associatedProfile = new AssociatedProfile().fromData(datasetProfile); + for (DescriptionTemplate descriptionTemplate : entity.getAssociatedDmps()) { + AssociatedProfile associatedProfile = new AssociatedProfile().fromData(descriptionTemplate); this.profiles.add(associatedProfile); } } @@ -359,11 +358,11 @@ public class DataManagementPlanEditorModel implements DataModel datasetProfiles = new HashSet<>(); + Set descriptionTemplates = new HashSet<>(); for (AssociatedProfile profile : this.profiles) { - datasetProfiles.add(profile.toData()); + descriptionTemplates.add(profile.toData()); } - dataManagementPlanEntity.setAssociatedDmps(datasetProfiles); + dataManagementPlanEntity.setAssociatedDmps(descriptionTemplates); } dataManagementPlanEntity.setProperties(this.properties != null ? JSONObject.toJSONString(this.properties) : null); dataManagementPlanEntity.setGroupId(this.groupId != null ? this.groupId : UUID.randomUUID()); diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanOverviewModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanOverviewModel.java index c207ab1fb..98d491343 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanOverviewModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanOverviewModel.java @@ -2,7 +2,7 @@ package eu.eudat.models.data.listingmodels; import eu.eudat.data.entities.DMP; import eu.eudat.data.entities.Dataset; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.models.DataModel; import eu.eudat.models.data.dataset.DatasetOverviewModel; import eu.eudat.models.data.dmp.AssociatedProfile; @@ -205,8 +205,8 @@ public class DataManagementPlanOverviewModel implements DataModel(); - for (DatasetProfile datasetProfile : entity.getAssociatedDmps()) { - AssociatedProfile associatedProfile = new AssociatedProfile().fromData(datasetProfile); + for (DescriptionTemplate descriptionTemplate : entity.getAssociatedDmps()) { + AssociatedProfile associatedProfile = new AssociatedProfile().fromData(descriptionTemplate); this.associatedProfiles.add(associatedProfile); } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/DatasetDescriptionQuickWizardModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/DatasetDescriptionQuickWizardModel.java index 5b3392689..1806e1eb7 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/DatasetDescriptionQuickWizardModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/DatasetDescriptionQuickWizardModel.java @@ -1,15 +1,13 @@ package eu.eudat.models.data.quickwizard; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel; import eu.eudat.models.data.dmp.DataManagementPlan; -import eu.eudat.data.entities.Dataset; import eu.eudat.models.data.datasetwizard.DatasetWizardModel; import eu.eudat.models.data.user.composite.PagedDatasetProfile; import java.util.Date; -import java.util.UUID; public class DatasetDescriptionQuickWizardModel extends PagedDatasetProfile { @@ -24,7 +22,7 @@ public class DatasetDescriptionQuickWizardModel extends PagedDatasetProfile { } - public DatasetWizardModel toDataModel(DataManagementPlan dmp, DatasetProfile profile){ + public DatasetWizardModel toDataModel(DataManagementPlan dmp, DescriptionTemplate profile){ DatasetWizardModel newDataset = new DatasetWizardModel(); newDataset.setLabel(datasetLabel); newDataset.setCreated(new Date()); diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/DmpQuickWizardModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/DmpQuickWizardModel.java index d67f9724b..427172351 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/DmpQuickWizardModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/DmpQuickWizardModel.java @@ -1,5 +1,6 @@ package eu.eudat.models.data.quickwizard; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.data.entities.Grant; import eu.eudat.data.entities.Project; import eu.eudat.models.data.dmp.AssociatedProfile; @@ -107,12 +108,12 @@ public class DmpQuickWizardModel { } - public eu.eudat.data.entities.DatasetProfile getDatasetProfile() { - eu.eudat.data.entities.DatasetProfile datasetProfile = new eu.eudat.data.entities.DatasetProfile(); - datasetProfile.setDefinition(this.datasetProfile.getLabel()); - datasetProfile.setLabel(this.datasetProfile.getLabel()); - datasetProfile.setId(this.datasetProfile.getId()); - return datasetProfile; + public DescriptionTemplate getDatasetProfile() { + DescriptionTemplate descriptionTemplate = new DescriptionTemplate(); + descriptionTemplate.setDefinition(this.datasetProfile.getLabel()); + descriptionTemplate.setLabel(this.datasetProfile.getLabel()); + descriptionTemplate.setId(this.datasetProfile.getId()); + return descriptionTemplate; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java index 4bcf83017..9beede1b5 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java @@ -2,7 +2,7 @@ package eu.eudat.models.rda.mapper; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.elastic.criteria.DatasetCriteria; import eu.eudat.elastic.entities.Tag; import eu.eudat.logic.managers.DatasetManager; @@ -268,12 +268,12 @@ public class DatasetRDAMapper { } - public eu.eudat.data.entities.Dataset toEntity(Dataset rda, DatasetProfile defaultProfile) { + public eu.eudat.data.entities.Dataset toEntity(Dataset rda, DescriptionTemplate defaultProfile) { eu.eudat.data.entities.Dataset entity = new eu.eudat.data.entities.Dataset(); entity.setLabel(rda.getTitle()); entity.setDescription(rda.getDescription()); try { - DatasetProfile profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(rda.getAdditionalProperties().get("template").toString())); + DescriptionTemplate profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(rda.getAdditionalProperties().get("template").toString())); entity.setProfile(profile); }catch(Exception e) { logger.warn(e.getMessage(), e); diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java index 2cf81d3bd..5272cc6cd 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java @@ -133,7 +133,7 @@ public class DmpRDAMapper { } if (profiles != null) { for (String profile : profiles) { - DatasetProfile exProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(profile)); + DescriptionTemplate exProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(profile)); entity.getAssociatedDmps().add(exProfile); } } @@ -143,7 +143,7 @@ public class DmpRDAMapper { entity.setCreated(rda.getCreated()); entity.setModified(rda.getModified()); entity.setDescription(rda.getDescription()); - DatasetProfile defaultProfile = ((DatasetProfile)entity.getAssociatedDmps().toArray()[0]); + DescriptionTemplate defaultProfile = ((DescriptionTemplate)entity.getAssociatedDmps().toArray()[0]); entity.setDataset(rda.getDataset().stream().map(rda1 -> datasetRDAMapper.toEntity(rda1, defaultProfile)).collect(Collectors.toSet())); if (rda.getProject().size() > 0) { Map result = ProjectRDAMapper.toEntity(rda.getProject().get(0), apiContext); @@ -159,7 +159,7 @@ public class DmpRDAMapper { return entity; } - private DatasetProfile getProfile(String id) { + private DescriptionTemplate getProfile(String id) { return apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().asQueryable().where(((builder, root) -> builder.equal(root.get("id"), UUID.fromString(id)))).getSingleOrDefault(); } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/managers/DatasetPublicManager.java b/dmp-backend/web/src/main/java/eu/eudat/publicapi/managers/DatasetPublicManager.java index e94db3db8..7e88973c0 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/managers/DatasetPublicManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/publicapi/managers/DatasetPublicManager.java @@ -1,6 +1,7 @@ package eu.eudat.publicapi.managers; import eu.eudat.data.entities.Dataset; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.data.query.definition.helpers.ColumnOrderings; import eu.eudat.elastic.criteria.DatasetCriteria; import eu.eudat.elastic.repository.DatasetRepository; @@ -139,10 +140,10 @@ public class DatasetPublicManager { DatasetPublicListingModel listingPublicModel = new DatasetPublicListingModel().fromDataModel(item); /*DatasetProfileCriteria criteria = new DatasetProfileCriteria(); criteria.setGroupIds(Collections.singletonList(item.getProfile().getGroupId())); - List profiles = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria).toList(); + List profiles = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria).toList(); boolean islast = false; if (!profiles.isEmpty()) { - profiles = profiles.stream().sorted(Comparator.comparing(DatasetProfile::getVersion)).collect(Collectors.toList()); + profiles = profiles.stream().sorted(Comparator.comparing(DescriptionTemplate::getVersion)).collect(Collectors.toList()); islast = profiles.get(0).getId().equals(item.getProfile().getId()); } listingModel.setProfileLatestVersion(islast);*/ @@ -162,7 +163,7 @@ public class DatasetPublicManager { return pagedDatasetProfile; } - private eu.eudat.models.data.user.composite.DatasetProfile generateDatasetProfileModel(eu.eudat.data.entities.DatasetProfile profile) { + private eu.eudat.models.data.user.composite.DatasetProfile generateDatasetProfileModel(DescriptionTemplate profile) { Document viewStyleDoc = XmlBuilder.fromXml(profile.getDefinition()); Element root = (Element) viewStyleDoc.getDocumentElement(); eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewstyle = new eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel().fromXml(root); diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/associatedprofile/AssociatedProfilePublicModel.java b/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/associatedprofile/AssociatedProfilePublicModel.java index 10edac3ca..d2783e56a 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/associatedprofile/AssociatedProfilePublicModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/associatedprofile/AssociatedProfilePublicModel.java @@ -1,6 +1,6 @@ package eu.eudat.publicapi.models.associatedprofile; -import eu.eudat.data.entities.DatasetProfile; +import eu.eudat.data.entities.DescriptionTemplate; import eu.eudat.logic.utilities.interfaces.XmlSerializable; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -42,14 +42,14 @@ public class AssociatedProfilePublicModel implements XmlSerializable { +public class DatasetProfilePublicModel implements DataModel { private UUID id; private String label; @@ -24,15 +24,15 @@ public class DatasetProfilePublicModel implements DataModel(); - for (DatasetProfile datasetProfile : entity.getAssociatedDmps()) { - AssociatedProfilePublicModel associatedProfile = new AssociatedProfilePublicModel().fromData(datasetProfile); + for (DescriptionTemplate descriptionTemplate : entity.getAssociatedDmps()) { + AssociatedProfilePublicModel associatedProfile = new AssociatedProfilePublicModel().fromData(descriptionTemplate); this.associatedProfiles.add(associatedProfile); } } @@ -217,7 +217,7 @@ public class DataManagementPlanPublicModel implements DataModel import('./ui/dataset/dataset.module').then(m => m.DatasetModule), data: { breadcrumb: true, - title: 'GENERAL.TITLES.DATASETS' + title: 'GENERAL.TITLES.DESCRIPTIONS' } }, { @@ -80,7 +80,7 @@ const appRoutes: Routes = [ loadChildren: () => import('./ui/admin/dmp-profile/dmp-profile.module').then(m => m.DmpProfileModule), data: { breadcrumb: true, - title: 'GENERAL.TITLES.DMP-PROFILES' + title: 'GENERAL.TITLES.DMP-BLUEPRINTS' } }, { diff --git a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts index 94e9ca3dc..b33a781c5 100644 --- a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts +++ b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts @@ -30,7 +30,7 @@ export class EnumUtils { case AppRole.Admin: return this.language.instant('TYPES.APP-ROLE.ADMIN'); case AppRole.User: return this.language.instant('TYPES.APP-ROLE.USER'); case AppRole.Manager: return this.language.instant('TYPES.APP-ROLE.MANAGER'); - case AppRole.DatasetTemplateEditor: return this.language.instant('TYPES.APP-ROLE.DATASET-TEMPLATE-EDITOR'); + case AppRole.DatasetTemplateEditor: return this.language.instant('TYPES.APP-ROLE.DESCRIPTION-TEMPLATE-EDITOR'); } } diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/listing/dataset-profile-listing.component.html b/dmp-frontend/src/app/ui/admin/dataset-profile/listing/dataset-profile-listing.component.html index c1036626b..adb990e47 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/listing/dataset-profile-listing.component.html +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/listing/dataset-profile-listing.component.html @@ -8,7 +8,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html index 795ff063d..18fa44347 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html @@ -22,7 +22,7 @@
- +
@@ -49,13 +49,13 @@
{{'DASHBOARD.EMPTY-LIST' | translate}}
- - + +
{{'DASHBOARD.EMPTY-LIST' | translate}}
@@ -69,7 +69,7 @@
0
{{'DASHBOARD.DMPS' | translate}}
0
- {{'DASHBOARD.DATASET-DESCRIPTIONS' | translate}} + {{'DASHBOARD.DESCRIPTIONS' | translate}}
0
{{'DASHBOARD.GRANTS' | translate}}
0
@@ -83,7 +83,7 @@ {{'DASHBOARD.DMPS' | translate}}
{{dashboardStatisticsData?.totalDataSetCount}}
- {{'DASHBOARD.DATASET-DESCRIPTIONS' | translate}} + {{'DASHBOARD.DESCRIPTIONS' | translate}}
{{dashboardStatisticsData?.totalGrantCount}}
{{'DASHBOARD.GRANTS' | translate}} @@ -147,7 +147,7 @@
{{'DASHBOARD.EMPTY-LIST' | translate}}
diff --git a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html index 752fe315a..47e21aab6 100644 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html +++ b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html @@ -26,7 +26,7 @@
-
{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}
+
{{'DATASET-LISTING.DESCRIPTION' | translate}}
{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | dateTimeCultureFormatter: "d MMMM y"}}
{{activity.label}}
@@ -50,7 +50,7 @@
-
{{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{ getDatasets(activity).length }}) +
{{'DMP-LISTING.CONTAINED-DESCRIPTIONS' | translate}}: ({{ getDatasets(activity).length }})
@@ -61,7 +61,7 @@
open_in_new{{'DMP-LISTING.ACTIONS.EXPORT' | translate}} - add{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}} + add{{'DMP-LISTING.ACTIONS.ADD-DESCRIPTION-SHORT' | translate}} group_add{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}} filter_none{{'DMP-LISTING.ACTIONS.CLONE' | translate}} library_books{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}} @@ -106,7 +106,7 @@
-
{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}
+
{{'DATASET-LISTING.DESCRIPTION' | translate}}
{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | dateTimeCultureFormatter: "d MMMM y"}}
{{'DATASET-LISTING.STATES.PUBLISHED' | translate}}: {{activity.publishedAt | dateTimeCultureFormatter: "d MMMM y"}}
@@ -132,7 +132,7 @@
-
{{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{ activity.datasets.length }}) +
{{'DMP-LISTING.CONTAINED-DESCRIPTIONS' | translate}}: ({{ activity.datasets.length }})
@@ -55,7 +55,7 @@
open_in_new{{'DMP-LISTING.ACTIONS.EXPORT' | translate}} - add{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}} + add{{'DMP-LISTING.ACTIONS.ADD-DESCRIPTION-SHORT' | translate}} group_add{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}} filter_none{{'DMP-LISTING.ACTIONS.CLONE' | translate}} library_books{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}} diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html index a33d78874..d6c8feb05 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html @@ -10,7 +10,7 @@
{{'DMP-EDITOR.TITLE.ADD-DATASET' | translate}}
-
{{'DMP-EDITOR.TITLE.EDIT-DATASET' | translate}}
+
{{'DMP-EDITOR.TITLE.EDIT-DESCRIPTION' | translate}}
{{ formGroup.get('label').value }} ({{'DMP-EDITOR.CHANGES' | translate}})
@@ -183,7 +183,7 @@
-

{{(isPublic ? 'GENERAL.TITLES.EXPLORE' : 'GENERAL.TITLES.DATASETS') | translate}}

+

{{(isPublic ? 'GENERAL.TITLES.EXPLORE' : 'GENERAL.TITLES.DESCRIPTIONS') | translate}}

diff --git a/dmp-frontend/src/app/ui/dataset/listing/listing-item/dataset-listing-item.component.html b/dmp-frontend/src/app/ui/dataset/listing/listing-item/dataset-listing-item.component.html index b5bea4415..a6ab5e51f 100644 --- a/dmp-frontend/src/app/ui/dataset/listing/listing-item/dataset-listing-item.component.html +++ b/dmp-frontend/src/app/ui/dataset/listing/listing-item/dataset-listing-item.component.html @@ -1,7 +1,7 @@
-
{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}
+
{{'DATASET-LISTING.DESCRIPTION' | translate}}
{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{dataset.modified | dateTimeCultureFormatter: "d MMMM y"}}
{{'DATASET-LISTING.STATES.PUBLISHED' | translate}}: {{dataset.dmpPublishedAt | dateTimeCultureFormatter: "d MMMM y"}}
@@ -27,7 +27,7 @@
+
diff --git a/dmp-frontend/src/app/ui/dmp/editor/dataset-info/dataset-info.component.html b/dmp-frontend/src/app/ui/dmp/editor/dataset-info/dataset-info.component.html index bd09b9352..491cb45f0 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dataset-info/dataset-info.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/dataset-info/dataset-info.component.html @@ -6,7 +6,7 @@
-
4.1 {{'DMP-EDITOR.STEPPER.DATASET-INFO' | translate}}*
+
4.1 {{'DMP-EDITOR.STEPPER.DESCRIPTION-INFO' | translate}}*
{{'DMP-EDITOR.DATASET-INFO.HINT' | translate}}
info {{'DMP-EDITOR.MAIN-INFO.TYPING' | translate}}
diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html index 37a0be5d1..0210e3819 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html @@ -76,8 +76,8 @@
  • {{'DMP-EDITOR.STEPPER.LICENSE-INFO' | translate}}
  • -
  • {{'DMP-EDITOR.STEPPER.DATASET-INFO' | translate}} (1)
  • -
  • {{'DMP-EDITOR.STEPPER.DATASET-INFO' | translate}} (done)
  • +
  • {{'DMP-EDITOR.STEPPER.DESCRIPTION-INFO' | translate}} (1)
  • +
  • {{'DMP-EDITOR.STEPPER.DESCRIPTION-INFO' | translate}} (done)
  • @@ -91,7 +91,7 @@ @@ -108,7 +108,7 @@
  • diff --git a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html index e83c9cb4d..495dc022a 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html +++ b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html @@ -17,7 +17,7 @@ . {{ 'DMP-LISTING.GRANT' | translate }}: {{dmp.grant}}
    -
    {{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{ dmp.datasets.length }}) +
    {{'DMP-LISTING.CONTAINED-DESCRIPTIONS' | translate}}: ({{ dmp.datasets.length }})
    @@ -29,7 +29,7 @@
    open_in_new{{'DMP-LISTING.ACTIONS.EXPORT' | translate}} - add{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}} + add{{'DMP-LISTING.ACTIONS.ADD-DESCRIPTION-SHORT' | translate}} group_add{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}} filter_none{{'DMP-LISTING.ACTIONS.CLONE' | translate}} library_books{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}} diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html index 0d69b4b3a..f64512914 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html @@ -87,7 +87,7 @@
    horizontal_rule
    -
    {{'DMP-OVERVIEW.DATASETS-USED' | translate}}
    +
    {{'DMP-OVERVIEW.DESCRIPTIONS-USED' | translate}}
    diff --git a/dmp-frontend/src/app/ui/dmp/wizard/listing/dmp-wizard-dataset-listing.component.html b/dmp-frontend/src/app/ui/dmp/wizard/listing/dmp-wizard-dataset-listing.component.html index b9e9cafb4..989e43042 100644 --- a/dmp-frontend/src/app/ui/dmp/wizard/listing/dmp-wizard-dataset-listing.component.html +++ b/dmp-frontend/src/app/ui/dmp/wizard/listing/dmp-wizard-dataset-listing.component.html @@ -1,6 +1,6 @@
    -
    {{'DATASET-LISTING.SELECT-DATASETS-TO-CLONE' | translate}} {{titlePrefix}}
    +
    {{'DATASET-LISTING.SELECT-DESCRIPTIONS-TO-CLONE' | translate}} {{titlePrefix}}
    @@ -10,6 +10,6 @@
    -
    {{'DATASET-LISTING.SELECT-DATASETS-NONE' | translate}}
    +
    {{'DATASET-LISTING.SELECT-DESCRIPTIONS-NONE' | translate}}
    diff --git a/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts b/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts index c417425b2..48bccf255 100644 --- a/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts +++ b/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts @@ -31,7 +31,7 @@ export const GENERAL_ROUTES: RouteInfo[] = [ ]; export const DMP_ROUTES: RouteInfo[] = [ { path: '/plans', title: 'SIDE-BAR.MY-DMPS', icon: 'library_books' }, - { path: '/datasets', title: 'SIDE-BAR.MY-DATASETS', icon: 'dns' }, + { path: '/datasets', title: 'SIDE-BAR.MY-DESCRIPTIONS', icon: 'dns' }, // { path: '/quick-wizard', title: 'SIDE-BAR.QUICK-WIZARD', icon: 'play_circle_outline' }, // { path: '/plans/new', title: 'SIDE-BAR.ADD-EXPERT', icon: 'playlist_add' } ]; @@ -51,15 +51,16 @@ export const PUBLIC_ROUTES: RouteInfo[] = [ // ]; export const ADMIN_ROUTES: RouteInfo[] = [ - { path: '/dmp-profiles', title: 'SIDE-BAR.DMP-TEMPLATES', icon: 'library_books' }, - { path: '/dataset-profiles', title: 'SIDE-BAR.DATASET-TEMPLATES', icon: 'library_books' }, + { path: '/dmp-profiles', title: 'SIDE-BAR.DMP-BLUEPRINTS', icon: 'library_books' }, + { path: '/dataset-profiles', title: 'SIDE-BAR.DESCRIPTION-TEMPLATES', icon: 'library_books' }, + { path: '/description-types', title: 'SIDE-BAR.DESCRIPTION-TEMPLATE-TYPES', icon: 'library_books' }, { path: '/users', title: 'SIDE-BAR.USERS', icon: 'people' }, { path: '/language-editor', title: 'SIDE-BAR.LANGUAGE-EDITOR', icon: 'language' }, { path: '/user-guide-editor', title: 'SIDE-BAR.GUIDE-EDITOR', icon: 'import_contacts' } ]; export const DATASET_TEMPLATE_ROUTES: RouteInfo[] = [ - { path: '/dataset-profiles', title: 'SIDE-BAR.DATASET-TEMPLATES', icon: 'library_books' } + { path: '/dataset-profiles', title: 'SIDE-BAR.DESCRIPTION-TEMPLATES', icon: 'library_books' } ]; export const INFO_ROUTES: RouteInfo[] = [ diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index a608c8ca0..228e900f1 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -28,6 +28,8 @@ "UNSUCCESSFUL-LOGIN": "Unsuccessful Login", "SUCCESSFUL-DATASET-PROFILE-DELETE": "Successful Delete", "UNSUCCESSFUL-DATASET-PROFILE-DELETE": "This template can not deleted, because Datasets are associated with it", + "SUCCESSFUL-DESCRIPTION-TEMPLATE-TYPE-DELETE": "Successful Delete", + "UNSUCCESSFUL-DESCRIPTION-TEMPLATE-TYPE-DELETE": "This type can not deleted, because Descriptions are associated with it", "SUCCESSFUL-DELETE": "Successful Delete", "UNSUCCESSFUL-DELETE": "Unsuccessful Delete", "UNSUCCESSFUL-EMAIL-SEND": "Failed sending email", @@ -133,12 +135,13 @@ "QUICK-WIZARD": "New DMP (Wizard)", "PLANS-NEW": "New DMP (Expert)", "DMP-NEW": "New DMP", - "DATASETS": "My Datasets", - "EXPLORE": "Published Datasets", + "DESCRIPTIONS": "My Descriptions", + "EXPLORE": "Published Descriptions", "DATASETCREATEWIZARD": "Add Dataset (Wizard)", "GRANTS": "My Grants", - "DMP-PROFILES": "DMP Templates", + "DMP-BLUEPRINTS": "DMP Blueprints", "DATASET-PROFILES": "Dataset Templates", + "DESCRIPTION-TYPES": "Description Types", "USERS": "Users", "PROFILE": "My Profile", "LOGIN": "Login", @@ -151,10 +154,12 @@ "DATASET-NEW": "New Dataset", "GRANT-NEW": "New Grant", "GRANT-EDIT": "View/Edit Grant", - "DMP-PROFILE-NEW": "New DMP Template", - "DMP-PROFILE-EDIT": "Edit DMP Template", + "DMP-BLUEPRINT-NEW": "New DMP Blueprint", + "DMP-BLUEPRINT-EDIT": "Edit DMP Blueprint", "DATASET-PROFILES-NEW": "New Dataset Template", "DATASET-PROFILES-EDIT": "Edit Dataset Template", + "DESCRIPTION-TYPE-NEW": "New Description Type", + "DESCRIPTION-TYPE-EDIT": "Edit Description Type", "EXPLORE-PLANS-OVERVIEW": "Published DMP Overview", "DATASET-PUBLIC-EDIT": "View Published Dataset", "DMP-PUBLIC-EDIT": "View Published DMP", @@ -219,11 +224,11 @@ "DMPS": "DMPs", "MY-DMPS": "MY DMPs", "DATASETS": "Datasets", - "DATASET": "Dataset", + "DESCRIPTION": "Description", "PUBLIC-DATASETS": "Explore {{ APP_NAME_CAPS }}", "USERS": "Users", "DATASETS-ADMIN": "Dataset Templates", - "DMP-PROFILES": "DMP Templates", + "DMP-BLUEPRINTS": "DMP Blueprints", "ABOUT": "About", "MY-DATASET-DESCRIPTIONS": "MY DATASETS", "DATASET-DESCRIPTION-WIZARD": "Dataset wizard", @@ -233,7 +238,7 @@ "DMP-WIZARD": "DMP Wizard", "DATASET-TEMPLATES": "DATASET TEMPLATES", "TEMPLATE": "TEMPLATE", - "DMP-TEMPLATES": "DMP TEMPLATES", + "DMP-BLUEPRINTS-CAPS": "DMP BLUEPRINTS", "USERS-BREADCRUMB": "USERS", "START-NEW-DMP": "Start new DMP", "START-NEW-DMP-TXT": "Start fresh or continue work in {{ APP_NAME }}! Create a new DMP or upload an existing DMP to {{ APP_NAME }}", @@ -259,18 +264,19 @@ "QUICK-WIZARD-DATASET": "Add Dataset (Wizard)", "ADD-EXPERT": "New DMP (Expert)", "MY-DATASET-DESC": "My Dataset Desc.", - "MY-DATASETS": "My Datasets", + "MY-DESCRIPTIONS": "My Descriptions", "MY-GRANTS": "My Grants", "HISTORY": "HISTORY", "HISTORY-VISITED": "LAST VISITED", "HISTORY-EDITED": "LAST EDITED", "PUBLIC": "PUBLISHED", "PUBLIC-DMPS": "Public DMPs", - "PUBLIC-DESC": "Public Dataset Desc.", + "PUBLIC-DESC": "Public Descriptions", "ACCOUNT": "ACCOUNT", "ADMIN": "ADMIN", - "DATASET-TEMPLATES": "Dataset Templates", - "DMP-TEMPLATES": "DMP Templates", + "DESCRIPTION-TEMPLATES": "Description Templates", + "DESCRIPTION-TEMPLATE-TYPES": "Description Types", + "DMP-BLUEPRINTS": "DMP Blueprints", "USERS": "Users", "LANGUAGE-EDITOR": "Language Editor", "GUIDE-EDITOR": "User Guide Editor", @@ -281,23 +287,25 @@ "DATASET-PROFILE-EDITOR": { "TITLE": { "NEW": "New API Client", - "NEW-PROFILE": "New Dataset Template", + "NEW-PROFILE": "New Description Template", "NEW-PROFILE-VERSION": "New Version Of ", "NEW-PROFILE-CLONE": "New Clone Of " }, "FIELDS": { - "DATASET-TITLE": "Dataset Template Name", + "DATASET-TITLE": "Description Template Name", "DATASET-DESCRIPTION": "Description", "ROLES": "Roles" }, "STEPS": { "GENERAL-INFO": { "TITLE": "General Info", - "DATASET-TEMPLATE-NAME": "Dataset template name", - "DATASET-TEMPLATE-NAME-HINT": "A title that determines the Dataset template.", + "DATASET-TEMPLATE-NAME": "Description template name", + "DATASET-TEMPLATE-NAME-HINT": "A title that determines the Description template.", "DATASET-TEMPLATE-DESCRIPTION": "Description", "DATASET-TEMPLATE-DESCRIPTION-HINT": "A brief description of what the Dataset is about, it's scope and objectives.", - "DATASET-TEMPLATE-LANGUAGE": "Dataset template language", + "DESCRIPTION-TEMPLATE-TYPE": "Description template type", + "DESCRIPTION-TEMPLATE-SELECT-TYPE": "Select a type", + "DATASET-TEMPLATE-LANGUAGE": "Description template language", "DATASET-TEMPLATE-SELECT-LANGUAGE": "Select a language", "DATASET-TEMPLATE-USERS": "Editors", "DATASET-TEMPLATE-USERS-HINT": "Add editors and save changes to notify them.", @@ -314,7 +322,7 @@ }, "PAGE-INFO": { "PAGE-NAME": "Chapter Name", - "PAGE-NAME-HINT": "Set a name for the dataset chapter.", + "PAGE-NAME-HINT": "Set a name for the desciption chapter.", "PAGE-DESCRIPTION": "Description", "PAGE-DESCRIPTION-HINT": "Write a brief desciption of what the chapter is about.", "ACTIONS": { @@ -615,7 +623,7 @@ "FINALIZED": "Finalized", "PUBLISHED": "Published", "VERSION": "Version", - "CONTAINED-DATASETS": "Contained Datasets", + "CONTAINED-DESCRIPTIONS": "Contained Descriptions", "TEXT-INFO": "Information in a DMP show how datasets have been collected and/or generated, how they have been processed and analysed, i.e. using which tools, standards, methodologies etc, but also where and how datasets are backed up, published and preserved, including any costs associated with personnel dedicated for data curation/ stewardship activities or costs for acquiring or building data management services.", "TEXT-INFO-QUESTION": "Not sure how a DMP looks in practice? Browse Public DMPs and", "LINK-ZENODO": "LIBER community in Zenodo", @@ -642,8 +650,7 @@ "INVITE-AUTHORS": "Invite authors", "INVITE-SHORT": "Invite", "ADD-DATASET": "Add Dataset To DMP", - "ADD-DATASET-DESCRIPTION": "Add dataset", - "ADD-DATASET-SHORT": "Add Dataset", + "ADD-DESCRIPTION-SHORT": "Add Description", "DATASETS": "List All DMP Datasets", "NEW-VERSION": "New Version", "START-NEW-VERSION": "Start New Version", @@ -745,7 +752,7 @@ "DOWNLOAD-PDF": "Download PDF", "DOWNLOAD-XML": "Download XML", "DOWNLOAD-DOCX": "Download DOCX", - "COPY-DATASET": "Copy Dataset", + "COPY-DESCRIPTION": "Copy Description", "UPDATE-DATASET-PROFILE": "Update Template", "VALIDATE":"Validate", "UNDO-FINALIZATION-QUESTION" :"Undo finalization?", @@ -794,7 +801,7 @@ "GRANT": "Grant", "DMP-AUTHORS": "DΜP Authors", "RESEARCHERS": "Researchers", - "DATASETS-USED": "Datasets used", + "DESCRIPTIONS-USED": "Descriptions used", "COLLABORATORS": "Collaborators", "PUBLIC": "Public", "PRIVATE": "Private", @@ -829,7 +836,7 @@ } }, "DATASET-OVERVIEW": { - "DATASET-AUTHORS": "Dataset authors", + "DESCRIPTION-AUTHORS": "Description authors", "ERROR": { "DELETED-DATASET": "The requested dataset is deleted", "FORBIDEN-DATASET": "You are not allowed to access this dataset" @@ -846,9 +853,9 @@ }, "DATASET-LISTING": { "TITLE": "Datasets", - "DATASET-DESCRIPTION": "Dataset", - "SELECT-DATASETS-TO-CLONE": "Select which datasets to include in the new DMP. Selected datasets will be editable.", - "SELECT-DATASETS-NONE": "Not available Datasets for this DMP.", + "DESCRIPTION": "Description", + "SELECT-DESCRIPTIONS-TO-CLONE": "Select which descriptions to include in the new DMP. Selected descriptions will be editable.", + "SELECT-DESCRIPTIONS-NONE": "Not available Descriptions for this DMP.", "TEXT-INFO": "Datasets are documented following pre-defined templates which set the content of dataset descriptions. In {{ APP_NAME }}, a DMP can contain as many dataset descriptions as the datasets it documents. Browse ", "TEXT-INFO-REST": " for a look at datasets described in {{ APP_NAME }} DMPs", "LINK-PUBLIC-DATASETS": "Public Datasets", @@ -913,7 +920,7 @@ "EMPTY-LIST": "Nothing here yet." }, "DATASET-PROFILE-LISTING": { - "TITLE": "Dataset Templates", + "TITLE": "Description Templates", "COLUMNS": { "NAME": "Name", "REFERNCE": "Reference", @@ -941,9 +948,20 @@ "CLONE": "Clone", "NEW-VERSION": "New Version", "NEW-VERSION-FROM-FILE": "New Version from File", - "VIEW-VERSIONS": "All Dataset Template Versions", + "VIEW-VERSIONS": "All Description Template Versions", "DELETE": "Delete", - "CREATE-DATASET-TEMPLATE": "Create Dataset Template" + "CREATE-DESCRIPTION-TEMPLATE": "Create Description Template" + } + }, + "DESCRIPTION-TYPES-LISTING": { + "TITLE": "Description Types", + "CREATE-TYPE": "Create Description Type", + "COLUMNS": { + "NAME": "Name", + "STATUS": "Status" + }, + "ACTIONS": { + "DELETE": "Delete" } }, "DATASET-UPLOAD": { @@ -962,9 +980,19 @@ "UNSUCCESSFUL": "Something went wrong" } }, + "DESCRIPTION-TYPE-EDITOR": { + "NEW": "New Description Type", + "FIELDS": { + "LABEL": "Name" + }, + "ACTIONS": { + "SAVE": "Save", + "CANCEL": "Cancel" + } + }, "DMP-PROFILE-EDITOR": { "TITLE": { - "NEW": "New DMP Template", + "NEW": "New DMP Blueprint", "EDIT": "Edit" }, "FIELDS": { @@ -1024,7 +1052,7 @@ "EDIT": "Edit", "EDIT-DMP": "Editing DMP", "ADD-DATASET": "Adding dataset", - "EDIT-DATASET": "Editing Dataset", + "EDIT-DESCRIPTION": "Editing Description", "CLONE-DMP": "Clone", "NEW-VERSION": "New Version", "CREATE-DATASET": "Creating Dataset", @@ -1044,7 +1072,7 @@ "TEMPLATES": "Templates", "TEMPLATE": "DMP Template", "DATASET-TEMPLATES": "Related Dataset Templates", - "SELECT-TEMPLATE": "Select a template to describe your dataset", + "SELECT-TEMPLATE": "Select a template to describe your descriptions", "PROFILE": "DMP Template", "PROJECT": "Project", "GRANT": "Grant", @@ -1065,7 +1093,7 @@ "PUBLICATION": "Publication Date", "CONTACT": "Contact", "COST": "Costs", - "DATASETS": "Datasets" + "DESCRIPTIONS": "Descriptions" }, "ACTIONS": { "GO-TO-GRANT": "Go To DMP Grant", @@ -1094,9 +1122,9 @@ "SUCCESSFUL-DOI": "Successful DOI creation", "UNSUCCESSFUL-FINALIZE": "Unsuccessful DMP finalization" }, - "DATASET-TEMPLATE-LIST": { - "TITLE": "Available Dataset Templates", - "TEXT": "Dataset Profiles selected: ", + "DESCRIPTION-TEMPLATE-LIST": { + "TITLE": "Available Description Templates", + "TEXT": "Descriptions selected: ", "OK": "OK" }, "VISIBILITY": { @@ -1108,7 +1136,7 @@ "MAIN-INFO": "Main info", "FUNDING-INFO": "Funding", "DATASET-SELECTION": "Dataset selection", - "DATASET-INFO": "Dataset info", + "DESCRIPTION-INFO": "Description info", "LICENSE-INFO": "License", "DATASET": "Dataset", "PREVIOUS": "Previous", @@ -1138,7 +1166,7 @@ "INTRO": "A DMP in {{ APP_NAME }} consists of key information about research, such as purpose, objectives and researchers involved, but also about documentation of research datasets that highlight the steps followed and the means used across data management activities.", "SECOND-INTRO": "Datasets are documented following pre-defined templates which set the content of dataset descriptions. In {{ APP_NAME }}, a DMP can contain as many dataset descriptions as the datasets it documents.", "FIND": "Couldn't find a suitable one?", - "HINT": "Select a template to describe your datasets. You may select more than one template." + "HINT": "Select a template to describe your descriptions. You may select more than one template." }, "LICENSE-INFO": { "INTRO": "Each DMP can contain specific license informatation over how much open and available it is, that way you can determine who can see your dataset and for how long that data will be private", @@ -1160,8 +1188,8 @@ } }, "DMP-PROFILE-LISTING": { - "TITLE": "DMP Templates", - "CREATE-DMP-TEMPLATE": "Create DMP Template", + "TITLE": "DMP Blueprints", + "CREATE-DMP-BLUEPRINT": "Create DMP Blueprint", "COLUMNS": { "NAME": "Name", "STATUS": "Status", @@ -1218,8 +1246,8 @@ "NONE": "-", "TAGS": "Tags", "SELECT-TAGS": "Select Tags", - "LIKE": "Search Datasets", - "DRAFT-LIKE": "Search Draft Datasets", + "LIKE": "Search Descriptions", + "DRAFT-LIKE": "Search Draft Descriptions", "SELECT-GRANTS": "Select Grants", "ROLE": "Role", "ORGANIZATION": "Organization", @@ -1255,12 +1283,12 @@ "TITLE": { "NEW": "New Data Management Plan", "EDIT": "Edit", - "INTRO": "You are using the Dataset editor. Answer here questions that describe your data management activities.", - "INTRO-TIP": "Tip: Add new datasets to describe different types of data or disciplinary data to avoid mixing information." + "INTRO": "You are using the Description editor. Answer here questions that describe your data management activities.", + "INTRO-TIP": "Tip: Add new descriptions to describe different types of data or disciplinary data to avoid mixing information." }, "FIELDS": { "NAME": "Name of the Dataset", - "TITLE": "Title of Dataset", + "TITLE": "Title of Description", "DESCRIPTION": "Description", "PROFILE": "Template", "URI": "Uri", @@ -1298,7 +1326,7 @@ "EXTERNAL-LINK": "Provide an external URL link" }, "HINT": { - "DESCRIPTION": "Briefly describe the context and purpose of the Dataset", + "DESCRIPTION": "Briefly describe the context and purpose of the Description", "TITLE": "A brief description of what the ", "TITLE-REST": " is about it’s scope and objectives." }, @@ -1370,7 +1398,7 @@ "ADMIN": "Admin", "USER": "User", "MANAGER": "Manager", - "DATASET-TEMPLATE-EDITOR": "Dataset Template Editor" + "DESCRIPTION-TEMPLATE-EDITOR": "Description Template Editor" }, "DMP-PROFILE-FIELD": { "DATA-TYPE": { @@ -1648,7 +1676,7 @@ "DATA-MANAGEMENT-PLANS": "DATA MANAGEMENT PLANS", "PERSONAL-USAGE": "Personal Usage", "PUBLIC-USAGE": "Public Usage", - "DATASET-DESCRIPTIONS": "Datasets", + "DESCRIPTIONS": "Descriptions", "DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Datasets", "PUBLIC-DMPS": "Public DMPs", "PUBLIC-DATASETS": "Public Datasets", @@ -1661,8 +1689,7 @@ "DMP-ABOUT-END": ", that highlight the steps followed and the means used across data management activities.", "SELECT-DMP": "Select a DMP for your Dataset", "ACTIONS": { - "ADD-DATASET-DESCRIPTION": "Add Dataset", - "ADD-DATASET": "Add Dataset", + "ADD-DESCRIPTION": "Add Description", "ADD-DMP-DESCRIPTION": "Add DMP Description" }, "TOUR-GUIDE": { @@ -1693,7 +1720,7 @@ }, "UNLINK-ACCOUNT": { "TITLE": "Verify account to be unlinked", - "MESSAGE": "An email to verify this action has been sent to you. Once accepted, {{accountToBeUnlinked}} will be no longer connected to your current ARGOS profile." + "MESSAGE": "An email to verify this action has been sent to your main account. Once accepted, {{accountToBeUnlinked}} will be no longer connected to your current ARGOS profile." }, "UNLINK-ACCOUNT-DIALOG": { "MESSAGE": "By clicking \"Confirm\", you accept the transfer of your ARGOS activity performed from this account to your main ARGOS account, which is the one that is listed first. By logging in again with the unlinked account, you will be able to start your ARGOS experience from scratch, in an empty dashboard.",