Merge branch 'Development' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot into Development
This commit is contained in:
commit
ad245dde5d
|
@ -15,11 +15,11 @@ import java.util.stream.Collectors;
|
|||
@NamedEntityGraphs({
|
||||
@NamedEntityGraph(
|
||||
name = "dataManagementPlanListingModel",
|
||||
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"), @NamedAttributeNode("associatedDmps"),
|
||||
@NamedAttributeNode("grant"), @NamedAttributeNode(value = "users", subgraph = "users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode("dataset")},
|
||||
subgraphs = {
|
||||
attributeNodes = {
|
||||
@NamedAttributeNode("grant"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile")}/*,*/
|
||||
/*subgraphs = {
|
||||
@NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")}),
|
||||
}
|
||||
}*/
|
||||
),
|
||||
@NamedEntityGraph(
|
||||
name = "fullyDetailed",
|
||||
|
|
|
@ -34,6 +34,10 @@ public class ColumnOrderings {
|
|||
ordering.fieldName(ordering.getFieldName().replace("|count|", "")).columnType(Ordering.ColumnType.COUNT);
|
||||
else if (ordering.getFieldName().contains("|join|"))
|
||||
ordering.fieldName(ordering.getFieldName().replace("|join|", "")).columnType(Ordering.ColumnType.JOIN_COLUMN);
|
||||
else if (ordering.getFieldName().equals("asc"))
|
||||
ordering.fieldName("label").orderByType(Ordering.OrderByType.ASC);
|
||||
else if (ordering.getFieldName().equals("desc"))
|
||||
ordering.fieldName("label").orderByType(Ordering.OrderByType.DESC);
|
||||
return ordering;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,9 @@ public class DatasetCriteria extends Criteria {
|
|||
private List<Tag> tags;
|
||||
private boolean isPublic;
|
||||
private Short grantStatus;
|
||||
private int offset;
|
||||
private int size;
|
||||
private List<SortCriteria> sortCriteria;
|
||||
|
||||
public String getLike() {
|
||||
return like;
|
||||
|
@ -117,4 +120,28 @@ public class DatasetCriteria extends Criteria {
|
|||
public void setGrantStatus(Short grantStatus) {
|
||||
this.grantStatus = grantStatus;
|
||||
}
|
||||
|
||||
public int getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void setOffset(int offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public List<SortCriteria> getSortCriteria() {
|
||||
return sortCriteria;
|
||||
}
|
||||
|
||||
public void setSortCriteria(List<SortCriteria> sortCriteria) {
|
||||
this.sortCriteria = sortCriteria;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,16 @@ public class DmpCriteria extends Criteria {
|
|||
private List<UUID> templates;
|
||||
private List<UUID> grants;
|
||||
private List<UUID> collaborators;
|
||||
private List<Integer> roles;
|
||||
private List<UUID> organizations;
|
||||
private boolean isPublic;
|
||||
private List<UUID> groupIds;
|
||||
private boolean allowAllVersions;
|
||||
private Short grantStatus;
|
||||
private int offset;
|
||||
private Integer size;
|
||||
private List<SortCriteria> sortCriteria;
|
||||
|
||||
|
||||
public String getLike() {
|
||||
return like;
|
||||
|
@ -55,6 +60,14 @@ public class DmpCriteria extends Criteria {
|
|||
this.collaborators = collaborators;
|
||||
}
|
||||
|
||||
public List<Integer> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(List<Integer> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
public List<UUID> getOrganizations() {
|
||||
return organizations;
|
||||
}
|
||||
|
@ -94,4 +107,28 @@ public class DmpCriteria extends Criteria {
|
|||
public void setGrantStatus(Short grantStatus) {
|
||||
this.grantStatus = grantStatus;
|
||||
}
|
||||
|
||||
public int getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void setOffset(int offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public Integer getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Integer size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public List<SortCriteria> getSortCriteria() {
|
||||
return sortCriteria;
|
||||
}
|
||||
|
||||
public void setSortCriteria(List<SortCriteria> sortCriteria) {
|
||||
this.sortCriteria = sortCriteria;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package eu.eudat.elastic.criteria;
|
||||
|
||||
public class SortCriteria {
|
||||
public enum OrderByType {
|
||||
ASC, DESC
|
||||
}
|
||||
|
||||
public enum ColumnType {
|
||||
COUNT, COLUMN, JOIN_COLUMN
|
||||
}
|
||||
|
||||
private String fieldName;
|
||||
private OrderByType orderByType;
|
||||
private ColumnType columnType;
|
||||
|
||||
public String getFieldName() {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
public void setFieldName(String fieldName) {
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
public OrderByType getOrderByType() {
|
||||
return orderByType;
|
||||
}
|
||||
|
||||
public void setOrderByType(OrderByType orderByType) {
|
||||
this.orderByType = orderByType;
|
||||
}
|
||||
|
||||
public ColumnType getColumnType() {
|
||||
return columnType;
|
||||
}
|
||||
|
||||
public void setColumnType(ColumnType columnType) {
|
||||
this.columnType = columnType;
|
||||
}
|
||||
}
|
|
@ -4,11 +4,11 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Collaborator implements ElasticEntity<Collaborator> {
|
||||
private String id;
|
||||
private String name;
|
||||
private int role;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
@ -26,11 +26,20 @@ public class Collaborator implements ElasticEntity<Collaborator> {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public int getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(int role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
||||
builder.startObject();
|
||||
builder.field("id", this.id);
|
||||
builder.field("name", this.name);
|
||||
builder.field("role", this.role);
|
||||
builder.endObject();
|
||||
return builder;
|
||||
}
|
||||
|
@ -39,6 +48,7 @@ public class Collaborator implements ElasticEntity<Collaborator> {
|
|||
public Collaborator fromElasticEntity(Map fields) {
|
||||
this.id = (String) fields.get("id");
|
||||
this.name = (String) fields.get("name");
|
||||
this.role = (int) fields.get("role");
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -59,6 +60,9 @@ public class Dataset implements ElasticEntity<Dataset> {
|
|||
private Boolean isPublic;
|
||||
private Short grantStatus;
|
||||
private String formData;
|
||||
private Date created;
|
||||
private Date modified;
|
||||
private Date finalizedAt;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
@ -188,6 +192,30 @@ public class Dataset implements ElasticEntity<Dataset> {
|
|||
this.formData = formData;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
public Date getFinalizedAt() {
|
||||
return finalizedAt;
|
||||
}
|
||||
|
||||
public void setFinalizedAt(Date finalizedAt) {
|
||||
this.finalizedAt = finalizedAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
||||
builder.startObject();
|
||||
|
@ -197,6 +225,9 @@ public class Dataset implements ElasticEntity<Dataset> {
|
|||
builder.field("template", this.template.toString());
|
||||
builder.field("status", this.status.toString());
|
||||
builder.field("dmp", this.dmp.toString());
|
||||
builder.field("created", this.created);
|
||||
builder.field("modified", this.modified);
|
||||
builder.field("finalizedAt", this.finalizedAt);
|
||||
if (this.group != null) {
|
||||
builder.field("group", this.group.toString());
|
||||
}
|
||||
|
@ -263,6 +294,12 @@ public class Dataset implements ElasticEntity<Dataset> {
|
|||
this.dmp = UUID.fromString((String) fields.get("dmp"));
|
||||
this.group = UUID.fromString((String) fields.get("group"));
|
||||
this.grant = UUID.fromString((String) fields.get("grant"));
|
||||
if (fields.get("created") != null)
|
||||
this.created = Date.from(Instant.parse((String) fields.get("created")));
|
||||
if (fields.get("modified") != null)
|
||||
this.modified = Date.from(Instant.parse((String) fields.get("modified")));
|
||||
if (fields.get("finalizedAt") != null)
|
||||
this.finalizedAt = Date.from(Instant.parse((String) fields.get("finalizedAt")));
|
||||
if (fields.get("collaborators") != null) {
|
||||
this.collaborators = ((List<HashMap>) fields.get("collaborators")).stream().map(hashMap -> new Collaborator().fromElasticEntity(hashMap)).collect(Collectors.toList());
|
||||
}
|
||||
|
|
|
@ -5,10 +5,7 @@ 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.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Dmp implements ElasticEntity<Dmp> {
|
||||
|
@ -55,6 +52,11 @@ public class Dmp implements ElasticEntity<Dmp> {
|
|||
private List<Dataset> datasets;
|
||||
private UUID grant;
|
||||
private Short grantStatus;
|
||||
private Date created;
|
||||
private Date modified;
|
||||
private Date finalizedAt;
|
||||
private Date publishedAt;
|
||||
private String doi;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
|
@ -168,6 +170,46 @@ public class Dmp implements ElasticEntity<Dmp> {
|
|||
this.grantStatus = grantStatus;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
public Date getFinalizedAt() {
|
||||
return finalizedAt;
|
||||
}
|
||||
|
||||
public void setFinalizedAt(Date finalizedAt) {
|
||||
this.finalizedAt = finalizedAt;
|
||||
}
|
||||
|
||||
public Date getPublishedAt() {
|
||||
return publishedAt;
|
||||
}
|
||||
|
||||
public void setPublishedAt(Date publishedAt) {
|
||||
this.publishedAt = publishedAt;
|
||||
}
|
||||
|
||||
public String getDoi() {
|
||||
return doi;
|
||||
}
|
||||
|
||||
public void setDoi(String doi) {
|
||||
this.doi = doi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
||||
builder.startObject();
|
||||
|
@ -233,6 +275,11 @@ public class Dmp implements ElasticEntity<Dmp> {
|
|||
builder.field(MapKey.GRANT.getName(), this.grant.toString());
|
||||
}
|
||||
builder.field(MapKey.GRANTSTATUS.getName(), this.grantStatus);
|
||||
builder.field(MapKey.CREATED.getName(), this.created);
|
||||
builder.field(MapKey.MODIFIED.getName(), this.modified);
|
||||
builder.field(MapKey.FINALIZEDAT.getName(), this.finalizedAt);
|
||||
builder.field(MapKey.PUBLISHEDAT.getName(), this.publishedAt);
|
||||
builder.field(MapKey.DOI.getName(), this.doi);
|
||||
builder.endObject();
|
||||
return builder;
|
||||
}
|
||||
|
@ -282,7 +329,12 @@ public class Dmp implements ElasticEntity<Dmp> {
|
|||
ISPUBLIC ("isPublic"),
|
||||
DATASETS ("datasets"),
|
||||
GRANT ("grant"),
|
||||
GRANTSTATUS ("grantStatus");
|
||||
GRANTSTATUS ("grantStatus"),
|
||||
CREATED ("created"),
|
||||
MODIFIED ("modified"),
|
||||
FINALIZEDAT ("finalizedAt"),
|
||||
PUBLISHEDAT ("publishedAt"),
|
||||
DOI ("doi");
|
||||
|
||||
private final String name;
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@ import org.elasticsearch.search.aggregations.bucket.filter.ParsedFilters;
|
|||
import org.elasticsearch.search.aggregations.bucket.nested.NestedAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.ParsedNested;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.search.sort.SortBuilder;
|
||||
import org.elasticsearch.search.sort.SortBuilders;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
@ -120,6 +123,7 @@ public class DatasetRepository extends ElasticRepository<Dataset, DatasetCriteri
|
|||
searchSourceBuilder.size(count.intValue());
|
||||
|
||||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery().mustNot(QueryBuilders.termsQuery("datasets.status", Stream.of(Dataset.Status.DELETED.getValue(), Dataset.Status.CANCELED.getValue()).collect(Collectors.toList())));
|
||||
List<SortBuilder> sortBuilders = new ArrayList<>();
|
||||
if (criteria.isPublic()) {
|
||||
boolQuery = boolQuery.should(QueryBuilders.termQuery("datasets.public", "true"));
|
||||
boolQuery = boolQuery.should(QueryBuilders.termQuery("datasets.status", Dataset.Status.FINALISED.getValue()));
|
||||
|
@ -181,8 +185,26 @@ public class DatasetRepository extends ElasticRepository<Dataset, DatasetCriteri
|
|||
boolQuery.minimumShouldMatch(boolQuery.should().size());
|
||||
}
|
||||
|
||||
if (criteria.getSortCriteria() != null && !criteria.getSortCriteria().isEmpty()) {
|
||||
criteria.getSortCriteria().forEach(sortCriteria -> {
|
||||
switch(sortCriteria.getColumnType()) {
|
||||
case COLUMN:
|
||||
sortBuilders.add(SortBuilders.fieldSort(sortCriteria.getFieldName()).order(SortOrder.fromString(sortCriteria.getOrderByType().name())));
|
||||
break;
|
||||
case JOIN_COLUMN:
|
||||
List<String> fields = Arrays.asList(sortCriteria.getFieldName().split(":"));
|
||||
fields.stream().filter(name -> !name.startsWith("dmp")).forEach(field -> {
|
||||
sortBuilders.add(SortBuilders.fieldSort(field).order(SortOrder.fromString(sortCriteria.getOrderByType().name())));
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
NestedQueryBuilder nestedQueryBuilder = QueryBuilders.nestedQuery("datasets", boolQuery, ScoreMode.Avg).innerHit(new InnerHitBuilder());
|
||||
searchSourceBuilder.query(nestedQueryBuilder);
|
||||
searchSourceBuilder.query(nestedQueryBuilder).from(criteria.getOffset()).size(criteria.getSize());
|
||||
sortBuilders.forEach(searchSourceBuilder::sort);
|
||||
searchRequest.source(searchSourceBuilder);
|
||||
SearchResponse response = this.getClient().search(searchRequest, RequestOptions.DEFAULT);
|
||||
return ((Stream<Dataset>)Arrays.stream(response.getHits().getHits())
|
||||
|
|
|
@ -23,6 +23,9 @@ 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.elasticsearch.search.sort.SortBuilder;
|
||||
import org.elasticsearch.search.sort.SortBuilders;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -97,6 +100,7 @@ public class DmpRepository extends ElasticRepository<Dmp, DmpCriteria> {
|
|||
searchSourceBuilder.size(count.intValue());
|
||||
|
||||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery().mustNot(QueryBuilders.termsQuery(Dmp.MapKey.STATUS.getName(), Collections.singletonList(Dmp.DMPStatus.DELETED.getValue())));
|
||||
List<SortBuilder> sortBuilders = new ArrayList<>();
|
||||
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()));
|
||||
|
@ -125,7 +129,11 @@ public class DmpRepository extends ElasticRepository<Dmp, DmpCriteria> {
|
|||
}
|
||||
|
||||
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())));
|
||||
boolQuery = boolQuery.should(QueryBuilders.termsQuery(Dmp.MapKey.COLLABORATORS.getName() + ".id.keyword", criteria.getCollaborators().stream().map(UUID::toString).collect(Collectors.toList())));
|
||||
}
|
||||
|
||||
if (criteria.getRoles() != null && criteria.getRoles().size() > 0) {
|
||||
boolQuery = boolQuery.should(QueryBuilders.termsQuery(Dmp.MapKey.COLLABORATORS.getName() + ".role.keyword", criteria.getRoles()));
|
||||
}
|
||||
|
||||
if (!criteria.isAllowAllVersions()) {
|
||||
|
@ -145,7 +153,28 @@ public class DmpRepository extends ElasticRepository<Dmp, DmpCriteria> {
|
|||
} else {
|
||||
boolQuery.minimumShouldMatch(boolQuery.should().size());
|
||||
}
|
||||
searchSourceBuilder.query(boolQuery);
|
||||
|
||||
if (criteria.getSortCriteria() != null && !criteria.getSortCriteria().isEmpty()) {
|
||||
criteria.getSortCriteria().forEach(sortCriteria -> {
|
||||
switch(sortCriteria.getColumnType()) {
|
||||
case COLUMN:
|
||||
sortBuilders.add(SortBuilders.fieldSort(sortCriteria.getFieldName()).order(SortOrder.fromString(sortCriteria.getOrderByType().name())));
|
||||
break;
|
||||
case JOIN_COLUMN:
|
||||
List<String> fields = Arrays.asList(sortCriteria.getFieldName().split(":"));
|
||||
fields.forEach(field -> {
|
||||
sortBuilders.add(SortBuilders.fieldSort(sortCriteria.getFieldName()).order(SortOrder.fromString(sortCriteria.getOrderByType().name())));
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
searchSourceBuilder.query(boolQuery).from(criteria.getOffset());
|
||||
if (criteria.getSize() != null) {
|
||||
searchSourceBuilder.size(criteria.getSize());
|
||||
}
|
||||
sortBuilders.forEach(searchSourceBuilder::sort);
|
||||
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());
|
||||
|
@ -153,6 +182,67 @@ public class DmpRepository extends ElasticRepository<Dmp, DmpCriteria> {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Long count(DmpCriteria criteria) throws IOException {
|
||||
if (this.getClient() != null) {
|
||||
CountRequest countRequest = new CountRequest(this.environment.getProperty("elasticsearch.index"));
|
||||
|
||||
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() + ".id.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());
|
||||
}
|
||||
|
||||
countRequest.query(boolQuery);
|
||||
CountResponse response = this.getClient().count(countRequest, RequestOptions.DEFAULT);
|
||||
return response.getCount();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean createIndex() {
|
||||
try {
|
||||
if (!this.exists()) {
|
||||
|
|
|
@ -243,7 +243,6 @@ public class DMPs extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.SUCCESS_MESSAGE).payload(cloneId));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = {"{id}"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DMP>> delete(@PathVariable UUID id, Principal principal) {
|
||||
|
@ -260,7 +259,7 @@ public class DMPs extends BaseController {
|
|||
if (files[0].getContentType().equals(APPLICATION_JSON.toString())) {
|
||||
this.dataManagementPlanManager.createFromRDA(files, principal, profiles);
|
||||
} else if (files[0].getContentType().equals(APPLICATION_ATOM_XML.toString()) || files[0].getContentType().equals(TEXT_XML.toString())) {
|
||||
this.dataManagementPlanManager.createDmpFromXml(this.getApiContext(), files, principal);
|
||||
this.dataManagementPlanManager.createDmpFromXml(files, principal, profiles);
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(new ResponseItem().status(ApiMessageCode.ERROR_MESSAGE).message("File format is not supported"));
|
||||
}
|
||||
|
@ -279,7 +278,6 @@ public class DMPs extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/finalize/{id}"})
|
||||
public ResponseEntity<ResponseItem<DMP>> makeFinalize(@PathVariable String id, Principal principal, @RequestBody DatasetsToBeFinalized datasetsToBeFinalized) {
|
||||
try {
|
||||
|
@ -291,7 +289,6 @@ public class DMPs extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/unfinalize/{id}"})
|
||||
public ResponseEntity<ResponseItem<DMP>> undoFinalize(@PathVariable String id, Principal principal) {
|
||||
try {
|
||||
|
@ -304,7 +301,6 @@ public class DMPs extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/updateusers/{id}"})
|
||||
public ResponseEntity<ResponseItem<DMP>> updateUsers(@PathVariable String id, @RequestBody List<UserInfoListingModel> users, Principal principal) {
|
||||
try {
|
||||
|
@ -320,7 +316,6 @@ public class DMPs extends BaseController {
|
|||
* DOI Generation
|
||||
* */
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/createZenodoDoi/{id}"})
|
||||
public ResponseEntity<ResponseItem<String>> createZenodoDoi(@PathVariable String id, Principal principal) {
|
||||
try {
|
||||
|
@ -328,7 +323,7 @@ public class DMPs extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<String>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully created DOI for Data Datamanagement Plan in question.").payload(zenodoDOI));
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<String>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to create DOI for the Data Management Plan."));
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<String>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to create DOI for the Data Management Plan: " + e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,14 +182,14 @@ public class DashBoardManager {
|
|||
.selectAsync(item -> recentActivityDataBuilder.label(item.getLabel()).timestamp(item.getModified()).id(item.getId().toString()).build())
|
||||
.whenComplete((datasetActivities, throwable) -> activity.setRecentDatasetActivities(datasetActivities));
|
||||
|
||||
CompletableFuture<List<RecentActivityData>> grants = grantRepository.getAuthenticated(grantRepository.getWithCriteria(grantCriteria), user)
|
||||
/*CompletableFuture<List<RecentActivityData>> grants = grantRepository.getAuthenticated(grantRepository.getWithCriteria(grantCriteria), user)
|
||||
.withHint("grantRecentActivity")
|
||||
.orderBy((builder, root) -> builder.desc(root.get("modified")))
|
||||
.take(numberofactivities)
|
||||
.selectAsync(item -> recentActivityDataBuilder.label(item.getLabel()).timestamp(item.getModified()).id(item.getId().toString()).build())
|
||||
.whenComplete((grantActivities, throwable) -> activity.setRecentGrantActivities(grantActivities));
|
||||
.whenComplete((grantActivities, throwable) -> activity.setRecentGrantActivities(grantActivities));*/
|
||||
|
||||
CompletableFuture.allOf(grants, dmps, datasets).join();
|
||||
CompletableFuture.allOf(/*grants, */dmps, datasets).join();
|
||||
return activity;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package eu.eudat.logic.managers;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.configurations.dynamicgrant.DynamicGrantConfiguration;
|
||||
|
@ -13,6 +14,7 @@ import eu.eudat.data.enumeration.notification.ActiveStatus;
|
|||
import eu.eudat.data.enumeration.notification.ContactType;
|
||||
import eu.eudat.data.enumeration.notification.NotificationType;
|
||||
import eu.eudat.data.enumeration.notification.NotifyState;
|
||||
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.dmp.DataManagementPlanTableRequest;
|
||||
import eu.eudat.elastic.criteria.DmpCriteria;
|
||||
|
@ -68,8 +70,6 @@ import org.springframework.core.env.Environment;
|
|||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.HttpServerErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
@ -129,73 +129,138 @@ public class DataManagementPlanManager {
|
|||
List<Dmp> dmps = null;
|
||||
QueryableList<DMP> items = null;
|
||||
QueryableList<DMP> authItems = null;
|
||||
Long totalData = 0L;
|
||||
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())));
|
||||
try {
|
||||
DmpCriteria criteria = DmpCriteriaMapper.toElasticCriteria(dataManagementPlanTableRequest.getCriteria(), principalID);
|
||||
criteria.setOffset(dataManagementPlanTableRequest.getOffset());
|
||||
criteria.setSize(dataManagementPlanTableRequest.getLength());
|
||||
criteria.setSortCriteria(DmpCriteriaMapper.toElasticSorting(dataManagementPlanTableRequest.getOrderings()));
|
||||
|
||||
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())));
|
||||
PaginationManager.applyOrder(items, dataManagementPlanTableRequest);
|
||||
totalData = apiContext.getOperationsContext().getElasticRepository().getDmpRepository().count(criteria);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.warn(ex.getMessage(), ex);
|
||||
items = null;
|
||||
}
|
||||
}
|
||||
if (items == null) {
|
||||
items = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(dataManagementPlanTableRequest.getCriteria());
|
||||
List<Integer> roles = new LinkedList<>();
|
||||
if (!dataManagementPlanTableRequest.getCriteria().isOnlyPublic()) {
|
||||
if (dataManagementPlanTableRequest.getCriteria().getRole() != null)
|
||||
roles.add(dataManagementPlanTableRequest.getCriteria().getRole());
|
||||
authItems = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getAuthenticated(items, principalID, roles);
|
||||
} else {
|
||||
authItems = items;
|
||||
}
|
||||
totalData = authItems.count();
|
||||
items = PaginationManager.applyPaging(authItems, dataManagementPlanTableRequest);
|
||||
}
|
||||
List<Integer> roles = new LinkedList<>();
|
||||
if (!dataManagementPlanTableRequest.getCriteria().isOnlyPublic()) {
|
||||
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);
|
||||
|
||||
|
||||
|
||||
DataTableData<DataManagementPlanListingModel> dataTable = new DataTableData<>();
|
||||
|
||||
CompletableFuture itemsFuture;
|
||||
if (fieldsGroup.equals("listing")) {
|
||||
if (!dataManagementPlanTableRequest.getCriteria().isOnlyPublic()) {
|
||||
itemsFuture = pagedItems.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class))
|
||||
.distinct()
|
||||
.selectAsync(item -> {
|
||||
List<DMP> dmps1 = items.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class))
|
||||
.distinct().toList();
|
||||
dataTable.setData(dmps1.stream().map(dmp -> {
|
||||
DatasetCriteria datasetCriteria = new DatasetCriteria();
|
||||
datasetCriteria.setDmpIds(Collections.singletonList(dmp.getId()));
|
||||
dmp.setDataset(retrieveRelevantDatasets(datasetCriteria, principalID));
|
||||
|
||||
|
||||
return new DataManagementPlanListingModel().fromDataModelDatasets(dmp);
|
||||
}).collect(Collectors.toList()));
|
||||
/*.selectAsync(item -> {
|
||||
item.setDataset(
|
||||
item.getDataset().stream()
|
||||
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue())).collect(Collectors.toList()).stream()
|
||||
.filter(dataset -> dataset.getDmp().getUsers().stream()
|
||||
*//*.filter(dataset -> dataset.getDmp().getUsers().stream()
|
||||
.filter(x -> x.getUser().getId().equals(principalID))
|
||||
.collect(Collectors.toList()).size() > 0)
|
||||
.collect(Collectors.toList()).size() > 0)*//*
|
||||
.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))
|
||||
.distinct()
|
||||
.selectAsync(item -> {
|
||||
List<DMP> dmps1 = items.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class))
|
||||
.distinct().toList();
|
||||
dataTable.setData(dmps1.stream().map(dmp -> {
|
||||
DatasetCriteria datasetCriteria = new DatasetCriteria();
|
||||
datasetCriteria.setDmpIds(Collections.singletonList(dmp.getId()));
|
||||
datasetCriteria.setIsPublic(true);
|
||||
dmp.setDataset(retrieveRelevantDatasets(datasetCriteria));
|
||||
|
||||
|
||||
return new DataManagementPlanListingModel().fromDataModelDatasets(dmp);
|
||||
}).collect(Collectors.toList()));
|
||||
/*.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));
|
||||
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));*/
|
||||
}
|
||||
} else if (fieldsGroup.equals("autocomplete")) {
|
||||
itemsFuture = pagedItems
|
||||
dataTable.setData(items
|
||||
.distinct()
|
||||
.selectAsync(item -> new DataManagementPlanListingModel().fromDataModelAutoComplete(item))
|
||||
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
|
||||
.select(item -> new DataManagementPlanListingModel().fromDataModelAutoComplete(item)));
|
||||
} else {
|
||||
itemsFuture = pagedItems
|
||||
dataTable.setData(items
|
||||
.distinct()
|
||||
.selectAsync(item -> new DataManagementPlanListingModel().fromDataModelAssociatedProfiles(item))
|
||||
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
|
||||
.select(item -> new DataManagementPlanListingModel().fromDataModelAssociatedProfiles(item)));
|
||||
}
|
||||
|
||||
CompletableFuture countFuture = authItems.distinct().countAsync().whenComplete((count, throwable) -> dataTable.setTotalCount(count));
|
||||
CompletableFuture.allOf(itemsFuture, countFuture).join();
|
||||
//CompletableFuture countFuture = authItems.distinct().countAsync().whenComplete((count, throwable) -> dataTable.setTotalCount(count));
|
||||
dataTable.setTotalCount(totalData);
|
||||
//CompletableFuture.allOf(itemsFuture).join();
|
||||
return dataTable;
|
||||
}
|
||||
|
||||
private Set<Dataset> retrieveRelevantDatasets(DatasetCriteria datasetCriteria) {
|
||||
return retrieveRelevantDatasets(datasetCriteria, null);
|
||||
}
|
||||
|
||||
private Set<Dataset> retrieveRelevantDatasets (DatasetCriteria datasetCriteria, UUID principal) {
|
||||
QueryableList<Dataset> datasetItems = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().getWithCriteria(datasetCriteria);
|
||||
if (principal != null) {
|
||||
UserInfo userInfo = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal);
|
||||
List<Integer> roles = new ArrayList<>();
|
||||
roles.add(0);
|
||||
roles.add(1);
|
||||
datasetItems = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().getAuthenticated(datasetItems, userInfo, roles);
|
||||
}
|
||||
Long maxDatasets = datasetItems.count();
|
||||
DatasetTableRequest datasetTableRequest = new DatasetTableRequest();
|
||||
datasetTableRequest.setOffset(0);
|
||||
datasetTableRequest.setLength(3);
|
||||
Set<Dataset> datasetsSet = new LinkedHashSet<>();
|
||||
try {
|
||||
datasetItems = PaginationManager.applyPaging(datasetItems, datasetTableRequest);
|
||||
List<Dataset> datasets = datasetItems.toList();
|
||||
datasetsSet.addAll(datasets);
|
||||
for (int i = 0; i < maxDatasets - datasets.size(); i++) {
|
||||
Dataset fakedataset = new Dataset();
|
||||
fakedataset.setId(UUID.randomUUID());
|
||||
datasetsSet.add(fakedataset);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return datasetsSet;
|
||||
}
|
||||
|
||||
public eu.eudat.models.data.dmp.DataManagementPlan getSingle(String id, Principal principal, boolean isPublic) throws Exception {
|
||||
eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlan = new eu.eudat.models.data.dmp.DataManagementPlan();
|
||||
DMP dataManagementPlanEntity = databaseRepository.getDmpDao().find(UUID.fromString(id));
|
||||
|
@ -567,6 +632,16 @@ public class DataManagementPlanManager {
|
|||
|
||||
copyDatasets(newDmp, databaseRepository.getDatasetDao());
|
||||
|
||||
databaseRepository
|
||||
.getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), oldDmp.getId()))
|
||||
.toList().stream().forEach(userDMP -> {
|
||||
UserDMP temp = new UserDMP();
|
||||
temp.setUser(userDMP.getUser());
|
||||
temp.setRole(userDMP.getRole());
|
||||
temp.setDmp(newDmp);
|
||||
apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().createOrUpdate(temp);
|
||||
});
|
||||
|
||||
newDmp.setUsers(new HashSet<>(databaseRepository.getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), newDmp.getId())).toList()));
|
||||
|
||||
DatasetCriteria criteria1 = new DatasetCriteria();
|
||||
|
@ -859,6 +934,7 @@ public class DataManagementPlanManager {
|
|||
datasetElastic.setCollaborators(dataset1.getDmp().getUsers().stream().map(user -> {
|
||||
Collaborator collaborator = new Collaborator();
|
||||
collaborator.setId(user.getId().toString());
|
||||
collaborator.setRole(user.getRole());
|
||||
// collaborator.setName(user.getUser().getName());
|
||||
return collaborator;
|
||||
}).collect(Collectors.toList()));
|
||||
|
@ -1192,7 +1268,7 @@ public class DataManagementPlanManager {
|
|||
if (versioned) {
|
||||
fileName += "_" + dmpEntity.getVersion();
|
||||
}
|
||||
fileName = fileName.replaceAll("[^a-zA-Z0-9+ ]", "");
|
||||
// fileName = fileName.replaceAll("[^a-zA-Z0-9+ ]", "");
|
||||
FileEnvelope exportEnvelope = new FileEnvelope();
|
||||
exportEnvelope.setFilename(fileName + ".docx");
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
|
@ -1226,6 +1302,22 @@ public class DataManagementPlanManager {
|
|||
dmpName.setTextContent(dmp.getLabel());
|
||||
dmpElement.appendChild(dmpName);
|
||||
|
||||
if (dmp.getExtraProperties() != null && !dmp.getExtraProperties().isEmpty()) {
|
||||
Map<String, Object> extraProperties = new ObjectMapper().readValue(dmp.getExtraProperties(), HashMap.class);
|
||||
Element language = xmlDoc.createElement("language");
|
||||
language.setTextContent(extraProperties.get("language") != null ? extraProperties.get("language").toString() : null);
|
||||
dmpElement.appendChild(language);
|
||||
Element visibility = xmlDoc.createElement("visibility");
|
||||
visibility.setTextContent(extraProperties.get("visible") != null ? extraProperties.get("visible").toString() : null);
|
||||
dmpElement.appendChild(visibility);
|
||||
Element publicDate = xmlDoc.createElement("publicDate");
|
||||
publicDate.setTextContent(extraProperties.get("publicDate") != null ? extraProperties.get("publicDate").toString() : null);
|
||||
dmpElement.appendChild(publicDate);
|
||||
Element costs = xmlDoc.createElement("costs");
|
||||
costs.setTextContent(extraProperties.get("costs") != null ? extraProperties.get("costs").toString() : null);
|
||||
dmpElement.appendChild(costs);
|
||||
}
|
||||
|
||||
DMPProfile dmpProfile = dmp.getProfile();
|
||||
Element dmpProfileElement = xmlDoc.createElement("dmpProfile");
|
||||
Element dmpProfileName = xmlDoc.createElement("dmpProfileName");
|
||||
|
@ -1341,7 +1433,7 @@ public class DataManagementPlanManager {
|
|||
return fileEnvelope;
|
||||
}
|
||||
|
||||
public ResponseEntity<byte[]> getRDAJsonDocument(String id, DatasetManager datasetManager, Principal principal) throws IOException {
|
||||
public ResponseEntity<byte[]> getRDAJsonDocument(String id, DatasetManager datasetManager, Principal principal) throws Exception {
|
||||
eu.eudat.data.entities.DMP dmp = databaseRepository.getDmpDao().find(UUID.fromString(id));
|
||||
if (!dmp.isPublic() && dmp.getUsers().stream().noneMatch(userInfo -> userInfo.getUser().getId() == principal.getId()))
|
||||
throw new UnauthorisedException();
|
||||
|
@ -1410,7 +1502,7 @@ public class DataManagementPlanManager {
|
|||
* Data Import
|
||||
* */
|
||||
|
||||
public List<DmpImportModel> createDmpFromXml(ApiContext apiContext, MultipartFile[] files, Principal principal) throws IOException, JAXBException, Exception {
|
||||
public List<DmpImportModel> createDmpFromXml(MultipartFile[] files, Principal principal, String[] profiles) throws IOException, JAXBException, Exception {
|
||||
List<DmpImportModel> dataManagementPlans = new ArrayList<>();
|
||||
// Jaxb approach.
|
||||
JAXBContext jaxbContext;
|
||||
|
@ -1466,16 +1558,26 @@ public class DataManagementPlanManager {
|
|||
projectEditor.setExistProject(project);
|
||||
|
||||
List<eu.eudat.models.data.dmp.AssociatedProfile> associatedProfiles = new LinkedList<>();
|
||||
if (profiles != null && profiles.length > 0) {
|
||||
for (String profile : profiles) {
|
||||
DatasetProfile exProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(profile));
|
||||
AssociatedProfile associatedProfile = new AssociatedProfile().fromData(exProfile);
|
||||
associatedProfiles.add(associatedProfile);
|
||||
}
|
||||
}
|
||||
|
||||
for (AssociatedProfileImportModels a : dataManagementPlans.get(0).getProfilesImportModels()) {
|
||||
AssociatedProfile associatedProfile = new AssociatedProfile();
|
||||
associatedProfile.setId(a.getId());
|
||||
associatedProfile.setLabel(a.getLabel());
|
||||
associatedProfiles.add(associatedProfile);
|
||||
try {
|
||||
DatasetProfile exProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(a.getId());
|
||||
AssociatedProfile associatedProfile = new AssociatedProfile().fromData(exProfile);
|
||||
associatedProfiles.add(associatedProfile);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
List<eu.eudat.models.data.dmp.Organisation> organisations = new ArrayList<>();
|
||||
for (OrganisationImportModel org : dataManagementPlans.get(0).getOrganisationImportModels()) {
|
||||
eu.eudat.models.data.dmp.Organisation organisation = new eu.eudat.models.data.dmp.Organisation();
|
||||
organisation.setLabel(org.getOrganaisationNameImport());
|
||||
organisation.setName(org.getOrganaisationNameImport());
|
||||
organisation.setReference(org.getOrganaisationReferenceImport());
|
||||
organisation.setKey(organisation.getReference().split(":")[0]);
|
||||
organisations.add(organisation);
|
||||
|
@ -1504,6 +1606,21 @@ public class DataManagementPlanManager {
|
|||
dm.setAssociatedUsers(associatedUsers); // Sets associatedUsers property.
|
||||
dm.setDynamicFields(dynamicFields); // Sets dynamicFields property.
|
||||
dm.setDefinition(dmpProfile);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Map<String, Object> extraPropertiesMap = new HashMap<>();
|
||||
if (dataManagementPlans.get(0).getLanguage() != null) {
|
||||
extraPropertiesMap.put("language", dataManagementPlans.get(0).getLanguage());
|
||||
}
|
||||
if (dataManagementPlans.get(0).getVisibility() != null) {
|
||||
extraPropertiesMap.put("visible", dataManagementPlans.get(0).getVisibility());
|
||||
}
|
||||
if (dataManagementPlans.get(0).getPublicDate() != null) {
|
||||
extraPropertiesMap.put("publicDate", dataManagementPlans.get(0).getPublicDate());
|
||||
}
|
||||
if (dataManagementPlans.get(0).getCosts() != null) {
|
||||
extraPropertiesMap.put("costs", mapper.readValue(dataManagementPlans.get(0).getCosts(), ArrayList.class));
|
||||
}
|
||||
dm.setExtraProperties(extraPropertiesMap);
|
||||
|
||||
//createOrUpdate(apiContext, dm, principal);
|
||||
DMP dmp = this.createOrUpdate(dm, principal);
|
||||
|
@ -1527,7 +1644,11 @@ public class DataManagementPlanManager {
|
|||
for (DatasetImportModels das: dataManagementPlans.get(0).getDatasetImportModels()) {
|
||||
eu.eudat.data.entities.Dataset dataset = new eu.eudat.data.entities.Dataset();
|
||||
dataset.setLabel(das.getName());
|
||||
dataset.setProfile(databaseRepository.getDatasetProfileDao().find(das.getProfile()));
|
||||
try {
|
||||
dataset.setProfile(databaseRepository.getDatasetProfileDao().find(das.getProfile()));
|
||||
} catch (Exception ignored) {
|
||||
dataset.setProfile(databaseRepository.getDatasetProfileDao().find(associatedProfiles.get(0).getId()));
|
||||
}
|
||||
dataset.setProperties(new ObjectMapper().writeValueAsString(das.getFieldImportModels()));
|
||||
dataset.setStatus((short) 0);
|
||||
dataset.setRegistries(new HashSet<>());
|
||||
|
@ -1749,7 +1870,7 @@ public class DataManagementPlanManager {
|
|||
}
|
||||
|
||||
private boolean isUserOwnerOfDmp(DMP dmp, Principal principal) {
|
||||
return (dmp.getUsers().stream().filter(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser().getId()).equals(principal.getId());
|
||||
return (dmp.getUsers().stream().filter(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).map(userDMP -> userDMP.getUser().getId())).collect(Collectors.toList()).contains(principal.getId());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1906,6 +2027,9 @@ public class DataManagementPlanManager {
|
|||
i++;
|
||||
}
|
||||
dataBuilder.append("],\n");
|
||||
if (dmp.getGrant().getReference() == null) {
|
||||
dmp.getGrant().setReference("dmp:" + dmp.getGrant().getId());
|
||||
}
|
||||
String grantReferenceHead = dmp.getGrant().getReference().split(":")[0];
|
||||
if (grantReferenceHead.equals("openaire")) {
|
||||
String grantReferenceTail = dmp.getGrant().getReference().split(":")[3];
|
||||
|
@ -1914,6 +2038,7 @@ public class DataManagementPlanManager {
|
|||
dataBuilder.append(" \"grants\": [{\n");
|
||||
dataBuilder.append(" \t\t\"id\": \"").append(finalId).append("\"\n}],\n");
|
||||
}
|
||||
|
||||
dataBuilder.append(" \"creators\": [{\n");
|
||||
dataBuilder.append(" \t\t\"name\": \"").append(dmp.getUsers().stream().filter(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser().getName()).append("\",\n");
|
||||
if (dmp.getOrganisations() != null && !dmp.getOrganisations().isEmpty()) {
|
||||
|
@ -1932,7 +2057,9 @@ public class DataManagementPlanManager {
|
|||
}
|
||||
dataBuilder.append(" }\n").append("}");
|
||||
createData = dataBuilder.toString();
|
||||
JsonNode createDataJSON = new ObjectMapper().readTree(createData);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);
|
||||
JsonNode createDataJSON = mapper.readTree(createData);
|
||||
HttpEntity<JsonNode> request = new HttpEntity<>(createDataJSON, headers);
|
||||
Map createResponse = null;
|
||||
LinkedHashMap<String, String> links = null;
|
||||
|
@ -1995,17 +2122,22 @@ public class DataManagementPlanManager {
|
|||
if (unpublishedUrl == null) {
|
||||
// Second step, add the file to the entry.
|
||||
FileEnvelope file = getWordDocument(id.toString(), principal, configLoader);
|
||||
/*String name = file.getFilename().substring(0, file.getFilename().length() - 5);
|
||||
String name = file.getFilename().substring(0, file.getFilename().length() - 5);
|
||||
File pdfFile = datasetManager.convertToPDF(file, environment);
|
||||
String fileName = name + ".pdf";*/
|
||||
FileSystemResource fileSystemResource = new FileSystemResource(file.getFile());
|
||||
String fileName = name + ".pdf";
|
||||
FileSystemResource fileSystemResource = new FileSystemResource(pdfFile);
|
||||
HttpEntity<FileSystemResource> addFileMapRequest = new HttpEntity<>(fileSystemResource, null);
|
||||
|
||||
String addFileUrl = links.get("bucket") + "/" + file.getFilename() + "?access_token=" + zenodoToken;
|
||||
String addFileUrl = links.get("bucket") + "/" + fileName + "?access_token=" + zenodoToken;
|
||||
restTemplate.put(addFileUrl, addFileMapRequest);
|
||||
Files.deleteIfExists(file.getFile().toPath());
|
||||
|
||||
ResponseEntity<byte[]> jsonFile = getRDAJsonDocument(id.toString(), datasetManager, principal);
|
||||
ResponseEntity<byte[]> jsonFile;
|
||||
try {
|
||||
jsonFile = getRDAJsonDocument(id.toString(), datasetManager, principal);
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
UUID jsonFileUUID = UUID.randomUUID();
|
||||
File tempJsonFile = new File(this.environment.getProperty("temp.temp") + jsonFileUUID.toString() + ".json");
|
||||
try (FileOutputStream jsonFos = new FileOutputStream(tempJsonFile)) {
|
||||
|
|
|
@ -22,6 +22,7 @@ import eu.eudat.exceptions.security.UnauthorisedException;
|
|||
import eu.eudat.logic.builders.BuilderFactory;
|
||||
import eu.eudat.logic.builders.entity.UserInfoBuilder;
|
||||
import eu.eudat.logic.mapper.elastic.DatasetMapper;
|
||||
import eu.eudat.logic.mapper.elastic.criteria.DmpCriteriaMapper;
|
||||
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
||||
|
@ -137,9 +138,21 @@ public class DatasetManager {
|
|||
if (datasetTableRequest.getCriteria().getIsPublic() != null) {
|
||||
datasetCriteria.setPublic(datasetTableRequest.getCriteria().getIsPublic());
|
||||
}
|
||||
|
||||
if (!datasetCriteria.isPublic()) {
|
||||
if (datasetCriteria.getCollaborators() == null) {
|
||||
datasetCriteria.setSortCriteria(new ArrayList<>());
|
||||
}
|
||||
datasetCriteria.getCollaborators().add(principal.getId());
|
||||
}
|
||||
if (datasetTableRequest.getCriteria().getGrantStatus() != null) {
|
||||
datasetCriteria.setGrantStatus(datasetTableRequest.getCriteria().getGrantStatus());
|
||||
}
|
||||
if (datasetTableRequest.getOrderings() != null) {
|
||||
datasetCriteria.setSortCriteria(DmpCriteriaMapper.toElasticSorting(datasetTableRequest.getOrderings()));
|
||||
}
|
||||
datasetCriteria.setOffset(datasetTableRequest.getOffset());
|
||||
datasetCriteria.setSize(datasetTableRequest.getLength());
|
||||
List<eu.eudat.elastic.entities.Dataset> datasets;
|
||||
try {
|
||||
datasets = datasetRepository.exists() ?
|
||||
|
@ -206,6 +219,11 @@ public class DatasetManager {
|
|||
datasetCriteria.setDatasetTemplates(datasetTableRequest.getCriteria().getDatasetProfile());
|
||||
datasetCriteria.setDmps(datasetTableRequest.getCriteria().getDmpIds());
|
||||
datasetCriteria.setGrants(datasetTableRequest.getCriteria().getGrants());
|
||||
if (datasetTableRequest.getOrderings() != null) {
|
||||
datasetCriteria.setSortCriteria(DmpCriteriaMapper.toElasticSorting(datasetTableRequest.getOrderings()));
|
||||
}
|
||||
datasetCriteria.setOffset(datasetTableRequest.getOffset());
|
||||
datasetCriteria.setSize(datasetTableRequest.getLength());
|
||||
List<eu.eudat.elastic.entities.Dataset> datasets;
|
||||
try {
|
||||
datasets = datasetRepository.exists() ?
|
||||
|
@ -214,9 +232,9 @@ public class DatasetManager {
|
|||
logger.warn(ex.getMessage());
|
||||
datasets = null;
|
||||
}
|
||||
datasetTableRequest.setQuery(databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetListingModel.class)));
|
||||
QueryableList<Dataset> items = datasetTableRequest.applyCriteria();
|
||||
/*QueryableList<Dataset> items;
|
||||
/*datasetTableRequest.setQuery(databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetListingModel.class)));
|
||||
QueryableList<Dataset> items = datasetTableRequest.applyCriteria();*/
|
||||
QueryableList<Dataset> items;
|
||||
if (datasets != null) {
|
||||
if (!datasets.isEmpty()) {
|
||||
items = databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetListingModel.class));
|
||||
|
@ -227,7 +245,7 @@ public class DatasetManager {
|
|||
items.where((builder, root) -> root.get("id").in(new UUID[]{UUID.randomUUID()}));
|
||||
} else {
|
||||
items = datasetTableRequest.applyCriteria();
|
||||
}*/
|
||||
}
|
||||
|
||||
if (principal.getId() != null && datasetTableRequest.getCriteria().getRole() != null) {
|
||||
items.where((builder, root) -> {
|
||||
|
|
|
@ -5,10 +5,11 @@ import eu.eudat.elastic.entities.Collaborator;
|
|||
|
||||
public class CollaboratorMapper {
|
||||
|
||||
public static Collaborator toElastic(UserInfo user) {
|
||||
public static Collaborator toElastic(UserInfo user, Integer role) {
|
||||
Collaborator elastic = new Collaborator();
|
||||
elastic.setId(user.getId().toString());
|
||||
elastic.setName(user.getName());
|
||||
elastic.setRole(role);
|
||||
return elastic;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,8 +50,11 @@ public class DatasetMapper {
|
|||
elastic.setDmp(dataset.getDmp().getId());
|
||||
elastic.setGroup(dataset.getDmp().getGroupId());
|
||||
elastic.setGrant(dataset.getDmp().getGrant().getId());
|
||||
elastic.setCreated(dataset.getCreated());
|
||||
elastic.setModified(dataset.getModified());
|
||||
elastic.setFinalizedAt(dataset.getFinalizedAt());
|
||||
if (dataset.getDmp().getUsers() != null) {
|
||||
elastic.setCollaborators(dataset.getDmp().getUsers().stream().map(user -> CollaboratorMapper.toElastic(user.getUser())).collect(Collectors.toList()));
|
||||
elastic.setCollaborators(dataset.getDmp().getUsers().stream().map(user -> CollaboratorMapper.toElastic(user.getUser(), user.getRole())).collect(Collectors.toList()));
|
||||
}
|
||||
DataManagementPlanCriteria dmpCriteria = new DataManagementPlanCriteria();
|
||||
dmpCriteria.setAllVersions(true);
|
||||
|
|
|
@ -34,13 +34,17 @@ public class DmpMapper {
|
|||
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.setCollaborators(dmp.getUsers().stream().map(user -> CollaboratorMapper.toElastic(user.getUser(), user.getRole())).collect(Collectors.toList()));
|
||||
}
|
||||
elastic.setDescription(dmp.getDescription());
|
||||
elastic.setGrant(dmp.getGrant().getId());
|
||||
elastic.setLabel(dmp.getLabel());
|
||||
elastic.setPublic(dmp.isPublic());
|
||||
elastic.setStatus(dmp.getStatus());
|
||||
elastic.setCreated(dmp.getCreated());
|
||||
elastic.setModified(dmp.getModified());
|
||||
elastic.setFinalizedAt(dmp.getFinalizedAt());
|
||||
elastic.setPublishedAt(dmp.getPublishedAt());
|
||||
DataManagementPlanCriteria dmpCriteria = new DataManagementPlanCriteria();
|
||||
dmpCriteria.setAllVersions(true);
|
||||
dmpCriteria.setGroupIds(Collections.singletonList(dmp.getGroupId()));
|
||||
|
|
|
@ -2,14 +2,20 @@ package eu.eudat.logic.mapper.elastic.criteria;
|
|||
|
||||
import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
|
||||
import eu.eudat.data.entities.Grant;
|
||||
import eu.eudat.data.query.definition.helpers.ColumnOrderings;
|
||||
import eu.eudat.data.query.definition.helpers.Ordering;
|
||||
import eu.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.eudat.elastic.criteria.SortCriteria;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DmpCriteriaMapper {
|
||||
|
||||
public static DmpCriteria toElasticCriteria(DataManagementPlanCriteria criteria) {
|
||||
public static DmpCriteria toElasticCriteria(DataManagementPlanCriteria criteria, UUID principalID) {
|
||||
DmpCriteria elastic = new DmpCriteria();
|
||||
|
||||
elastic.setAllowAllVersions(criteria.getAllVersions());
|
||||
|
@ -23,6 +29,12 @@ public class DmpCriteriaMapper {
|
|||
elastic.setOrganizations(criteria.getOrganisations().stream().map(UUID::fromString).collect(Collectors.toList()));
|
||||
}
|
||||
elastic.setPublic(criteria.getIsPublic());
|
||||
if (!elastic.isPublic()) {
|
||||
elastic.setCollaborators(Collections.singletonList(principalID));
|
||||
}
|
||||
if (criteria.getRole() != null) {
|
||||
elastic.setRoles(Collections.singletonList(criteria.getRole()));
|
||||
}
|
||||
if (criteria.getStatus() != null) {
|
||||
elastic.setStatus(criteria.getStatus().shortValue());
|
||||
}
|
||||
|
@ -30,4 +42,18 @@ public class DmpCriteriaMapper {
|
|||
elastic.setGrantStatus(criteria.getGrantStatus());
|
||||
return elastic;
|
||||
}
|
||||
|
||||
public static List<SortCriteria> toElasticSorting(ColumnOrderings columnOrderings) {
|
||||
List<SortCriteria> sortCriteria = new ArrayList<>();
|
||||
if (columnOrderings.getFieldOrderings() != null && columnOrderings.getFieldOrderings().length > 0) {
|
||||
for (Ordering ordering: columnOrderings.getFieldOrderings()) {
|
||||
SortCriteria sortCriteria1 = new SortCriteria();
|
||||
sortCriteria1.setFieldName(ordering.getFieldName() + (ordering.getFieldName().contains("label") ?".keyword" : ""));
|
||||
sortCriteria1.setColumnType(ordering.getColumnType() != null ? SortCriteria.ColumnType.valueOf(ordering.getColumnType().name()): SortCriteria.ColumnType.COLUMN);
|
||||
sortCriteria1.setOrderByType(SortCriteria.OrderByType.valueOf(ordering.getOrderByType().name()));
|
||||
sortCriteria.add(sortCriteria1);
|
||||
}
|
||||
}
|
||||
return sortCriteria;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,67 +144,89 @@ public class WordBuilder {
|
|||
|
||||
private void createSections(List<Section> sections, XWPFDocument mainDocumentPart, ParagraphStyle style, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService, Integer page, String sectionString) {
|
||||
if (createListing) this.addListing(mainDocumentPart, indent, false, true);
|
||||
sections.forEach(section -> {
|
||||
boolean hasValue = false;
|
||||
for (Section section: sections) {
|
||||
int paragraphPos = -1;
|
||||
String tempSectionString = sectionString != null ? sectionString + "." + (section.getOrdinal() + 1) : "" + (section.getOrdinal() + 1);
|
||||
if (visibilityRuleService.isElementVisible(section.getId())) {
|
||||
if (!createListing) {
|
||||
XWPFParagraph paragraph = addParagraphContent(page + "." + tempSectionString + " " + section.getTitle(), mainDocumentPart, style, numId);
|
||||
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
||||
number.setVal(BigInteger.valueOf(indent));
|
||||
paragraphPos = mainDocumentPart.getPosOfParagraph(paragraph);
|
||||
}
|
||||
createSections(section.getSections(), mainDocumentPart, ParagraphStyle.HEADER5, 1, createListing, visibilityRuleService, page, tempSectionString);
|
||||
createCompositeFields(section.getCompositeFields(), mainDocumentPart, 2, createListing, visibilityRuleService, page, tempSectionString);
|
||||
hasValue = createCompositeFields(section.getCompositeFields(), mainDocumentPart, 2, createListing, visibilityRuleService, page, tempSectionString);
|
||||
|
||||
if (!hasValue && paragraphPos > -1) {
|
||||
mainDocumentPart.removeBodyElement(paragraphPos);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void createCompositeFields(List<FieldSet> compositeFields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService, Integer page, String section) {
|
||||
private Boolean createCompositeFields(List<FieldSet> compositeFields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService, Integer page, String section) {
|
||||
if (createListing) this.addListing(mainDocumentPart, indent, true, true);
|
||||
compositeFields.forEach(compositeField -> {
|
||||
boolean hasValue = false;
|
||||
for (FieldSet compositeField: compositeFields) {
|
||||
if (visibilityRuleService.isElementVisible(compositeField.getId()) && hasVisibleFields(compositeField, visibilityRuleService)) {
|
||||
int paragraphPos = -1;
|
||||
if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty() && !createListing) {
|
||||
XWPFParagraph paragraph = addParagraphContent(page + "." + section + "." + (compositeField.getOrdinal() +1) + " " + compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER6, numId);
|
||||
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
||||
number.setVal(BigInteger.valueOf(indent));
|
||||
paragraphPos = mainDocumentPart.getPosOfParagraph(paragraph);
|
||||
}
|
||||
createFields(compositeField.getFields(), mainDocumentPart, 3, createListing, visibilityRuleService);
|
||||
hasValue = createFields(compositeField.getFields(), mainDocumentPart, 3, createListing, visibilityRuleService);
|
||||
if (compositeField.getMultiplicityItems() != null && !compositeField.getMultiplicityItems().isEmpty()) {
|
||||
for (FieldSet multiplicityFieldset : compositeField.getMultiplicityItems()) {
|
||||
createFields(multiplicityFieldset.getFields(), mainDocumentPart, 3, createListing, visibilityRuleService);
|
||||
hasValue = createFields(multiplicityFieldset.getFields(), mainDocumentPart, 3, createListing, visibilityRuleService);
|
||||
}
|
||||
}
|
||||
if (compositeField.getHasCommentField() && compositeField.getCommentFieldValue() != null && !compositeField.getCommentFieldValue().isEmpty() && !createListing) {
|
||||
if (hasValue && compositeField.getHasCommentField() && compositeField.getCommentFieldValue() != null && !compositeField.getCommentFieldValue().isEmpty() && !createListing) {
|
||||
XWPFParagraph paragraph = addParagraphContent("Comment: " + compositeField.getCommentFieldValue(), mainDocumentPart, ParagraphStyle.COMMENT, numId);
|
||||
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
||||
number.setVal(BigInteger.valueOf(indent));
|
||||
}
|
||||
if (!hasValue && paragraphPos > -1) {
|
||||
mainDocumentPart.removeBodyElement(paragraphPos);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return hasValue;
|
||||
}
|
||||
|
||||
private void createFields(List<Field> fields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService) {
|
||||
private Boolean createFields(List<Field> fields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService) {
|
||||
if (createListing) this.addListing(mainDocumentPart, indent, false, false);
|
||||
fields.forEach(field -> {
|
||||
boolean hasValue = false;
|
||||
for (Field field: fields) {
|
||||
if (visibilityRuleService.isElementVisible(field.getId())) {
|
||||
if (!createListing) {
|
||||
try {
|
||||
XWPFParagraph paragraph = addParagraphContent(this.formatter(field), mainDocumentPart, ParagraphStyle.TEXT, numId);
|
||||
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
||||
number.setVal(BigInteger.valueOf(indent));
|
||||
if (paragraph != null) {
|
||||
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
||||
number.setVal(BigInteger.valueOf(indent));
|
||||
hasValue = true;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return hasValue;
|
||||
}
|
||||
|
||||
public XWPFParagraph addParagraphContent(String text, XWPFDocument mainDocumentPart, ParagraphStyle style, BigInteger numId) {
|
||||
XWPFParagraph paragraph = this.options.get(style).apply(mainDocumentPart, text);
|
||||
if (numId != null) {
|
||||
paragraph.setNumID(numId);
|
||||
if (text != null && !text.isEmpty()) {
|
||||
XWPFParagraph paragraph = this.options.get(style).apply(mainDocumentPart, text);
|
||||
if (numId != null) {
|
||||
paragraph.setNumID(numId);
|
||||
}
|
||||
return paragraph;
|
||||
}
|
||||
return paragraph;
|
||||
return null;
|
||||
}
|
||||
|
||||
private void addListing(XWPFDocument document, int indent, Boolean question, Boolean hasIndication) {
|
||||
|
@ -254,6 +276,7 @@ public class WordBuilder {
|
|||
mapList = Arrays.asList(mapper.readValue(field.getValue().toString(), HashMap[].class));
|
||||
}catch (Exception e) {
|
||||
logger.warn(e.getMessage(), e);
|
||||
logger.info("Moving to fallback parsing");
|
||||
Map <String, Object> map = new HashMap<>();
|
||||
map.put("label", field.getValue().toString());
|
||||
mapList.add(map);
|
||||
|
@ -304,6 +327,7 @@ public class WordBuilder {
|
|||
WordListData wordListData = (WordListData) field.getData();
|
||||
if (wordListData.getOptions().isEmpty() && field.getValue() != null) {
|
||||
logger.warn("World List has no values but the field has");
|
||||
logger.info("Return value as is");
|
||||
return field.getValue().toString();
|
||||
} else if (field.getValue() != null){
|
||||
ComboBoxData<WordListData>.Option selectedOption = null;
|
||||
|
@ -332,21 +356,24 @@ public class WordBuilder {
|
|||
return field.getValue() != null ? field.getValue().toString(): "";
|
||||
case "datasetIdentifier":
|
||||
case "validation":
|
||||
Map<String, String> identifierData;
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
identifierData = mapper.readValue(field.getValue().toString(), HashMap.class);
|
||||
} catch (JsonParseException ex) {
|
||||
identifierData = new HashMap<>();
|
||||
String parsedData = field.getValue().toString().substring(1, field.getValue().toString().length() - 1);
|
||||
StringTokenizer commaTokens = new StringTokenizer(parsedData, ", ");
|
||||
while (commaTokens.hasMoreTokens()) {
|
||||
String token = commaTokens.nextToken();
|
||||
StringTokenizer equalTokens = new StringTokenizer(token, "=");
|
||||
identifierData.put(equalTokens.nextToken(), equalTokens.nextToken());
|
||||
if (field.getValue() != null) {
|
||||
Map<String, String> identifierData;
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
identifierData = mapper.readValue(field.getValue().toString(), HashMap.class);
|
||||
} catch (JsonParseException ex) {
|
||||
identifierData = new HashMap<>();
|
||||
String parsedData = field.getValue().toString().substring(1, field.getValue().toString().length() - 1);
|
||||
StringTokenizer commaTokens = new StringTokenizer(parsedData, ", ");
|
||||
while (commaTokens.hasMoreTokens()) {
|
||||
String token = commaTokens.nextToken();
|
||||
StringTokenizer equalTokens = new StringTokenizer(token, "=");
|
||||
identifierData.put(equalTokens.nextToken(), equalTokens.nextToken());
|
||||
}
|
||||
}
|
||||
return "id: " + identifierData.get("identifier") + ", Validation Type: " + identifierData.get("type");
|
||||
}
|
||||
return "id: " + identifierData.get("identifier") + ", Validation Type: " + identifierData.get("type");
|
||||
return "";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,10 @@ public class DmpImportModel {
|
|||
private List<UserInfoImportModels> associatedUsersImportModels;
|
||||
private List<DynamicFieldWithValueImportModels> dynamicFieldsImportModels;
|
||||
private List<DatasetImportModels> datasetImportModels;
|
||||
private String language;
|
||||
private Boolean visibility;
|
||||
private String publicDate;
|
||||
private String costs;
|
||||
|
||||
@XmlElement(name = "description")
|
||||
public String getDescriptionImport() {
|
||||
|
@ -113,4 +117,37 @@ public class DmpImportModel {
|
|||
@XmlElement(name = "dataset")
|
||||
public List<DatasetImportModels> getDatasetImportModels() { return datasetImportModels; }
|
||||
public void setDatasetImportModels(List<DatasetImportModels> datasetImportModels) { this.datasetImportModels = datasetImportModels; }
|
||||
|
||||
@XmlElement(name = "language")
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
@XmlElement(name = "visibility")
|
||||
public Boolean getVisibility() {
|
||||
return visibility;
|
||||
}
|
||||
|
||||
public void setVisibility(Boolean visibility) {
|
||||
this.visibility = visibility;
|
||||
}
|
||||
@XmlElement(name = "publicDate")
|
||||
public String getPublicDate() {
|
||||
return publicDate;
|
||||
}
|
||||
|
||||
public void setPublicDate(String publicDate) {
|
||||
this.publicDate = publicDate;
|
||||
}
|
||||
@XmlElement(name = "costs")
|
||||
public String getCosts() {
|
||||
return costs;
|
||||
}
|
||||
|
||||
public void setCosts(String costs) {
|
||||
this.costs = costs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,19 +24,19 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
|||
private String id;
|
||||
private String label;
|
||||
private String grant;
|
||||
private String profile;
|
||||
private Date creationTime;
|
||||
// private String profile;
|
||||
// private Date creationTime;
|
||||
private Date modifiedTime;
|
||||
private String organisations;
|
||||
//private String organisations;
|
||||
private int version;
|
||||
private int status;
|
||||
private UUID groupId;
|
||||
private List<DatasetUrlListing> datasets;
|
||||
private List<AssociatedProfile> associatedProfiles;
|
||||
// private List<AssociatedProfile> associatedProfiles;
|
||||
private List<UserInfoListingModel> users;
|
||||
private String description;
|
||||
private String grantAbbreviation;
|
||||
private String grantId;
|
||||
// private String grantAbbreviation;
|
||||
// private String grantId;
|
||||
private Date finalizedAt;
|
||||
private Boolean isPublic;
|
||||
private Date publishedAt;
|
||||
|
@ -63,19 +63,19 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
|||
this.grant = grant;
|
||||
}
|
||||
|
||||
public String getProfile() {
|
||||
/* public String getProfile() {
|
||||
return profile;
|
||||
}
|
||||
public void setProfile(String profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
}*/
|
||||
|
||||
public Date getCreationTime() {
|
||||
/*public Date getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
public void setCreationTime(Date creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
}*/
|
||||
|
||||
public Date getModifiedTime() {
|
||||
return modifiedTime;
|
||||
|
@ -84,12 +84,12 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
|||
this.modifiedTime = modifiedTime;
|
||||
}
|
||||
|
||||
public String getOrganisations() {
|
||||
/*public String getOrganisations() {
|
||||
return organisations;
|
||||
}
|
||||
public void setOrganisations(String organisations) {
|
||||
this.organisations = organisations;
|
||||
}
|
||||
}*/
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
|
@ -119,12 +119,12 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
public List<AssociatedProfile> getAssociatedProfiles() {
|
||||
/*public List<AssociatedProfile> getAssociatedProfiles() {
|
||||
return associatedProfiles;
|
||||
}
|
||||
public void setAssociatedProfiles(List<AssociatedProfile> associatedProfiles) {
|
||||
this.associatedProfiles = associatedProfiles;
|
||||
}
|
||||
}*/
|
||||
|
||||
public List<UserInfoListingModel> getUsers() {
|
||||
return users;
|
||||
|
@ -140,19 +140,19 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public String getGrantAbbreviation() {
|
||||
/*public String getGrantAbbreviation() {
|
||||
return grantAbbreviation;
|
||||
}
|
||||
public void setGrantAbbreviation(String grantAbbreviation) {
|
||||
this.grantAbbreviation = grantAbbreviation;
|
||||
}
|
||||
}*/
|
||||
|
||||
public String getGrantId() {
|
||||
/*public String getGrantId() {
|
||||
return grantId;
|
||||
}
|
||||
public void setGrantId(String grantId) {
|
||||
this.grantId = grantId;
|
||||
}
|
||||
}*/
|
||||
|
||||
public Date getFinalizedAt() {
|
||||
return finalizedAt;
|
||||
|
@ -187,8 +187,8 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
|||
this.id = entity.getId().toString();
|
||||
this.label = entity.getLabel();
|
||||
this.groupId = entity.getGroupId();
|
||||
this.creationTime = entity.getCreated();
|
||||
this.associatedProfiles = entity.getAssociatedDmps().stream().map(item -> new AssociatedProfile().fromData(item)).collect(Collectors.toList());
|
||||
// this.creationTime = entity.getCreated();
|
||||
// this.associatedProfiles = entity.getAssociatedDmps().stream().map(item -> new AssociatedProfile().fromData(item)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
|||
this.id = entity.getId().toString();
|
||||
this.label = entity.getLabel();
|
||||
this.groupId = entity.getGroupId();
|
||||
this.creationTime = entity.getCreated();
|
||||
// this.creationTime = entity.getCreated();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -205,26 +205,26 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
|||
this.status = entity.getStatus();
|
||||
this.version = entity.getVersion();
|
||||
this.grant = entity.getGrant().getLabel();
|
||||
if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel();
|
||||
this.creationTime = entity.getCreated();
|
||||
/*if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel();
|
||||
this.creationTime = entity.getCreated();*/
|
||||
this.modifiedTime = entity.getModified();
|
||||
this.organisations = LabelBuilder.getLabel(entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()));
|
||||
// this.organisations = LabelBuilder.getLabel(entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()));
|
||||
this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList());
|
||||
this.users = entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList());
|
||||
this.description = entity.getDescription();
|
||||
this.grantAbbreviation = entity.getGrant().getAbbreviation();
|
||||
this.grantId = entity.getGrant().getId().toString();
|
||||
// this.grantAbbreviation = entity.getGrant().getAbbreviation();
|
||||
// this.grantId = entity.getGrant().getId().toString();
|
||||
this.finalizedAt = entity.getFinalizedAt();
|
||||
this.isPublic = entity.isPublic();
|
||||
this.publishedAt = entity.getPublishedAt();
|
||||
|
||||
if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {
|
||||
/*if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {
|
||||
this.associatedProfiles = new LinkedList<>();
|
||||
for (DatasetProfile datasetProfile: entity.getAssociatedDmps()) {
|
||||
AssociatedProfile associatedProfile = new AssociatedProfile().fromData(datasetProfile);
|
||||
this.associatedProfiles.add(associatedProfile);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class DatasetRDAMapper {
|
|||
for (int i = 0; i < keywordNodes.size(); i++) {
|
||||
rda.setAdditionalProperty("keyword" + (i + 1), keywordNodes.get(i).get("id").asText());
|
||||
}
|
||||
} else {
|
||||
} else if (apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().exists()) {
|
||||
List<String> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString()).getTags().stream().map(Tag::getName).collect(Collectors.toList());
|
||||
rda.setKeyword(tags);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class DmpRDAMapper {
|
|||
}
|
||||
Map<String, Object> extraProperties;
|
||||
if (dmp.getExtraProperties() == null) {
|
||||
throw new IllegalArgumentException("DMP is missing required Data for RDA export");
|
||||
throw new IllegalArgumentException("DMP is missing language and contact properties");
|
||||
} else {
|
||||
extraProperties = new org.json.JSONObject(dmp.getExtraProperties()).toMap();
|
||||
if (extraProperties.get("language") == null) {
|
||||
|
|
|
@ -6,11 +6,13 @@ import eu.eudat.data.entities.Grant;
|
|||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.rda.Funding;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
public class FundingRDAMapper {
|
||||
|
||||
@Transactional
|
||||
public static Funding toRDA(Grant grant) {
|
||||
Funding rda = new Funding();
|
||||
String referencePrefix;
|
||||
|
@ -22,9 +24,13 @@ public class FundingRDAMapper {
|
|||
} else {
|
||||
rda.setFunderId(FunderIdRDAMapper.toRDA(grant.getFunder().getId()));
|
||||
}
|
||||
referencePrefix = grant.getReference().split(":")[0];
|
||||
shortReference = grant.getReference().substring(referencePrefix.length() + 1);
|
||||
rda.setGrantId(GrantIdRDAMapper.toRDA(shortReference));
|
||||
if (grant.getReference() != null) {
|
||||
referencePrefix = grant.getReference().split(":")[0];
|
||||
shortReference = grant.getReference().substring(referencePrefix.length() + 1);
|
||||
rda.setGrantId(GrantIdRDAMapper.toRDA(shortReference));
|
||||
} else {
|
||||
rda.setGrantId(GrantIdRDAMapper.toRDA(grant.getId().toString()));
|
||||
}
|
||||
return rda;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,25 +4,34 @@ import eu.eudat.data.entities.Funder;
|
|||
import eu.eudat.data.entities.Grant;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.rda.Project;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.*;
|
||||
|
||||
public class ProjectRDAMapper {
|
||||
private final static Logger logger = LoggerFactory.getLogger(ProjectRDAMapper.class);
|
||||
|
||||
@Transactional
|
||||
public static Project toRDA(eu.eudat.data.entities.Project project, Grant grant) {
|
||||
Project rda = new Project();
|
||||
rda.setTitle(project.getLabel());
|
||||
rda.setDescription(project.getDescription());
|
||||
if (project.getStartdate() != null) {
|
||||
rda.setStart(project.getStartdate().toString());
|
||||
}
|
||||
if (project.getEnddate() != null) {
|
||||
rda.setEnd(project.getEnddate().toString());
|
||||
}
|
||||
rda.setFunding(Collections.singletonList(FundingRDAMapper.toRDA(grant)));
|
||||
try {
|
||||
rda.setTitle(project.getLabel());
|
||||
rda.setDescription(project.getDescription());
|
||||
if (project.getStartdate() != null) {
|
||||
rda.setStart(project.getStartdate().toString());
|
||||
}
|
||||
if (project.getEnddate() != null) {
|
||||
rda.setEnd(project.getEnddate().toString());
|
||||
}
|
||||
rda.setFunding(Collections.singletonList(FundingRDAMapper.toRDA(grant)));
|
||||
|
||||
if (rda.getTitle() == null) {
|
||||
throw new IllegalArgumentException("Project Title is missing");
|
||||
if (rda.getTitle() == null) {
|
||||
throw new IllegalArgumentException("Project Title is missing");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
return rda;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<div class="row root">
|
||||
<mat-card class="col-md-3 offset-md-4">
|
||||
<div>
|
||||
<div style="color: red;">Warning: Danger zone. It might delete Dataset tags if not careful</div>
|
||||
<button mat-raised-button color="primary" (click)="generateIndex($event)" class="lightblue-btn button">Generate Index</button>
|
||||
<button mat-raised-button color="primary" (click)="clearIndex($event)" class="lightblue-btn button">Clear Index</button>
|
||||
<!-- <button mat-raised-button color="primary" (click)="clearIndex($event)" class="lightblue-btn button">Clear Index</button> -->
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
|
|
|
@ -54,10 +54,13 @@ export class LoginComponent extends BaseComponent implements OnInit, AfterViewIn
|
|||
private mergeLoginService: MergeLoginService,
|
||||
private oauth2DialogService: Oauth2DialogService,
|
||||
private httpClient: HttpClient,
|
||||
private matomoService: MatomoService
|
||||
private matomoService: MatomoService,
|
||||
) { super(); }
|
||||
|
||||
ngOnInit(): void {
|
||||
if(this.authService.current()){
|
||||
this.router.navigate(['home']);
|
||||
}
|
||||
this.matomoService.trackPageView('loginPage');
|
||||
this.route.queryParams
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
{{'DASHBOARD.NEW-QUESTION' | translate}} <a href="https://www.openaire.eu/how-to-create-a-data-management-plan" target="_blank"><u>{{'DASHBOARD.OPEN-AIR-GUIDE' | translate}}</u></a> {{'DASHBOARD.LEARN-MORE' | translate}}
|
||||
</p>
|
||||
<p *ngIf="this.hasDmps()" class="card-content mb-0 pt-0">{{'DASHBOARD.DMP-ABOUT-BEG' | translate}}
|
||||
<b>{{'DASHBOARD.DATASET-DESCRIPTIONS' | translate}}</b>
|
||||
<b>{{'DASHBOARD.DATASET-DESCRIPTIONS-DASHBOARD-TEXT' | translate}}</b>
|
||||
{{'DASHBOARD.DMP-ABOUT-END' | translate}}
|
||||
</p>
|
||||
|
||||
|
|
|
@ -61,7 +61,8 @@ export class DatasetCopyDialogueComponent {
|
|||
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
|
||||
dmpDataTableRequest.criteria = new DmpCriteria();
|
||||
dmpDataTableRequest.criteria.like = query;
|
||||
return this.dmpService.getPaged(dmpDataTableRequest, "profiles").pipe(map(x => x.data), map(x => x.filter(y => this.existsDatasetDescriptionTemplate(y.associatedProfiles))));
|
||||
dmpDataTableRequest.criteria.datasetTemplates = [this.data.datasetProfileId];
|
||||
return this.dmpService.getPaged(dmpDataTableRequest, "profiles").pipe(map(x => x.data));
|
||||
}
|
||||
|
||||
existsDatasetDescriptionTemplate(associatedProfiles: DmpAssociatedProfileModel[]): boolean {
|
||||
|
|
|
@ -173,7 +173,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
|||
setIsUserOwner() {
|
||||
if (this.dataset) {
|
||||
const principal: Principal = this.authentication.current();
|
||||
if (principal) this.isUserOwner = principal.id === this.dataset.users.find(x => x.role === Role.Owner).id;
|
||||
if (principal) this.isUserOwner = !!this.dataset.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
</mat-form-field>
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="ml-auto col-auto"><button mat-raised-button mat-dialog-close type="button">Cancel</button></div>
|
||||
<div class="col-auto"><button mat-raised-button [disabled]="!isFormValid()" color="primary" (click)="addResearcher()" type="button">Save</button></div>
|
||||
<div class="ml-auto col-auto"><button mat-raised-button mat-dialog-close type="button">{{'DMP-EDITOR.MAIN-INFO.CANCEL' | translate}}</button></div>
|
||||
<div class="col-auto"><button mat-raised-button [disabled]="!isFormValid()" color="primary" (click)="addResearcher()" type="button">{{'DMP-EDITOR.MAIN-INFO.SAVE' | translate}}</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1046,7 +1046,9 @@
|
|||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST": "This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list."
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list.",
|
||||
"SAVE":"Save",
|
||||
"CANCEL": "Cancel"
|
||||
},
|
||||
"FUNDING-INFO": {
|
||||
"INTRO": "You are using the DMP editor. Add here information about the scope, funding, actors of your DMP and decide on access and re-use issues for the DMP output that you are creating.",
|
||||
|
@ -1539,6 +1541,7 @@
|
|||
"PERSONAL-USAGE": "Personal Usage",
|
||||
"PUBLIC-USAGE": "Public Usage",
|
||||
"DATASET-DESCRIPTIONS": "Datasets",
|
||||
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Datasets",
|
||||
"PUBLIC-DMPS": "Public DMPs",
|
||||
"PUBLIC-DATASETS": "Public Datasets",
|
||||
"RELATED-ORGANISATIONS": "Related Organisations",
|
||||
|
|
|
@ -1046,7 +1046,9 @@
|
|||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST": "This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list."
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list.",
|
||||
"SAVE":"Save",
|
||||
"CANCEL": "Cancel"
|
||||
},
|
||||
"FUNDING-INFO": {
|
||||
"INTRO": "You are using the DMP editor. Add here information about the scope, funding, actors of your DMP and decide on access and re-use issues for the DMP output that you are creating.",
|
||||
|
@ -1539,6 +1541,7 @@
|
|||
"PERSONAL-USAGE": "Personal Usage",
|
||||
"PUBLIC-USAGE": "Public Usage",
|
||||
"DATASET-DESCRIPTIONS": "Datasets",
|
||||
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Datasets",
|
||||
"PUBLIC-DMPS": "Public DMPs",
|
||||
"PUBLIC-DATASETS": "Public Datasets",
|
||||
"RELATED-ORGANISATIONS": "Related Organisations",
|
||||
|
|
|
@ -1046,7 +1046,9 @@
|
|||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST": "This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list."
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list.",
|
||||
"SAVE":"Save",
|
||||
"CANCEL": "Cancel"
|
||||
},
|
||||
"FUNDING-INFO": {
|
||||
"INTRO": "You are using the DMP editor. Add here information about the scope, funding, actors of your DMP and decide on access and re-use issues for the DMP output that you are creating.",
|
||||
|
@ -1539,6 +1541,7 @@
|
|||
"PERSONAL-USAGE": "Uso personal",
|
||||
"PUBLIC-USAGE": "Public Usage",
|
||||
"DATASET-DESCRIPTIONS": "Descripciones de los datasets",
|
||||
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Descripciones de los datasets",
|
||||
"PUBLIC-DMPS": "Public DMPs",
|
||||
"PUBLIC-DATASETS": "Public Dataset Descriptions",
|
||||
"RELATED-ORGANISATIONS": "Organizaciones relacionadas",
|
||||
|
|
|
@ -1046,7 +1046,9 @@
|
|||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST": "This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list."
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list.",
|
||||
"SAVE":"Αποθήκευση",
|
||||
"CANCEL": "Ακύρωση"
|
||||
},
|
||||
"FUNDING-INFO": {
|
||||
"INTRO": "You are using the DMP editor. Add here information about the scope, funding, actors of your DMP and decide on access and re-use issues for the DMP output that you are creating.",
|
||||
|
@ -1539,6 +1541,7 @@
|
|||
"PERSONAL-USAGE": "Προσωπική Χρήση",
|
||||
"PUBLIC-USAGE": "Δημόσια Χρήση",
|
||||
"DATASET-DESCRIPTIONS": "Περιγραφές Συνόλου Δεδομένων",
|
||||
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Περιγραφές Συνόλου Δεδομένων",
|
||||
"PUBLIC-DMPS": "Δημόσια Σχέδια Διαχείρισης Δεδομένων",
|
||||
"PUBLIC-DATASETS": "Δημόσιες Περιγραφές Συνόλου Δεδομένων",
|
||||
"RELATED-ORGANISATIONS": "Σχετικοί Οργανισμοί",
|
||||
|
|
|
@ -572,8 +572,8 @@
|
|||
"PUBLISHED": "Publicado",
|
||||
"VERSION": "Versão",
|
||||
"CONTAINED-DATASETS": "Contém Datasets",
|
||||
"TEXT-INFO": "A informação contida no Plano de Gestão de Dados (PGD) demonstra como os Datasets foram recolhidos e/ou gerados, como foram processados e analisados, que ferramentas, normas e metodologias utilizaram, mas também fornece informação de onde e como os Datasets são alojados, publicados e preservados, incluindo quaisquer custos associados com recursos humanos dedicados a atividades de curadoria/admnistração dos dados ou custos para aquisição ou construção de serviços de gestão de dados.",
|
||||
"TEXT-INFO-QUESTION": "Não tem a certeza de como um PGD é na prática? Pesquise PGD Públicos e",
|
||||
"TEXT-INFO": "A informação contida no Plano de Gestão de Dados (PGD) demonstra como os dados foram recolhidos e/ou gerados, como foram processados e analisados, que ferramentas, normas e metodologias utilizaram. Fornece também informação de onde e como os dados são alojados, publicados e preservados.",
|
||||
"TEXT-INFO-QUESTION": "Não tem a certeza de como um Plano de Gestão de Dados (PGD) é na prática? Pesquise “PGD Públicos” e",
|
||||
"LINK-ZENODO": "Comunidade LIBER no Zenodo",
|
||||
"GET-IDEA": "para ter uma ideia!",
|
||||
"SORT-BY": "Ordenar por",
|
||||
|
@ -1046,7 +1046,9 @@
|
|||
"RESEARCHER-IDENTIFIER-EXISTS": "O identificador do investigador já existe.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "O identificador da organização já existe.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST": "Este identificador está já a ser utilizado por um investigador incluído na lista.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "Este identificador está já a ser utilizado por uma organização incluída na lista."
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "Este identificador está já a ser utilizado por uma organização incluída na lista.",
|
||||
"SAVE":"Guardar",
|
||||
"CANCEL": "Cancelar"
|
||||
},
|
||||
"FUNDING-INFO": {
|
||||
"INTRO": "Um Plano de Gestão de Dados (PGD) permite uma maior proximidade com o local onde os seus dados são gerados, analisados e armazenados. O Argos é uma ferramenta aberta, extensível e colaborativa que disponibiliza Planos de Gestão de Dados FAIR e Abertos.",
|
||||
|
@ -1539,6 +1541,7 @@
|
|||
"PERSONAL-USAGE": "Uso Pessoal",
|
||||
"PUBLIC-USAGE": "Uso Público",
|
||||
"DATASET-DESCRIPTIONS": "Datasets",
|
||||
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "",
|
||||
"PUBLIC-DMPS": "PGDs Públicos",
|
||||
"PUBLIC-DATASETS": "Datasets Públicos",
|
||||
"RELATED-ORGANISATIONS": "Organizações Relacionadas",
|
||||
|
@ -1546,8 +1549,8 @@
|
|||
"ALL": "TODOS",
|
||||
"EMPTY-LIST": "Sem Informação",
|
||||
"LATEST-ACTIVITY": "Última Atividade",
|
||||
"DMP-ABOUT-BEG": "A criação de um Plano de Gestão de Dados (PGD) no Argos consiste em fornecer informação-chave sobre a investigação, tal como, a sua finalidade, os seus objetivos e quais os investigadores envolvidos, como também sobre a documentação relativa aos dados de investigação",
|
||||
"DMP-ABOUT-END": "que permite evidenciar os passos dados e os meios utilizados para uma gestão mais eficaz dos dados a produzir ou que já tenham sido produzidos.",
|
||||
"DMP-ABOUT-BEG": "A criação de um Plano de Gestão de Dados (PGD) no Argos consiste em fornecer informação-chave sobre a investigação, tal como, a sua finalidade, os seus objetivos e quais os investigadores envolvidos, como também sobre a documentação relativa aos dados de investigação que permite evidenciar os passos dados e os meios utilizados para uma gestão mais eficaz dos dados a produzir ou que já tenham sido produzidos.",
|
||||
"DMP-ABOUT-END": "",
|
||||
"SELECT-DMP": "Selecione um PGD para o seu Dataset",
|
||||
"ACTIONS": {
|
||||
"ADD-DATASET-DESCRIPTION": "Adicione um Dataset",
|
||||
|
@ -1793,5 +1796,6 @@
|
|||
"File format is not supported": "Ficheiro a importar deverá ser em formato .json",
|
||||
"You cannot Remove Datamanagement Plan with Datasets": "Não pode remover o Plano de Gestão de Dados porque contém pelo menos um modelo de dados associado",
|
||||
"Failed to create DOI for the Data Management Plan.": "Não foi possível criar um DOI para o Plano de Gestão de Dados",
|
||||
"No entity found for query": "Não foi possível eliminar o item pretendido"
|
||||
"No entity found for query": "Não foi possível eliminar o item pretendido",
|
||||
"Index: 0, Size: 0" : "Ficheiro a importar deverá ser em formato .json"
|
||||
}
|
|
@ -1046,7 +1046,9 @@
|
|||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST": "This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list."
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list.",
|
||||
"SAVE":"Save",
|
||||
"CANCEL": "Cancel"
|
||||
},
|
||||
"FUNDING-INFO": {
|
||||
"INTRO": "Plán manažmentu dát (DMP, z angl. Data Management Plan) tvoria vaše plány manažmentu dát, ktoré sú bližšie miestu, kde sú vygenerované, analyzované a uložené. Argos je otvorený, rozširovateľný, kolaboratívny nástroj, ktorý podporuje plány manažmentu otvorených dát a FAIR dát (Open and FAIR Data Management Plans).",
|
||||
|
@ -1539,6 +1541,7 @@
|
|||
"PERSONAL-USAGE": "Osobné použitie",
|
||||
"PUBLIC-USAGE": "Verejné použitie",
|
||||
"DATASET-DESCRIPTIONS": "Súbory dát",
|
||||
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Súbory dát",
|
||||
"PUBLIC-DMPS": "Verejné DMP",
|
||||
"PUBLIC-DATASETS": "Verejné súbory dát",
|
||||
"RELATED-ORGANISATIONS": "Ďalšie organizácie",
|
||||
|
|
|
@ -1046,7 +1046,9 @@
|
|||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST": "This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list."
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list.",
|
||||
"SAVE":"Save",
|
||||
"CANCEL": "Cancel"
|
||||
},
|
||||
"FUNDING-INFO": {
|
||||
"INTRO": "Plan upravljanja podacima (eng. Data Management Plan) se sastoji od Vaših planova za upravljanje podacima i sadrži informacije kako su nastali, kako su analizirani i na koji način su sačuvani podaci. Argos je otvoren kolaboracioni alat sa mogućnošću nadogradnje i koji podržava otvorene FAIR principe za upravljanje podacima.",
|
||||
|
@ -1539,6 +1541,7 @@
|
|||
"PERSONAL-USAGE": "Lična upotreba",
|
||||
"PUBLIC-USAGE": "Javna upotreba",
|
||||
"DATASET-DESCRIPTIONS": "Skupovi podataka",
|
||||
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Skupovi podataka",
|
||||
"PUBLIC-DMPS": "Javno dostupni Planovi",
|
||||
"PUBLIC-DATASETS": "Javno dostupni skupovi podataka",
|
||||
"RELATED-ORGANISATIONS": "Povezane institucije",
|
||||
|
|
|
@ -1046,7 +1046,9 @@
|
|||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST": "This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list."
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST": "This identifier is already used by an organisation in the organisations list.",
|
||||
"SAVE":"Save",
|
||||
"CANCEL": "Cancel"
|
||||
},
|
||||
"FUNDING-INFO": {
|
||||
"INTRO": "You are using the DMP editor. Add here information about the scope, funding, actors of your DMP and decide on access and re-use issues for the DMP output that you are creating.",
|
||||
|
@ -1539,6 +1541,7 @@
|
|||
"PERSONAL-USAGE": "Kişisel Kullanım",
|
||||
"PUBLIC-USAGE": "Genel Kullanım",
|
||||
"DATASET-DESCRIPTIONS": "Veri Setleri",
|
||||
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Veri Setleri",
|
||||
"PUBLIC-DMPS": "Herkese açık VYP'ler",
|
||||
"PUBLIC-DATASETS": "Herkese açık Veri Setleri",
|
||||
"RELATED-ORGANISATIONS": "Bağlantılı Kurumlar",
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
analysed and stored.</p>
|
||||
</div>
|
||||
<div class="head-start-dmp">
|
||||
<a href="/login">
|
||||
<a href="/home">
|
||||
<button type="button" class="normal-btn">Start your DMP</button>
|
||||
</a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue