Merge branch 'Development' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot into Development
This commit is contained in:
commit
49fe557fdc
|
@ -1,6 +1,7 @@
|
||||||
package eu.eudat.dao.entities;
|
package eu.eudat.dao.entities;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import eu.eudat.dao.DatabaseAccess;
|
import eu.eudat.dao.DatabaseAccess;
|
||||||
import eu.eudat.dao.databaselayer.service.DatabaseService;
|
import eu.eudat.dao.databaselayer.service.DatabaseService;
|
||||||
import eu.eudat.entities.*;
|
import eu.eudat.entities.*;
|
||||||
|
@ -21,9 +22,14 @@ public class ProjectDaoImpl extends DatabaseAccess<Project> implements ProjectDa
|
||||||
@Override
|
@Override
|
||||||
public QueryableList<Project> getWithCriteria(ProjectCriteria criteria) {
|
public QueryableList<Project> getWithCriteria(ProjectCriteria criteria) {
|
||||||
QueryableList<Project> query = getDatabaseService().getQueryable(Project.class);
|
QueryableList<Project> query = getDatabaseService().getQueryable(Project.class);
|
||||||
if(criteria.getLike()!=null&&!criteria.getLike().isEmpty())query.where((builder, root) -> builder.like(root.get("label"),"%"+criteria.getLike()+"%"));
|
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
||||||
if(criteria.getPeriodEnd()!=null)query.where((builder, root) -> builder.lessThan(root.get("enddate"),criteria.getPeriodEnd()));
|
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%"));
|
||||||
if(criteria.getPeriodStart()!=null)query.where((builder, root) -> builder.greaterThan(root.get("startdate"),criteria.getPeriodStart()));
|
if (criteria.getPeriodEnd() != null)
|
||||||
|
query.where((builder, root) -> builder.lessThan(root.get("enddate"), criteria.getPeriodEnd()));
|
||||||
|
if (criteria.getPeriodStart() != null)
|
||||||
|
query.where((builder, root) -> builder.greaterThan(root.get("startdate"), criteria.getPeriodStart()));
|
||||||
|
if (criteria.getReference() != null)
|
||||||
|
query.where((builder, root) -> builder.equal(root.get("reference"), criteria.getReference()));
|
||||||
query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue()));
|
query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue()));
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
@NamedEntityGraph(
|
@NamedEntityGraph(
|
||||||
name = "dataManagementPlanListingModel",
|
name = "dataManagementPlanListingModel",
|
||||||
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"),
|
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"),
|
||||||
@NamedAttributeNode("project"), @NamedAttributeNode("profile")}
|
@NamedAttributeNode("project"), @NamedAttributeNode("profile"),@NamedAttributeNode("dataset")}
|
||||||
),
|
),
|
||||||
@NamedEntityGraph(
|
@NamedEntityGraph(
|
||||||
name = "fullyDetailed",
|
name = "fullyDetailed",
|
||||||
|
@ -258,6 +258,7 @@ public class DMP implements Serializable, DataEntity<DMP> {
|
||||||
this.label = entity.getLabel();
|
this.label = entity.getLabel();
|
||||||
this.status = entity.getStatus();
|
this.status = entity.getStatus();
|
||||||
this.created = entity.created;
|
this.created = entity.created;
|
||||||
|
this.project = entity.getProject();
|
||||||
this.description = entity.getDescription();
|
this.description = entity.getDescription();
|
||||||
this.researchers = entity.getResearchers();
|
this.researchers = entity.getResearchers();
|
||||||
this.organisations = entity.getOrganisations();
|
this.organisations = entity.getOrganisations();
|
||||||
|
|
|
@ -106,9 +106,9 @@ public class DataManagementPlanManager {
|
||||||
if (newDmp.getProject() != null) {
|
if (newDmp.getProject() != null) {
|
||||||
Project project = newDmp.getProject();
|
Project project = newDmp.getProject();
|
||||||
ProjectCriteria criteria = new ProjectCriteria();
|
ProjectCriteria criteria = new ProjectCriteria();
|
||||||
criteria.setLike(project.getReference());
|
criteria.setReference(project.getReference());
|
||||||
List<eu.eudat.entities.Project> entries = projectDao.getWithCriteria(criteria).toList();
|
eu.eudat.entities.Project projectEntity = projectDao.getWithCriteria(criteria).getSingleOrDefault();
|
||||||
if (entries != null && !entries.isEmpty()) project.setId(entries.get(0).getId());
|
if (projectEntity != null) project.setId(projectEntity.getId());
|
||||||
else {
|
else {
|
||||||
project.setCreationUser(userInfo);
|
project.setCreationUser(userInfo);
|
||||||
projectDao.createOrUpdate(project);
|
projectDao.createOrUpdate(project);
|
||||||
|
|
|
@ -6,6 +6,8 @@ import eu.eudat.models.helpers.common.Ordering;
|
||||||
import eu.eudat.models.helpers.requests.TableRequest;
|
import eu.eudat.models.helpers.requests.TableRequest;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
public class PaginationManager {
|
public class PaginationManager {
|
||||||
|
|
||||||
public static <T extends DataEntity<T>> QueryableList<T> applyPaging(QueryableList<T> items, TableRequest tableRequest) throws Exception {
|
public static <T extends DataEntity<T>> QueryableList<T> applyPaging(QueryableList<T> items, TableRequest tableRequest) throws Exception {
|
||||||
|
@ -18,9 +20,34 @@ public class PaginationManager {
|
||||||
public static <T extends DataEntity<T>> void applyOrder(QueryableList<T> items, TableRequest tableRequest) throws Exception {
|
public static <T extends DataEntity<T>> void applyOrder(QueryableList<T> items, TableRequest tableRequest) throws Exception {
|
||||||
ColumnOrderings columnOrderings = tableRequest.getOrderings();
|
ColumnOrderings columnOrderings = tableRequest.getOrderings();
|
||||||
for (Ordering ordering : columnOrderings.getFieldOrderings()) {
|
for (Ordering ordering : columnOrderings.getFieldOrderings()) {
|
||||||
if(ordering.getType() == Ordering.OrderByType.ASC) items.orderByAsc(root -> root.get(ordering.getFieldName()));
|
if (ordering.getOrderByType() == Ordering.OrderByType.ASC)
|
||||||
if(ordering.getType() == Ordering.OrderByType.DESC) items.orderByDesc(root -> root.get(ordering.getFieldName()));
|
applyAscOrder(items,ordering);
|
||||||
|
if (ordering.getOrderByType() == Ordering.OrderByType.DESC) {
|
||||||
|
applyDescOrder(items,ordering);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static <T extends DataEntity<T>> void applyAscOrder(QueryableList<T> items, Ordering ordering) {
|
||||||
|
if (ordering.getColumnType() == Ordering.ColumnType.COUNT) {
|
||||||
|
items.orderBy((builder, root) -> builder.asc(builder.size(root.<Collection>get(ordering.getFieldName()))));
|
||||||
|
} else if (ordering.getColumnType() == Ordering.ColumnType.JOIN_COLUMN) {
|
||||||
|
String[] fields = ordering.getFieldName().split(":");
|
||||||
|
items.orderBy((builder, root) -> builder.asc(root.get(fields[0]).get(fields[1])));
|
||||||
|
} else {
|
||||||
|
items.orderBy((builder, root) -> builder.asc(root.get(ordering.getFieldName())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T extends DataEntity<T>> void applyDescOrder(QueryableList<T> items, Ordering ordering) {
|
||||||
|
if (ordering.getColumnType() == Ordering.ColumnType.COUNT) {
|
||||||
|
items.orderBy((builder, root) -> builder.desc(builder.size(root.<Collection>get(ordering.getFieldName()))));
|
||||||
|
} else if (ordering.getColumnType() == Ordering.ColumnType.JOIN_COLUMN) {
|
||||||
|
String[] fields = ordering.getFieldName().split(":");
|
||||||
|
items.orderBy((builder, root) -> builder.desc(root.get(fields[0]).get(fields[1])));
|
||||||
|
} else {
|
||||||
|
items.orderBy((builder, root) -> builder.desc(root.get(ordering.getFieldName())));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import java.util.Date;
|
||||||
public class ProjectCriteria extends Criteria<Project>{
|
public class ProjectCriteria extends Criteria<Project>{
|
||||||
private Date periodStart;
|
private Date periodStart;
|
||||||
private Date periodEnd;
|
private Date periodEnd;
|
||||||
|
private String reference;
|
||||||
public Date getPeriodStart() {
|
public Date getPeriodStart() {
|
||||||
return periodStart;
|
return periodStart;
|
||||||
}
|
}
|
||||||
|
@ -23,4 +23,12 @@ public class ProjectCriteria extends Criteria<Project>{
|
||||||
public void setPeriodEnd(Date periodEnd) {
|
public void setPeriodEnd(Date periodEnd) {
|
||||||
this.periodEnd = periodEnd;
|
this.periodEnd = periodEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getReference() {
|
||||||
|
return reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReference(String reference) {
|
||||||
|
this.reference = reference;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,11 @@ public class ColumnOrderings {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Ordering orderingFromString(String field) throws Exception {
|
private Ordering orderingFromString(String field) throws Exception {
|
||||||
if(field.startsWith("+")) return new Ordering(field.replace("+",""), Ordering.OrderByType.ASC);
|
Ordering ordering = new Ordering(field);
|
||||||
else if(field.startsWith("-")) return new Ordering(field.replace("-",""), Ordering.OrderByType.DESC);
|
if(ordering.getFieldName().contains("+")) ordering.fieldName(ordering.getFieldName().replace("+","")).orderByType(Ordering.OrderByType.ASC);
|
||||||
else throw new Exception("Unsupported Field Order Type");
|
else if(ordering.getFieldName().startsWith("-")) ordering.fieldName(ordering.getFieldName().replace("-","")).orderByType(Ordering.OrderByType.DESC);
|
||||||
|
if(ordering.getFieldName().contains("|count|")) ordering.fieldName(ordering.getFieldName().replace("|count|","")).columnType(Ordering.ColumnType.COUNT);
|
||||||
|
else if(ordering.getFieldName().contains("|join|")) ordering.fieldName(ordering.getFieldName().replace("|join|","")).columnType(Ordering.ColumnType.JOIN_COLUMN);
|
||||||
|
return ordering;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,16 @@ public class Ordering {
|
||||||
ASC, DESC
|
ASC, DESC
|
||||||
}
|
}
|
||||||
|
|
||||||
private String fieldName;
|
public enum ColumnType {
|
||||||
private OrderByType type;
|
COUNT, COLUMN , JOIN_COLUMN
|
||||||
|
}
|
||||||
|
|
||||||
public Ordering(String fieldName, OrderByType type) {
|
private String fieldName;
|
||||||
|
private OrderByType orderByType;
|
||||||
|
private ColumnType columnType;
|
||||||
|
|
||||||
|
public Ordering(String fieldName) {
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
this.type = type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFieldName() {
|
public String getFieldName() {
|
||||||
|
@ -22,11 +26,34 @@ public class Ordering {
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderByType getType() {
|
public OrderByType getOrderByType() {
|
||||||
return type;
|
return orderByType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(OrderByType type) {
|
public void setOrderByType(OrderByType orderByType) {
|
||||||
this.type = type;
|
this.orderByType = orderByType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ordering fieldName(String fieldName) {
|
||||||
|
this.fieldName = fieldName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ordering orderByType(OrderByType orderByType) {
|
||||||
|
this.orderByType = orderByType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColumnType getColumnType() {
|
||||||
|
return columnType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColumnType(ColumnType columnType) {
|
||||||
|
this.columnType = columnType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ordering columnType(ColumnType columnType) {
|
||||||
|
this.columnType = columnType;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP> {
|
||||||
private String label;
|
private String label;
|
||||||
private String project;
|
private String project;
|
||||||
private String profile;
|
private String profile;
|
||||||
private String researchers;
|
private String creationTime;
|
||||||
private String organisations;
|
private String organisations;
|
||||||
private String version;
|
private String version;
|
||||||
private Integer numOfDatasets;
|
private Integer numOfDatasets;
|
||||||
|
@ -55,12 +55,12 @@ public class DataManagementPlanListingModel implements DataModel<DMP> {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResearchers() {
|
public String getCreationTime() {
|
||||||
return researchers;
|
return creationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResearchers(String researchers) {
|
public void setCreationTime(String creationTime) {
|
||||||
this.researchers = researchers;
|
this.creationTime = creationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOrganisations() {
|
public String getOrganisations() {
|
||||||
|
@ -94,7 +94,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP> {
|
||||||
this.project = entity.getProject().getLabel();
|
this.project = entity.getProject().getLabel();
|
||||||
if(entity.getProfile()!=null)this.profile = entity.getProfile().getLabel();
|
if(entity.getProfile()!=null)this.profile = entity.getProfile().getLabel();
|
||||||
this.organisations =LabelBuilder.getLabel(new DomainModelConverter<eu.eudat.entities.Organisation,Organisation>().fromDataModel(entity.getOrganisations().stream().collect(Collectors.toList()),Organisation.class));
|
this.organisations =LabelBuilder.getLabel(new DomainModelConverter<eu.eudat.entities.Organisation,Organisation>().fromDataModel(entity.getOrganisations().stream().collect(Collectors.toList()),Organisation.class));
|
||||||
this.researchers =LabelBuilder.getLabel(new DomainModelConverter<eu.eudat.entities.Researcher,Researcher>().fromDataModel(entity.getResearchers().stream().collect(Collectors.toList()),Researcher.class));
|
this.creationTime = entity.getCreated().toString();
|
||||||
this.version = ""+entity.getVersion();
|
this.version = ""+entity.getVersion();
|
||||||
this.numOfDatasets = entity.getDataset().size();
|
this.numOfDatasets = entity.getDataset().size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,6 @@ import eu.eudat.models.dmp.DataManagementPlan;
|
||||||
|
|
||||||
public class Project implements DataModel<eu.eudat.entities.Project> {
|
public class Project implements DataModel<eu.eudat.entities.Project> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
private List<DataManagementPlan> dmps;
|
private List<DataManagementPlan> dmps;
|
||||||
|
@ -170,7 +167,6 @@ public class Project implements DataModel<eu.eudat.entities.Project> {
|
||||||
this.created = entity.getCreated();
|
this.created = entity.getCreated();
|
||||||
this.modified = entity.getModified();
|
this.modified = entity.getModified();
|
||||||
this.description = entity.getDescription();
|
this.description = entity.getDescription();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -179,7 +175,7 @@ public class Project implements DataModel<eu.eudat.entities.Project> {
|
||||||
entity.setId(this.id);
|
entity.setId(this.id);
|
||||||
entity.setAbbreviation(this.abbreviation);
|
entity.setAbbreviation(this.abbreviation);
|
||||||
entity.setLabel(this.label);
|
entity.setLabel(this.label);
|
||||||
entity.setReference(this.reference);
|
entity.setReference(this.reference == null ? "dmp:"+this.label : this.reference);
|
||||||
entity.setUri(this.uri);
|
entity.setUri(this.uri);
|
||||||
entity.setDefinition(this.definition);
|
entity.setDefinition(this.definition);
|
||||||
entity.setStartdate(this.startDate);
|
entity.setStartdate(this.startDate);
|
||||||
|
|
|
@ -27,9 +27,7 @@ public interface QueryableList<T extends DataEntity<T>> {
|
||||||
|
|
||||||
QueryableList<T> distinct();
|
QueryableList<T> distinct();
|
||||||
|
|
||||||
QueryableList<T> orderByAsc(OrderByPredicate<T> predicate);
|
QueryableList<T> orderBy(OrderByPredicate<T> predicate);
|
||||||
|
|
||||||
QueryableList<T> orderByDesc(OrderByPredicate<T> predicate);
|
|
||||||
|
|
||||||
QueryableList<T> setHints(Set<String> hints);
|
QueryableList<T> setHints(Set<String> hints);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
|
||||||
private Class<T> tClass;
|
private Class<T> tClass;
|
||||||
private Root<T> root;
|
private Root<T> root;
|
||||||
private List<SinglePredicate<T>> predicates = new LinkedList<>();
|
private List<SinglePredicate<T>> predicates = new LinkedList<>();
|
||||||
private List<Order> orderings = new LinkedList<>();
|
private List<OrderByPredicate<T>> orderings = new LinkedList<>();
|
||||||
private List<Selection> fields = new LinkedList<>();
|
private List<Selection> fields = new LinkedList<>();
|
||||||
private Integer length;
|
private Integer length;
|
||||||
private Integer offset;
|
private Integer offset;
|
||||||
|
@ -93,13 +93,8 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryableList<T> orderByAsc(OrderByPredicate<T> predicate) {
|
public QueryableList<T> orderBy(OrderByPredicate<T> predicate) {
|
||||||
this.orderings.add(this.manager.getCriteriaBuilder().asc(predicate.applyPredicate(this.root)));
|
this.orderings.add(predicate);
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QueryableList<T> orderByDesc(OrderByPredicate<T> predicate) {
|
|
||||||
this.orderings.add(this.manager.getCriteriaBuilder().desc(predicate.applyPredicate(this.root)));
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,10 +115,18 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
|
||||||
return predicates.toArray(new Predicate[predicates.size()]);
|
return predicates.toArray(new Predicate[predicates.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Order[] generateOrderPredicates(List<OrderByPredicate<T>> orderByPredicates, Root<T> root) {
|
||||||
|
List<Order> predicates = new LinkedList<>();
|
||||||
|
for (OrderByPredicate<T> orderPredicate : orderByPredicates) {
|
||||||
|
predicates.add(orderPredicate.applyPredicate(this.manager.getCriteriaBuilder(), root));
|
||||||
|
}
|
||||||
|
return predicates.toArray(new Order[predicates.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
public List<T> toList() {
|
public List<T> toList() {
|
||||||
|
|
||||||
this.query.where(this.generateWherePredicates(this.predicates, this.root));
|
this.query.where(this.generateWherePredicates(this.predicates, this.root));
|
||||||
if (!this.orderings.isEmpty()) this.query.orderBy(this.orderings);
|
if (!this.orderings.isEmpty()) this.query.orderBy(this.generateOrderPredicates(this.orderings, this.root));
|
||||||
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
|
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
|
||||||
if (this.offset != null) typedQuery.setFirstResult(this.offset);
|
if (this.offset != null) typedQuery.setFirstResult(this.offset);
|
||||||
if (this.length != null) typedQuery.setMaxResults(this.length);
|
if (this.length != null) typedQuery.setMaxResults(this.length);
|
||||||
|
@ -156,6 +159,8 @@ public class QueryableHibernateList<T extends DataEntity<T>> implements Queryabl
|
||||||
Root<T> criteriaRoot = criteriaQuery.from(this.tClass);
|
Root<T> criteriaRoot = criteriaQuery.from(this.tClass);
|
||||||
|
|
||||||
criteriaQuery.where(criteriaRoot.get("id").in(ids));
|
criteriaQuery.where(criteriaRoot.get("id").in(ids));
|
||||||
|
if (!this.orderings.isEmpty()) criteriaQuery.orderBy(this.generateOrderPredicates(this.orderings, criteriaRoot));
|
||||||
|
|
||||||
TypedQuery<T> typedQuery = this.manager.createQuery(criteriaQuery);
|
TypedQuery<T> typedQuery = this.manager.createQuery(criteriaQuery);
|
||||||
typedQuery.setHint("javax.persistence.fetchgraph", this.manager.getEntityGraph(this.hint));
|
typedQuery.setHint("javax.persistence.fetchgraph", this.manager.getEntityGraph(this.hint));
|
||||||
return typedQuery;
|
return typedQuery;
|
||||||
|
|
|
@ -6,6 +6,6 @@ import javax.persistence.criteria.Path;
|
||||||
import javax.persistence.criteria.Root;
|
import javax.persistence.criteria.Root;
|
||||||
|
|
||||||
public interface OrderByPredicate<T> {
|
public interface OrderByPredicate<T> {
|
||||||
Path applyPredicate(Root<T> root);
|
Order applyPredicate(CriteriaBuilder builder, Root<T> root);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,23 +7,23 @@
|
||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
|
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-table [dataSource]="dataSource" matSort>
|
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
|
||||||
|
|
||||||
<!-- Column Definition: Name -->
|
<!-- Column Definition: Name -->
|
||||||
<ng-container cdkColumnDef="label">
|
<ng-container cdkColumnDef="label">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DATASET-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
|
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Column Definition: Dmp -->
|
<!-- Column Definition: Dmp -->
|
||||||
<ng-container cdkColumnDef="dmp">
|
<ng-container cdkColumnDef="dmp">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.DMP' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|dmp:label">{{'DATASET-LISTING.COLUMNS.DMP' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.dmp}} </mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.dmp}} </mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Column Definition: Profile -->
|
<!-- Column Definition: Profile -->
|
||||||
<ng-container cdkColumnDef="profile">
|
<ng-container cdkColumnDef="profile">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.PROFILE' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|profile:label">{{'DATASET-LISTING.COLUMNS.PROFILE' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.profile}} </mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.profile}} </mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
<!-- Column Definition: Created -->
|
<!-- Column Definition: Created -->
|
||||||
<ng-container cdkColumnDef="created">
|
<ng-container cdkColumnDef="created">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DATASET-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
|
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { Field } from '../../models/Field';
|
||||||
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
|
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
|
||||||
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
|
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
|
||||||
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
|
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
|
||||||
|
@ -84,7 +85,8 @@ export class DatasetListingComponent implements OnInit {
|
||||||
return defaultCriteria;
|
return defaultCriteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
makeItPublic(id:String){debugger;
|
makeItPublic(id: String) {
|
||||||
|
debugger;
|
||||||
this.datasetService.makeDatasetPublic(id).subscribe();
|
this.datasetService.makeDatasetPublic(id).subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +123,9 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize);
|
let fields: Array<string> = new Array()
|
||||||
|
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
||||||
|
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.criteria;
|
request.criteria = this._criteria.criteria;
|
||||||
return this._service.getPaged(request);
|
return this._service.getPaged(request);
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,18 +6,18 @@
|
||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
|
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-table [dataSource]="dataSource" matSort>
|
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
|
||||||
|
|
||||||
|
|
||||||
<!-- Column Definition: Name -->
|
<!-- Column Definition: Name -->
|
||||||
<ng-container cdkColumnDef="name">
|
<ng-container cdkColumnDef="name">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DMP-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
|
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Column Definition: Project -->
|
<!-- Column Definition: Project -->
|
||||||
<ng-container cdkColumnDef="project">
|
<ng-container cdkColumnDef="project">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.PROJECT' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|project:label">{{'DMP-LISTING.COLUMNS.PROJECT' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.project}} </mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.project}} </mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
@ -28,9 +28,9 @@
|
||||||
</ng-container> -->
|
</ng-container> -->
|
||||||
|
|
||||||
<!-- Column Definition: Researchers -->
|
<!-- Column Definition: Researchers -->
|
||||||
<ng-container cdkColumnDef="researchers">
|
<ng-container cdkColumnDef="creationTime">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.RESEARCHERS' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DMP-LISTING.COLUMNS.CREATION-TIME' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.researchers}} </mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.creationTime | date:'shortDate'}} </mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Column Definition: Organisations -->
|
<!-- Column Definition: Organisations -->
|
||||||
|
@ -41,13 +41,13 @@
|
||||||
|
|
||||||
<!-- Column Definition: Version -->
|
<!-- Column Definition: Version -->
|
||||||
<ng-container cdkColumnDef="version">
|
<ng-container cdkColumnDef="version">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.VERSION' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="version">{{'DMP-LISTING.COLUMNS.VERSION' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.version}}</mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.version}}</mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Column Definition: Datasets(count) -->
|
<!-- Column Definition: Datasets(count) -->
|
||||||
<ng-container cdkColumnDef="numOfDatasets">
|
<ng-container cdkColumnDef="numOfDatasets">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.DATASETS' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="|count|dataset">{{'DMP-LISTING.COLUMNS.DATASETS' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.numOfDatasets}}</mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.numOfDatasets}}</mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,13 @@ import { Observable } from "rxjs/Observable";
|
||||||
})
|
})
|
||||||
export class DataManagementPlanListingComponent implements OnInit {
|
export class DataManagementPlanListingComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
@ViewChild(MatPaginator) _paginator: MatPaginator;
|
@ViewChild(MatPaginator) _paginator: MatPaginator;
|
||||||
@ViewChild(MatSort) sort: MatSort;
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
@ViewChild(DataManagementPlanCriteriaComponent) criteria: DataManagementPlanCriteriaComponent;
|
@ViewChild(DataManagementPlanCriteriaComponent) criteria: DataManagementPlanCriteriaComponent;
|
||||||
|
|
||||||
dataSource: DataManagementPlanDataSource | null;
|
dataSource: DataManagementPlanDataSource | null;
|
||||||
displayedColumns: String[] = ['name', 'project', 'researchers', 'organisations', 'version', 'numOfDatasets', 'actions'];
|
displayedColumns: String[] = ['name', 'project', 'creationTime', 'organisations', 'version', 'numOfDatasets', 'actions'];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private dataManagementPlanService: DataManagementPlanService,
|
private dataManagementPlanService: DataManagementPlanService,
|
||||||
|
@ -111,7 +112,9 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
const request = new DataTableRequest<DataManagementPlanCriteria>(startIndex, this._paginator.pageSize);
|
let fields: Array<string> = new Array()
|
||||||
|
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
||||||
|
const request = new DataTableRequest<DataManagementPlanCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.criteria;
|
request.criteria = this._criteria.criteria;
|
||||||
return this._service.getPaged(request);
|
return this._service.getPaged(request);
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,7 +5,7 @@ export class DataManagementPlanListingModel implements Serializable<DataManageme
|
||||||
public label: String;
|
public label: String;
|
||||||
public project: String;
|
public project: String;
|
||||||
public profile: String;
|
public profile: String;
|
||||||
public researchers: String;
|
public creationTime: String;
|
||||||
public organisations: String;
|
public organisations: String;
|
||||||
public version: number;
|
public version: number;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ export class DataManagementPlanListingModel implements Serializable<DataManageme
|
||||||
this.label = item.label;
|
this.label = item.label;
|
||||||
this.project = item.project;
|
this.project = item.project;
|
||||||
this.profile = item.profile;
|
this.profile = item.profile;
|
||||||
this.researchers = item.researchers;
|
this.creationTime = item.creationTime;
|
||||||
this.organisations = item.organisations;
|
this.organisations = item.organisations;
|
||||||
this.version = item.version;
|
this.version = item.version;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
export class ColumnOrderings{
|
||||||
|
public fields:Array<string> = new Array();
|
||||||
|
}
|
|
@ -1,13 +1,15 @@
|
||||||
|
import { ColumnOrderings } from './ColumnOrderings';
|
||||||
import { BaseCriteria } from "../criteria/BaseCriteria";
|
import { BaseCriteria } from "../criteria/BaseCriteria";
|
||||||
import { RequestItem } from "../criteria/RequestItem";
|
import { RequestItem } from "../criteria/RequestItem";
|
||||||
|
|
||||||
export class DataTableRequest<T> extends RequestItem<T> {
|
export class DataTableRequest<T> extends RequestItem<T> {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
length = 0;
|
length = 0;
|
||||||
|
public orderings: ColumnOrderings;
|
||||||
constructor(offset: number, length: number) {
|
constructor(offset: number, length: number, orderings: ColumnOrderings) {
|
||||||
super();
|
super();
|
||||||
this.length = length;
|
this.length = length;
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
|
this.orderings = orderings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,29 +7,29 @@
|
||||||
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
|
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
|
|
||||||
<mat-table [dataSource]="dataSource" matSort>
|
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
|
||||||
|
|
||||||
<!-- Column Definition: Name -->
|
<!-- Column Definition: Name -->
|
||||||
<ng-container cdkColumnDef="name">
|
<ng-container cdkColumnDef="name">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'PROJECT-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'PROJECT-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
|
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Column Definition: Αbbreviation -->
|
<!-- Column Definition: Αbbreviation -->
|
||||||
<ng-container cdkColumnDef="abbreviation">
|
<ng-container cdkColumnDef="abbreviation">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'PROJECT-LISTING.COLUMNS.ABBREVIATION' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="abbreviation">{{'PROJECT-LISTING.COLUMNS.ABBREVIATION' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.abbreviation}} </mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.abbreviation}} </mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Column Definition: Start -->
|
<!-- Column Definition: Start -->
|
||||||
<ng-container cdkColumnDef="start">
|
<ng-container cdkColumnDef="start">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'PROJECT-LISTING.COLUMNS.START' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="startdate">{{'PROJECT-LISTING.COLUMNS.START' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.startDate | date:'shortDate'}} </mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.startDate | date:'shortDate'}} </mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Column Definition: End -->
|
<!-- Column Definition: End -->
|
||||||
<ng-container cdkColumnDef="end">
|
<ng-container cdkColumnDef="end">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'PROJECT-LISTING.COLUMNS.END' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef mat-sort-header="enddate">{{'PROJECT-LISTING.COLUMNS.END' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row"> {{row.endDate | date:'shortDate'}} </mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.endDate | date:'shortDate'}} </mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,9 @@ export class ProjectDataSource extends DataSource<ProjectListingModel> {
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
const request = new DataTableRequest<ProjectCriteria>(startIndex, this._paginator.pageSize);
|
let fields: Array<string> = new Array()
|
||||||
|
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
||||||
|
const request = new DataTableRequest<ProjectCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.criteria;
|
request.criteria = this._criteria.criteria;
|
||||||
return this._service.getPaged(request);
|
return this._service.getPaged(request);
|
||||||
})
|
})
|
||||||
|
|
|
@ -53,7 +53,9 @@ export class UsersDataSource extends DataSource<UserListingModel> {
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
const request = new DataTableRequest<UserCriteria>(startIndex, this._paginator.pageSize);
|
let fields: Array<string> = new Array()
|
||||||
|
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
||||||
|
const request = new DataTableRequest<UserCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.getFormData();
|
request.criteria = this._criteria.getFormData();
|
||||||
return this._service.getPaged(request);
|
return this._service.getPaged(request);
|
||||||
})
|
})
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
"NAME": "Name",
|
"NAME": "Name",
|
||||||
"PROJECT": "Project",
|
"PROJECT": "Project",
|
||||||
"PROFILE": "Profile",
|
"PROFILE": "Profile",
|
||||||
"RESEARCHERS": "Researchers",
|
"CREATION-TIME": "Creation Time",
|
||||||
"ORGANISATIONS": "Organisations",
|
"ORGANISATIONS": "Organisations",
|
||||||
"VERSION": "Version",
|
"VERSION": "Version",
|
||||||
"ACTIONS": "Actions",
|
"ACTIONS": "Actions",
|
||||||
|
|
Loading…
Reference in New Issue