Refactoring public api dependencies from 'to be deleted' data and queryable modules
This commit is contained in:
parent
87dd56ff2c
commit
80096e9164
|
@ -1,69 +0,0 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
|
||||
import eu.eudat.data.DescriptionEntity;
|
||||
import eu.eudat.types.grant.GrantStateType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 10/2/2018.
|
||||
*/
|
||||
public class DatasetPublicCriteria extends Criteria<DescriptionEntity>{
|
||||
private GrantStateType grantStatus;
|
||||
private List<UUID> grants;
|
||||
private List<UUID> datasetProfile;
|
||||
private List<String> dmpOrganisations;
|
||||
// private List<Tag> tags; TODO:
|
||||
private List<UUID> dmpIds;
|
||||
private Integer role;
|
||||
|
||||
public GrantStateType getGrantStatus() {
|
||||
return grantStatus;
|
||||
}
|
||||
public void setGrantStatus(GrantStateType grantStatus) {
|
||||
this.grantStatus = grantStatus;
|
||||
}
|
||||
|
||||
public List<UUID> getGrants() {
|
||||
return grants;
|
||||
}
|
||||
public void setGrants(List<UUID> grants) {
|
||||
this.grants = grants;
|
||||
}
|
||||
|
||||
public List<UUID> getDatasetProfile() {
|
||||
return datasetProfile;
|
||||
}
|
||||
public void setDatasetProfile(List<UUID> datasetProfile) {
|
||||
this.datasetProfile = datasetProfile;
|
||||
}
|
||||
|
||||
public List<String> getDmpOrganisations() {
|
||||
return dmpOrganisations;
|
||||
}
|
||||
public void setDmpOrganisations(List<String> dmpOrganisations) {
|
||||
this.dmpOrganisations = dmpOrganisations;
|
||||
}
|
||||
|
||||
// public List<Tag> getTags() {
|
||||
// return tags;
|
||||
// }
|
||||
// public void setTags(List<Tag> tags) {
|
||||
// this.tags = tags;
|
||||
// }
|
||||
|
||||
public List<UUID> getDmpIds() {
|
||||
return dmpIds;
|
||||
}
|
||||
public void setDmpIds(List<UUID> dmpIds) {
|
||||
this.dmpIds = dmpIds;
|
||||
}
|
||||
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package eu.eudat.data.query.items.table.dataset;
|
||||
|
||||
import eu.eudat.commons.enums.DescriptionStatus;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.data.dao.criteria.DatasetPublicCriteria;
|
||||
import eu.eudat.data.DescriptionEntity;
|
||||
import eu.eudat.data.query.definition.TableQuery;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
import eu.eudat.types.grant.GrantStateType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 10/2/2018.
|
||||
*/
|
||||
public class DatasetPublicTableRequest extends TableQuery<DatasetPublicCriteria, DescriptionEntity, UUID> {
|
||||
@Override
|
||||
public QueryableList<DescriptionEntity> applyCriteria() {
|
||||
QueryableList<DescriptionEntity> query = this.getQuery();
|
||||
query.where((builder, root) -> builder.equal(root.get("dmp").get("isPublic"), true));
|
||||
query.where((builder, root) -> builder.equal(root.get("status"), DescriptionStatus.Finalized.getValue()));
|
||||
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"),
|
||||
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")),
|
||||
Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));
|
||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||
query.where((builder, root) -> builder.or(
|
||||
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
|
||||
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
|
||||
if (this.getCriteria().getGrants() != null && !this.getCriteria().getGrants().isEmpty())
|
||||
query.where(((builder, root) -> root.get("dmp").get("grant").get("id").in(this.getCriteria().getGrants())));
|
||||
if (this.getCriteria().getGrantStatus() != null) {
|
||||
if (this.getCriteria().getGrantStatus().getValue().equals(GrantStateType.FINISHED.getValue()))
|
||||
query.where((builder, root) -> builder.lessThan(root.get("dmp").get("grant").get("enddate"), new Date()));
|
||||
if (this.getCriteria().getGrantStatus().getValue().equals(GrantStateType.ONGOING.getValue()))
|
||||
query.where((builder, root) ->
|
||||
builder.or(builder.greaterThan(root.get("dmp").get("grant").get("enddate"), new Date())
|
||||
, builder.isNull(root.get("dmp").get("grant").get("enddate"))));
|
||||
}
|
||||
if (this.getCriteria().getDmpIds() != null && !this.getCriteria().getDmpIds().isEmpty()) {
|
||||
query.where(((builder, root) -> root.get("dmp").get("id").in(this.getCriteria().getDmpIds())));
|
||||
}
|
||||
if (this.getCriteria().getDatasetProfile() != null && !this.getCriteria().getDatasetProfile().isEmpty()) query
|
||||
.where(((builder, root) -> root.get("profile").get("id").in(this.getCriteria().getDatasetProfile())));
|
||||
if (this.getCriteria().getDmpOrganisations() != null && !this.getCriteria().getDmpOrganisations().isEmpty()) query
|
||||
.where(((builder, root) -> root.join("dmp").join("organisations").get("reference").in(this.getCriteria().getDmpOrganisations())));
|
||||
query.where((builder, root) -> builder.notEqual(root.get(DescriptionEntity._isActive), IsActive.Inactive));
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DescriptionEntity> applyPaging(QueryableList<DescriptionEntity> items) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package eu.eudat.types.grant;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 8/24/2018.
|
||||
*/
|
||||
public enum GrantStateType {
|
||||
ONGOING(0), FINISHED(1);
|
||||
|
||||
private Integer value;
|
||||
|
||||
private GrantStateType(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static GrantStateType fromInteger(Integer value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return ONGOING;
|
||||
case 1:
|
||||
return FINISHED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Grant State Type");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
package eu.eudat.queryable;
|
||||
|
||||
import eu.eudat.queryable.jpa.predicates.*;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
package eu.eudat.controllers.publicapi;
|
||||
|
||||
import eu.eudat.controllers.publicapi.jpa.predicates.*;
|
||||
import eu.eudat.controllers.publicapi.types.SelectionField;
|
||||
import jakarta.persistence.criteria.Join;
|
||||
import jakarta.persistence.criteria.JoinType;
|
||||
import jakarta.persistence.criteria.Subquery;
|
|
@ -1,8 +1,7 @@
|
|||
package eu.eudat.queryable.collector;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
package eu.eudat.controllers.publicapi.collector;
|
||||
|
||||
import jakarta.persistence.Tuple;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.queryable.collector;
|
||||
package eu.eudat.controllers.publicapi.collector;
|
||||
|
||||
import jakarta.persistence.Tuple;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.data.dao.criteria;
|
||||
package eu.eudat.controllers.publicapi.criteria;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package eu.eudat.controllers.publicapi.criteria.dataset;
|
||||
|
||||
import eu.eudat.data.dao.criteria.Criteria;
|
||||
import eu.eudat.controllers.publicapi.criteria.Criteria;
|
||||
import eu.eudat.data.DescriptionEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.eudat.controllers.publicapi.criteria.dmp;
|
||||
|
||||
import eu.eudat.controllers.publicapi.criteria.Criteria;
|
||||
import eu.eudat.data.DmpEntity;
|
||||
import eu.eudat.data.dao.criteria.Criteria;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.queryable.exceptions;
|
||||
package eu.eudat.controllers.publicapi.exceptions;
|
||||
|
||||
|
||||
public class NotSingleResultException extends RuntimeException {
|
|
@ -1,12 +1,12 @@
|
|||
package eu.eudat.queryable.jpa.hibernatequeryablelist;
|
||||
package eu.eudat.controllers.publicapi.jpa.hibernatequeryablelist;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.collector.Collector;
|
||||
import eu.eudat.queryable.exceptions.NotSingleResultException;
|
||||
import eu.eudat.queryable.jpa.predicates.*;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
import eu.eudat.controllers.publicapi.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.collector.Collector;
|
||||
import eu.eudat.controllers.publicapi.exceptions.NotSingleResultException;
|
||||
import eu.eudat.controllers.publicapi.jpa.predicates.*;
|
||||
import eu.eudat.controllers.publicapi.types.FieldSelectionType;
|
||||
import eu.eudat.controllers.publicapi.types.SelectionField;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.Tuple;
|
||||
import jakarta.persistence.TypedQuery;
|
|
@ -1,8 +1,7 @@
|
|||
package eu.eudat.queryable.jpa.predicates;
|
||||
package eu.eudat.controllers.publicapi.jpa.predicates;
|
||||
|
||||
import jakarta.persistence.criteria.Path;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 10/10/2018.
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.queryable.jpa.predicates;
|
||||
package eu.eudat.controllers.publicapi.jpa.predicates;
|
||||
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.Expression;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.queryable.jpa.predicates;
|
||||
package eu.eudat.controllers.publicapi.jpa.predicates;
|
||||
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.Predicate;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.queryable.jpa.predicates;
|
||||
package eu.eudat.controllers.publicapi.jpa.predicates;
|
||||
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.Order;
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.queryable.jpa.predicates;
|
||||
package eu.eudat.controllers.publicapi.jpa.predicates;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 2/7/2018.
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.queryable.jpa.predicates;
|
||||
package eu.eudat.controllers.publicapi.jpa.predicates;
|
||||
|
||||
public interface SelectPredicate<T, R> {
|
||||
R applySelection(T item);
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.queryable.jpa.predicates;
|
||||
package eu.eudat.controllers.publicapi.jpa.predicates;
|
||||
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.Predicate;
|
|
@ -1,9 +1,9 @@
|
|||
package eu.eudat.data.query;
|
||||
package eu.eudat.controllers.publicapi.query;
|
||||
|
||||
import eu.eudat.data.query.definition.TableQuery;
|
||||
import eu.eudat.data.query.definition.helpers.ColumnOrderings;
|
||||
import eu.eudat.data.query.definition.helpers.Ordering;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.query.definition.TableQuery;
|
||||
import eu.eudat.controllers.publicapi.query.definition.helpers.ColumnOrderings;
|
||||
import eu.eudat.controllers.publicapi.query.definition.helpers.Ordering;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
|
@ -1,6 +1,6 @@
|
|||
package eu.eudat.data.query.definition;
|
||||
package eu.eudat.controllers.publicapi.query.definition;
|
||||
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.QueryableList;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/21/2018.
|
|
@ -1,7 +1,7 @@
|
|||
package eu.eudat.data.query.definition;
|
||||
package eu.eudat.controllers.publicapi.query.definition;
|
||||
|
||||
import eu.eudat.data.dao.criteria.Criteria;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.criteria.Criteria;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/21/2018.
|
|
@ -1,7 +1,7 @@
|
|||
package eu.eudat.data.query.definition;
|
||||
package eu.eudat.controllers.publicapi.query.definition;
|
||||
|
||||
import eu.eudat.data.dao.criteria.Criteria;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.criteria.Criteria;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,7 +1,7 @@
|
|||
package eu.eudat.data.query.definition;
|
||||
package eu.eudat.controllers.publicapi.query.definition;
|
||||
|
||||
import eu.eudat.data.dao.criteria.Criteria;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.criteria.Criteria;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/21/2018.
|
|
@ -1,9 +1,9 @@
|
|||
package eu.eudat.data.query.definition;
|
||||
package eu.eudat.controllers.publicapi.query.definition;
|
||||
|
||||
import eu.eudat.data.dao.criteria.Criteria;
|
||||
import eu.eudat.data.query.definition.helpers.ColumnOrderings;
|
||||
import eu.eudat.data.query.definition.helpers.SelectionFields;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.criteria.Criteria;
|
||||
import eu.eudat.controllers.publicapi.query.definition.helpers.ColumnOrderings;
|
||||
import eu.eudat.controllers.publicapi.query.definition.helpers.SelectionFields;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.data.query.definition.helpers;
|
||||
package eu.eudat.controllers.publicapi.query.definition.helpers;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.data.query.definition.helpers;
|
||||
package eu.eudat.controllers.publicapi.query.definition.helpers;
|
||||
|
||||
|
||||
public class Ordering {
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.data.query.definition.helpers;
|
||||
package eu.eudat.controllers.publicapi.query.definition.helpers;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
|
@ -2,12 +2,12 @@ package eu.eudat.controllers.publicapi.request.dataset;
|
|||
|
||||
import eu.eudat.commons.enums.DescriptionStatus;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.controllers.publicapi.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.criteria.dataset.DatasetPublicCriteria;
|
||||
import eu.eudat.controllers.publicapi.query.definition.TableQuery;
|
||||
import eu.eudat.controllers.publicapi.types.FieldSelectionType;
|
||||
import eu.eudat.controllers.publicapi.types.SelectionField;
|
||||
import eu.eudat.data.DescriptionEntity;
|
||||
import eu.eudat.data.query.definition.TableQuery;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package eu.eudat.controllers.publicapi.request.dmp;
|
||||
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.controllers.publicapi.QueryableList;
|
||||
import eu.eudat.controllers.publicapi.criteria.dmp.DataManagementPlanPublicCriteria;
|
||||
import eu.eudat.controllers.publicapi.query.PaginationService;
|
||||
import eu.eudat.controllers.publicapi.query.definition.TableQuery;
|
||||
import eu.eudat.controllers.publicapi.types.FieldSelectionType;
|
||||
import eu.eudat.controllers.publicapi.types.SelectionField;
|
||||
import eu.eudat.data.DmpEntity;
|
||||
import eu.eudat.data.query.PaginationService;
|
||||
import eu.eudat.data.query.definition.TableQuery;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.queryable.types.FieldSelectionType;
|
||||
import eu.eudat.queryable.types.SelectionField;
|
||||
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import java.util.*;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.queryable.types;
|
||||
package eu.eudat.controllers.publicapi.types;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 2/7/2018.
|
|
@ -1,4 +1,4 @@
|
|||
package eu.eudat.queryable.types;
|
||||
package eu.eudat.controllers.publicapi.types;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 2/7/2018.
|
Loading…
Reference in New Issue