Add Dmp Index (ref #252), compacted Dmp Listing so now both the user and the public listing will use one component (ref #253) and refactor operation context

This commit is contained in:
George Kalampokis 2020-04-01 18:16:06 +03:00
parent 8ca2b912d4
commit dcede0b1eb
39 changed files with 1205 additions and 144 deletions

View File

@ -1,7 +1,6 @@
package eu.eudat.data.dao.criteria; package eu.eudat.data.dao.criteria;
import eu.eudat.data.entities.DMP; import eu.eudat.data.entities.DMP;
import eu.eudat.data.entities.Grant; import eu.eudat.data.entities.Grant;
import java.util.Date; import java.util.Date;
@ -20,6 +19,8 @@ public class DataManagementPlanCriteria extends Criteria<DMP> {
private List<UUID> collaborators; private List<UUID> collaborators;
private List<UUID> datasetTemplates; private List<UUID> datasetTemplates;
private boolean isPublic; private boolean isPublic;
private boolean onlyPublic;
private Short grantStatus;
public Date getPeriodStart() { public Date getPeriodStart() {
return periodStart; return periodStart;
@ -97,4 +98,20 @@ public class DataManagementPlanCriteria extends Criteria<DMP> {
public void setIsPublic(boolean isPublic) { public void setIsPublic(boolean isPublic) {
this.isPublic = isPublic; this.isPublic = isPublic;
} }
public boolean isOnlyPublic() {
return onlyPublic;
}
public void setOnlyPublic(boolean onlyPublic) {
this.onlyPublic = onlyPublic;
}
public Short getGrantStatus() {
return grantStatus;
}
public void setGrantStatus(Short grantStatus) {
this.grantStatus = grantStatus;
}
} }

View File

@ -9,6 +9,7 @@ import eu.eudat.data.entities.UserInfo;
import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType; import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField; import eu.eudat.queryable.types.SelectionField;
import eu.eudat.types.grant.GrantStateType;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -16,6 +17,7 @@ import org.springframework.stereotype.Component;
import javax.persistence.criteria.Join; import javax.persistence.criteria.Join;
import javax.persistence.criteria.JoinType; import javax.persistence.criteria.JoinType;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -73,6 +75,14 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
if (criteria.getDatasetTemplates() != null && !criteria.getDatasetTemplates().isEmpty()) { if (criteria.getDatasetTemplates() != null && !criteria.getDatasetTemplates().isEmpty()) {
query.where((builder, root) -> root.join("associatedDmps", JoinType.LEFT).get("id").in(criteria.getDatasetTemplates())); query.where((builder, root) -> root.join("associatedDmps", JoinType.LEFT).get("id").in(criteria.getDatasetTemplates()));
} }
if (criteria.getGrantStatus() != null) {
if (criteria.getGrantStatus().equals(GrantStateType.FINISHED.getValue().shortValue()))
query.where((builder, root) -> builder.lessThan(root.get("grant").get("enddate"), new Date()));
if (criteria.getGrantStatus().equals(GrantStateType.ONGOING.getValue().shortValue()))
query.where((builder, root) ->
builder.or(builder.greaterThan(root.get("grant").get("enddate"), new Date())
, builder.isNull(root.get("grant").get("enddate"))));
}
query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue())); query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue()));
return query; return query;
} }

View File

@ -0,0 +1,97 @@
package eu.eudat.elastic.criteria;
import java.util.List;
import java.util.UUID;
public class DmpCriteria extends Criteria {
private String like;
private Short status;
private List<UUID> templates;
private List<UUID> grants;
private List<UUID> collaborators;
private List<UUID> organizations;
private boolean isPublic;
private List<UUID> groupIds;
private boolean allowAllVersions;
private Short grantStatus;
public String getLike() {
return like;
}
public void setLike(String like) {
this.like = like;
}
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
public List<UUID> getTemplates() {
return templates;
}
public void setTemplates(List<UUID> templates) {
this.templates = templates;
}
public List<UUID> getGrants() {
return grants;
}
public void setGrants(List<UUID> grants) {
this.grants = grants;
}
public List<UUID> getCollaborators() {
return collaborators;
}
public void setCollaborators(List<UUID> collaborators) {
this.collaborators = collaborators;
}
public List<UUID> getOrganizations() {
return organizations;
}
public void setOrganizations(List<UUID> organizations) {
this.organizations = organizations;
}
public boolean isPublic() {
return isPublic;
}
public void setPublic(boolean aPublic) {
isPublic = aPublic;
}
public List<UUID> getGroupIds() {
return groupIds;
}
public void setGroupIds(List<UUID> groupIds) {
this.groupIds = groupIds;
}
public boolean isAllowAllVersions() {
return allowAllVersions;
}
public void setAllowAllVersions(boolean allowAllVersions) {
this.allowAllVersions = allowAllVersions;
}
public Short getGrantStatus() {
return grantStatus;
}
public void setGrantStatus(Short grantStatus) {
this.grantStatus = grantStatus;
}
}

View File

@ -0,0 +1,44 @@
package eu.eudat.elastic.entities;
import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.Map;
import java.util.UUID;
public class DatasetTempalate implements ElasticEntity<DatasetTempalate> {
private UUID id;
private String name;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
builder.startObject();
builder.field("id", this.id.toString());
builder.field("name", this.name);
builder.endObject();
return builder;
}
@Override
public DatasetTempalate fromElasticEntity(Map<String, Object> fields) {
this.id = UUID.fromString((String) fields.get("id"));
this.name = (String) fields.get("name");
return this;
}
}

View File

@ -0,0 +1,285 @@
package eu.eudat.elastic.entities;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
public class Dmp implements ElasticEntity<Dmp> {
private static final Logger logger = LoggerFactory.getLogger(Dmp.class);
public enum DMPStatus {
ACTIVE((short) 0), FINALISED((short) 1),DELETED((short) 99);
private short value;
private DMPStatus(short value) {
this.value = value;
}
public short getValue() {
return value;
}
public static DMPStatus fromInteger(short value) {
switch (value) {
case 0:
return ACTIVE;
case 1:
return FINALISED;
case 99:
return DELETED;
default:
throw new RuntimeException("Unsupported DMP Status");
}
}
}
private UUID id;
private String label;
private String description;
private UUID groupId;
private Short status;
private List<DatasetTempalate> templates;
private List<Collaborator> collaborators;
private List<Organization> organizations;
private Boolean lastVersion;
private Boolean lastPublicVersion;
private Boolean isPublic;
private List<Dataset> datasets;
private UUID grant;
private Short grantStatus;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public UUID getGroupId() {
return groupId;
}
public void setGroupId(UUID groupId) {
this.groupId = groupId;
}
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
public List<DatasetTempalate> getTemplates() {
return templates;
}
public void setTemplates(List<DatasetTempalate> templates) {
this.templates = templates;
}
public List<Collaborator> getCollaborators() {
return collaborators;
}
public void setCollaborators(List<Collaborator> collaborators) {
this.collaborators = collaborators;
}
public List<Organization> getOrganizations() {
return organizations;
}
public void setOrganizations(List<Organization> organizations) {
this.organizations = organizations;
}
public Boolean getLastVersion() {
return lastVersion;
}
public void setLastVersion(Boolean lastVersion) {
this.lastVersion = lastVersion;
}
public Boolean getLastPublicVersion() {
return lastPublicVersion;
}
public void setLastPublicVersion(Boolean lastPublicVersion) {
this.lastPublicVersion = lastPublicVersion;
}
public Boolean getPublic() {
return isPublic;
}
public void setPublic(Boolean aPublic) {
isPublic = aPublic;
}
public List<Dataset> getDatasets() {
return datasets;
}
public void setDatasets(List<Dataset> datasets) {
this.datasets = datasets;
}
public UUID getGrant() {
return grant;
}
public void setGrant(UUID grant) {
this.grant = grant;
}
public Short getGrantStatus() {
return grantStatus;
}
public void setGrantStatus(Short grantStatus) {
this.grantStatus = grantStatus;
}
@Override
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
builder.startObject();
builder.field(MapKey.ID.getName(), this.id.toString());
builder.field(MapKey.LABEL.getName(), this.label);
builder.field(MapKey.DESCRIPTION.getName(), this.description);
builder.field(MapKey.GROUPID.getName(), this.groupId.toString());
builder.field(MapKey.STATUS.getName(), this.status);
if (this.templates != null) {
builder.startArray(MapKey.TEMPLATES.getName());
this.templates.forEach(template -> {
try {
template.toElasticEntity(builder);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
});
builder.endArray();
}
if (this.collaborators != null) {
builder.startArray(MapKey.COLLABORATORS.getName());
this.collaborators.forEach(collaborator -> {
try {
collaborator.toElasticEntity(builder);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
});
builder.endArray();
}
if (this.organizations != null) {
builder.startArray(MapKey.ORGANIZATIONS.getName());
this.organizations.forEach(organization -> {
try {
organization.toElasticEntity(builder);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
});
builder.endArray();
}
builder.field(MapKey.LASTVERSION.getName(), this.lastVersion);
builder.field(MapKey.LASTPUBLICVERSION.getName(), this.lastPublicVersion);
builder.field(MapKey.ISPUBLIC.getName(), this.isPublic);
builder.startArray(MapKey.DATASETS.getName());
this.datasets.forEach(dataset -> {
try {
dataset.toElasticEntity(builder);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
});
builder.endArray();
builder.field(MapKey.GRANT.getName(), this.grant.toString());
builder.field(MapKey.GRANTSTATUS.getName(), this.grantStatus);
builder.endObject();
return builder;
}
@Override
public Dmp fromElasticEntity(Map<String, Object> fields) {
this.id = UUID.fromString((String) fields.get(MapKey.ID.getName()));
this.label = (String) fields.get(MapKey.LABEL.getName());
this.description = (String) fields.get(MapKey.DESCRIPTION.getName());
this.groupId = UUID.fromString((String) fields.get(MapKey.GROUPID.getName()));
this.status = Short.valueOf(fields.get(MapKey.STATUS.getName()).toString());
if (fields.get(MapKey.TEMPLATES.getName()) != null) {
this.templates = ((List<HashMap<String, Object>>) fields.get(MapKey.TEMPLATES.getName())).stream().map(hashMap -> new DatasetTempalate().fromElasticEntity(hashMap)).collect(Collectors.toList());
}
if (fields.get(MapKey.COLLABORATORS.getName()) != null) {
this.collaborators = ((List<HashMap<String, Object>>) fields.get(MapKey.COLLABORATORS.getName())).stream().map(map -> new Collaborator().fromElasticEntity(map)).collect(Collectors.toList());
}
if (fields.get(MapKey.ORGANIZATIONS.getName()) != null) {
this.organizations = ((List<HashMap<String, Object>>) fields.get(MapKey.ORGANIZATIONS.getName())).stream().map(map -> new Organization().fromElasticEntity(map)).collect(Collectors.toList());
}
this.lastVersion = (Boolean) fields.get(MapKey.LASTVERSION.getName());
this.lastPublicVersion = (Boolean) fields.get(MapKey.LASTPUBLICVERSION.getName());
this.isPublic = (Boolean) fields.get(MapKey.ISPUBLIC.getName());
if (fields.get(MapKey.DATASETS.getName()) != null) {
this.datasets = ((List<HashMap<String, Object>>) fields.get(MapKey.DATASETS.getName())).stream().map(map -> new Dataset().fromElasticEntity(map)).collect(Collectors.toList());
}
this.grant = UUID.fromString((String) fields.get(MapKey.GRANT.getName()));
if (fields.get(MapKey.GRANTSTATUS.getName()) != null) {
this.grantStatus = Short.valueOf(fields.get(MapKey.GRANTSTATUS.getName()).toString());
}
return this;
}
public enum MapKey {
ID ("id"),
LABEL ("label"),
DESCRIPTION ("description"),
GROUPID ("groupId"),
STATUS ("status"),
TEMPLATES ("templates"),
COLLABORATORS ("collaborators"),
ORGANIZATIONS ("organizations"),
LASTVERSION ("lastVersion"),
LASTPUBLICVERSION ("lastPublicVersion"),
ISPUBLIC ("isPublic"),
DATASETS ("datasets"),
GRANT ("grant"),
GRANTSTATUS ("grantStatus");
private final String name;
private MapKey(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
}

View File

@ -0,0 +1,137 @@
package eu.eudat.elastic.repository;
import eu.eudat.elastic.criteria.DmpCriteria;
import eu.eudat.elastic.entities.Dataset;
import eu.eudat.elastic.entities.Dmp;
import eu.eudat.elastic.entities.Tag;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.core.CountRequest;
import org.elasticsearch.client.core.CountResponse;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service("dmpRepository")
public class DmpRepository extends ElasticRepository<Dmp, DmpCriteria> {
@Autowired
public DmpRepository(RestHighLevelClient client) {
super(client);
}
@Override
public Dmp createOrUpdate(Dmp entity) throws IOException {
XContentBuilder builder = XContentFactory.jsonBuilder();
IndexRequest request = new IndexRequest("dmps").id(entity.getId().toString()).source(entity.toElasticEntity(builder));
IndexResponse response = this.getClient().index(request, RequestOptions.DEFAULT);
return entity;
}
@Override
public Dmp findDocument(String id) throws IOException {
GetRequest request = new GetRequest("dmps",id);
GetResponse response = this.getClient().get(request, RequestOptions.DEFAULT);
return new Dmp().fromElasticEntity(response.getSourceAsMap());
}
@Override
public List<Dmp> query(DmpCriteria criteria) throws IOException {
SearchRequest searchRequest = new SearchRequest("dmps");
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
CountRequest countRequest = new CountRequest("dmps");
countRequest.query(QueryBuilders.boolQuery().mustNot(QueryBuilders.termsQuery(Dmp.MapKey.STATUS.getName(), Collections.singletonList(Dmp.DMPStatus.DELETED.getValue()))));
CountResponse countResponse = getClient().count(countRequest, RequestOptions.DEFAULT);
Long count = countResponse.getCount();
searchSourceBuilder.size(count.intValue());
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery().mustNot(QueryBuilders.termsQuery(Dmp.MapKey.STATUS.getName(), Collections.singletonList(Dmp.DMPStatus.DELETED.getValue())));
if (criteria.isPublic()) {
boolQuery = boolQuery.should(QueryBuilders.termQuery(Dmp.MapKey.ISPUBLIC.getName(), true));
boolQuery = boolQuery.should(QueryBuilders.termQuery(Dmp.MapKey.STATUS.getName(), Dmp.DMPStatus.FINALISED.getValue()));
}
if (criteria.getLike() != null && !criteria.getLike().isEmpty()) {
boolQuery = boolQuery.should(QueryBuilders.queryStringQuery(criteria.getLike()).fields(Stream.of(new Object[][] {
{ Dmp.MapKey.LABEL.getName(), 1.0f },
{ Dmp.MapKey.DESCRIPTION.getName(), 1.0f }
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Float) data[1]))));
}
if (criteria.getTemplates() != null && criteria.getTemplates().size() > 0) {
boolQuery = boolQuery.should(QueryBuilders.termsQuery(Dmp.MapKey.TEMPLATES.getName() + ".id.keyword", criteria.getTemplates().stream().map(UUID::toString).collect(Collectors.toList())));
}
if (criteria.getStatus() != null) {
boolQuery = boolQuery.should(QueryBuilders.termQuery(Dmp.MapKey.STATUS.getName(), criteria.getStatus().intValue()));
}
if (criteria.getGroupIds() != null && criteria.getGroupIds().size() > 0) {
boolQuery = boolQuery.should(QueryBuilders.termsQuery(Dmp.MapKey.GROUPID.getName(), criteria.getGroupIds().stream().map(UUID::toString).collect(Collectors.toList())));
}
if (criteria.getGrants() != null && criteria.getGrants().size() > 0) {
boolQuery = boolQuery.should(QueryBuilders.termsQuery(Dmp.MapKey.GRANT.getName() + ".keyword", criteria.getGrants().stream().map(UUID::toString).collect(Collectors.toList())));
}
if (criteria.getCollaborators() != null && criteria.getCollaborators().size() > 0) {
boolQuery = boolQuery.should(QueryBuilders.termsQuery(Dmp.MapKey.COLLABORATORS.getName() + ".keyword", criteria.getCollaborators().stream().map(UUID::toString).collect(Collectors.toList())));
}
if (!criteria.isAllowAllVersions()) {
boolQuery = boolQuery.should(QueryBuilders.termQuery(criteria.isPublic() ? Dmp.MapKey.LASTPUBLICVERSION.getName() : Dmp.MapKey.LASTVERSION.getName(), true));
}
if (criteria.getOrganizations() != null && criteria.getOrganizations().size() > 0) {
boolQuery = boolQuery.should(QueryBuilders.termsQuery(Dmp.MapKey.ORGANIZATIONS.getName() + ".id.keyword", criteria.getOrganizations().stream().map(UUID::toString).collect(Collectors.toList())));
}
if (criteria.getGrantStatus() != null) {
boolQuery = boolQuery.should(QueryBuilders.termQuery(Dmp.MapKey.GRANTSTATUS.getName(), criteria.getGrantStatus()));
}
if (boolQuery.should().isEmpty() && boolQuery.mustNot().isEmpty()) {
boolQuery = boolQuery.should(QueryBuilders.matchAllQuery());
} else {
boolQuery.minimumShouldMatch(boolQuery.should().size());
}
searchSourceBuilder.query(boolQuery);
searchRequest.source(searchSourceBuilder);
SearchResponse response = this.getClient().search(searchRequest, RequestOptions.DEFAULT);
return Arrays.stream(response.getHits().getHits()).map(x -> new Dmp().fromElasticEntity((Map<String, Object>)this.transformFromString(x.getSourceAsString(), Map.class))).collect(Collectors.toList());
}
@Override
public boolean exists() throws IOException {
GetIndexRequest request = new GetIndexRequest("dmps");
return this.getClient().indices().exists(request, RequestOptions.DEFAULT);
}
@Override
public void clear() throws IOException {
if (exists()) {
DeleteByQueryRequest delete = new DeleteByQueryRequest("dmps");
delete.setQuery(QueryBuilders.matchAllQuery());
this.getClient().deleteByQuery(delete, RequestOptions.DEFAULT);
}
}
}

View File

@ -6,6 +6,7 @@ import eu.eudat.criteria.DMPCriteria;
import eu.eudat.data.dao.criteria.DynamicFieldsCriteria; import eu.eudat.data.dao.criteria.DynamicFieldsCriteria;
import eu.eudat.data.dao.criteria.RequestItem; import eu.eudat.data.dao.criteria.RequestItem;
import eu.eudat.data.entities.DMP; import eu.eudat.data.entities.DMP;
import eu.eudat.data.entities.Dataset;
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem; import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest; import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest;
import eu.eudat.data.query.items.table.dmp.DataManagmentPlanPublicTableRequest; import eu.eudat.data.query.items.table.dmp.DataManagmentPlanPublicTableRequest;
@ -90,7 +91,9 @@ public class DMPs extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = {"/paged"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.POST, value = {"/paged"}, consumes = "application/json", produces = "application/json")
public @ResponseBody public @ResponseBody
ResponseEntity<ResponseItem<DataTableData<DataManagementPlanListingModel>>> getPaged(@Valid @RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest, @RequestParam String fieldsGroup, Principal principal) throws Exception { ResponseEntity<ResponseItem<DataTableData<DataManagementPlanListingModel>>> getPaged(@Valid @RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest,
@RequestParam String fieldsGroup,
@ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
DataTableData<DataManagementPlanListingModel> dataTable = this.dataManagementPlanManager.getPaged(dataManagementPlanTableRequest, principal, fieldsGroup); DataTableData<DataManagementPlanListingModel> dataTable = this.dataManagementPlanManager.getPaged(dataManagementPlanTableRequest, principal, fieldsGroup);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DataManagementPlanListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DataManagementPlanListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
} }
@ -122,7 +125,7 @@ public class DMPs extends BaseController {
@RequestMapping(method = RequestMethod.GET, value = {"/overview/{id}"}) @RequestMapping(method = RequestMethod.GET, value = {"/overview/{id}"})
public @ResponseBody public @ResponseBody
ResponseEntity getOverviewSingle(@PathVariable String id, Principal principal) { ResponseEntity getOverviewSingle(@PathVariable String id,@ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) {
try { try {
DataManagementPlanOverviewModel dataManagementPlan = this.dataManagementPlanManager.getOverviewSingle(id, principal); DataManagementPlanOverviewModel dataManagementPlan = this.dataManagementPlanManager.getOverviewSingle(id, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanOverviewModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlan)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataManagementPlanOverviewModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlan));
@ -190,7 +193,7 @@ public class DMPs extends BaseController {
try { try {
this.dataManagementPlanManager.delete(id); this.dataManagementPlanManager.delete(id);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully Deleted Datamanagement Plan")); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully Deleted Datamanagement Plan"));
} catch (DMPWithDatasetsDeleteException exception) { } catch (DMPWithDatasetsDeleteException | IOException exception) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DMP>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage())); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DMP>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage()));
} }
} }
@ -292,4 +295,20 @@ public class DMPs extends BaseController {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<String>().status(ApiMessageCode.ERROR_MESSAGE).message(e.getMessage())); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<String>().status(ApiMessageCode.ERROR_MESSAGE).message(e.getMessage()));
} }
} }
@javax.transaction.Transactional
@RequestMapping(method = RequestMethod.POST, value = {"/index"})
public @ResponseBody
ResponseEntity<ResponseItem<Dataset>> generateIndex(Principal principal) throws Exception {
this.dataManagementPlanManager.generateIndex(principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.data.entities.Dataset>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Generated").payload(null));
}
@javax.transaction.Transactional
@RequestMapping(method = RequestMethod.DELETE, value = {"/index"})
public @ResponseBody
ResponseEntity<ResponseItem<Dataset>> clearIndex(Principal principal) throws Exception {
this.dataManagementPlanManager.clearIndex(principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.data.entities.Dataset>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Cleared").payload(null));
}
} }

View File

