Merge branch 'Development' of code-repo.d4science.org:MaDgiK-CITE/argos into Development

This commit is contained in:
Konstantinos Triantafyllou 2022-10-19 01:48:57 +03:00
commit 9f1c0352ea
15 changed files with 51 additions and 9 deletions

View File

@ -25,5 +25,10 @@
<artifactId>elastic</artifactId> <artifactId>elastic</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.20</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1,9 +1,9 @@
package eu.eudat.data.dao.criteria; package eu.eudat.data.dao.criteria;
import io.swagger.annotations.ApiModelProperty;
import eu.eudat.queryable.queryableentity.DataEntity;
public abstract class Criteria<T> { public abstract class Criteria<T> {
@ApiModelProperty(value = "like", name = "like", dataType = "String", allowEmptyValue = true, example = "\"\"")
private String like; private String like;
public String getLike() { public String getLike() {

View File

@ -3,12 +3,14 @@ package eu.eudat.data.query.definition;
import eu.eudat.data.dao.criteria.Criteria; import eu.eudat.data.dao.criteria.Criteria;
import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.queryableentity.DataEntity; import eu.eudat.queryable.queryableentity.DataEntity;
import io.swagger.annotations.ApiModelProperty;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public abstract class Query<C extends Criteria<T>, T extends DataEntity> implements CriteriaQuery<C, T> { public abstract class Query<C extends Criteria<T>, T extends DataEntity> implements CriteriaQuery<C, T> {
private static final Logger logger = LoggerFactory.getLogger(Query.class); private static final Logger logger = LoggerFactory.getLogger(Query.class);
private C criteria; private C criteria;
@ApiModelProperty(value = "query", name = "query", dataType = "String", hidden = true)
private QueryableList<T> query; private QueryableList<T> query;
public static class QueryBuilder<C extends Criteria<T>, T extends DataEntity, Q extends Query<C, T>> { public static class QueryBuilder<C extends Criteria<T>, T extends DataEntity, Q extends Query<C, T>> {

View File

@ -6,12 +6,16 @@ import eu.eudat.data.query.definition.helpers.ColumnOrderings;
import eu.eudat.data.query.definition.helpers.SelectionFields; import eu.eudat.data.query.definition.helpers.SelectionFields;
import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.queryableentity.DataEntity; import eu.eudat.queryable.queryableentity.DataEntity;
import io.swagger.annotations.ApiModelProperty;
public abstract class TableQuery<C extends Criteria<T>, T extends DataEntity<T, K>, K> extends Query<C, T> implements TableCriteriaQuery<C, T> { public abstract class TableQuery<C extends Criteria<T>, T extends DataEntity<T, K>, K> extends Query<C, T> implements TableCriteriaQuery<C, T> {
private ColumnOrderings orderings; private ColumnOrderings orderings;
@ApiModelProperty(hidden = true)
private SelectionFields selection; private SelectionFields selection;
@ApiModelProperty(value = "length", name = "length", dataType = "Integer", example = "2")
private Integer length; private Integer length;
@ApiModelProperty(value = "offset", name = "offset", dataType = "Integer", example = "0")
private Integer offset; private Integer offset;
public Integer getLength() { public Integer getLength() {

View File

@ -1,11 +1,14 @@
package eu.eudat.data.query.definition.helpers; package eu.eudat.data.query.definition.helpers;
import io.swagger.annotations.ApiModelProperty;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
public class ColumnOrderings { public class ColumnOrderings {
@ApiModelProperty(value = "fields", name = "fields", dataType = "List<String>", example = "[]")
private List<String> fields; private List<String> fields;
public List<String> getFields() { public List<String> getFields() {

View File

@ -1,8 +1,11 @@
package eu.eudat.data.query.definition.helpers; package eu.eudat.data.query.definition.helpers;
import io.swagger.annotations.ApiModelProperty;
public class SelectionFields { public class SelectionFields {
@ApiModelProperty(value = "fields", name = "fields", dataType = "String[]", example = "[]")
private String[] fields; private String[] fields;
public String[] getFields() { public String[] getFields() {

View File

@ -3,6 +3,7 @@ package eu.eudat.publicapi.criteria.dataset;
import eu.eudat.data.dao.criteria.Criteria; import eu.eudat.data.dao.criteria.Criteria;
import eu.eudat.data.entities.Dataset; import eu.eudat.data.entities.Dataset;
import eu.eudat.elastic.entities.Tag; import eu.eudat.elastic.entities.Tag;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -10,15 +11,25 @@ import java.util.UUID;
public class DatasetPublicCriteria extends Criteria<Dataset> { public class DatasetPublicCriteria extends Criteria<Dataset> {
@ApiModelProperty(value = "periodStart", name = "periodStart", dataType = "Date", example = "2022-01-01T13:19:42.210Z")
private Date periodStart; private Date periodStart;
@ApiModelProperty(value = "periodEnd", name = "periodEnd", dataType = "Date", example = "2022-12-31T13:19:42.210Z")
private Date periodEnd; private Date periodEnd;
@ApiModelProperty(value = "grants", name = "grants", dataType = "List<UUID>", example = "[]")
private List<UUID> grants; private List<UUID> grants;
@ApiModelProperty(value = "collaborators", name = "collaborators", dataType = "List<UUID>", example = "[]")
private List<UUID> collaborators; private List<UUID> collaborators;
@ApiModelProperty(value = "datasetTemplates", name = "datasetTemplates", dataType = "List<UUID>", example = "[]")
private List<UUID> datasetTemplates; private List<UUID> datasetTemplates;
@ApiModelProperty(value = "dmpOrganisations", name = "dmpOrganisations", dataType = "List<String>", example = "[]")
private List<String> dmpOrganisations; private List<String> dmpOrganisations;
@ApiModelProperty(value = "tags", name = "tags", dataType = "List<Tag>", example = "[]")
private List<Tag> tags; private List<Tag> tags;
@ApiModelProperty(value = "dmpIds", name = "dmpIds", dataType = "List<UUID>", example = "[]")
private List<UUID> dmpIds; private List<UUID> dmpIds;
@ApiModelProperty(value = "groupIds", name = "groupIds", dataType = "List<UUID>", example = "[]")
private List<UUID> groupIds; private List<UUID> groupIds;
@ApiModelProperty(value = "allVersions", name = "allVersions", dataType = "Boolean", example = "false")
private boolean allVersions; private boolean allVersions;
public Date getPeriodStart() { public Date getPeriodStart() {

View File

@ -2,20 +2,30 @@ package eu.eudat.publicapi.criteria.dmp;
import eu.eudat.data.dao.criteria.Criteria; import eu.eudat.data.dao.criteria.Criteria;
import eu.eudat.data.entities.DMP; import eu.eudat.data.entities.DMP;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
public class DataManagementPlanPublicCriteria extends Criteria<DMP> { public class DataManagementPlanPublicCriteria extends Criteria<DMP> {
@ApiModelProperty(value = "periodStart", name = "periodStart", dataType = "Date", example = "2022-01-01T13:19:42.210Z")
private Date periodStart; private Date periodStart;
@ApiModelProperty(value = "periodEnd", name = "periodEnd", dataType = "Date", example = "2022-12-31T13:19:42.210Z")
private Date periodEnd; private Date periodEnd;
@ApiModelProperty(value = "grants", name = "grants", dataType = "List<UUID>", example = "[]")
private List<UUID> grants; private List<UUID> grants;
@ApiModelProperty(value = "funders", name = "funders", dataType = "List<UUID>", example = "[]")
private List<UUID> funders; private List<UUID> funders;
@ApiModelProperty(value = "datasetTemplates", name = "datasetTemplates", dataType = "List<UUID>", example = "[]")
private List<UUID> datasetTemplates; private List<UUID> datasetTemplates;
@ApiModelProperty(value = "dmpOrganisations", name = "dmpOrganisations", dataType = "List<String>", example = "[]")
private List<String> dmpOrganisations; private List<String> dmpOrganisations;
@ApiModelProperty(value = "collaborators", name = "collaborators", dataType = "List<UUID>", example = "[]")
private List<UUID> collaborators; private List<UUID> collaborators;
@ApiModelProperty(value = "allVersions", name = "allVersions", dataType = "Boolean", example = "false")
private boolean allVersions; private boolean allVersions;
@ApiModelProperty(value = "groupIds", name = "groupIds", dataType = "List<UUID>", example = "[]")
private List<UUID> groupIds; private List<UUID> groupIds;
public Date getPeriodStart() { public Date getPeriodStart() {

View File

@ -227,7 +227,7 @@ export class DraftsComponent extends BaseComponent implements OnInit {
isUserOwner(activity: DatasetListingModel): boolean { isUserOwner(activity: DatasetListingModel): boolean {
const principal: Principal = this.authentication.current(); const principal: Principal = this.authentication.current();
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id; if (principal) return !!activity.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
} }
onCallbackSuccess(id?: String): void { onCallbackSuccess(id?: String): void {

View File

@ -186,7 +186,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
isUserOwner(activity: DmpListingModel): boolean { isUserOwner(activity: DmpListingModel): boolean {
const principal: Principal = this.authentication.current(); const principal: Principal = this.authentication.current();
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id; if (principal) return !!activity.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
} }
editClicked(dmp: DmpListingModel) { editClicked(dmp: DmpListingModel) {

View File

@ -163,7 +163,7 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
isUserOwner(activity: DatasetListingModel): boolean { isUserOwner(activity: DatasetListingModel): boolean {
const principal: Principal = this.authentication.current(); const principal: Principal = this.authentication.current();
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id; if (principal) return !!activity.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
} }
goToOverview(id: string): string[] { goToOverview(id: string): string[] {

View File

@ -165,7 +165,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
isUserOwner(activity: DmpListingModel): boolean { isUserOwner(activity: DmpListingModel): boolean {
const principal: Principal = this.authentication.current(); const principal: Principal = this.authentication.current();
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id; if (principal) return !!activity.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
} }
editClicked(dmp: DmpListingModel) { editClicked(dmp: DmpListingModel) {

View File

@ -74,7 +74,7 @@ export class DatasetListingItemComponent 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));
} }
} }

View File

@ -210,7 +210,11 @@ export class DmpCloneComponent extends BaseComponent implements OnInit {
setIsUserOwner() { setIsUserOwner() {
if (this.dmp) { if (this.dmp) {
const principal: Principal = this.authentication.current(); const principal: Principal = this.authentication.current();
this.isUserOwner = principal.id === this.dmp.users.find(x => x.role === Role.Owner).id; if (principal) {
this.isUserOwner = !!this.dmp.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
} else {
this.isUserOwner = false;
}
} }
} }

View File

@ -367,6 +367,6 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
isUserOwner(activity: DmpListingModel): boolean { isUserOwner(activity: DmpListingModel): boolean {
const principal: Principal = this.authentication.current(); const principal: Principal = this.authentication.current();
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id; if (principal) return !!activity.users.find(x => (x.role === Role.Owner) && (principal.id === x.id));
} }
} }