Adds criteria "Public" on DMP listing.

This commit is contained in:
gkolokythas 2019-06-20 14:31:29 +03:00
parent 4d9ae93cf2
commit 8e0bafcbfa
6 changed files with 22 additions and 4 deletions

View File

@ -19,6 +19,7 @@ public class DataManagementPlanCriteria extends Criteria<DMP> {
private Integer role;
private List<UUID> collaborators;
private List<UUID> datasetTemplates;
private boolean isPublic;
public Date getPeriodStart() {
return periodStart;
@ -89,4 +90,11 @@ public class DataManagementPlanCriteria extends Criteria<DMP> {
public void setDatasetTemplates(List<UUID> datasetTemplates) {
this.datasetTemplates = datasetTemplates;
}
public boolean getIsPublic() {
return isPublic;
}
public void setIsPublic(boolean isPublic) {
this.isPublic = isPublic;
}
}

View File

@ -55,6 +55,8 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
query.where((builder, root) -> builder.equal(root.get("status"), DMP.DMPStatus.ACTIVE.getValue()));
}
}
if (criteria.getIsPublic())
query.where(((builder, root) -> builder.equal(root.get("isPublic"), true)));
if (criteria.getRole() != null) {
if (criteria.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())){
query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).get("role"), UserDMP.UserDMPRoles.OWNER.getValue()));

View File

@ -11,4 +11,5 @@ export class DmpCriteria extends BaseCriteria {
public role?: number;
public collaborators?: string[] = [];
public datasetTemplates?: string[] = [];
public isPublic?: boolean;
}

View File

@ -17,8 +17,9 @@
<h6 class="category-title">{{ 'TYPES.DMP-VISIBILITY.VISIBILITY' | translate }}</h6>
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('status')">
<mat-list-item><mat-radio-button value="null">{{ 'TYPES.DMP-VISIBILITY.ANY' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="1">{{ 'TYPES.DMP-VISIBILITY.PUBLIC' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="0">{{ 'TYPES.DMP-VISIBILITY.PRIVATE' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="2">{{ 'TYPES.DMP-VISIBILITY.PUBLIC' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="1">{{ 'TYPES.DMP-VISIBILITY.FINALIZED' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="0">{{ 'TYPES.DMP-VISIBILITY.DRAFT' | translate }}</mat-radio-button></mat-list-item>
</mat-radio-group>
</div>
<!-- End of Visibility Filter-->

View File

@ -107,9 +107,14 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
request.criteria = {
like: value.like,
projects: value.projects,
status: value.status,
role: value.role
}
if (value.status == 2) {
request.criteria.isPublic = true;
} else {
request.criteria.status = value.status;
request.criteria.isPublic = false;
}
if (value.datasetTemplates)
request.criteria.datasetTemplates = value.datasetTemplates.map(x => x.id);
if (value.collaborators)

View File

@ -675,7 +675,8 @@
"DMP-VISIBILITY": {
"VISIBILITY": "Visibility",
"PUBLIC": "Public",
"PRIVATE": "Private",
"FINALIZED": "Finalized" ,
"DRAFT": "Draft",
"ANY": "Any"
},
"DATASET-PROFILE-FIELD-VALIDATION-TYPE": {