@ -89,12 +89,12 @@ public class DashBoardManager {
UserInfo user = new UserInfo(); UserInfo user = new UserInfo();
user.setId(principal.getId()); user.setId(principal.getId());
DatasetCriteria datasetCriteria = new DatasetCriteria(); DatasetCriteria datasetCriteria = new DatasetCriteria();
if (apiContext.getOperationsContext().getDatasetRepository() != null) { if (apiContext.getOperationsContext().getElasticRepository().getDatasetRepository() != null) {
try { try {
eu.eudat.elastic.criteria.DatasetCriteria datasetElasticCriteria = new eu.eudat.elastic.criteria.DatasetCriteria(); eu.eudat.elastic.criteria.DatasetCriteria datasetElasticCriteria = new eu.eudat.elastic.criteria.DatasetCriteria();
datasetElasticCriteria.setAllowAllVersions(false); datasetElasticCriteria.setAllowAllVersions(false);
datasetElasticCriteria.setPublic(false); datasetElasticCriteria.setPublic(false);
datasets = apiContext.getOperationsContext().getDatasetRepository().query(datasetElasticCriteria); datasets = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(datasetElasticCriteria);
}catch (Exception e) { }catch (Exception e) {
logger.warn(e.getMessage(), e); logger.warn(e.getMessage(), e);
datasets = null; datasets = null;

View File

@ -18,12 +18,17 @@ import eu.eudat.data.query.items.item.dmp.DataManagementPlanCriteriaRequest;
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem; import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest; import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest;
import eu.eudat.data.query.items.table.dmp.DataManagmentPlanPublicTableRequest; import eu.eudat.data.query.items.table.dmp.DataManagmentPlanPublicTableRequest;
import eu.eudat.elastic.criteria.DmpCriteria;
import eu.eudat.elastic.entities.Collaborator; import eu.eudat.elastic.entities.Collaborator;
import eu.eudat.elastic.entities.Dmp;
import eu.eudat.elastic.entities.Organization; import eu.eudat.elastic.entities.Organization;
import eu.eudat.elastic.entities.Tag;
import eu.eudat.exceptions.datamanagementplan.DMPNewVersionException; import eu.eudat.exceptions.datamanagementplan.DMPNewVersionException;
import eu.eudat.exceptions.datamanagementplan.DMPWithDatasetsDeleteException; import eu.eudat.exceptions.datamanagementplan.DMPWithDatasetsDeleteException;
import eu.eudat.exceptions.security.UnauthorisedException; import eu.eudat.exceptions.security.UnauthorisedException;
import eu.eudat.logic.builders.entity.UserInfoBuilder; import eu.eudat.logic.builders.entity.UserInfoBuilder;
import eu.eudat.logic.mapper.elastic.DmpMapper;
import eu.eudat.logic.mapper.elastic.criteria.DmpCriteriaMapper;
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader; import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
import eu.eudat.logic.services.ApiContext; import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.services.forms.VisibilityRuleService; import eu.eudat.logic.services.forms.VisibilityRuleService;
@ -51,11 +56,11 @@ import eu.eudat.models.data.listingmodels.DataManagementPlanOverviewModel;
import eu.eudat.models.data.listingmodels.DatasetListingModel; import eu.eudat.models.data.listingmodels.DatasetListingModel;
import eu.eudat.models.data.listingmodels.UserInfoListingModel; import eu.eudat.models.data.listingmodels.UserInfoListingModel;
import eu.eudat.models.data.project.ProjectDMPEditorModel; import eu.eudat.models.data.project.ProjectDMPEditorModel;
import eu.eudat.models.data.rda.RDAExportModel;
import eu.eudat.models.data.security.Principal; import eu.eudat.models.data.security.Principal;
import eu.eudat.models.data.user.composite.PagedDatasetProfile; import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import eu.eudat.models.data.userinfo.UserListingModel; import eu.eudat.models.data.userinfo.UserListingModel;
import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.QueryableList;
import eu.eudat.types.Authorities;
import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun; import org.apache.poi.xwpf.usermodel.XWPFRun;
@ -119,29 +124,58 @@ public class DataManagementPlanManager {
public DataTableData<DataManagementPlanListingModel> getPaged(DataManagementPlanTableRequest dataManagementPlanTableRequest, Principal principal, String fieldsGroup) throws Exception { public DataTableData<DataManagementPlanListingModel> getPaged(DataManagementPlanTableRequest dataManagementPlanTableRequest, Principal principal, String fieldsGroup) throws Exception {
UUID principalID = principal.getId(); UUID principalID = principal.getId();
QueryableList<DMP> items = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(dataManagementPlanTableRequest.getCriteria()); List<Dmp> dmps = null;
QueryableList<DMP> items = null;
QueryableList<DMP> authItems = null;
if (apiContext.getOperationsContext().getElasticRepository().getDmpRepository() != null) {
DmpCriteria criteria = DmpCriteriaMapper.toElasticCriteria(dataManagementPlanTableRequest.getCriteria());
dmps = apiContext.getOperationsContext().getElasticRepository().getDmpRepository().query(criteria);
if (dmps != null && !dmps.isEmpty()) {
List<Dmp> finalDmps = dmps;
items = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().asQueryable().where((builder, root) -> root.get("id").in(finalDmps.stream().map(Dmp::getId).collect(Collectors.toList())));
}
}
if (items == null) {
items = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(dataManagementPlanTableRequest.getCriteria());
}
List<Integer> roles = new LinkedList<>(); List<Integer> roles = new LinkedList<>();
if (dataManagementPlanTableRequest.getCriteria().getRole() != null) roles.add(dataManagementPlanTableRequest.getCriteria().getRole()); if (!dataManagementPlanTableRequest.getCriteria().isOnlyPublic()) {
QueryableList<DMP> authItems = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getAuthenticated(items, principalID, roles); if (dataManagementPlanTableRequest.getCriteria().getRole() != null)
roles.add(dataManagementPlanTableRequest.getCriteria().getRole());
authItems = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getAuthenticated(items, principalID, roles);
} else {
authItems = items;
}
QueryableList<DMP> pagedItems = PaginationManager.applyPaging(authItems, dataManagementPlanTableRequest); QueryableList<DMP> pagedItems = PaginationManager.applyPaging(authItems, dataManagementPlanTableRequest);
DataTableData<DataManagementPlanListingModel> dataTable = new DataTableData<>(); DataTableData<DataManagementPlanListingModel> dataTable = new DataTableData<>();
CompletableFuture itemsFuture; CompletableFuture itemsFuture;
if (fieldsGroup.equals("listing")) { if (fieldsGroup.equals("listing")) {
itemsFuture = pagedItems.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class)) if (!dataManagementPlanTableRequest.getCriteria().isOnlyPublic()) {
.selectAsync(item -> { itemsFuture = pagedItems.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class))
item.setDataset( .selectAsync(item -> {
item.getDataset().stream() item.setDataset(
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue())).collect(Collectors.toList()).stream() item.getDataset().stream()
.filter(dataset -> dataset.getDmp().getUsers().stream().filter(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser().getId().equals(principalID) .filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue())).collect(Collectors.toList()).stream()
|| dataset.getDmp().getUsers().stream() .filter(dataset -> dataset.getDmp().getUsers().stream().filter(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser().getId().equals(principalID)
.filter(x -> x.getUser().getId().equals(principalID)) || dataset.getDmp().getUsers().stream()
.collect(Collectors.toList()).size() > 0) .filter(x -> x.getUser().getId().equals(principalID))
.collect(Collectors.toSet())); .collect(Collectors.toList()).size() > 0)
return new DataManagementPlanListingModel().fromDataModelDatasets(item); .collect(Collectors.toSet()));
}) return new DataManagementPlanListingModel().fromDataModelDatasets(item);
.whenComplete((resultList, throwable) -> dataTable.setData(resultList)); })
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
} else {
itemsFuture = pagedItems.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class))
.selectAsync(item -> {
item.setDataset(
item.getDataset().stream()
.filter(dataset -> dataset.getStatus().equals(Dataset.Status.FINALISED.getValue())).collect(Collectors.toSet()));
return new DataManagementPlanListingModel().fromDataModelDatasets(item);
})
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
}
} else if (fieldsGroup.equals("autocomplete")) { } else if (fieldsGroup.equals("autocomplete")) {
itemsFuture = pagedItems itemsFuture = pagedItems
.selectAsync(item -> new DataManagementPlanListingModel().fromDataModelAutoComplete(item)) .selectAsync(item -> new DataManagementPlanListingModel().fromDataModelAutoComplete(item))
@ -601,6 +635,8 @@ public class DataManagementPlanManager {
if (dataManagementPlan.getAssociatedUsers().size() == 0) if (dataManagementPlan.getAssociatedUsers().size() == 0)
assignUser(newDmp, user); assignUser(newDmp, user);
this.updateIndex(newDmp);
if (setNotification) { if (setNotification) {
if (newDmp.getStatus() != DMP.DMPStatus.FINALISED.getValue()) { if (newDmp.getStatus() != DMP.DMPStatus.FINALISED.getValue()) {
this.sendNotification(newDmp, user, NotificationType.DMP_MODIFIED); this.sendNotification(newDmp, user, NotificationType.DMP_MODIFIED);
@ -686,6 +722,8 @@ public class DataManagementPlanManager {
assignUser(newDmp, user); assignUser(newDmp, user);
copyDatasets(newDmp, databaseRepository.getDatasetDao()); copyDatasets(newDmp, databaseRepository.getDatasetDao());
this.updateIndex(newDmp);
} else { } else {
throw new DMPNewVersionException("Version to update not the latest."); throw new DMPNewVersionException("Version to update not the latest.");
} }
@ -718,9 +756,11 @@ public class DataManagementPlanManager {
assignUser(newDmp, user); assignUser(newDmp, user);
copyDatasets(newDmp, databaseRepository.getDatasetDao()); copyDatasets(newDmp, databaseRepository.getDatasetDao());
this.updateIndex(newDmp);
} }
public void delete(UUID uuid) throws DMPWithDatasetsDeleteException { public void delete(UUID uuid) throws DMPWithDatasetsDeleteException, IOException {
DatasetCriteria criteria = new DatasetCriteria(); DatasetCriteria criteria = new DatasetCriteria();
List<UUID> dmpIds = Collections.singletonList(uuid); List<UUID> dmpIds = Collections.singletonList(uuid);
criteria.setDmpIds(dmpIds); criteria.setDmpIds(dmpIds);
@ -729,16 +769,15 @@ public class DataManagementPlanManager {
DMP oldDmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(uuid); DMP oldDmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(uuid);
oldDmp.setStatus(DMP.DMPStatus.DELETED.getValue()); oldDmp.setStatus(DMP.DMPStatus.DELETED.getValue());
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(oldDmp); apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(oldDmp);
this.updateIndex(oldDmp);
DataManagementPlanCriteria criteria1 = new DataManagementPlanCriteria(); DataManagementPlanCriteria criteria1 = new DataManagementPlanCriteria();
criteria1.setAllVersions(true); criteria1.setAllVersions(true);
criteria1.setGroupIds(Collections.singletonList(oldDmp.getGroupId())); criteria1.setGroupIds(Collections.singletonList(oldDmp.getGroupId()));
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria1).toList().forEach(dmp -> { apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria1).toList().forEach(dmp -> {
for (Dataset dataset: dmp.getDataset()) { for (Dataset dataset: dmp.getDataset()) {
try { try {
DatasetWizardModel datasetWizardModel = new DatasetWizardModel().fromDataModel(dataset); List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString()).getTags();
datasetWizardModel.setTags(apiContext.getOperationsContext().getDatasetRepository().findDocument(dataset.getId().toString()).getTags()); this.datasetManager.updateTags(dataset, tags);
datasetWizardModel.setDatasetProfileDefinition(this.datasetManager.getPagedProfile(datasetWizardModel, dataset));
this.datasetManager.updateTags(apiContext.getOperationsContext().getDatasetRepository(), datasetWizardModel);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
@ -887,10 +926,8 @@ public class DataManagementPlanManager {
.thenApplyAsync(entityDataset -> { .thenApplyAsync(entityDataset -> {
Dataset newDataset = new Dataset(); Dataset newDataset = new Dataset();
try { try {
DatasetWizardModel datasetWizardModel = new DatasetWizardModel().fromDataModel(entityDataset); List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString()).getTags();
datasetWizardModel.setTags(apiContext.getOperationsContext().getDatasetRepository().findDocument(dataset.getId().toString()).getTags()); this.datasetManager.updateTags(dataset, tags);
datasetWizardModel.setDatasetProfileDefinition(this.datasetManager.getPagedProfile(datasetWizardModel, entityDataset));
this.datasetManager.updateTags(apiContext.getOperationsContext().getDatasetRepository(), datasetWizardModel);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
@ -976,12 +1013,9 @@ public class DataManagementPlanManager {
datasetElastic.setGrantStatus(dataset1.getDmp().getGrant().getStatus()); datasetElastic.setGrantStatus(dataset1.getDmp().getGrant().getStatus());
try { try {
datasetElastic.setTags(apiContext.getOperationsContext().getDatasetRepository().findDocument(dataset.getId().toString()).getTags()); datasetElastic.setTags(apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString()).getTags());
DatasetWizardModel datasetWizardModel = new DatasetWizardModel(); datasetElastic.setFormData(this.datasetManager.getWordDocumentText(dataset1));
datasetWizardModel.setStatus(dataset1.getStatus()); apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().createOrUpdate(datasetElastic);
datasetWizardModel.setDatasetProfileDefinition(this.datasetManager.getPagedProfile(datasetWizardModel, dataset1));
datasetElastic.setFormData(this.datasetManager.getWordDocumentText(datasetWizardModel));
apiContext.getOperationsContext().getDatasetRepository().createOrUpdate(datasetElastic);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
@ -1354,6 +1388,7 @@ public class DataManagementPlanManager {
} }
databaseRepository.getDmpDao().createOrUpdate(dmp); databaseRepository.getDmpDao().createOrUpdate(dmp);
assignUser(dmp, me); assignUser(dmp, me);
this.updateIndex(dmp);
dmp.getDataset().forEach(dataset -> { dmp.getDataset().forEach(dataset -> {
dataset.setStatus(Dataset.Status.SAVED.getValue()); dataset.setStatus(Dataset.Status.SAVED.getValue());
dataset.setCreated(new Date()); dataset.setCreated(new Date());
@ -1372,9 +1407,8 @@ public class DataManagementPlanManager {
} }
dmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmp.getId())).toList())); dmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmp.getId())).toList()));
try { try {
DatasetWizardModel model = new DatasetWizardModel().fromDataModel(dataset); List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString()).getTags();
model.setDatasetProfileDefinition(datasetManager.getPagedProfile(model, dataset)); datasetManager.updateTags(dataset, tags);
datasetManager.updateTags(apiContext.getOperationsContext().getDatasetRepository(), model);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
@ -1408,16 +1442,15 @@ public class DataManagementPlanManager {
throw new Exception("DMP is not finalized"); throw new Exception("DMP is not finalized");
dmp.setPublic(true); dmp.setPublic(true);
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp); apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp);
this.updateIndex(dmp);
DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); DataManagementPlanCriteria criteria = new DataManagementPlanCriteria();
criteria.setGroupIds(Collections.singletonList(dmp.getGroupId())); criteria.setGroupIds(Collections.singletonList(dmp.getGroupId()));
criteria.setAllVersions(true); criteria.setAllVersions(true);
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria).toList().stream().forEach(dmp1 -> { apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria).toList().stream().forEach(dmp1 -> {
dmp1.getDataset().forEach(dataset -> { dmp1.getDataset().forEach(dataset -> {
try { try {
DatasetWizardModel datasetWizardModel = new DatasetWizardModel().fromDataModel(dataset); List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString()).getTags();
datasetWizardModel.setTags(apiContext.getOperationsContext().getDatasetRepository().findDocument(dataset.getId().toString()).getTags()); this.datasetManager.updateTags(dataset, tags);
datasetWizardModel.setDatasetProfileDefinition(this.datasetManager.getPagedProfile(datasetWizardModel, dataset));
this.datasetManager.updateTags(apiContext.getOperationsContext().getDatasetRepository(), datasetWizardModel);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
@ -1435,6 +1468,7 @@ public class DataManagementPlanManager {
throw new Exception("DMP is already finalized"); throw new Exception("DMP is already finalized");
dmp.setStatus(DMP.DMPStatus.FINALISED.getValue()); dmp.setStatus(DMP.DMPStatus.FINALISED.getValue());
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp); apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp);
this.updateIndex(dmp);
if (datasetsToBeFinalized != null && datasetsToBeFinalized.getUuids() != null && !datasetsToBeFinalized.getUuids().isEmpty()) { if (datasetsToBeFinalized != null && datasetsToBeFinalized.getUuids() != null && !datasetsToBeFinalized.getUuids().isEmpty()) {
apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao() apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao()
.asQueryable().where((builder, root) -> root.get("id").in(datasetsToBeFinalized.getUuids())) .asQueryable().where((builder, root) -> root.get("id").in(datasetsToBeFinalized.getUuids()))
@ -1587,4 +1621,29 @@ public class DataManagementPlanManager {
throw new IOException(parsedException.get("message"), ex); throw new IOException(parsedException.get("message"), ex);
} }
} }
private void updateIndex(DMP dmp) throws IOException {
DmpMapper mapper = new DmpMapper(apiContext, datasetManager);
Dmp elastic = mapper.toElastic(dmp);
apiContext.getOperationsContext().getElasticRepository().getDmpRepository().createOrUpdate(elastic);
}
public void generateIndex(Principal principal) {
if (principal.getAuthorities().contains(Authorities.ADMIN.getValue())) {
List<DMP> dmps = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().asQueryable().toList();
dmps.forEach(dmp -> {
try {
this.updateIndex(dmp);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
});
}
}
public void clearIndex(Principal principal) throws IOException {
if (principal.getAuthorities().contains(Authorities.ADMIN.getValue())) {
apiContext.getOperationsContext().getElasticRepository().getDmpRepository().clear();
}
}
} }

View File

@ -13,13 +13,12 @@ import eu.eudat.data.query.items.table.dataset.DatasetPublicTableRequest;
import eu.eudat.data.query.items.table.dataset.DatasetTableRequest; import eu.eudat.data.query.items.table.dataset.DatasetTableRequest;
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem; import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
import eu.eudat.elastic.criteria.DatasetCriteria; import eu.eudat.elastic.criteria.DatasetCriteria;
import eu.eudat.elastic.entities.Collaborator;
import eu.eudat.elastic.entities.Organization;
import eu.eudat.elastic.entities.Tag; import eu.eudat.elastic.entities.Tag;
import eu.eudat.elastic.repository.DatasetRepository; import eu.eudat.elastic.repository.DatasetRepository;
import eu.eudat.exceptions.security.UnauthorisedException; import eu.eudat.exceptions.security.UnauthorisedException;
import eu.eudat.logic.builders.BuilderFactory; import eu.eudat.logic.builders.BuilderFactory;
import eu.eudat.logic.builders.entity.UserInfoBuilder; import eu.eudat.logic.builders.entity.UserInfoBuilder;
import eu.eudat.logic.mapper.elastic.DatasetMapper;
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader; import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
import eu.eudat.logic.services.ApiContext; import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.services.forms.VisibilityRuleService; import eu.eudat.logic.services.forms.VisibilityRuleService;
@ -28,7 +27,6 @@ import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
import eu.eudat.logic.utilities.documents.types.ParagraphStyle; import eu.eudat.logic.utilities.documents.types.ParagraphStyle;
import eu.eudat.logic.utilities.documents.word.WordBuilder; import eu.eudat.logic.utilities.documents.word.WordBuilder;
import eu.eudat.logic.utilities.documents.xml.ExportXmlBuilder; import eu.eudat.logic.utilities.documents.xml.ExportXmlBuilder;
import eu.eudat.logic.utilities.helpers.StreamDistinctBy;
import eu.eudat.models.HintedModelFactory; import eu.eudat.models.HintedModelFactory;
import eu.eudat.models.data.datasetImport.DatasetImportField; import eu.eudat.models.data.datasetImport.DatasetImportField;
import eu.eudat.models.data.datasetImport.DatasetImportPagedDatasetProfile; import eu.eudat.models.data.datasetImport.DatasetImportPagedDatasetProfile;
@ -104,7 +102,7 @@ public class DatasetManager {
public DatasetManager(ApiContext apiContext, UserManager userManager, ConfigLoader configLoader, Environment environment) { public DatasetManager(ApiContext apiContext, UserManager userManager, ConfigLoader configLoader, Environment environment) {
this.apiContext = apiContext; this.apiContext = apiContext;
this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository(); this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository();
this.datasetRepository = apiContext.getOperationsContext().getDatasetRepository(); this.datasetRepository = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository();
this.builderFactory = apiContext.getOperationsContext().getBuilderFactory(); this.builderFactory = apiContext.getOperationsContext().getBuilderFactory();
this.userManager = userManager; this.userManager = userManager;
this.configLoader = configLoader; this.configLoader = configLoader;
@ -463,8 +461,10 @@ public class DatasetManager {
return exportFile; return exportFile;
} }
public String getWordDocumentText (DatasetWizardModel datasetEntity) throws Exception { public String getWordDocumentText (Dataset datasetEntity) throws Exception {
XWPFDocument document = getLightWordDocument(this.configLoader, datasetEntity, this.apiContext.getUtilitiesService().getVisibilityRuleService()); DatasetWizardModel datasetWizardModel = new DatasetWizardModel().fromDataModel(datasetEntity);
datasetWizardModel.setDatasetProfileDefinition(this.getPagedProfile(datasetWizardModel, datasetEntity));
XWPFDocument document = getLightWordDocument(this.configLoader, datasetWizardModel, this.apiContext.getUtilitiesService().getVisibilityRuleService());
XWPFWordExtractor extractor = new XWPFWordExtractor(document); XWPFWordExtractor extractor = new XWPFWordExtractor(document);
return extractor.getText();/*.replaceAll("\n\\s*", " ");*/ return extractor.getText();/*.replaceAll("\n\\s*", " ");*/
} }
@ -572,8 +572,8 @@ public class DatasetManager {
datasetWizardModel.setDmp(new DataManagementPlan().fromDataModelNoDatasets(dataset1.getDmp())); datasetWizardModel.setDmp(new DataManagementPlan().fromDataModelNoDatasets(dataset1.getDmp()));
} }
dataset1.setProfile(this.apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(datasetWizardModel.getProfile())); dataset1.setProfile(this.apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(datasetWizardModel.getProfile()));
datasetWizardModel.setDatasetProfileDefinition(getPagedProfile(datasetWizardModel, dataset1)); // datasetWizardModel.setDatasetProfileDefinition(getPagedProfile(datasetWizardModel, dataset1));
updateTags(apiContext.getOperationsContext().getDatasetRepository(), datasetWizardModel); updateTags(dataset1, datasetWizardModel.getTags());
if (sendNotification) { if (sendNotification) {
if (dataset1.getStatus() != Dataset.Status.FINALISED.getValue()) { if (dataset1.getStatus() != Dataset.Status.FINALISED.getValue()) {
this.sendNotification(dataset1, dataset1.getDmp(), userInfo, NotificationType.DATASET_MODIFIED); this.sendNotification(dataset1, dataset1.getDmp(), userInfo, NotificationType.DATASET_MODIFIED);
@ -640,14 +640,14 @@ public class DatasetManager {
return jobject.toString(); return jobject.toString();
} }
public void updateTags(DatasetRepository datasetRepository, DatasetWizardModel datasetWizardModel) throws Exception { public void updateTags(Dataset datasetEntity, List<Tag> tags) throws Exception {
// if (datasetWizardModel.getTags() != null && !datasetWizardModel.getTags().isEmpty()) { // if (datasetWizardModel.getTags() != null && !datasetWizardModel.getTags().isEmpty()) {
eu.eudat.elastic.entities.Dataset dataset = new eu.eudat.elastic.entities.Dataset(); /*eu.eudat.elastic.entities.Dataset dataset = new eu.eudat.elastic.entities.Dataset();
dataset.setId(datasetWizardModel.getId().toString()); dataset.setId(datasetWizardModel.getId().toString());
if (datasetWizardModel.getTags() != null && !datasetWizardModel.getTags().isEmpty()) { if (datasetWizardModel.getTags() != null && !datasetWizardModel.getTags().isEmpty()) {
DatasetCriteria criteria = new DatasetCriteria(); DatasetCriteria criteria = new DatasetCriteria();
criteria.setTags(datasetWizardModel.getTags()); criteria.setTags(datasetWizardModel.getTags());
List<Tag> tags = apiContext.getOperationsContext().getDatasetRepository().query(criteria).stream().map(eu.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream) List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream)
.filter(StreamDistinctBy.distinctByKey(Tag::getId)).filter(tag -> datasetWizardModel.getTags().stream().anyMatch(tag1 -> tag1.getName().equals(tag.getName()))).collect(Collectors.toList()); .filter(StreamDistinctBy.distinctByKey(Tag::getId)).filter(tag -> datasetWizardModel.getTags().stream().anyMatch(tag1 -> tag1.getName().equals(tag.getName()))).collect(Collectors.toList());
if (tags.isEmpty()) { if (tags.isEmpty()) {
datasetWizardModel.getTags().forEach(tag -> tag.setId(UUID.randomUUID().toString())); datasetWizardModel.getTags().forEach(tag -> tag.setId(UUID.randomUUID().toString()));
@ -694,8 +694,10 @@ public class DatasetManager {
} }
dataset.setPublic(datasetWizardModel.getDmp().getPublic()); dataset.setPublic(datasetWizardModel.getDmp().getPublic());
dataset.setGrantStatus(datasetWizardModel.getDmp().getGrant().getStatus()); dataset.setGrantStatus(datasetWizardModel.getDmp().getGrant().getStatus());
dataset.setFormData(this.getWordDocumentText(datasetWizardModel)); dataset.setFormData(this.getWordDocumentText(datasetWizardModel));*/
datasetRepository.createOrUpdate(dataset); DatasetMapper mapper = new DatasetMapper(apiContext, this);
eu.eudat.elastic.entities.Dataset dataset = mapper.toElastic(datasetEntity, tags);
apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().createOrUpdate(dataset);
// } // }
} }
@ -862,7 +864,7 @@ public class DatasetManager {
UserInfo userInfo = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(principal.getId()).build(); UserInfo userInfo = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(principal.getId()).build();
entity.setCreator(userInfo); entity.setCreator(userInfo);
updateTagsXmlImportDataset(apiContext.getOperationsContext().getDatasetRepository(), entity); updateTagsXmlImportDataset(apiContext.getOperationsContext().getElasticRepository().getDatasetRepository(), entity);
createRegistriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao(), entity); createRegistriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao(), entity);
createDataRepositoriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao(), entity); createDataRepositoriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao(), entity);
createServicesIfTheyDontExist(entity); createServicesIfTheyDontExist(entity);
@ -945,19 +947,11 @@ public class DatasetManager {
public void generateIndex(Principal principal) { public void generateIndex(Principal principal) {
if (principal.getAuthorities().contains(Authorities.ADMIN.getValue())) { if (principal.getAuthorities().contains(Authorities.ADMIN.getValue())) {
this.apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().asQueryable().toList(); this.apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().asQueryable().toList();
List<DatasetWizardModel> datasetWizardModels = this.apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().asQueryable().toList() List<Dataset> datasetEntities = new ArrayList<>(this.apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().asQueryable().toList());
.stream().map(dataset -> { datasetEntities.forEach(datasetEntity -> {
DatasetWizardModel datasetWizardModel = new DatasetWizardModel().fromDataModel(dataset);
datasetWizardModel.setDatasetProfileDefinition(getPagedProfile(datasetWizardModel, dataset));
return datasetWizardModel;
}).collect(Collectors.toList());
datasetWizardModels.forEach(datasetWizardModel -> {
try { try {
eu.eudat.elastic.entities.Dataset dataset = apiContext.getOperationsContext().getDatasetRepository().findDocument(datasetWizardModel.getId().toString()); eu.eudat.elastic.entities.Dataset dataset = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(datasetEntity.getId().toString());
if (dataset != null) { updateTags(datasetEntity, dataset != null ? dataset.getTags() : null);
datasetWizardModel.setTags(dataset.getTags());
}
updateTags(apiContext.getOperationsContext().getDatasetRepository(), datasetWizardModel);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
@ -968,7 +962,7 @@ public class DatasetManager {
public void clearIndex(Principal principal) { public void clearIndex(Principal principal) {
if (principal.getAuthorities().contains(Authorities.ADMIN.getValue())) { if (principal.getAuthorities().contains(Authorities.ADMIN.getValue())) {
try { try {
this.apiContext.getOperationsContext().getDatasetRepository().clear(); this.apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().clear();
} catch (IOException e) { } catch (IOException e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }

View File

@ -50,12 +50,12 @@ public class DatasetWizardManager {
public void delete(ApiContext apiContext, UUID uuid) throws IOException { public void delete(ApiContext apiContext, UUID uuid) throws IOException {
Dataset oldDataset = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().find(uuid); Dataset oldDataset = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().find(uuid);
eu.eudat.elastic.entities.Dataset oldDatasetElasitc = apiContext.getOperationsContext().getDatasetRepository().findDocument(uuid.toString()); eu.eudat.elastic.entities.Dataset oldDatasetElasitc = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(uuid.toString());
oldDataset.setStatus(Dataset.Status.DELETED.getValue()); oldDataset.setStatus(Dataset.Status.DELETED.getValue());
oldDatasetElasitc.setStatus(oldDataset.getStatus()); oldDatasetElasitc.setStatus(oldDataset.getStatus());
apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().createOrUpdate(oldDataset); apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().createOrUpdate(oldDataset);
if (uuid != null && oldDatasetElasitc.getId()!= null) { if (uuid != null && oldDatasetElasitc.getId()!= null) {
apiContext.getOperationsContext().getDatasetRepository().createOrUpdate(oldDatasetElasitc); apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().createOrUpdate(oldDatasetElasitc);
} }
} }
} }

View File

@ -0,0 +1,14 @@
package eu.eudat.logic.mapper.elastic;
import eu.eudat.data.entities.UserInfo;
import eu.eudat.elastic.entities.Collaborator;
public class CollaboratorMapper {
public static Collaborator toElastic(UserInfo user) {
Collaborator elastic = new Collaborator();
elastic.setId(user.getId().toString());
elastic.setName(user.getName());
return elastic;
}
}

View File

@ -0,0 +1,74 @@
package eu.eudat.logic.mapper.elastic;
import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
import eu.eudat.data.entities.DMP;
import eu.eudat.elastic.criteria.DatasetCriteria;
import eu.eudat.elastic.entities.Collaborator;
import eu.eudat.elastic.entities.Dataset;
import eu.eudat.elastic.entities.Organization;
import eu.eudat.elastic.entities.Tag;
import eu.eudat.logic.managers.DatasetManager;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.utilities.helpers.StreamDistinctBy;
import java.util.*;
import java.util.stream.Collectors;
public class DatasetMapper {
private final ApiContext apiContext;
private final DatasetManager datasetManager;
public DatasetMapper(ApiContext apiContext, DatasetManager datasetManager) {
this.apiContext = apiContext;
this.datasetManager = datasetManager;
}
public Dataset toElastic(eu.eudat.data.entities.Dataset dataset, List<Tag> tags) throws Exception {
Dataset elastic = new Dataset();
elastic.setId(dataset.getId().toString());
if (tags != null && !tags.isEmpty()) {
DatasetCriteria criteria = new DatasetCriteria();
criteria.setTags(tags);
List<Tag> tags1 = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream)
.filter(StreamDistinctBy.distinctByKey(Tag::getId)).filter(tag -> tags.stream().anyMatch(tag1 -> tag1.getName().equals(tag.getName()))).collect(Collectors.toList());
if (tags1.isEmpty()) {
tags.forEach(tag -> tag.setId(UUID.randomUUID().toString()));
elastic.setTags(tags);
} else {
elastic.setTags(tags1);
}
}
elastic.setLabel(dataset.getLabel());
elastic.setDescription(dataset.getDescription());
elastic.setTemplate(dataset.getProfile().getId());
elastic.setStatus(dataset.getStatus());
elastic.setDmp(dataset.getDmp().getId());
elastic.setGroup(dataset.getDmp().getGroupId());
elastic.setGrant(dataset.getDmp().getGrant().getId());
if (dataset.getDmp().getUsers() != null) {
elastic.setCollaborators(dataset.getDmp().getUsers().stream().map(user -> CollaboratorMapper.toElastic(user.getUser())).collect(Collectors.toList()));
}
DataManagementPlanCriteria dmpCriteria = new DataManagementPlanCriteria();
dmpCriteria.setAllVersions(true);
dmpCriteria.setGroupIds(Collections.singletonList(dataset.getDmp().getGroupId()));
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(dmpCriteria).toList().stream()
.max(Comparator.comparing(DMP::getVersion)).ifPresent(dmp -> elastic.setLastVersion(dmp.getId().equals(dataset.getDmp().getId())));
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(dmpCriteria).toList().stream().filter(DMP::isPublic)
.max(Comparator.comparing(DMP::getVersion)).ifPresent(dmp -> elastic.setLastPublicVersion(dmp.getId().equals(dataset.getDmp().getId())));
if (elastic.getLastVersion() == null) {
elastic.setLastVersion(true);
}
if (elastic.getLastPublicVersion() == null) {
elastic.setLastPublicVersion(false);
}
if (dataset.getDmp().getOrganisations() != null) {
elastic.setOrganizations(dataset.getDmp().getOrganisations().stream().map(OrganizationMapper::toElastic).collect(Collectors.toList()));
}
elastic.setPublic(dataset.getDmp().isPublic());
elastic.setGrantStatus(dataset.getDmp().getGrant().getStatus());
elastic.setFormData(datasetManager.getWordDocumentText(dataset));
return elastic;
}
}

View File

@ -0,0 +1,14 @@
package eu.eudat.logic.mapper.elastic;
import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.elastic.entities.DatasetTempalate;
public class DatasetTemplateMapper {
public static DatasetTempalate toElastic(DatasetProfile profile) {
DatasetTempalate elastic = new DatasetTempalate();
elastic.setId(profile.getId());
elastic.setName(profile.getLabel());
return elastic;
}
}

View File

@ -0,0 +1,86 @@
package eu.eudat.logic.mapper.elastic;
import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
import eu.eudat.data.dao.entities.DMPDao;
import eu.eudat.data.entities.DMP;
import eu.eudat.elastic.entities.Collaborator;
import eu.eudat.elastic.entities.Dataset;
import eu.eudat.elastic.entities.Dmp;
import eu.eudat.elastic.entities.Tag;
import eu.eudat.logic.managers.DatasetManager;
import eu.eudat.logic.services.ApiContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
public class DmpMapper {
private static final Logger logger = LoggerFactory.getLogger(DmpMapper.class);
private final ApiContext apiContext;
private final DatasetManager datasetManager;
private final DatasetMapper datasetMapper;
public DmpMapper(ApiContext apiContext, DatasetManager datasetManager) {
this.apiContext = apiContext;
this.datasetManager = datasetManager;
this.datasetMapper = new DatasetMapper(apiContext, datasetManager);
}
public Dmp toElastic(DMP dmp) {
Dmp elastic = new Dmp();
elastic.setId(dmp.getId());
elastic.setGroupId(dmp.getGroupId());
if (dmp.getUsers() != null) {
elastic.setCollaborators(dmp.getUsers().stream().map(user -> CollaboratorMapper.toElastic(user.getUser())).collect(Collectors.toList()));
}
elastic.setDescription(dmp.getDescription());
elastic.setGrant(dmp.getGrant().getId());
elastic.setLabel(dmp.getLabel());
elastic.setPublic(dmp.isPublic());
elastic.setStatus(dmp.getStatus());
DataManagementPlanCriteria dmpCriteria = new DataManagementPlanCriteria();
dmpCriteria.setAllVersions(true);
dmpCriteria.setGroupIds(Collections.singletonList(dmp.getGroupId()));
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(dmpCriteria).toList().stream()
.max(Comparator.comparing(DMP::getVersion)).ifPresent(dmp1 -> elastic.setLastVersion(dmp1.getId().equals(dmp.getId())));
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(dmpCriteria).toList().stream().filter(DMP::isPublic)
.max(Comparator.comparing(DMP::getVersion)).ifPresent(dmp1 -> elastic.setLastPublicVersion(dmp1.getId().equals(dmp.getId())));
if (elastic.getLastVersion() == null) {
elastic.setLastVersion(false);
}
if (elastic.getLastPublicVersion() == null) {
elastic.setLastPublicVersion(false);
}
if (dmp.getDataset() != null) {
elastic.setDatasets(dmp.getDataset().stream().map(dataset -> {
List<Tag> tags = null;
try {
Dataset dataset1 = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
if (dataset1 != null) {
tags = dataset1.getTags();
}
return datasetMapper.toElastic(dataset, tags);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return null;
}).collect(Collectors.toList()));
}
if (dmp.getAssociatedDmps() != null) {
elastic.setTemplates(dmp.getAssociatedDmps().stream().map(DatasetTemplateMapper::toElastic).collect(Collectors.toList()));
}
if (dmp.getOrganisations() != null) {
elastic.setOrganizations(dmp.getOrganisations().stream().map(OrganizationMapper::toElastic).collect(Collectors.toList()));
}
if (dmp.getGrant() != null) {
elastic.setGrantStatus(dmp.getGrant().getStatus());
}
return elastic;
}
}

View File

@ -0,0 +1,14 @@
package eu.eudat.logic.mapper.elastic;
import eu.eudat.data.entities.Organisation;
import eu.eudat.elastic.entities.Organization;
public class OrganizationMapper {
public static Organization toElastic(Organisation organisation) {
Organization elastic = new Organization();
elastic.setId(organisation.getId().toString());
elastic.setName(organisation.getLabel());
return elastic;
}
}

View File

@ -0,0 +1,33 @@
package eu.eudat.logic.mapper.elastic.criteria;
import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
import eu.eudat.data.entities.Grant;
import eu.eudat.elastic.criteria.DmpCriteria;
import java.util.UUID;
import java.util.stream.Collectors;
public class DmpCriteriaMapper {
public static DmpCriteria toElasticCriteria(DataManagementPlanCriteria criteria) {
DmpCriteria elastic = new DmpCriteria();
elastic.setAllowAllVersions(criteria.getAllVersions());
elastic.setCollaborators(criteria.getCollaborators());
if (criteria.getGrants() != null) {
elastic.setGrants(criteria.getGrants().stream().map(Grant::getId).collect(Collectors.toList()));
}
elastic.setGroupIds(criteria.getGroupIds());
elastic.setLike(criteria.getLike());
if (criteria.getOrganisations() != null) {
elastic.setOrganizations(criteria.getOrganisations().stream().map(UUID::fromString).collect(Collectors.toList()));
}
elastic.setPublic(criteria.getIsPublic());
if (criteria.getStatus() != null) {
elastic.setStatus(criteria.getStatus().shortValue());
}
elastic.setTemplates(criteria.getDatasetTemplates());
elastic.setGrantStatus(criteria.getGrantStatus());
return elastic;
}
}

View File

@ -0,0 +1,11 @@
package eu.eudat.logic.services.operations;
import eu.eudat.elastic.repository.DatasetRepository;
import eu.eudat.elastic.repository.DmpRepository;
public interface ElasticRepository {
DatasetRepository getDatasetRepository();
DmpRepository getDmpRepository();
}

View File

@ -0,0 +1,29 @@
package eu.eudat.logic.services.operations;
import eu.eudat.elastic.repository.DatasetRepository;
import eu.eudat.elastic.repository.DmpRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("elasticRepository")
public class ElasticRepositoryImpl implements ElasticRepository {
private final DatasetRepository datasetRepository;
private final DmpRepository dmpRepository;
@Autowired
public ElasticRepositoryImpl(DatasetRepository datasetRepository, DmpRepository dmpRepository) {
this.datasetRepository = datasetRepository;
this.dmpRepository = dmpRepository;
}
@Override
public DatasetRepository getDatasetRepository() {
return datasetRepository;
}
@Override
public DmpRepository getDmpRepository() {
return dmpRepository;
}
}

View File

@ -1,6 +1,7 @@
package eu.eudat.logic.services.operations; package eu.eudat.logic.services.operations;
import eu.eudat.elastic.repository.DatasetRepository; import eu.eudat.elastic.repository.DatasetRepository;
import eu.eudat.elastic.repository.DmpRepository;
import eu.eudat.logic.builders.BuilderFactory; import eu.eudat.logic.builders.BuilderFactory;
import eu.eudat.logic.proxy.fetching.RemoteFetcher; import eu.eudat.logic.proxy.fetching.RemoteFetcher;
import eu.eudat.logic.services.helpers.FileStorageService; import eu.eudat.logic.services.helpers.FileStorageService;
@ -21,5 +22,5 @@ public interface OperationsContext {
FileStorageService getFileStorageService(); FileStorageService getFileStorageService();
DatasetRepository getDatasetRepository(); ElasticRepository getElasticRepository();
} }

View File

@ -1,6 +1,7 @@
package eu.eudat.logic.services.operations; package eu.eudat.logic.services.operations;
import eu.eudat.elastic.repository.DatasetRepository; import eu.eudat.elastic.repository.DatasetRepository;
import eu.eudat.elastic.repository.DmpRepository;
import eu.eudat.logic.builders.BuilderFactory; import eu.eudat.logic.builders.BuilderFactory;
import eu.eudat.logic.proxy.fetching.RemoteFetcher; import eu.eudat.logic.proxy.fetching.RemoteFetcher;
import eu.eudat.logic.services.helpers.FileStorageService; import eu.eudat.logic.services.helpers.FileStorageService;
@ -14,22 +15,22 @@ import org.springframework.stereotype.Service;
@Service("operationsContext") @Service("operationsContext")
public class OperationsContextImpl implements OperationsContext { public class OperationsContextImpl implements OperationsContext {
private DatabaseRepository databaseRepository; private final DatabaseRepository databaseRepository;
private ApplicationContext applicationContext; private final ApplicationContext applicationContext;
private RemoteFetcher remoteFetcher; private final RemoteFetcher remoteFetcher;
private BuilderFactory builderFactory; private final BuilderFactory builderFactory;
private FileStorageService fileStorageService; private final FileStorageService fileStorageService;
private DatasetRepository datasetRepository; private final ElasticRepository elasticRepository;
@Autowired @Autowired
public OperationsContextImpl(DatabaseRepository databaseRepository, ApplicationContext applicationContext, RemoteFetcher remoteFetcher public OperationsContextImpl(DatabaseRepository databaseRepository, ApplicationContext applicationContext, RemoteFetcher remoteFetcher
, BuilderFactory builderFactory, FileStorageService fileStorageService, DatasetRepository datasetRepository) { , BuilderFactory builderFactory, FileStorageService fileStorageService, ElasticRepository elasticRepository) {
this.databaseRepository = databaseRepository; this.databaseRepository = databaseRepository;
this.applicationContext = applicationContext; this.applicationContext = applicationContext;
this.remoteFetcher = remoteFetcher; this.remoteFetcher = remoteFetcher;
this.builderFactory = builderFactory; this.builderFactory = builderFactory;
this.fileStorageService = fileStorageService; this.fileStorageService = fileStorageService;
this.datasetRepository = datasetRepository; this.elasticRepository = elasticRepository;
} }
@Override @Override
@ -58,11 +59,7 @@ public class OperationsContextImpl implements OperationsContext {
} }
@Override @Override
public DatasetRepository getDatasetRepository() { public ElasticRepository getElasticRepository() {
return datasetRepository; return elasticRepository;
}
public void setDatasetRepository(DatasetRepository datasetRepository) {
this.datasetRepository = datasetRepository;
} }
} }

View File

@ -164,8 +164,8 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
this.description = entity.getDescription(); this.description = entity.getDescription();
this.profile = entity.getProfile().getId(); this.profile = entity.getProfile().getId();
this.uri = entity.getUri(); this.uri = entity.getUri();
this.registries = entity.getRegistries().stream().map(item -> new Registry().fromDataModel(item)).collect(Collectors.toList()); this.registries = entity.getRegistries() != null ? entity.getRegistries().stream().map(item -> new Registry().fromDataModel(item)).collect(Collectors.toList()) : new ArrayList<>();
this.dataRepositories = entity.getDatasetDataRepositories().stream().map(item -> { this.dataRepositories = entity.getDatasetDataRepositories() != null ? entity.getDatasetDataRepositories().stream().map(item -> {
DataRepository dataRepository = new DataRepository().fromDataModel(item.getDataRepository()); DataRepository dataRepository = new DataRepository().fromDataModel(item.getDataRepository());
if (item.getData() != null) { if (item.getData() != null) {
Map<String, Map<String, String>> data = (Map<String, Map<String, String>>) JSONValue.parse(item.getData()); Map<String, Map<String, String>> data = (Map<String, Map<String, String>>) JSONValue.parse(item.getData());
@ -173,11 +173,11 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
dataRepository.setInfo(values.get("info")); dataRepository.setInfo(values.get("info"));
} }
return dataRepository; return dataRepository;
}).collect(Collectors.toList()); }).collect(Collectors.toList()) : new ArrayList<>();
this.services = entity.getServices().stream().map(item -> new Service().fromDataModel(item.getService())).collect(Collectors.toList()); this.services = entity.getServices() != null ? entity.getServices().stream().map(item -> new Service().fromDataModel(item.getService())).collect(Collectors.toList()) : new ArrayList<>();
this.created = entity.getCreated(); this.created = entity.getCreated();
this.dmp = new DataManagementPlan().fromDataModelNoDatasets(entity.getDmp()); this.dmp = new DataManagementPlan().fromDataModelNoDatasets(entity.getDmp());
this.externalDatasets = entity.getDatasetExternalDatasets().stream().map(item -> { this.externalDatasets = entity.getDatasetExternalDatasets() != null ? entity.getDatasetExternalDatasets().stream().map(item -> {
ExternalDatasetListingModel externalDatasetListingModel = new ExternalDatasetListingModel().fromDataModel(item.getExternalDataset()); ExternalDatasetListingModel externalDatasetListingModel = new ExternalDatasetListingModel().fromDataModel(item.getExternalDataset());
if (item.getData() != null) { if (item.getData() != null) {
Map<String, Map<String, String>> data = (Map<String, Map<String, String>>) JSONValue.parse(item.getData()); Map<String, Map<String, String>> data = (Map<String, Map<String, String>>) JSONValue.parse(item.getData());
@ -186,7 +186,7 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
externalDatasetListingModel.setType(Integer.parseInt(values.get("type"))); externalDatasetListingModel.setType(Integer.parseInt(values.get("type")));
} }
return externalDatasetListingModel; return externalDatasetListingModel;
}).collect(Collectors.toList()); }).collect(Collectors.toList()) : new ArrayList<>();
this.modified = entity.getModified(); this.modified = entity.getModified();
return this; return this;
} }

View File

@ -327,16 +327,15 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public DataManagementPlan fromDataModelNoDatasets(DMP entity) { public DataManagementPlan fromDataModelNoDatasets(DMP entity) {
this.id = entity.getId(); this.id = entity.getId();
this.profile = entity.getProfile() != null ? new Tuple<UUID, String>(entity.getProfile().getId(), entity.getProfile().getLabel()) : null; this.profile = entity.getProfile() != null ? new Tuple<UUID, String>(entity.getProfile().getId(), entity.getProfile().getLabel()) : null;
this.organisations = entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()); this.organisations = entity.getOrganisations() != null ? entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()) : new ArrayList<>();
this.researchers = entity.getResearchers().stream().map(item -> new Researcher().fromDataModel(item)).collect(Collectors.toList()); this.researchers = entity.getResearchers() != null ? entity.getResearchers().stream().map(item -> new Researcher().fromDataModel(item)).collect(Collectors.toList()) : new ArrayList<>();
this.version = entity.getVersion(); this.version = entity.getVersion();
this.groupId = this.groupId == null ? null : this.groupId;
this.label = entity.getLabel(); this.label = entity.getLabel();
this.grant = new Grant(); this.grant = new Grant();
this.properties = entity.getProperties() != null ? new org.json.JSONObject(entity.getProperties()).toMap() : null; this.properties = entity.getProperties() != null ? new org.json.JSONObject(entity.getProperties()).toMap() : null;
this.creator = new eu.eudat.models.data.userinfo.UserInfo(); this.creator = new eu.eudat.models.data.userinfo.UserInfo();
this.groupId = entity.getGroupId(); this.groupId = entity.getGroupId();
this.lockable = entity.getDataset().stream().findAny().isPresent(); this.lockable = entity.getDataset() != null && entity.getDataset().stream().findAny().isPresent();
this.definition = entity.getProfile() == null ? null : new DataManagementPlanProfile().fromXml(XmlBuilder.fromXml(entity.getProfile().getDefinition()).getDocumentElement()); this.definition = entity.getProfile() == null ? null : new DataManagementPlanProfile().fromXml(XmlBuilder.fromXml(entity.getProfile().getDefinition()).getDocumentElement());
if (this.definition != null && this.definition.getFields() != null && !this.definition.getFields().isEmpty() && this.properties != null) { if (this.definition != null && this.definition.getFields() != null && !this.definition.getFields().isEmpty() && this.properties != null) {
this.definition.getFields().forEach(item -> { this.definition.getFields().forEach(item -> {
@ -344,7 +343,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
fieldOptional.ifPresent(stringObjectMap -> item.setValue(stringObjectMap.get("value"))); fieldOptional.ifPresent(stringObjectMap -> item.setValue(stringObjectMap.get("value")));
}); });
} }
if (entity.getUsers().stream().anyMatch(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue()))) if (entity.getUsers() != null && entity.getUsers().stream().anyMatch(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())))
this.creator.fromDataModel(entity.getUsers().stream().filter(user -> user.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser()); this.creator.fromDataModel(entity.getUsers().stream().filter(user -> user.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser());
if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) { if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {
@ -358,8 +357,8 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
this.created = entity.getCreated(); this.created = entity.getCreated();
this.description = entity.getDescription(); this.description = entity.getDescription();
this.status = entity.getStatus(); this.status = entity.getStatus();
this.associatedUsers = entity.getUsers().stream().map(item -> new UserListingModel().fromDataModel(item.getUser())).collect(Collectors.toList()); this.associatedUsers = entity.getUsers() != null ? entity.getUsers().stream().map(item -> new UserListingModel().fromDataModel(item.getUser())).collect(Collectors.toList()) : new ArrayList<>();
this.users = entity.getUsers().stream().map(item -> new UserInfoListingModel().fromDataModel(item)).collect(Collectors.toList()); this.users = entity.getUsers() != null ? entity.getUsers().stream().map(item -> new UserInfoListingModel().fromDataModel(item)).collect(Collectors.toList()) : new ArrayList<>();
this.doi = entity.getDoi(); this.doi = entity.getDoi();
this.grant.fromDataModel(entity.getGrant()); this.grant.fromDataModel(entity.getGrant());

View File

@ -32,7 +32,8 @@ const appRoutes: Routes = [
}, },
{ {
path: 'explore-plans', path: 'explore-plans',
loadChildren: () => import('./ui/explore-dmp/explore-dmp.module').then(m => m.ExploreDmpModule), // loadChildren: () => import('./ui/explore-dmp/explore-dmp.module').then(m => m.ExploreDmpModule),
loadChildren: () => import('./ui/dmp/dmp.module').then(m => m.DmpModule),
data: { data: {
breadcrumb: true, breadcrumb: true,
title: 'GENERAL.TITLES.EXPLORE-PLANS' title: 'GENERAL.TITLES.EXPLORE-PLANS'

View File

@ -12,4 +12,6 @@ export class DmpCriteria extends BaseCriteria {
public collaborators?: string[] = []; public collaborators?: string[] = [];
public datasetTemplates?: string[] = []; public datasetTemplates?: string[] = [];
public isPublic?: boolean; public isPublic?: boolean;
public onlyPublic?: boolean;
public grantStatus?: boolean;
} }

View File

@ -142,4 +142,12 @@ export class DmpService {
getDatasetProfilesUsedPaged(dataTableRequest: DataTableRequest<DatasetProfileCriteria>) { getDatasetProfilesUsedPaged(dataTableRequest: DataTableRequest<DatasetProfileCriteria>) {
return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'datasetProfilesUsedByDmps/paged', dataTableRequest); return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'datasetProfilesUsedByDmps/paged', dataTableRequest);
} }
generateIndex() {
return this.http.post(this.actionUrl + 'index', {});
}
clearIndex() {
return this.http.delete(this.actionUrl + 'index');
}
} }

View File

@ -5,6 +5,7 @@ import { takeUntil } from 'rxjs/operators';
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service'; import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { DmpService } from '@app/core/services/dmp/dmp.service';
@Component({ @Component({
selector: 'app-index-managment', selector: 'app-index-managment',
@ -18,6 +19,7 @@ export class IndexManagmentComponent extends BaseComponent implements OnInit {
private uiNotificationService: UiNotificationService, private uiNotificationService: UiNotificationService,
private translate: TranslateService, private translate: TranslateService,
private router: Router, private router: Router,
private dmpService: DmpService
) )
{ {
super(); super();
@ -38,6 +40,16 @@ export class IndexManagmentComponent extends BaseComponent implements OnInit {
this.onCallbackError(error); this.onCallbackError(error);
} }
); );
this.dmpService.generateIndex().pipe(takeUntil(this._destroyed)).subscribe(
response => {
(ev.srcElement as HTMLButtonElement).disabled = false;
this.onCallbackSuccess();
},
error => {
(ev.srcElement as HTMLButtonElement).disabled = false;
this.onCallbackError(error);
}
);
} }
clearIndex(ev: Event) { clearIndex(ev: Event) {
@ -52,6 +64,16 @@ export class IndexManagmentComponent extends BaseComponent implements OnInit {
this.onCallbackError(error); this.onCallbackError(error);
} }
); );
this.dmpService.clearIndex().pipe(takeUntil(this._destroyed)).subscribe(
response => {
(ev.srcElement as HTMLButtonElement).disabled = false;
this.onCallbackSuccess();
},
error => {
(ev.srcElement as HTMLButtonElement).disabled = false;
this.onCallbackError(error);
}
);
} }
onCallbackSuccess(): void { onCallbackSuccess(): void {

View File

@ -38,7 +38,7 @@ export class DatasetListingItemComponent implements OnInit {
} }
getDmpLink(): string[] { getDmpLink(): string[] {
return this.isPublic ? [`/explore-plans/overview/${this.dataset.dmpId}`] : [`/plans/edit/${this.dataset.dmpId}`]; return this.isPublic ? [`/explore-plans/publicOverview/${this.dataset.dmpId}`] : [`/plans/edit/${this.dataset.dmpId}`];
} }

View File

@ -55,6 +55,14 @@ const routes: Routes = [
title: 'GENERAL.TITLES.DMP-OVERVIEW' title: 'GENERAL.TITLES.DMP-OVERVIEW'
}, },
}, },
{
path: 'publicOverview/:publicId',
component: DmpOverviewComponent,
data: {
breadcrumb: true,
title: 'GENERAL.TITLES.DMP-OVERVIEW'
},
},
// ----------- UNCOMMENT TO ADD AGAIN GRANTS -------- // ----------- UNCOMMENT TO ADD AGAIN GRANTS --------
// { // {
// path: 'new/grant/:grantId', // path: 'new/grant/:grantId',

View File

@ -23,7 +23,7 @@ export class DatasetsTabComponent implements OnInit {
} }
datasetClicked(datasetId: String) { datasetClicked(datasetId: String) {
this.router.navigate(['/datasets/edit/' + datasetId]); this.router.navigate(this.isPublic ? ['/datasets/publicEdit/' + datasetId] : ['/datasets/edit/' + datasetId]);
} }
datasetsClicked(dmpId: String) { datasetsClicked(dmpId: String) {

View File

@ -110,19 +110,17 @@
</button> </button>
</div> </div>
</div> </div>
<div *ngIf="!isFinalized && !isNew" class="d-flex justify-content-end pt-2 pb-4 pl-2"> <div *ngIf="!isNew" class="d-flex justify-content-end pt-2 pb-4 pl-2">
<div *ngIf="!isNew">
<button mat-raised-button color="primary" (click)="cancel(dmp.id)" type="button" class="text-uppercase mr-2"> <button mat-raised-button color="primary" (click)="cancel(dmp.id)" type="button" class="text-uppercase mr-2">
{{'DMP-EDITOR.ACTIONS.CANCEL' | translate}} {{'DMP-EDITOR.ACTIONS.CANCEL' | translate}}
</button> </button>
</div>
<div *ngIf="formGroup.enabled && !lockStatus"> <div *ngIf="formGroup.enabled && !lockStatus">
<button *ngIf="!isNew" mat-raised-button type="submit" class="text-uppercase dark-theme mr-2" color="primary"> <button *ngIf="!isFinalized" mat-raised-button type="submit" class="text-uppercase dark-theme mr-2" color="primary">
{{'DMP-EDITOR.ACTIONS.SAVE-CHANGES' | translate}} {{'DMP-EDITOR.ACTIONS.SAVE-CHANGES' | translate}}
</button> </button>
</div> </div>
<div *ngIf="formGroup.enabled && !isNew && !lockStatus"> <div *ngIf="formGroup.enabled && !isFinalized && !lockStatus">
<button type="button" mat-raised-button color="primary" class="text-uppercase mr-2" (click)="saveAndFinalize()">{{'DMP-EDITOR.ACTIONS.FINALISE' | translate}} <button type="button" mat-raised-button color="primary" class="text-uppercase mr-2" (click)="saveAndFinalize()">{{'DMP-EDITOR.ACTIONS.FINALISE' | translate}}
</button> </button>
</div> </div>

View File

@ -109,9 +109,22 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
// displayFn: (item) => item['label'], // displayFn: (item) => item['label'],
// titleFn: (item) => item['label'] // titleFn: (item) => item['label']
// }; // };
switch(tabToNav) {
case 'general':
this.selectedTab = 0;
break;
case 'grant':
this.selectedTab = 1;
break;
case 'datasetDescriptions':
this.selectedTab = 2;
break;
case 'peoples':
this.selectedTab = 3;
break;
}
if (itemId != null) { if (itemId != null) {
this.isNew = false; this.isNew = false;
if (tabToNav == "datasetDescriptions") this.selectedTab = 2
this.dmpService.getSingle(itemId).pipe(map(data => data as DmpModel)) this.dmpService.getSingle(itemId).pipe(map(data => data as DmpModel))
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(async data => { .subscribe(async data => {
@ -167,11 +180,12 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
} else if (publicId != null) { } else if (publicId != null) {
this.isNew = false; this.isNew = false;
this.isPublic = true; this.isPublic = true;
this.isFinalized = true;
this.dmpService.getSinglePublic(publicId).pipe(map(data => data as DmpModel)) this.dmpService.getSinglePublic(publicId).pipe(map(data => data as DmpModel))
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(async data => { .subscribe(async data => {
this.lockService.checkLockStatus(data.id).pipe(takeUntil(this._destroyed)).subscribe(lockStatus => { // this.lockService.checkLockStatus(data.id).pipe(takeUntil(this._destroyed)).subscribe(lockStatus => {
this.lockStatus = lockStatus; // this.lockStatus = true;
this.dmp = new DmpEditorModel(); this.dmp = new DmpEditorModel();
this.dmp.grant = new GrantTabModel(); this.dmp.grant = new GrantTabModel();
this.dmp.project = new ProjectFormModel(); this.dmp.project = new ProjectFormModel();
@ -179,7 +193,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
this.dmp.fromModel(data); this.dmp.fromModel(data);
this.formGroup = this.dmp.buildForm(); this.formGroup = this.dmp.buildForm();
//this.registerFormEventsForDmpProfile(this.dmp.definition); //this.registerFormEventsForDmpProfile(this.dmp.definition);
if (!this.editMode || this.dmp.status === DmpStatus.Finalized || lockStatus) { this.formGroup.disable(); } this.formGroup.disable();
// if (!this.isAuthenticated) { // if (!this.isAuthenticated) {
const breadcrumbs = []; const breadcrumbs = [];
breadcrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC-DMPS').toUpperCase(), url: '/plans' }); breadcrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC-DMPS').toUpperCase(), url: '/plans' });
@ -195,15 +209,15 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
// ); // );
this.associatedUsers = data.associatedUsers; this.associatedUsers = data.associatedUsers;
// } // }
if (!lockStatus) { // if (!lockStatus) {
this.lock = new LockModel(data.id, this.getUserFromDMP()); // this.lock = new LockModel(data.id, this.getUserFromDMP());
this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => { // this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => {
this.lock.id = Guid.parse(result); // this.lock.id = Guid.parse(result);
interval(this.configurationService.lockInterval).pipe(takeUntil(this._destroyed)).subscribe(() => this.pumpLock()); // interval(this.configurationService.lockInterval).pipe(takeUntil(this._destroyed)).subscribe(() => this.pumpLock());
}); // });
} // }
}) // })
}); });
} else { } else {
this.dmp = new DmpEditorModel(); this.dmp = new DmpEditorModel();

View File

@ -13,7 +13,7 @@
<!-- End of Search Filter --> <!-- End of Search Filter -->
<!-- Visibility Filter--> <!-- Visibility Filter-->
<div *ngIf="showGrant" class="col-10 gray-container"> <div *ngIf="!isPublic" class="col-10 gray-container">
<h6 class="category-title">{{ 'TYPES.DMP-VISIBILITY.VISIBILITY' | translate }}</h6> <h6 class="category-title">{{ 'TYPES.DMP-VISIBILITY.VISIBILITY' | translate }}</h6>
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('status')"> <mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('status')">
<mat-list-item><mat-radio-button value="null" checked>{{ 'TYPES.DMP-VISIBILITY.ANY' | translate }}</mat-radio-button></mat-list-item> <mat-list-item><mat-radio-button value="null" checked>{{ 'TYPES.DMP-VISIBILITY.ANY' | translate }}</mat-radio-button></mat-list-item>
@ -24,6 +24,23 @@
</div> </div>
<!-- End of Visibility Filter--> <!-- End of Visibility Filter-->
<!-- Grant Status -->
<div class="col-10 gray-container" *ngIf="isPublic">
<h6 class="category-title">{{ 'FACET-SEARCH.GRANT-STATUS.TITLE' | translate }}</h6>
<mat-radio-group [formControl]="formGroup.get('grantStatus')">
<mat-list-item>
<mat-radio-button value="null" checked>{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ANY' | translate }}</mat-radio-button>
</mat-list-item>
<mat-list-item>
<mat-radio-button value="0">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ACTIVE' | translate }}</mat-radio-button>
</mat-list-item>
<mat-list-item>
<mat-radio-button value="1">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.INACTIVE' | translate }}</mat-radio-button>
</mat-list-item>
</mat-radio-group>
</div>
<!-- End of Grant Status -->
<!-- Related Dataset Templates Filter --> <!-- Related Dataset Templates Filter -->
<div *ngIf="showGrant" class="col-10 gray-container"> <div *ngIf="showGrant" class="col-10 gray-container">
<h6 class="category-title">{{ 'CRITERIA.DMP.RELATED-DATASET-TEMPLATES' | translate}}</h6> <h6 class="category-title">{{ 'CRITERIA.DMP.RELATED-DATASET-TEMPLATES' | translate}}</h6>
@ -49,7 +66,7 @@
<!-- End of Related Grants Filters --> <!-- End of Related Grants Filters -->
<!-- Collaborators Filter --> <!-- Collaborators Filter -->
<div *ngIf="showGrant" class="col-10 gray-container"> <div *ngIf="isAuthenticated()" class="col-10 gray-container">
<h6 class="category-title">{{ 'CRITERIA.DMP.RELATED-COLLABORATORS' | translate}}</h6> <h6 class="category-title">{{ 'CRITERIA.DMP.RELATED-COLLABORATORS' | translate}}</h6>
<mat-form-field> <mat-form-field>
<app-multiple-auto-complete [formControl]="formGroup.get('collaborators')" <app-multiple-auto-complete [formControl]="formGroup.get('collaborators')"
@ -61,7 +78,7 @@
<!-- End of Collaborators Filter --> <!-- End of Collaborators Filter -->
<!-- Role Filter --> <!-- Role Filter -->
<div *ngIf="showGrant" class="col-10 gray-container"> <div *ngIf="isAuthenticated()" class="col-10 gray-container">
<h6 class="category-title">{{ 'DATASET-PROFILE-LISTING.COLUMNS.ROLE' | translate }}</h6> <h6 class="category-title">{{ 'DATASET-PROFILE-LISTING.COLUMNS.ROLE' | translate }}</h6>
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('role')"> <mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('role')">
<mat-list-item><mat-radio-button value="null" checked>{{ 'TYPES.DATASET-ROLE.ANY' | translate }}</mat-radio-button></mat-list-item> <mat-list-item><mat-radio-button value="null" checked>{{ 'TYPES.DATASET-ROLE.ANY' | translate }}</mat-radio-button></mat-list-item>

View File

@ -19,6 +19,9 @@ import { BaseCriteriaComponent } from '@app/ui/misc/criteria/base-criteria.compo
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { map, takeUntil } from 'rxjs/operators'; import { map, takeUntil } from 'rxjs/operators';
import { AuthService } from '@app/core/services/auth/auth.service';
import { isNullOrUndefined } from 'util';
import { DatasetService } from '@app/core/services/dataset/dataset.service';
@Component({ @Component({
selector: 'app-dmp-criteria-component', selector: 'app-dmp-criteria-component',
@ -28,6 +31,7 @@ import { map, takeUntil } from 'rxjs/operators';
export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnInit { export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnInit {
@Input() showGrant: boolean; @Input() showGrant: boolean;
@Input() isPublic: boolean;
filteringGrantsAsync = false; filteringGrantsAsync = false;
sizeError = false; sizeError = false;
maxFileSize: number = 1048576; maxFileSize: number = 1048576;
@ -41,7 +45,8 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
role: new FormControl, role: new FormControl,
organisations: new FormControl(), organisations: new FormControl(),
collaborators: new FormControl(), collaborators: new FormControl(),
datasetTemplates: new FormControl() datasetTemplates: new FormControl(),
grantStatus: new FormControl()
}); });
collaboratorsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = { collaboratorsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
@ -81,7 +86,8 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
private dialog: MatDialog, private dialog: MatDialog,
private organisationService: OrganisationService, private organisationService: OrganisationService,
private userService: UserService, private userService: UserService,
private datasetProfileService: DatasetProfileService private datasetProfileService: DatasetService,
private authService: AuthService
) { ) {
super(new ValidationErrorModel()); super(new ValidationErrorModel());
} }
@ -109,6 +115,9 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
this.formGroup.get('datasetTemplates').valueChanges this.formGroup.get('datasetTemplates').valueChanges
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(x => this.controlModified()); .subscribe(x => this.controlModified());
this.formGroup.get('grantStatus').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.controlModified());
//if (this.criteria == null) { this.criteria = new DataManagementPlanCriteria(); } //if (this.criteria == null) { this.criteria = new DataManagementPlanCriteria(); }
} }
@ -119,6 +128,7 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
this.formGroup.get('role').patchValue(criteria.role); this.formGroup.get('role').patchValue(criteria.role);
this.formGroup.get('collaborators').patchValue(criteria.collaborators); this.formGroup.get('collaborators').patchValue(criteria.collaborators);
this.formGroup.get('datasetTemplates').patchValue(criteria.datasetTemplates); this.formGroup.get('datasetTemplates').patchValue(criteria.datasetTemplates);
this.formGroup.get('grantStatus').patchValue(criteria.grantStatus);
} }
onCallbackError(error: any) { onCallbackError(error: any) {
@ -140,7 +150,7 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
const grantRequestItem: DataTableRequest<GrantCriteria> = new DataTableRequest(0, null, { fields: fields }); const grantRequestItem: DataTableRequest<GrantCriteria> = new DataTableRequest(0, null, { fields: fields });
grantRequestItem.criteria = new GrantCriteria(); grantRequestItem.criteria = new GrantCriteria();
grantRequestItem.criteria.like = query; grantRequestItem.criteria.like = query;
return this.grantService.getPaged(grantRequestItem, "autocomplete").pipe(map(x => x.data)); return this.isPublic ? this.grantService.getPublicPaged(grantRequestItem).pipe(map(x => x.data)) : this.grantService.getPaged(grantRequestItem, "autocomplete").pipe(map(x => x.data));
} }
filterOrganisations(value: string) { filterOrganisations(value: string) {
@ -151,7 +161,7 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
dataTableRequest.criteria = new OrganisationCriteria(); dataTableRequest.criteria = new OrganisationCriteria();
dataTableRequest.criteria.labelLike = value; dataTableRequest.criteria.labelLike = value;
return this.organisationService.searchInternalOrganisations(dataTableRequest).pipe(map(x => x.data)); return this.isPublic ? this.organisationService.searchPublicOrganisations(dataTableRequest).pipe(map(x => x.data)) : this.organisationService.searchInternalOrganisations(dataTableRequest).pipe(map(x => x.data));
} }
filterCollaborators(query: string) { filterCollaborators(query: string) {
@ -169,7 +179,11 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
const datasetTemplateRequestItem: DataTableRequest<DatasetProfileCriteria> = new DataTableRequest(0, null, { fields: fields }); const datasetTemplateRequestItem: DataTableRequest<DatasetProfileCriteria> = new DataTableRequest(0, null, { fields: fields });
datasetTemplateRequestItem.criteria = new DatasetProfileCriteria(); datasetTemplateRequestItem.criteria = new DatasetProfileCriteria();
datasetTemplateRequestItem.criteria.like = query; datasetTemplateRequestItem.criteria.like = query;
return this.dmpService.getDatasetProfilesUsedPaged(datasetTemplateRequestItem).pipe(map(x => x.data)); return this.isPublic ? this.datasetProfileService.getDatasetProfiles(datasetTemplateRequestItem) : this.dmpService.getDatasetProfilesUsedPaged(datasetTemplateRequestItem).pipe(map(x => x.data));
}
isAuthenticated(): boolean {
return !isNullOrUndefined(this.authService.current());
} }

View File

@ -1,4 +1,10 @@
<div class="main-content"> <div class="header-image" *ngIf="isPublic">
<div class="header-text-container">
<h3>{{ 'ABOUT.WELCOME' | translate }}</h3>
<h4>{{ 'ABOUT.WELCOME-MESSAGE' | translate }}</h4>
</div>
</div>
<div [ngClass]="isPublic ? 'explore-dmp-content' : 'main-content'">
<div class="container-fluid"> <div class="container-fluid">
<div class="card"> <div class="card">
<div class="row card-header card-header-plain d-flex"> <div class="row card-header card-header-plain d-flex">
@ -14,7 +20,7 @@
</div> </div>
<!-- <p class="card-category">{{'DMP-LISTING.SUBTITLE' | translate}}</p> --> <!-- <p class="card-category">{{'DMP-LISTING.SUBTITLE' | translate}}</p> -->
</div> </div>
<div class="row ml-auto p-2"> <div class="row ml-auto p-2" *ngIf="!isPublic">
<!-- Import Button --> <!-- Import Button -->
<button mat-icon-button [matMenuTriggerFor]="actionsMenu" class="ml-auto more-icon" (click)="$event.stopImmediatePropagation();"> <button mat-icon-button [matMenuTriggerFor]="actionsMenu" class="ml-auto more-icon" (click)="$event.stopImmediatePropagation();">
<mat-icon class="more-horiz">more_horiz</mat-icon> <mat-icon class="more-horiz">more_horiz</mat-icon>
@ -36,12 +42,12 @@
<div class="card-body table-responsive"> <div class="card-body table-responsive">
<div class="listing row pb-2"> <div class="listing row pb-2">
<div class="col-12 col-sm-12 col-md-3"> <div class="col-12 col-sm-12 col-md-3">
<app-dmp-criteria-component [showGrant]="showGrant" class="col-auto"></app-dmp-criteria-component> <app-dmp-criteria-component [showGrant]="showGrant" [isPublic]="isPublic" class="col-auto"></app-dmp-criteria-component>
</div> </div>
<div class="col-12 col-sm-12 col-md-9 pt-4"> <div class="col-12 col-sm-12 col-md-9 pt-4">
<!-- <mat-paginator #paginator [length]="totalCount" [pageSizeOptions]="[10, 25, 100]" (page)="pageThisEvent($event)" class="top-paginator"></mat-paginator> --> <!-- <mat-paginator #paginator [length]="totalCount" [pageSizeOptions]="[10, 25, 100]" (page)="pageThisEvent($event)" class="top-paginator"></mat-paginator> -->
<div *ngFor="let item of listingItems; let i = index"> <div *ngFor="let item of listingItems; let i = index">
<app-dmp-listing-item-component [showDivider]="i != (listingItems.length - 1)" [dmp]="item"></app-dmp-listing-item-component> <app-dmp-listing-item-component [showDivider]="i != (listingItems.length - 1)" [dmp]="item" [isPublic]="isPublic"></app-dmp-listing-item-component>
</div> </div>
</div> </div>
</div> </div>

View File

@ -73,6 +73,28 @@
color: #00b29f; color: #00b29f;
} }
.header-image {
background: url("/assets/images/new-dashboard-bg.png") no-repeat;
background-size: cover;
margin-top: 70px;
min-height: 15em;
position: relative;
}
.header-text-container {
background: rgba(255, 255, 255, 0.7);
position: absolute;
bottom: 0px;
padding-left: 5em;
padding-right: 10em;
padding-top: 2em;
padding-bottom: 2em;
}
.explore-dmp-content {
padding: 30px 15px;
}
// .bot-paginator { // .bot-paginator {
// margin-top: auto; // margin-top: auto;
// } // }

View File

@ -21,6 +21,8 @@ import { takeUntil } from 'rxjs/operators';
import { GrantService } from "@app/core/services/grant/grant.service"; import { GrantService } from "@app/core/services/grant/grant.service";
import { DmpUploadDialogue } from './upload-dialogue/dmp-upload-dialogue.component'; import { DmpUploadDialogue } from './upload-dialogue/dmp-upload-dialogue.component';
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service'; import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
import { isNullOrUndefined } from 'util';
import { AuthService } from '@app/core/services/auth/auth.service';
@Component({ @Component({
@ -43,6 +45,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
listingItems: DmpListingModel[] = []; listingItems: DmpListingModel[] = [];
allVersions: boolean = false; allVersions: boolean = false;
groupLabel: string; groupLabel: string;
isPublic: boolean = false;
constructor( constructor(
private dmpService: DmpService, private dmpService: DmpService,
@ -52,12 +55,18 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
public enumUtils: EnumUtils, public enumUtils: EnumUtils,
private language: TranslateService, private language: TranslateService,
private grantService: GrantService, private grantService: GrantService,
private uiNotificationService: UiNotificationService private uiNotificationService: UiNotificationService,
private authService: AuthService
) { ) {
super(); super();
} }
ngOnInit() { ngOnInit() {
console.log(this.router.url);
this.isPublic = this.router.url.startsWith('/explore-plans');
if (!this.isPublic && isNullOrUndefined(this.authService.current())) {
this.router.navigateByUrl("/explore-plans");
}
this.route.params this.route.params
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(async params => { .subscribe(async params => {
@ -155,6 +164,10 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
request.criteria.status = value.status; request.criteria.status = value.status;
request.criteria.isPublic = false; request.criteria.isPublic = false;
} }
request.criteria.onlyPublic = this.isPublic;
if (this.isPublic) {
request.criteria.isPublic = true;
}
if (value.datasetTemplates) if (value.datasetTemplates)
request.criteria.datasetTemplates = value.datasetTemplates.map(x => x.id); request.criteria.datasetTemplates = value.datasetTemplates.map(x => x.id);
if (value.collaborators) if (value.collaborators)
@ -165,6 +178,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
request.criteria.groupIds = [this.itemId]; request.criteria.groupIds = [this.itemId];
request.criteria.allVersions = true; request.criteria.allVersions = true;
} }
request.criteria.grantStatus = value.grantStatus;
this.dmpService.getPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => { this.dmpService.getPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => {
if (!result) { return []; } if (!result) { return []; }
if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; } if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
@ -236,7 +250,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
private onCallbackImportComplete() { private onCallbackImportComplete() {
this.uiNotificationService.snackBarNotification(this.language.instant('DMP-UPLOAD.UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); this.uiNotificationService.snackBarNotification(this.language.instant('DMP-UPLOAD.UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success);
this.router.navigate(['/reload']).then(() => this.router.navigate(['/plans'])); this.router.navigate(['/reload']).then(() => this.isPublic ? this.router.navigate(['/explore-plans']) : this.router.navigate(['/plans']));
} }
private onCallbackImportFail(error: string) { private onCallbackImportFail(error: string) {

View File

@ -1,5 +1,5 @@
<div class="listing-item"> <div class="listing-item">
<a [routerLink]="['/plans/overview/' + dmp.id]"> <a [routerLink]="isPublic ? ['/explore-plans/publicOverview/' + dmp.id] : ['/plans/overview/' + dmp.id]">
<div class="col"> <div class="col">
<div class="row"> <div class="row">
<div class="col-12 gray-container container-header"> <div class="col-12 gray-container container-header">
@ -8,13 +8,13 @@
<mat-icon class="more-horiz">more_horiz</mat-icon> <mat-icon class="more-horiz">more_horiz</mat-icon>
</button> </button>
<mat-menu #actionsMenu="matMenu"> <mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="editClicked(dmp.id)" class="menu-item"> <button mat-menu-item (click)="editClicked(dmp.id)" class="menu-item" *ngIf="!isPublic">
<mat-icon>edit</mat-icon>{{ 'DMP-LISTING.ACTIONS.EDIT' | translate }} <mat-icon>edit</mat-icon>{{ 'DMP-LISTING.ACTIONS.EDIT' | translate }}
</button> </button>
<button mat-menu-item (click)="openShareDialog(dmp.id,dmp.label)"> <button mat-menu-item (click)="openShareDialog(dmp.id,dmp.label)" *ngIf="!isPublic">
<mat-icon>share</mat-icon>{{'DMP-LISTING.ACTIONS.INVITE' | translate}} <mat-icon>share</mat-icon>{{'DMP-LISTING.ACTIONS.INVITE' | translate}}
</button> </button>
<button mat-menu-item (click)="addDataset(dmp.id)"> <button mat-menu-item (click)="addDataset(dmp.id)" *ngIf="!isPublic">
<mat-icon>add</mat-icon>{{'DMP-LISTING.ACTIONS.ADD-DATASET' | translate}} <mat-icon>add</mat-icon>{{'DMP-LISTING.ACTIONS.ADD-DATASET' | translate}}
</button> </button>
<button mat-menu-item (click)="showDatasets(dmp.id, dmp.label)"> <button mat-menu-item (click)="showDatasets(dmp.id, dmp.label)">
@ -57,14 +57,14 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-auto about-item pl-0"> <div class="col-auto about-item pl-0" *ngIf="!isPublic">
<mat-icon class="gray-icon pt-2" matTooltip="{{'DMP-LISTING.TOOLTIP.LEVEL-OF-ACCESS' | translate}}"> <mat-icon class="gray-icon pt-2" matTooltip="{{'DMP-LISTING.TOOLTIP.LEVEL-OF-ACCESS' | translate}}">
settings settings
</mat-icon> </mat-icon>
<h4 class="mt-1 ml-1 mr-3 p-1 role">{{roleDisplay(dmp.users).toUpperCase()}}</h4> <h4 class="mt-1 ml-1 mr-3 p-1 role">{{roleDisplay(dmp.users).toUpperCase()}}</h4>
</div> </div>
<div class="col-auto about-item"> <div class="col-auto about-item" [ngClass]="isPublic ? 'pl-0' : ''">
<a class="datasets-counter" [routerLink]="['/plans/edit/' + dmp.id]" [queryParams]="{ tab: 'datasetDescriptions' }"> <a class="datasets-counter" [routerLink]="isPublic ? ['/explore-plans/publicEdit/' + dmp.id] : ['/plans/edit/' + dmp.id]" [queryParams]="{ tab: 'datasetDescriptions' }">
<mat-icon class="gray-icon pt-2" matTooltip="{{'DMP-LISTING.TOOLTIP.INVOLVED-DATASETS' | translate}}"> <mat-icon class="gray-icon pt-2" matTooltip="{{'DMP-LISTING.TOOLTIP.INVOLVED-DATASETS' | translate}}">
storage storage
</mat-icon> </mat-icon>

View File

@ -18,6 +18,7 @@ export class DmpListingItemComponent implements OnInit {
@Input() dmp: DmpListingModel; @Input() dmp: DmpListingModel;
@Input() showDivider: boolean = true; @Input() showDivider: boolean = true;
@Input() isPublic: boolean;
@Output() onClick: EventEmitter<DmpListingModel> = new EventEmitter(); @Output() onClick: EventEmitter<DmpListingModel> = new EventEmitter();
isDraft: boolean; isDraft: boolean;