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({
|
@NamedEntityGraphs({
|
||||||
@NamedEntityGraph(
|
@NamedEntityGraph(
|
||||||
name = "dataManagementPlanListingModel",
|
name = "dataManagementPlanListingModel",
|
||||||
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"), @NamedAttributeNode("associatedDmps"),
|
attributeNodes = {
|
||||||
@NamedAttributeNode("grant"), @NamedAttributeNode(value = "users", subgraph = "users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode("dataset")},
|
@NamedAttributeNode("grant"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile")}/*,*/
|
||||||
subgraphs = {
|
/*subgraphs = {
|
||||||
@NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")}),
|
@NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")}),
|
||||||
}
|
}*/
|
||||||
),
|
),
|
||||||
@NamedEntityGraph(
|
@NamedEntityGraph(
|
||||||
name = "fullyDetailed",
|
name = "fullyDetailed",
|
||||||
|
|
|
@ -34,6 +34,10 @@ public class ColumnOrderings {
|
||||||
ordering.fieldName(ordering.getFieldName().replace("|count|", "")).columnType(Ordering.ColumnType.COUNT);
|
ordering.fieldName(ordering.getFieldName().replace("|count|", "")).columnType(Ordering.ColumnType.COUNT);
|
||||||
else if (ordering.getFieldName().contains("|join|"))
|
else if (ordering.getFieldName().contains("|join|"))
|
||||||
ordering.fieldName(ordering.getFieldName().replace("|join|", "")).columnType(Ordering.ColumnType.JOIN_COLUMN);
|
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;
|
return ordering;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,9 @@ public class DatasetCriteria extends Criteria {
|
||||||
private List<Tag> tags;
|
private List<Tag> tags;
|
||||||
private boolean isPublic;
|
private boolean isPublic;
|
||||||
private Short grantStatus;
|
private Short grantStatus;
|
||||||
|
private int offset;
|
||||||
|
private int size;
|
||||||
|
private List<SortCriteria> sortCriteria;
|
||||||
|
|
||||||
public String getLike() {
|
public String getLike() {
|
||||||
return like;
|
return like;
|
||||||
|
@ -117,4 +120,28 @@ public class DatasetCriteria extends Criteria {
|
||||||
public void setGrantStatus(Short grantStatus) {
|
public void setGrantStatus(Short grantStatus) {
|
||||||
this.grantStatus = 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> templates;
|
||||||
private List<UUID> grants;
|
private List<UUID> grants;
|
||||||
private List<UUID> collaborators;
|
private List<UUID> collaborators;
|
||||||
|
private List<Integer> roles;
|
||||||
private List<UUID> organizations;
|
private List<UUID> organizations;
|
||||||
private boolean isPublic;
|
private boolean isPublic;
|
||||||
private List<UUID> groupIds;
|
private List<UUID> groupIds;
|
||||||
private boolean allowAllVersions;
|
private boolean allowAllVersions;
|
||||||
private Short grantStatus;
|
private Short grantStatus;
|
||||||
|
private int offset;
|
||||||
|
private Integer size;
|
||||||
|
private List<SortCriteria> sortCriteria;
|
||||||
|
|
||||||
|
|
||||||
public String getLike() {
|
public String getLike() {
|
||||||
return like;
|
return like;
|
||||||
|
@ -55,6 +60,14 @@ public class DmpCriteria extends Criteria {
|
||||||
this.collaborators = collaborators;
|
this.collaborators = collaborators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Integer> getRoles() {
|
||||||
|
return roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoles(List<Integer> roles) {
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
|
|
||||||
public List<UUID> getOrganizations() {
|
public List<UUID> getOrganizations() {
|
||||||
return organizations;
|
return organizations;
|
||||||
}
|
}
|
||||||
|
@ -94,4 +107,28 @@ public class DmpCriteria extends Criteria {
|
||||||
public void setGrantStatus(Short grantStatus) {
|
public void setGrantStatus(Short grantStatus) {
|
||||||
this.grantStatus = 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.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class Collaborator implements ElasticEntity<Collaborator> {
|
public class Collaborator implements ElasticEntity<Collaborator> {
|
||||||
private String id;
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
|
private int role;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -26,11 +26,20 @@ public class Collaborator implements ElasticEntity<Collaborator> {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getRole() {
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRole(int role) {
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.field("id", this.id);
|
builder.field("id", this.id);
|
||||||
builder.field("name", this.name);
|
builder.field("name", this.name);
|
||||||
|
builder.field("role", this.role);
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +48,7 @@ public class Collaborator implements ElasticEntity<Collaborator> {
|
||||||
public Collaborator fromElasticEntity(Map fields) {
|
public Collaborator fromElasticEntity(Map fields) {
|
||||||
this.id = (String) fields.get("id");
|
this.id = (String) fields.get("id");
|
||||||
this.name = (String) fields.get("name");
|
this.name = (String) fields.get("name");
|
||||||
|
this.role = (int) fields.get("role");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -59,6 +60,9 @@ public class Dataset implements ElasticEntity<Dataset> {
|
||||||
private Boolean isPublic;
|
private Boolean isPublic;
|
||||||
private Short grantStatus;
|
private Short grantStatus;
|
||||||
private String formData;
|
private String formData;
|
||||||
|
private Date created;
|
||||||
|
private Date modified;
|
||||||
|
private Date finalizedAt;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -188,6 +192,30 @@ public class Dataset implements ElasticEntity<Dataset> {
|
||||||
this.formData = formData;
|
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
|
@Override
|
||||||
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
|
@ -197,6 +225,9 @@ public class Dataset implements ElasticEntity<Dataset> {
|
||||||
builder.field("template", this.template.toString());
|
builder.field("template", this.template.toString());
|
||||||
builder.field("status", this.status.toString());
|
builder.field("status", this.status.toString());
|
||||||
builder.field("dmp", this.dmp.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) {
|
if (this.group != null) {
|
||||||
builder.field("group", this.group.toString());
|
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.dmp = UUID.fromString((String) fields.get("dmp"));
|
||||||
this.group = UUID.fromString((String) fields.get("group"));
|
this.group = UUID.fromString((String) fields.get("group"));
|
||||||
this.grant = UUID.fromString((String) fields.get("grant"));
|
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) {
|
if (fields.get("collaborators") != null) {
|
||||||
this.collaborators = ((List<HashMap>) fields.get("collaborators")).stream().map(hashMap -> new Collaborator().fromElasticEntity(hashMap)).collect(Collectors.toList());
|
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 org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class Dmp implements ElasticEntity<Dmp> {
|
public class Dmp implements ElasticEntity<Dmp> {
|
||||||
|
@ -55,6 +52,11 @@ public class Dmp implements ElasticEntity<Dmp> {
|
||||||
private List<Dataset> datasets;
|
private List<Dataset> datasets;
|
||||||
private UUID grant;
|
private UUID grant;
|
||||||
private Short grantStatus;
|
private Short grantStatus;
|
||||||
|
private Date created;
|
||||||
|
private Date modified;
|
||||||
|
private Date finalizedAt;
|
||||||
|
private Date publishedAt;
|
||||||
|
private String doi;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -168,6 +170,46 @@ public class Dmp implements ElasticEntity<Dmp> {
|
||||||
this.grantStatus = grantStatus;
|
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
|
@Override
|
||||||
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
|
@ -233,6 +275,11 @@ public class Dmp implements ElasticEntity<Dmp> {
|
||||||
builder.field(MapKey.GRANT.getName(), this.grant.toString());
|
builder.field(MapKey.GRANT.getName(), this.grant.toString());
|
||||||
}
|
}
|
||||||
builder.field(MapKey.GRANTSTATUS.getName(), this.grantStatus);
|
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();
|
builder.endObject();
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
@ -282,7 +329,12 @@ public class Dmp implements ElasticEntity<Dmp> {
|
||||||
ISPUBLIC ("isPublic"),
|
ISPUBLIC ("isPublic"),
|
||||||
DATASETS ("datasets"),
|
DATASETS ("datasets"),
|
||||||
GRANT ("grant"),
|
GRANT ("grant"),
|
||||||
GRANTSTATUS ("grantStatus");
|
GRANTSTATUS ("grantStatus"),
|
||||||
|
CREATED ("created"),
|
||||||
|
MODIFIED ("modified"),
|
||||||
|
FINALIZEDAT ("finalizedAt"),
|
||||||
|
PUBLISHEDAT ("publishedAt"),
|
||||||
|
DOI ("doi");
|
||||||
|
|
||||||
private final String name;
|
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.NestedAggregationBuilder;
|
||||||
import org.elasticsearch.search.aggregations.bucket.nested.ParsedNested;
|
import org.elasticsearch.search.aggregations.bucket.nested.ParsedNested;
|
||||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
|
@ -120,6 +123,7 @@ public class DatasetRepository extends ElasticRepository<Dataset, DatasetCriteri
|
||||||
searchSourceBuilder.size(count.intValue());
|
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())));
|
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()) {
|
if (criteria.isPublic()) {
|
||||||
boolQuery = boolQuery.should(QueryBuilders.termQuery("datasets.public", "true"));
|
boolQuery = boolQuery.should(QueryBuilders.termQuery("datasets.public", "true"));
|
||||||
boolQuery = boolQuery.should(QueryBuilders.termQuery("datasets.status", Dataset.Status.FINALISED.getValue()));
|
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());
|
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());
|
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);
|
searchRequest.source(searchSourceBuilder);
|
||||||
SearchResponse response = this.getClient().search(searchRequest, RequestOptions.DEFAULT);
|
SearchResponse response = this.getClient().search(searchRequest, RequestOptions.DEFAULT);
|
||||||
return ((Stream<Dataset>)Arrays.stream(response.getHits().getHits())
|
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.query.QueryBuilders;
|
||||||
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
|
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
|
||||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -97,6 +100,7 @@ public class DmpRepository extends ElasticRepository<Dmp, DmpCriteria> {
|
||||||
searchSourceBuilder.size(count.intValue());
|
searchSourceBuilder.size(count.intValue());
|
||||||
|
|
||||||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery().mustNot(QueryBuilders.termsQuery(Dmp.MapKey.STATUS.getName(), Collections.singletonList(Dmp.DMPStatus.DELETED.getValue())));
|
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()) {
|
if (criteria.isPublic()) {
|
||||||
boolQuery = boolQuery.should(QueryBuilders.termQuery(Dmp.MapKey.ISPUBLIC.getName(), true));
|
boolQuery = boolQuery.should(QueryBuilders.termQuery(Dmp.MapKey.ISPUBLIC.getName(), true));
|
||||||
boolQuery = boolQuery.should(QueryBuilders.termQuery(Dmp.MapKey.STATUS.getName(), Dmp.DMPStatus.FINALISED.getValue()));
|
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) {
|
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()) {
|
if (!criteria.isAllowAllVersions()) {
|
||||||
|
@ -145,7 +153,28 @@ public class DmpRepository extends ElasticRepository<Dmp, DmpCriteria> {
|
||||||
} else {
|
} else {
|
||||||
boolQuery.minimumShouldMatch(boolQuery.should().size());
|
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);
|
searchRequest.source(searchSourceBuilder);
|
||||||
SearchResponse response = this.getClient().search(searchRequest, RequestOptions.DEFAULT);
|
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());
|
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;
|
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() {
|
public boolean createIndex() {
|
||||||
try {
|
try {
|
||||||
if (!this.exists()) {
|
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));
|
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")
|
@RequestMapping(method = RequestMethod.DELETE, value = {"{id}"}, consumes = "application/json", produces = "application/json")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<DMP>> delete(@PathVariable UUID id, Principal principal) {
|
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())) {
|
if (files[0].getContentType().equals(APPLICATION_JSON.toString())) {
|
||||||
this.dataManagementPlanManager.createFromRDA(files, principal, profiles);
|
this.dataManagementPlanManager.createFromRDA(files, principal, profiles);
|
||||||
} else if (files[0].getContentType().equals(APPLICATION_ATOM_XML.toString()) || files[0].getContentType().equals(TEXT_XML.toString())) {
|
} 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 {
|
} else {
|
||||||
return ResponseEntity.badRequest().body(new ResponseItem().status(ApiMessageCode.ERROR_MESSAGE).message("File format is not supported"));
|
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}"})
|
@RequestMapping(method = RequestMethod.POST, value = {"/finalize/{id}"})
|
||||||
public ResponseEntity<ResponseItem<DMP>> makeFinalize(@PathVariable String id, Principal principal, @RequestBody DatasetsToBeFinalized datasetsToBeFinalized) {
|
public ResponseEntity<ResponseItem<DMP>> makeFinalize(@PathVariable String id, Principal principal, @RequestBody DatasetsToBeFinalized datasetsToBeFinalized) {
|
||||||
try {
|
try {
|
||||||
|
@ -291,7 +289,6 @@ public class DMPs extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/unfinalize/{id}"})
|
@RequestMapping(method = RequestMethod.POST, value = {"/unfinalize/{id}"})
|
||||||
public ResponseEntity<ResponseItem<DMP>> undoFinalize(@PathVariable String id, Principal principal) {
|
public ResponseEntity<ResponseItem<DMP>> undoFinalize(@PathVariable String id, Principal principal) {
|
||||||
try {
|
try {
|
||||||
|
@ -304,7 +301,6 @@ public class DMPs extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/updateusers/{id}"})
|
@RequestMapping(method = RequestMethod.POST, value = {"/updateusers/{id}"})
|
||||||
public ResponseEntity<ResponseItem<DMP>> updateUsers(@PathVariable String id, @RequestBody List<UserInfoListingModel> users, Principal principal) {
|
public ResponseEntity<ResponseItem<DMP>> updateUsers(@PathVariable String id, @RequestBody List<UserInfoListingModel> users, Principal principal) {
|
||||||
try {
|
try {
|
||||||
|
@ -320,7 +316,6 @@ public class DMPs extends BaseController {
|
||||||
* DOI Generation
|
* DOI Generation
|
||||||
* */
|
* */
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/createZenodoDoi/{id}"})
|
@RequestMapping(method = RequestMethod.POST, value = {"/createZenodoDoi/{id}"})
|
||||||
public ResponseEntity<ResponseItem<String>> createZenodoDoi(@PathVariable String id, Principal principal) {
|
public ResponseEntity<ResponseItem<String>> createZenodoDoi(@PathVariable String id, Principal principal) {
|
||||||
try {
|
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));
|
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) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), 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())
|
.selectAsync(item -> recentActivityDataBuilder.label(item.getLabel()).timestamp(item.getModified()).id(item.getId().toString()).build())
|
||||||
.whenComplete((datasetActivities, throwable) -> activity.setRecentDatasetActivities(datasetActivities));
|
.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")
|
.withHint("grantRecentActivity")
|
||||||
.orderBy((builder, root) -> builder.desc(root.get("modified")))
|
.orderBy((builder, root) -> builder.desc(root.get("modified")))
|
||||||
.take(numberofactivities)
|
.take(numberofactivities)
|
||||||
.selectAsync(item -> recentActivityDataBuilder.label(item.getLabel()).timestamp(item.getModified()).id(item.getId().toString()).build())
|
.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;
|
return activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.logic.managers;
|
package eu.eudat.logic.managers;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import eu.eudat.configurations.dynamicgrant.DynamicGrantConfiguration;
|
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.ContactType;
|
||||||
import eu.eudat.data.enumeration.notification.NotificationType;
|
import eu.eudat.data.enumeration.notification.NotificationType;
|
||||||
import eu.eudat.data.enumeration.notification.NotifyState;
|
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.datasetprofile.DatasetProfileTableRequestItem;
|
||||||
import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest;
|
import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest;
|
||||||
import eu.eudat.elastic.criteria.DmpCriteria;
|
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.core.io.FileSystemResource;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.*;
|
||||||
import org.springframework.stereotype.Component;
|
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.HttpClientErrorException;
|
||||||
import org.springframework.web.client.HttpServerErrorException;
|
import org.springframework.web.client.HttpServerErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
@ -129,73 +129,138 @@ public class DataManagementPlanManager {
|
||||||
List<Dmp> dmps = null;
|
List<Dmp> dmps = null;
|
||||||
QueryableList<DMP> items = null;
|
QueryableList<DMP> items = null;
|
||||||
QueryableList<DMP> authItems = null;
|
QueryableList<DMP> authItems = null;
|
||||||
|
Long totalData = 0L;
|
||||||
if (apiContext.getOperationsContext().getElasticRepository().getDmpRepository() != null) {
|
if (apiContext.getOperationsContext().getElasticRepository().getDmpRepository() != null) {
|
||||||
DmpCriteria criteria = DmpCriteriaMapper.toElasticCriteria(dataManagementPlanTableRequest.getCriteria());
|
try {
|
||||||
dmps = apiContext.getOperationsContext().getElasticRepository().getDmpRepository().query(criteria);
|
DmpCriteria criteria = DmpCriteriaMapper.toElasticCriteria(dataManagementPlanTableRequest.getCriteria(), principalID);
|
||||||
if (dmps != null && !dmps.isEmpty()) {
|
criteria.setOffset(dataManagementPlanTableRequest.getOffset());
|
||||||
List<Dmp> finalDmps = dmps;
|
criteria.setSize(dataManagementPlanTableRequest.getLength());
|
||||||
items = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().asQueryable().where((builder, root) -> root.get("id").in(finalDmps.stream().map(Dmp::getId).collect(Collectors.toList())));
|
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) {
|
if (items == null) {
|
||||||
items = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(dataManagementPlanTableRequest.getCriteria());
|
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<>();
|
DataTableData<DataManagementPlanListingModel> dataTable = new DataTableData<>();
|
||||||
|
|
||||||
CompletableFuture itemsFuture;
|
CompletableFuture itemsFuture;
|
||||||
if (fieldsGroup.equals("listing")) {
|
if (fieldsGroup.equals("listing")) {
|
||||||
if (!dataManagementPlanTableRequest.getCriteria().isOnlyPublic()) {
|
if (!dataManagementPlanTableRequest.getCriteria().isOnlyPublic()) {
|
||||||
itemsFuture = pagedItems.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class))
|
List<DMP> dmps1 = items.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class))
|
||||||
.distinct()
|
.distinct().toList();
|
||||||
.selectAsync(item -> {
|
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.setDataset(
|
||||||
item.getDataset().stream()
|
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.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))
|
.filter(x -> x.getUser().getId().equals(principalID))
|
||||||
.collect(Collectors.toList()).size() > 0)
|
.collect(Collectors.toList()).size() > 0)*//*
|
||||||
.collect(Collectors.toSet()));
|
.collect(Collectors.toSet()));
|
||||||
return new DataManagementPlanListingModel().fromDataModelDatasets(item);
|
return new DataManagementPlanListingModel().fromDataModelDatasets(item);
|
||||||
})
|
})
|
||||||
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
|
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));*/
|
||||||
} else {
|
} else {
|
||||||
itemsFuture = pagedItems.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class))
|
List<DMP> dmps1 = items.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class))
|
||||||
.distinct()
|
.distinct().toList();
|
||||||
.selectAsync(item -> {
|
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.setDataset(
|
||||||
item.getDataset().stream()
|
item.getDataset().stream()
|
||||||
.filter(dataset -> dataset.getStatus().equals(Dataset.Status.FINALISED.getValue())).collect(Collectors.toSet()));
|
.filter(dataset -> dataset.getStatus().equals(Dataset.Status.FINALISED.getValue())).collect(Collectors.toSet()));
|
||||||
return new DataManagementPlanListingModel().fromDataModelDatasets(item);
|
return new DataManagementPlanListingModel().fromDataModelDatasets(item);
|
||||||
})
|
})
|
||||||
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
|
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));*/
|
||||||
}
|
}
|
||||||
} else if (fieldsGroup.equals("autocomplete")) {
|
} else if (fieldsGroup.equals("autocomplete")) {
|
||||||
itemsFuture = pagedItems
|
dataTable.setData(items
|
||||||
.distinct()
|
.distinct()
|
||||||
.selectAsync(item -> new DataManagementPlanListingModel().fromDataModelAutoComplete(item))
|
.select(item -> new DataManagementPlanListingModel().fromDataModelAutoComplete(item)));
|
||||||
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
|
|
||||||
} else {
|
} else {
|
||||||
itemsFuture = pagedItems
|
dataTable.setData(items
|
||||||
.distinct()
|
.distinct()
|
||||||
.selectAsync(item -> new DataManagementPlanListingModel().fromDataModelAssociatedProfiles(item))
|
.select(item -> new DataManagementPlanListingModel().fromDataModelAssociatedProfiles(item)));
|
||||||
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CompletableFuture countFuture = authItems.distinct().countAsync().whenComplete((count, throwable) -> dataTable.setTotalCount(count));
|
//CompletableFuture countFuture = authItems.distinct().countAsync().whenComplete((count, throwable) -> dataTable.setTotalCount(count));
|
||||||
CompletableFuture.allOf(itemsFuture, countFuture).join();
|
dataTable.setTotalCount(totalData);
|
||||||
|
//CompletableFuture.allOf(itemsFuture).join();
|
||||||
return dataTable;
|
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 {
|
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();
|
eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlan = new eu.eudat.models.data.dmp.DataManagementPlan();
|
||||||
DMP dataManagementPlanEntity = databaseRepository.getDmpDao().find(UUID.fromString(id));
|
DMP dataManagementPlanEntity = databaseRepository.getDmpDao().find(UUID.fromString(id));
|
||||||
|
@ -567,6 +632,16 @@ public class DataManagementPlanManager {
|
||||||
|
|
||||||
copyDatasets(newDmp, databaseRepository.getDatasetDao());
|
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()));
|
newDmp.setUsers(new HashSet<>(databaseRepository.getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), newDmp.getId())).toList()));
|
||||||
|
|
||||||
DatasetCriteria criteria1 = new DatasetCriteria();
|
DatasetCriteria criteria1 = new DatasetCriteria();
|
||||||
|
@ -859,6 +934,7 @@ public class DataManagementPlanManager {
|
||||||
datasetElastic.setCollaborators(dataset1.getDmp().getUsers().stream().map(user -> {
|
datasetElastic.setCollaborators(dataset1.getDmp().getUsers().stream().map(user -> {
|
||||||
Collaborator collaborator = new Collaborator();
|
Collaborator collaborator = new Collaborator();
|
||||||
collaborator.setId(user.getId().toString());
|
collaborator.setId(user.getId().toString());
|
||||||
|
collaborator.setRole(user.getRole());
|
||||||
// collaborator.setName(user.getUser().getName());
|
// collaborator.setName(user.getUser().getName());
|
||||||
return collaborator;
|
return collaborator;
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
|
@ -1192,7 +1268,7 @@ public class DataManagementPlanManager {
|
||||||
if (versioned) {
|
if (versioned) {
|
||||||
fileName += "_" + dmpEntity.getVersion();
|
fileName += "_" + dmpEntity.getVersion();
|
||||||
}
|
}
|
||||||
fileName = fileName.replaceAll("[^a-zA-Z0-9+ ]", "");
|
// fileName = fileName.replaceAll("[^a-zA-Z0-9+ ]", "");
|
||||||
FileEnvelope exportEnvelope = new FileEnvelope();
|
FileEnvelope exportEnvelope = new FileEnvelope();
|
||||||
exportEnvelope.setFilename(fileName + ".docx");
|
exportEnvelope.setFilename(fileName + ".docx");
|
||||||
String uuid = UUID.randomUUID().toString();
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
@ -1226,6 +1302,22 @@ public class DataManagementPlanManager {
|
||||||
dmpName.setTextContent(dmp.getLabel());
|
dmpName.setTextContent(dmp.getLabel());
|
||||||
dmpElement.appendChild(dmpName);
|
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();
|
DMPProfile dmpProfile = dmp.getProfile();
|
||||||
Element dmpProfileElement = xmlDoc.createElement("dmpProfile");
|
Element dmpProfileElement = xmlDoc.createElement("dmpProfile");
|
||||||
Element dmpProfileName = xmlDoc.createElement("dmpProfileName");
|
Element dmpProfileName = xmlDoc.createElement("dmpProfileName");
|
||||||
|
@ -1341,7 +1433,7 @@ public class DataManagementPlanManager {
|
||||||
return fileEnvelope;
|
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));
|
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()))
|
if (!dmp.isPublic() && dmp.getUsers().stream().noneMatch(userInfo -> userInfo.getUser().getId() == principal.getId()))
|
||||||
throw new UnauthorisedException();
|
throw new UnauthorisedException();
|
||||||
|
@ -1410,7 +1502,7 @@ public class DataManagementPlanManager {
|
||||||
* Data Import
|
* 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<>();
|
List<DmpImportModel> dataManagementPlans = new ArrayList<>();
|
||||||
// Jaxb approach.
|
// Jaxb approach.
|
||||||
JAXBContext jaxbContext;
|
JAXBContext jaxbContext;
|
||||||
|
@ -1466,16 +1558,26 @@ public class DataManagementPlanManager {
|
||||||
projectEditor.setExistProject(project);
|
projectEditor.setExistProject(project);
|
||||||
|
|
||||||
List<eu.eudat.models.data.dmp.AssociatedProfile> associatedProfiles = new LinkedList<>();
|
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()) {
|
for (AssociatedProfileImportModels a : dataManagementPlans.get(0).getProfilesImportModels()) {
|
||||||
AssociatedProfile associatedProfile = new AssociatedProfile();
|
try {
|
||||||
associatedProfile.setId(a.getId());
|
DatasetProfile exProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(a.getId());
|
||||||
associatedProfile.setLabel(a.getLabel());
|
AssociatedProfile associatedProfile = new AssociatedProfile().fromData(exProfile);
|
||||||
associatedProfiles.add(associatedProfile);
|
associatedProfiles.add(associatedProfile);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
List<eu.eudat.models.data.dmp.Organisation> organisations = new ArrayList<>();
|
List<eu.eudat.models.data.dmp.Organisation> organisations = new ArrayList<>();
|
||||||
for (OrganisationImportModel org : dataManagementPlans.get(0).getOrganisationImportModels()) {
|
for (OrganisationImportModel org : dataManagementPlans.get(0).getOrganisationImportModels()) {
|
||||||
eu.eudat.models.data.dmp.Organisation organisation = new eu.eudat.models.data.dmp.Organisation();
|
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.setReference(org.getOrganaisationReferenceImport());
|
||||||
organisation.setKey(organisation.getReference().split(":")[0]);
|
organisation.setKey(organisation.getReference().split(":")[0]);
|
||||||
organisations.add(organisation);
|
organisations.add(organisation);
|
||||||
|
@ -1504,6 +1606,21 @@ public class DataManagementPlanManager {
|
||||||
dm.setAssociatedUsers(associatedUsers); // Sets associatedUsers property.
|
dm.setAssociatedUsers(associatedUsers); // Sets associatedUsers property.
|
||||||
dm.setDynamicFields(dynamicFields); // Sets dynamicFields property.
|
dm.setDynamicFields(dynamicFields); // Sets dynamicFields property.
|
||||||
dm.setDefinition(dmpProfile);
|
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);
|
//createOrUpdate(apiContext, dm, principal);
|
||||||
DMP dmp = this.createOrUpdate(dm, principal);
|
DMP dmp = this.createOrUpdate(dm, principal);
|
||||||
|
@ -1527,7 +1644,11 @@ public class DataManagementPlanManager {
|
||||||
for (DatasetImportModels das: dataManagementPlans.get(0).getDatasetImportModels()) {
|
for (DatasetImportModels das: dataManagementPlans.get(0).getDatasetImportModels()) {
|
||||||
eu.eudat.data.entities.Dataset dataset = new eu.eudat.data.entities.Dataset();
|
eu.eudat.data.entities.Dataset dataset = new eu.eudat.data.entities.Dataset();
|
||||||
dataset.setLabel(das.getName());
|
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.setProperties(new ObjectMapper().writeValueAsString(das.getFieldImportModels()));
|
||||||
dataset.setStatus((short) 0);
|
dataset.setStatus((short) 0);
|
||||||
dataset.setRegistries(new HashSet<>());
|
dataset.setRegistries(new HashSet<>());
|
||||||
|
@ -1749,7 +1870,7 @@ public class DataManagementPlanManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUserOwnerOfDmp(DMP dmp, Principal principal) {
|
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++;
|
i++;
|
||||||
}
|
}
|
||||||
dataBuilder.append("],\n");
|
dataBuilder.append("],\n");
|
||||||
|
if (dmp.getGrant().getReference() == null) {
|
||||||
|
dmp.getGrant().setReference("dmp:" + dmp.getGrant().getId());
|
||||||
|
}
|
||||||
String grantReferenceHead = dmp.getGrant().getReference().split(":")[0];
|
String grantReferenceHead = dmp.getGrant().getReference().split(":")[0];
|
||||||
if (grantReferenceHead.equals("openaire")) {
|
if (grantReferenceHead.equals("openaire")) {
|
||||||
String grantReferenceTail = dmp.getGrant().getReference().split(":")[3];
|
String grantReferenceTail = dmp.getGrant().getReference().split(":")[3];
|
||||||
|
@ -1914,6 +2038,7 @@ public class DataManagementPlanManager {
|
||||||
dataBuilder.append(" \"grants\": [{\n");
|
dataBuilder.append(" \"grants\": [{\n");
|
||||||
dataBuilder.append(" \t\t\"id\": \"").append(finalId).append("\"\n}],\n");
|
dataBuilder.append(" \t\t\"id\": \"").append(finalId).append("\"\n}],\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
dataBuilder.append(" \"creators\": [{\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");
|
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()) {
|
if (dmp.getOrganisations() != null && !dmp.getOrganisations().isEmpty()) {
|
||||||
|
@ -1932,7 +2057,9 @@ public class DataManagementPlanManager {
|
||||||
}
|
}
|
||||||
dataBuilder.append(" }\n").append("}");
|
dataBuilder.append(" }\n").append("}");
|
||||||
createData = dataBuilder.toString();
|
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);
|
HttpEntity<JsonNode> request = new HttpEntity<>(createDataJSON, headers);
|
||||||
Map createResponse = null;
|
Map createResponse = null;
|
||||||
LinkedHashMap<String, String> links = null;
|
LinkedHashMap<String, String> links = null;
|
||||||
|
@ -1995,17 +2122,22 @@ public class DataManagementPlanManager {
|
||||||
if (unpublishedUrl == null) {
|
if (unpublishedUrl == null) {
|
||||||
// Second step, add the file to the entry.
|
// Second step, add the file to the entry.
|
||||||
FileEnvelope file = getWordDocument(id.toString(), principal, configLoader);
|
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);
|
File pdfFile = datasetManager.convertToPDF(file, environment);
|
||||||
String fileName = name + ".pdf";*/
|
String fileName = name + ".pdf";
|
||||||
FileSystemResource fileSystemResource = new FileSystemResource(file.getFile());
|
FileSystemResource fileSystemResource = new FileSystemResource(pdfFile);
|
||||||
HttpEntity<FileSystemResource> addFileMapRequest = new HttpEntity<>(fileSystemResource, null);
|
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);
|
restTemplate.put(addFileUrl, addFileMapRequest);
|
||||||
Files.deleteIfExists(file.getFile().toPath());
|
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();
|
UUID jsonFileUUID = UUID.randomUUID();
|
||||||
File tempJsonFile = new File(this.environment.getProperty("temp.temp") + jsonFileUUID.toString() + ".json");
|
File tempJsonFile = new File(this.environment.getProperty("temp.temp") + jsonFileUUID.toString() + ".json");
|
||||||
try (FileOutputStream jsonFos = new FileOutputStream(tempJsonFile)) {
|
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.BuilderFactory;
|
||||||
import eu.eudat.logic.builders.entity.UserInfoBuilder;
|
import eu.eudat.logic.builders.entity.UserInfoBuilder;
|
||||||
import eu.eudat.logic.mapper.elastic.DatasetMapper;
|
import eu.eudat.logic.mapper.elastic.DatasetMapper;
|
||||||
|
import eu.eudat.logic.mapper.elastic.criteria.DmpCriteriaMapper;
|
||||||
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
||||||
|
@ -137,9 +138,21 @@ public class DatasetManager {
|
||||||
if (datasetTableRequest.getCriteria().getIsPublic() != null) {
|
if (datasetTableRequest.getCriteria().getIsPublic() != null) {
|
||||||
datasetCriteria.setPublic(datasetTableRequest.getCriteria().getIsPublic());
|
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) {
|
if (datasetTableRequest.getCriteria().getGrantStatus() != null) {
|
||||||
datasetCriteria.setGrantStatus(datasetTableRequest.getCriteria().getGrantStatus());
|
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;
|
List<eu.eudat.elastic.entities.Dataset> datasets;
|
||||||
try {
|
try {
|
||||||
datasets = datasetRepository.exists() ?
|
datasets = datasetRepository.exists() ?
|
||||||
|
@ -206,6 +219,11 @@ public class DatasetManager {
|
||||||
datasetCriteria.setDatasetTemplates(datasetTableRequest.getCriteria().getDatasetProfile());
|
datasetCriteria.setDatasetTemplates(datasetTableRequest.getCriteria().getDatasetProfile());
|
||||||
datasetCriteria.setDmps(datasetTableRequest.getCriteria().getDmpIds());
|
datasetCriteria.setDmps(datasetTableRequest.getCriteria().getDmpIds());
|
||||||
datasetCriteria.setGrants(datasetTableRequest.getCriteria().getGrants());
|
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;
|
List<eu.eudat.elastic.entities.Dataset> datasets;
|
||||||
try {
|
try {
|
||||||
datasets = datasetRepository.exists() ?
|
datasets = datasetRepository.exists() ?
|
||||||
|
@ -214,9 +232,9 @@ public class DatasetManager {
|
||||||
logger.warn(ex.getMessage());
|
logger.warn(ex.getMessage());
|
||||||
datasets = null;
|
datasets = null;
|
||||||
}
|
}
|
||||||
datasetTableRequest.setQuery(databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetListingModel.class)));
|
/*datasetTableRequest.setQuery(databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetListingModel.class)));
|
||||||
QueryableList<Dataset> items = datasetTableRequest.applyCriteria();
|
QueryableList<Dataset> items = datasetTableRequest.applyCriteria();*/
|
||||||
/*QueryableList<Dataset> items;
|
QueryableList<Dataset> items;
|
||||||
if (datasets != null) {
|
if (datasets != null) {
|
||||||
if (!datasets.isEmpty()) {
|
if (!datasets.isEmpty()) {
|
||||||
items = databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetListingModel.class));
|
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()}));
|
items.where((builder, root) -> root.get("id").in(new UUID[]{UUID.randomUUID()}));
|
||||||
} else {
|
} else {
|
||||||
items = datasetTableRequest.applyCriteria();
|
items = datasetTableRequest.applyCriteria();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if (principal.getId() != null && datasetTableRequest.getCriteria().getRole() != null) {
|
if (principal.getId() != null && datasetTableRequest.getCriteria().getRole() != null) {
|
||||||
items.where((builder, root) -> {
|
items.where((builder, root) -> {
|
||||||
|
|
|
@ -5,10 +5,11 @@ import eu.eudat.elastic.entities.Collaborator;
|
||||||
|
|
||||||
public class CollaboratorMapper {
|
public class CollaboratorMapper {
|
||||||
|
|
||||||
public static Collaborator toElastic(UserInfo user) {
|
public static Collaborator toElastic(UserInfo user, Integer role) {
|
||||||
Collaborator elastic = new Collaborator();
|
Collaborator elastic = new Collaborator();
|
||||||
elastic.setId(user.getId().toString());
|
elastic.setId(user.getId().toString());
|
||||||
elastic.setName(user.getName());
|
elastic.setName(user.getName());
|
||||||
|
elastic.setRole(role);
|
||||||
return elastic;
|
return elastic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,11 @@ public class DatasetMapper {
|
||||||
elastic.setDmp(dataset.getDmp().getId());
|
elastic.setDmp(dataset.getDmp().getId());
|
||||||
elastic.setGroup(dataset.getDmp().getGroupId());
|
elastic.setGroup(dataset.getDmp().getGroupId());
|
||||||
elastic.setGrant(dataset.getDmp().getGrant().getId());
|
elastic.setGrant(dataset.getDmp().getGrant().getId());
|
||||||
|
elastic.setCreated(dataset.getCreated());
|
||||||
|
elastic.setModified(dataset.getModified());
|
||||||
|
elastic.setFinalizedAt(dataset.getFinalizedAt());
|
||||||
if (dataset.getDmp().getUsers() != null) {
|
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();
|
DataManagementPlanCriteria dmpCriteria = new DataManagementPlanCriteria();
|
||||||
dmpCriteria.setAllVersions(true);
|
dmpCriteria.setAllVersions(true);
|
||||||
|
|
|
@ -34,13 +34,17 @@ public class DmpMapper {
|
||||||
elastic.setId(dmp.getId());
|
elastic.setId(dmp.getId());
|
||||||
elastic.setGroupId(dmp.getGroupId());
|
elastic.setGroupId(dmp.getGroupId());
|
||||||
if (dmp.getUsers() != null) {
|
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.setDescription(dmp.getDescription());
|
||||||
elastic.setGrant(dmp.getGrant().getId());
|
elastic.setGrant(dmp.getGrant().getId());
|
||||||
elastic.setLabel(dmp.getLabel());
|
elastic.setLabel(dmp.getLabel());
|
||||||
elastic.setPublic(dmp.isPublic());
|
elastic.setPublic(dmp.isPublic());
|
||||||
elastic.setStatus(dmp.getStatus());
|
elastic.setStatus(dmp.getStatus());
|
||||||
|
elastic.setCreated(dmp.getCreated());
|
||||||
|
elastic.setModified(dmp.getModified());
|
||||||
|
elastic.setFinalizedAt(dmp.getFinalizedAt());
|
||||||
|
elastic.setPublishedAt(dmp.getPublishedAt());
|
||||||
DataManagementPlanCriteria dmpCriteria = new DataManagementPlanCriteria();
|
DataManagementPlanCriteria dmpCriteria = new DataManagementPlanCriteria();
|
||||||
dmpCriteria.setAllVersions(true);
|
dmpCriteria.setAllVersions(true);
|
||||||
dmpCriteria.setGroupIds(Collections.singletonList(dmp.getGroupId()));
|
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.dao.criteria.DataManagementPlanCriteria;
|
||||||
import eu.eudat.data.entities.Grant;
|
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.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.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class DmpCriteriaMapper {
|
public class DmpCriteriaMapper {
|
||||||
|
|
||||||
public static DmpCriteria toElasticCriteria(DataManagementPlanCriteria criteria) {
|
public static DmpCriteria toElasticCriteria(DataManagementPlanCriteria criteria, UUID principalID) {
|
||||||
DmpCriteria elastic = new DmpCriteria();
|
DmpCriteria elastic = new DmpCriteria();
|
||||||
|
|
||||||
elastic.setAllowAllVersions(criteria.getAllVersions());
|
elastic.setAllowAllVersions(criteria.getAllVersions());
|
||||||
|
@ -23,6 +29,12 @@ public class DmpCriteriaMapper {
|
||||||
elastic.setOrganizations(criteria.getOrganisations().stream().map(UUID::fromString).collect(Collectors.toList()));
|
elastic.setOrganizations(criteria.getOrganisations().stream().map(UUID::fromString).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
elastic.setPublic(criteria.getIsPublic());
|
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) {
|
if (criteria.getStatus() != null) {
|
||||||
elastic.setStatus(criteria.getStatus().shortValue());
|
elastic.setStatus(criteria.getStatus().shortValue());
|
||||||
}
|
}
|
||||||
|
@ -30,4 +42,18 @@ public class DmpCriteriaMapper {
|
||||||
elastic.setGrantStatus(criteria.getGrantStatus());
|
elastic.setGrantStatus(criteria.getGrantStatus());
|
||||||
return elastic;
|
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) {
|
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);
|
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);
|
String tempSectionString = sectionString != null ? sectionString + "." + (section.getOrdinal() + 1) : "" + (section.getOrdinal() + 1);
|
||||||
if (visibilityRuleService.isElementVisible(section.getId())) {
|
if (visibilityRuleService.isElementVisible(section.getId())) {
|
||||||
if (!createListing) {
|
if (!createListing) {
|
||||||
XWPFParagraph paragraph = addParagraphContent(page + "." + tempSectionString + " " + section.getTitle(), mainDocumentPart, style, numId);
|
XWPFParagraph paragraph = addParagraphContent(page + "." + tempSectionString + " " + section.getTitle(), mainDocumentPart, style, numId);
|
||||||
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
||||||
number.setVal(BigInteger.valueOf(indent));
|
number.setVal(BigInteger.valueOf(indent));
|
||||||
|
paragraphPos = mainDocumentPart.getPosOfParagraph(paragraph);
|
||||||
}
|
}
|
||||||
createSections(section.getSections(), mainDocumentPart, ParagraphStyle.HEADER5, 1, createListing, visibilityRuleService, page, tempSectionString);
|
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);
|
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)) {
|
if (visibilityRuleService.isElementVisible(compositeField.getId()) && hasVisibleFields(compositeField, visibilityRuleService)) {
|
||||||
|
int paragraphPos = -1;
|
||||||
if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty() && !createListing) {
|
if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty() && !createListing) {
|
||||||
XWPFParagraph paragraph = addParagraphContent(page + "." + section + "." + (compositeField.getOrdinal() +1) + " " + compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER6, numId);
|
XWPFParagraph paragraph = addParagraphContent(page + "." + section + "." + (compositeField.getOrdinal() +1) + " " + compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER6, numId);
|
||||||
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
||||||
number.setVal(BigInteger.valueOf(indent));
|
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()) {
|
if (compositeField.getMultiplicityItems() != null && !compositeField.getMultiplicityItems().isEmpty()) {
|
||||||
for (FieldSet multiplicityFieldset : compositeField.getMultiplicityItems()) {
|
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);
|
XWPFParagraph paragraph = addParagraphContent("Comment: " + compositeField.getCommentFieldValue(), mainDocumentPart, ParagraphStyle.COMMENT, numId);
|
||||||
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
||||||
number.setVal(BigInteger.valueOf(indent));
|
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);
|
if (createListing) this.addListing(mainDocumentPart, indent, false, false);
|
||||||
fields.forEach(field -> {
|
boolean hasValue = false;
|
||||||
|
for (Field field: fields) {
|
||||||
if (visibilityRuleService.isElementVisible(field.getId())) {
|
if (visibilityRuleService.isElementVisible(field.getId())) {
|
||||||
if (!createListing) {
|
if (!createListing) {
|
||||||
try {
|
try {
|
||||||
XWPFParagraph paragraph = addParagraphContent(this.formatter(field), mainDocumentPart, ParagraphStyle.TEXT, numId);
|
XWPFParagraph paragraph = addParagraphContent(this.formatter(field), mainDocumentPart, ParagraphStyle.TEXT, numId);
|
||||||
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
if (paragraph != null) {
|
||||||
number.setVal(BigInteger.valueOf(indent));
|
CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl();
|
||||||
|
number.setVal(BigInteger.valueOf(indent));
|
||||||
|
hasValue = true;
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
return hasValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XWPFParagraph addParagraphContent(String text, XWPFDocument mainDocumentPart, ParagraphStyle style, BigInteger numId) {
|
public XWPFParagraph addParagraphContent(String text, XWPFDocument mainDocumentPart, ParagraphStyle style, BigInteger numId) {
|
||||||
XWPFParagraph paragraph = this.options.get(style).apply(mainDocumentPart, text);
|
if (text != null && !text.isEmpty()) {
|
||||||
if (numId != null) {
|
XWPFParagraph paragraph = this.options.get(style).apply(mainDocumentPart, text);
|
||||||
paragraph.setNumID(numId);
|
if (numId != null) {
|
||||||
|
paragraph.setNumID(numId);
|
||||||
|
}
|
||||||
|
return paragraph;
|
||||||
}
|
}
|
||||||
return paragraph;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addListing(XWPFDocument document, int indent, Boolean question, Boolean hasIndication) {
|
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));
|
mapList = Arrays.asList(mapper.readValue(field.getValue().toString(), HashMap[].class));
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.warn(e.getMessage(), e);
|
logger.warn(e.getMessage(), e);
|
||||||
|
logger.info("Moving to fallback parsing");
|
||||||
Map <String, Object> map = new HashMap<>();
|
Map <String, Object> map = new HashMap<>();
|
||||||
map.put("label", field.getValue().toString());
|
map.put("label", field.getValue().toString());
|
||||||
mapList.add(map);
|
mapList.add(map);
|
||||||
|
@ -304,6 +327,7 @@ public class WordBuilder {
|
||||||
WordListData wordListData = (WordListData) field.getData();
|
WordListData wordListData = (WordListData) field.getData();
|
||||||
if (wordListData.getOptions().isEmpty() && field.getValue() != null) {
|
if (wordListData.getOptions().isEmpty() && field.getValue() != null) {
|
||||||
logger.warn("World List has no values but the field has");
|
logger.warn("World List has no values but the field has");
|
||||||
|
logger.info("Return value as is");
|
||||||
return field.getValue().toString();
|
return field.getValue().toString();
|
||||||
} else if (field.getValue() != null){
|
} else if (field.getValue() != null){
|
||||||
ComboBoxData<WordListData>.Option selectedOption = null;
|
ComboBoxData<WordListData>.Option selectedOption = null;
|
||||||
|
@ -332,21 +356,24 @@ public class WordBuilder {
|
||||||
return field.getValue() != null ? field.getValue().toString(): "";
|
return field.getValue() != null ? field.getValue().toString(): "";
|
||||||
case "datasetIdentifier":
|
case "datasetIdentifier":
|
||||||
case "validation":
|
case "validation":
|
||||||
Map<String, String> identifierData;
|
if (field.getValue() != null) {
|
||||||
try {
|
Map<String, String> identifierData;
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
try {
|
||||||
identifierData = mapper.readValue(field.getValue().toString(), HashMap.class);
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
} catch (JsonParseException ex) {
|
identifierData = mapper.readValue(field.getValue().toString(), HashMap.class);
|
||||||
identifierData = new HashMap<>();
|
} catch (JsonParseException ex) {
|
||||||
String parsedData = field.getValue().toString().substring(1, field.getValue().toString().length() - 1);
|
identifierData = new HashMap<>();
|
||||||
StringTokenizer commaTokens = new StringTokenizer(parsedData, ", ");
|
String parsedData = field.getValue().toString().substring(1, field.getValue().toString().length() - 1);
|
||||||
while (commaTokens.hasMoreTokens()) {
|
StringTokenizer commaTokens = new StringTokenizer(parsedData, ", ");
|
||||||
String token = commaTokens.nextToken();
|
while (commaTokens.hasMoreTokens()) {
|
||||||
StringTokenizer equalTokens = new StringTokenizer(token, "=");
|
String token = commaTokens.nextToken();
|
||||||
identifierData.put(equalTokens.nextToken(), equalTokens.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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,10 @@ public class DmpImportModel {
|
||||||
private List<UserInfoImportModels> associatedUsersImportModels;
|
private List<UserInfoImportModels> associatedUsersImportModels;
|
||||||
private List<DynamicFieldWithValueImportModels> dynamicFieldsImportModels;
|
private List<DynamicFieldWithValueImportModels> dynamicFieldsImportModels;
|
||||||
private List<DatasetImportModels> datasetImportModels;
|
private List<DatasetImportModels> datasetImportModels;
|
||||||
|
private String language;
|
||||||
|
private Boolean visibility;
|
||||||
|
private String publicDate;
|
||||||
|
private String costs;
|
||||||
|
|
||||||
@XmlElement(name = "description")
|
@XmlElement(name = "description")
|
||||||
public String getDescriptionImport() {
|
public String getDescriptionImport() {
|
||||||
|
@ -113,4 +117,37 @@ public class DmpImportModel {
|
||||||
@XmlElement(name = "dataset")
|
@XmlElement(name = "dataset")
|
||||||
public List<DatasetImportModels> getDatasetImportModels() { return datasetImportModels; }
|
public List<DatasetImportModels> getDatasetImportModels() { return datasetImportModels; }
|
||||||
public void setDatasetImportModels(List<DatasetImportModels> datasetImportModels) { this.datasetImportModels = 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 id;
|
||||||
private String label;
|
private String label;
|
||||||
private String grant;
|
private String grant;
|
||||||
private String profile;
|
// private String profile;
|
||||||
private Date creationTime;
|
// private Date creationTime;
|
||||||
private Date modifiedTime;
|
private Date modifiedTime;
|
||||||
private String organisations;
|
//private String organisations;
|
||||||
private int version;
|
private int version;
|
||||||
private int status;
|
private int status;
|
||||||
private UUID groupId;
|
private UUID groupId;
|
||||||
private List<DatasetUrlListing> datasets;
|
private List<DatasetUrlListing> datasets;
|
||||||
private List<AssociatedProfile> associatedProfiles;
|
// private List<AssociatedProfile> associatedProfiles;
|
||||||
private List<UserInfoListingModel> users;
|
private List<UserInfoListingModel> users;
|
||||||
private String description;
|
private String description;
|
||||||
private String grantAbbreviation;
|
// private String grantAbbreviation;
|
||||||
private String grantId;
|
// private String grantId;
|
||||||
private Date finalizedAt;
|
private Date finalizedAt;
|
||||||
private Boolean isPublic;
|
private Boolean isPublic;
|
||||||
private Date publishedAt;
|
private Date publishedAt;
|
||||||
|
@ -63,19 +63,19 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
||||||
this.grant = grant;
|
this.grant = grant;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProfile() {
|
/* public String getProfile() {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
public void setProfile(String profile) {
|
public void setProfile(String profile) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public Date getCreationTime() {
|
/*public Date getCreationTime() {
|
||||||
return creationTime;
|
return creationTime;
|
||||||
}
|
}
|
||||||
public void setCreationTime(Date creationTime) {
|
public void setCreationTime(Date creationTime) {
|
||||||
this.creationTime = creationTime;
|
this.creationTime = creationTime;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public Date getModifiedTime() {
|
public Date getModifiedTime() {
|
||||||
return modifiedTime;
|
return modifiedTime;
|
||||||
|
@ -84,12 +84,12 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
||||||
this.modifiedTime = modifiedTime;
|
this.modifiedTime = modifiedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOrganisations() {
|
/*public String getOrganisations() {
|
||||||
return organisations;
|
return organisations;
|
||||||
}
|
}
|
||||||
public void setOrganisations(String organisations) {
|
public void setOrganisations(String organisations) {
|
||||||
this.organisations = organisations;
|
this.organisations = organisations;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public int getVersion() {
|
public int getVersion() {
|
||||||
return version;
|
return version;
|
||||||
|
@ -119,12 +119,12 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AssociatedProfile> getAssociatedProfiles() {
|
/*public List<AssociatedProfile> getAssociatedProfiles() {
|
||||||
return associatedProfiles;
|
return associatedProfiles;
|
||||||
}
|
}
|
||||||
public void setAssociatedProfiles(List<AssociatedProfile> associatedProfiles) {
|
public void setAssociatedProfiles(List<AssociatedProfile> associatedProfiles) {
|
||||||
this.associatedProfiles = associatedProfiles;
|
this.associatedProfiles = associatedProfiles;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public List<UserInfoListingModel> getUsers() {
|
public List<UserInfoListingModel> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
|
@ -140,19 +140,19 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGrantAbbreviation() {
|
/*public String getGrantAbbreviation() {
|
||||||
return grantAbbreviation;
|
return grantAbbreviation;
|
||||||
}
|
}
|
||||||
public void setGrantAbbreviation(String grantAbbreviation) {
|
public void setGrantAbbreviation(String grantAbbreviation) {
|
||||||
this.grantAbbreviation = grantAbbreviation;
|
this.grantAbbreviation = grantAbbreviation;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public String getGrantId() {
|
/*public String getGrantId() {
|
||||||
return grantId;
|
return grantId;
|
||||||
}
|
}
|
||||||
public void setGrantId(String grantId) {
|
public void setGrantId(String grantId) {
|
||||||
this.grantId = grantId;
|
this.grantId = grantId;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public Date getFinalizedAt() {
|
public Date getFinalizedAt() {
|
||||||
return finalizedAt;
|
return finalizedAt;
|
||||||
|
@ -187,8 +187,8 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
||||||
this.id = entity.getId().toString();
|
this.id = entity.getId().toString();
|
||||||
this.label = entity.getLabel();
|
this.label = entity.getLabel();
|
||||||
this.groupId = entity.getGroupId();
|
this.groupId = entity.getGroupId();
|
||||||
this.creationTime = entity.getCreated();
|
// this.creationTime = entity.getCreated();
|
||||||
this.associatedProfiles = entity.getAssociatedDmps().stream().map(item -> new AssociatedProfile().fromData(item)).collect(Collectors.toList());
|
// this.associatedProfiles = entity.getAssociatedDmps().stream().map(item -> new AssociatedProfile().fromData(item)).collect(Collectors.toList());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
||||||
this.id = entity.getId().toString();
|
this.id = entity.getId().toString();
|
||||||
this.label = entity.getLabel();
|
this.label = entity.getLabel();
|
||||||
this.groupId = entity.getGroupId();
|
this.groupId = entity.getGroupId();
|
||||||
this.creationTime = entity.getCreated();
|
// this.creationTime = entity.getCreated();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,26 +205,26 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
||||||
this.status = entity.getStatus();
|
this.status = entity.getStatus();
|
||||||
this.version = entity.getVersion();
|
this.version = entity.getVersion();
|
||||||
this.grant = entity.getGrant().getLabel();
|
this.grant = entity.getGrant().getLabel();
|
||||||
if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel();
|
/*if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel();
|
||||||
this.creationTime = entity.getCreated();
|
this.creationTime = entity.getCreated();*/
|
||||||
this.modifiedTime = entity.getModified();
|
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.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.users = entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList());
|
||||||
this.description = entity.getDescription();
|
this.description = entity.getDescription();
|
||||||
this.grantAbbreviation = entity.getGrant().getAbbreviation();
|
// this.grantAbbreviation = entity.getGrant().getAbbreviation();
|
||||||
this.grantId = entity.getGrant().getId().toString();
|
// this.grantId = entity.getGrant().getId().toString();
|
||||||
this.finalizedAt = entity.getFinalizedAt();
|
this.finalizedAt = entity.getFinalizedAt();
|
||||||
this.isPublic = entity.isPublic();
|
this.isPublic = entity.isPublic();
|
||||||
this.publishedAt = entity.getPublishedAt();
|
this.publishedAt = entity.getPublishedAt();
|
||||||
|
|
||||||
if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {
|
/*if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {
|
||||||
this.associatedProfiles = new LinkedList<>();
|
this.associatedProfiles = new LinkedList<>();
|
||||||
for (DatasetProfile datasetProfile: entity.getAssociatedDmps()) {
|
for (DatasetProfile datasetProfile: entity.getAssociatedDmps()) {
|
||||||
AssociatedProfile associatedProfile = new AssociatedProfile().fromData(datasetProfile);
|
AssociatedProfile associatedProfile = new AssociatedProfile().fromData(datasetProfile);
|
||||||
this.associatedProfiles.add(associatedProfile);
|
this.associatedProfiles.add(associatedProfile);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class DatasetRDAMapper {
|
||||||
for (int i = 0; i < keywordNodes.size(); i++) {
|
for (int i = 0; i < keywordNodes.size(); i++) {
|
||||||
rda.setAdditionalProperty("keyword" + (i + 1), keywordNodes.get(i).get("id").asText());
|
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());
|
List<String> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString()).getTags().stream().map(Tag::getName).collect(Collectors.toList());
|
||||||
rda.setKeyword(tags);
|
rda.setKeyword(tags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class DmpRDAMapper {
|
||||||
}
|
}
|
||||||
Map<String, Object> extraProperties;
|
Map<String, Object> extraProperties;
|
||||||
if (dmp.getExtraProperties() == null) {
|
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 {
|
} else {
|
||||||
extraProperties = new org.json.JSONObject(dmp.getExtraProperties()).toMap();
|
extraProperties = new org.json.JSONObject(dmp.getExtraProperties()).toMap();
|
||||||
if (extraProperties.get("language") == null) {
|
if (extraProperties.get("language") == null) {
|
||||||
|
|
|
@ -6,11 +6,13 @@ import eu.eudat.data.entities.Grant;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.models.rda.Funding;
|
import eu.eudat.models.rda.Funding;
|
||||||
|
|
||||||
|
import javax.transaction.Transactional;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class FundingRDAMapper {
|
public class FundingRDAMapper {
|
||||||
|
|
||||||
|
@Transactional
|
||||||
public static Funding toRDA(Grant grant) {
|
public static Funding toRDA(Grant grant) {
|
||||||
Funding rda = new Funding();
|
Funding rda = new Funding();
|
||||||
String referencePrefix;
|
String referencePrefix;
|
||||||
|
@ -22,9 +24,13 @@ public class FundingRDAMapper {
|
||||||
} else {
|
} else {
|
||||||
rda.setFunderId(FunderIdRDAMapper.toRDA(grant.getFunder().getId()));
|
rda.setFunderId(FunderIdRDAMapper.toRDA(grant.getFunder().getId()));
|
||||||
}
|
}
|
||||||
referencePrefix = grant.getReference().split(":")[0];
|
if (grant.getReference() != null) {
|
||||||
shortReference = grant.getReference().substring(referencePrefix.length() + 1);
|
referencePrefix = grant.getReference().split(":")[0];
|
||||||
rda.setGrantId(GrantIdRDAMapper.toRDA(shortReference));
|
shortReference = grant.getReference().substring(referencePrefix.length() + 1);
|
||||||
|
rda.setGrantId(GrantIdRDAMapper.toRDA(shortReference));
|
||||||
|
} else {
|
||||||
|
rda.setGrantId(GrantIdRDAMapper.toRDA(grant.getId().toString()));
|
||||||
|
}
|
||||||
return rda;
|
return rda;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,25 +4,34 @@ import eu.eudat.data.entities.Funder;
|
||||||
import eu.eudat.data.entities.Grant;
|
import eu.eudat.data.entities.Grant;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.models.rda.Project;
|
import eu.eudat.models.rda.Project;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.transaction.Transactional;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class ProjectRDAMapper {
|
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) {
|
public static Project toRDA(eu.eudat.data.entities.Project project, Grant grant) {
|
||||||
Project rda = new Project();
|
Project rda = new Project();
|
||||||
rda.setTitle(project.getLabel());
|
try {
|
||||||
rda.setDescription(project.getDescription());
|
rda.setTitle(project.getLabel());
|
||||||
if (project.getStartdate() != null) {
|
rda.setDescription(project.getDescription());
|
||||||
rda.setStart(project.getStartdate().toString());
|
if (project.getStartdate() != null) {
|
||||||
}
|
rda.setStart(project.getStartdate().toString());
|
||||||
if (project.getEnddate() != null) {
|
}
|
||||||
rda.setEnd(project.getEnddate().toString());
|
if (project.getEnddate() != null) {
|
||||||
}
|
rda.setEnd(project.getEnddate().toString());
|
||||||
rda.setFunding(Collections.singletonList(FundingRDAMapper.toRDA(grant)));
|
}
|
||||||
|
rda.setFunding(Collections.singletonList(FundingRDAMapper.toRDA(grant)));
|
||||||
|
|
||||||
if (rda.getTitle() == null) {
|
if (rda.getTitle() == null) {
|
||||||
throw new IllegalArgumentException("Project Title is missing");
|
throw new IllegalArgumentException("Project Title is missing");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rda;
|
return rda;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<div class="row root">
|
<div class="row root">
|
||||||
<mat-card class="col-md-3 offset-md-4">
|
<mat-card class="col-md-3 offset-md-4">
|
||||||
<div>
|
<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)="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>
|
</div>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -54,10 +54,13 @@ export class LoginComponent extends BaseComponent implements OnInit, AfterViewIn
|
||||||
private mergeLoginService: MergeLoginService,
|
private mergeLoginService: MergeLoginService,
|
||||||
private oauth2DialogService: Oauth2DialogService,
|
private oauth2DialogService: Oauth2DialogService,
|
||||||
private httpClient: HttpClient,
|
private httpClient: HttpClient,
|
||||||
private matomoService: MatomoService
|
private matomoService: MatomoService,
|
||||||
) { super(); }
|
) { super(); }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
if(this.authService.current()){
|
||||||
|
this.router.navigate(['home']);
|
||||||
|
}
|
||||||
this.matomoService.trackPageView('loginPage');
|
this.matomoService.trackPageView('loginPage');
|
||||||
this.route.queryParams
|
this.route.queryParams
|
||||||
.pipe(takeUntil(this._destroyed))
|
.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}}
|
{{'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>
|
||||||
<p *ngIf="this.hasDmps()" class="card-content mb-0 pt-0">{{'DASHBOARD.DMP-ABOUT-BEG' | translate}}
|
<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}}
|
{{'DASHBOARD.DMP-ABOUT-END' | translate}}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,8 @@ export class DatasetCopyDialogueComponent {
|
||||||
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
|
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
|
||||||
dmpDataTableRequest.criteria = new DmpCriteria();
|
dmpDataTableRequest.criteria = new DmpCriteria();
|
||||||
dmpDataTableRequest.criteria.like = query;
|
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 {
|
existsDatasetDescriptionTemplate(associatedProfiles: DmpAssociatedProfileModel[]): boolean {
|
||||||
|
|
|
@ -173,7 +173,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
||||||
setIsUserOwner() {
|
setIsUserOwner() {
|
||||||
if (this.dataset) {
|
if (this.dataset) {
|
||||||
const principal: Principal = this.authentication.current();
|
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>
|
</mat-form-field>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="ml-auto col-auto"><button mat-raised-button mat-dialog-close type="button">Cancel</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">Save</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1046,7 +1046,9 @@
|
||||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation 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-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": {
|
"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.",
|
"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",
|
"PERSONAL-USAGE": "Personal Usage",
|
||||||
"PUBLIC-USAGE": "Public Usage",
|
"PUBLIC-USAGE": "Public Usage",
|
||||||
"DATASET-DESCRIPTIONS": "Datasets",
|
"DATASET-DESCRIPTIONS": "Datasets",
|
||||||
|
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Datasets",
|
||||||
"PUBLIC-DMPS": "Public DMPs",
|
"PUBLIC-DMPS": "Public DMPs",
|
||||||
"PUBLIC-DATASETS": "Public Datasets",
|
"PUBLIC-DATASETS": "Public Datasets",
|
||||||
"RELATED-ORGANISATIONS": "Related Organisations",
|
"RELATED-ORGANISATIONS": "Related Organisations",
|
||||||
|
|
|
@ -1046,7 +1046,9 @@
|
||||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation 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-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": {
|
"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.",
|
"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",
|
"PERSONAL-USAGE": "Personal Usage",
|
||||||
"PUBLIC-USAGE": "Public Usage",
|
"PUBLIC-USAGE": "Public Usage",
|
||||||
"DATASET-DESCRIPTIONS": "Datasets",
|
"DATASET-DESCRIPTIONS": "Datasets",
|
||||||
|
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Datasets",
|
||||||
"PUBLIC-DMPS": "Public DMPs",
|
"PUBLIC-DMPS": "Public DMPs",
|
||||||
"PUBLIC-DATASETS": "Public Datasets",
|
"PUBLIC-DATASETS": "Public Datasets",
|
||||||
"RELATED-ORGANISATIONS": "Related Organisations",
|
"RELATED-ORGANISATIONS": "Related Organisations",
|
||||||
|
|
|
@ -1046,7 +1046,9 @@
|
||||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation 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-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": {
|
"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.",
|
"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",
|
"PERSONAL-USAGE": "Uso personal",
|
||||||
"PUBLIC-USAGE": "Public Usage",
|
"PUBLIC-USAGE": "Public Usage",
|
||||||
"DATASET-DESCRIPTIONS": "Descripciones de los datasets",
|
"DATASET-DESCRIPTIONS": "Descripciones de los datasets",
|
||||||
|
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Descripciones de los datasets",
|
||||||
"PUBLIC-DMPS": "Public DMPs",
|
"PUBLIC-DMPS": "Public DMPs",
|
||||||
"PUBLIC-DATASETS": "Public Dataset Descriptions",
|
"PUBLIC-DATASETS": "Public Dataset Descriptions",
|
||||||
"RELATED-ORGANISATIONS": "Organizaciones relacionadas",
|
"RELATED-ORGANISATIONS": "Organizaciones relacionadas",
|
||||||
|
|
|
@ -1046,7 +1046,9 @@
|
||||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation 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-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": {
|
"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.",
|
"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": "Περιγραφές Συνόλου Δεδομένων",
|
"DATASET-DESCRIPTIONS": "Περιγραφές Συνόλου Δεδομένων",
|
||||||
|
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Περιγραφές Συνόλου Δεδομένων",
|
||||||
"PUBLIC-DMPS": "Δημόσια Σχέδια Διαχείρισης Δεδομένων",
|
"PUBLIC-DMPS": "Δημόσια Σχέδια Διαχείρισης Δεδομένων",
|
||||||
"PUBLIC-DATASETS": "Δημόσιες Περιγραφές Συνόλου Δεδομένων",
|
"PUBLIC-DATASETS": "Δημόσιες Περιγραφές Συνόλου Δεδομένων",
|
||||||
"RELATED-ORGANISATIONS": "Σχετικοί Οργανισμοί",
|
"RELATED-ORGANISATIONS": "Σχετικοί Οργανισμοί",
|
||||||
|
|
|
@ -572,8 +572,8 @@
|
||||||
"PUBLISHED": "Publicado",
|
"PUBLISHED": "Publicado",
|
||||||
"VERSION": "Versão",
|
"VERSION": "Versão",
|
||||||
"CONTAINED-DATASETS": "Contém Datasets",
|
"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": "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 PGD é na prática? Pesquise PGD Públicos e",
|
"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",
|
"LINK-ZENODO": "Comunidade LIBER no Zenodo",
|
||||||
"GET-IDEA": "para ter uma ideia!",
|
"GET-IDEA": "para ter uma ideia!",
|
||||||
"SORT-BY": "Ordenar por",
|
"SORT-BY": "Ordenar por",
|
||||||
|
@ -1046,7 +1046,9 @@
|
||||||
"RESEARCHER-IDENTIFIER-EXISTS": "O identificador do investigador já existe.",
|
"RESEARCHER-IDENTIFIER-EXISTS": "O identificador do investigador já existe.",
|
||||||
"ORGANISATION-IDENTIFIER-EXSTS": "O identificador da organização 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-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": {
|
"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.",
|
"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",
|
"PERSONAL-USAGE": "Uso Pessoal",
|
||||||
"PUBLIC-USAGE": "Uso Público",
|
"PUBLIC-USAGE": "Uso Público",
|
||||||
"DATASET-DESCRIPTIONS": "Datasets",
|
"DATASET-DESCRIPTIONS": "Datasets",
|
||||||
|
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "",
|
||||||
"PUBLIC-DMPS": "PGDs Públicos",
|
"PUBLIC-DMPS": "PGDs Públicos",
|
||||||
"PUBLIC-DATASETS": "Datasets Públicos",
|
"PUBLIC-DATASETS": "Datasets Públicos",
|
||||||
"RELATED-ORGANISATIONS": "Organizações Relacionadas",
|
"RELATED-ORGANISATIONS": "Organizações Relacionadas",
|
||||||
|
@ -1546,8 +1549,8 @@
|
||||||
"ALL": "TODOS",
|
"ALL": "TODOS",
|
||||||
"EMPTY-LIST": "Sem Informação",
|
"EMPTY-LIST": "Sem Informação",
|
||||||
"LATEST-ACTIVITY": "Última Atividade",
|
"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-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": "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",
|
"SELECT-DMP": "Selecione um PGD para o seu Dataset",
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
"ADD-DATASET-DESCRIPTION": "Adicione um Dataset",
|
"ADD-DATASET-DESCRIPTION": "Adicione um Dataset",
|
||||||
|
@ -1793,5 +1796,6 @@
|
||||||
"File format is not supported": "Ficheiro a importar deverá ser em formato .json",
|
"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",
|
"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",
|
"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.",
|
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation 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-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": {
|
"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).",
|
"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",
|
"PERSONAL-USAGE": "Osobné použitie",
|
||||||
"PUBLIC-USAGE": "Verejné použitie",
|
"PUBLIC-USAGE": "Verejné použitie",
|
||||||
"DATASET-DESCRIPTIONS": "Súbory dát",
|
"DATASET-DESCRIPTIONS": "Súbory dát",
|
||||||
|
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Súbory dát",
|
||||||
"PUBLIC-DMPS": "Verejné DMP",
|
"PUBLIC-DMPS": "Verejné DMP",
|
||||||
"PUBLIC-DATASETS": "Verejné súbory dát",
|
"PUBLIC-DATASETS": "Verejné súbory dát",
|
||||||
"RELATED-ORGANISATIONS": "Ďalšie organizácie",
|
"RELATED-ORGANISATIONS": "Ďalšie organizácie",
|
||||||
|
|
|
@ -1046,7 +1046,9 @@
|
||||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation 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-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": {
|
"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.",
|
"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",
|
"PERSONAL-USAGE": "Lična upotreba",
|
||||||
"PUBLIC-USAGE": "Javna upotreba",
|
"PUBLIC-USAGE": "Javna upotreba",
|
||||||
"DATASET-DESCRIPTIONS": "Skupovi podataka",
|
"DATASET-DESCRIPTIONS": "Skupovi podataka",
|
||||||
|
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Skupovi podataka",
|
||||||
"PUBLIC-DMPS": "Javno dostupni Planovi",
|
"PUBLIC-DMPS": "Javno dostupni Planovi",
|
||||||
"PUBLIC-DATASETS": "Javno dostupni skupovi podataka",
|
"PUBLIC-DATASETS": "Javno dostupni skupovi podataka",
|
||||||
"RELATED-ORGANISATIONS": "Povezane institucije",
|
"RELATED-ORGANISATIONS": "Povezane institucije",
|
||||||
|
|
|
@ -1046,7 +1046,9 @@
|
||||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation 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-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": {
|
"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.",
|
"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",
|
"PERSONAL-USAGE": "Kişisel Kullanım",
|
||||||
"PUBLIC-USAGE": "Genel Kullanım",
|
"PUBLIC-USAGE": "Genel Kullanım",
|
||||||
"DATASET-DESCRIPTIONS": "Veri Setleri",
|
"DATASET-DESCRIPTIONS": "Veri Setleri",
|
||||||
|
"DATASET-DESCRIPTIONS-DASHBOARD-TEXT": "Veri Setleri",
|
||||||
"PUBLIC-DMPS": "Herkese açık VYP'ler",
|
"PUBLIC-DMPS": "Herkese açık VYP'ler",
|
||||||
"PUBLIC-DATASETS": "Herkese açık Veri Setleri",
|
"PUBLIC-DATASETS": "Herkese açık Veri Setleri",
|
||||||
"RELATED-ORGANISATIONS": "Bağlantılı Kurumlar",
|
"RELATED-ORGANISATIONS": "Bağlantılı Kurumlar",
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
analysed and stored.</p>
|
analysed and stored.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="head-start-dmp">
|
<div class="head-start-dmp">
|
||||||
<a href="/login">
|
<a href="/home">
|
||||||
<button type="button" class="normal-btn">Start your DMP</button>
|
<button type="button" class="normal-btn">Start your DMP</button>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue