add missing grant checks

This commit is contained in:
Bernaldo Mihasi 2023-09-22 09:31:12 +03:00
parent fbad63ee76
commit beac6be706
10 changed files with 46 additions and 24 deletions

View File

@ -39,7 +39,9 @@ public class RecentDatasetModel extends RecentActivityModel<Dataset, RecentDatas
this.setFinalizedAt(entity.getFinalizedAt());
this.setPublishedAt(entity.getDmp() != null ? entity.getDmp().getPublishedAt() : new Date());
this.setProfile(entity.getProfile() != null ? new DatasetProfileOverviewModel().fromDataModel(entity.getProfile()): null);
this.setGrant(entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "");
if (entity.getDmp() != null && entity.getDmp().getGrant() != null) {
this.setGrant(entity.getDmp().getGrant().getLabel());
}
this.setDmp( entity.getDmp() != null ? entity.getDmp().getLabel() : "");
this.setDmpId(entity.getDmp() != null ? entity.getDmp().getId().toString() : "");
this.setPublic(entity.getDmp().isPublic());
@ -58,7 +60,9 @@ public class RecentDatasetModel extends RecentActivityModel<Dataset, RecentDatas
this.setFinalizedAt(entity.getFinalizedAt());
this.setPublishedAt(entity.getDmp() != null ? entity.getDmp().getPublishedAt() : new Date());
this.setProfile(entity.getProfile() != null ? new DatasetProfileOverviewModel().fromDataModel(entity.getProfile()) : null);
this.setGrant(entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "");
if (entity.getDmp() != null && entity.getDmp().getGrant() != null) {
this.setGrant(entity.getDmp().getGrant().getLabel());
}
this.setDmp( entity.getDmp() != null ? entity.getDmp().getLabel() : "");
this.setDmpId(entity.getDmp() != null ? entity.getDmp().getId().toString() : "");
return this;

View File

@ -51,7 +51,9 @@ public class RecentDmpModel extends RecentActivityModel<DMP, RecentDmpModel> {
this.setVersion(entity.getVersion());
this.datasets = entity.getDataset().stream().map(dataset -> new DatasetUrlListing().fromDataModel(dataset)).collect(Collectors.toList());
this.setFinalizedAt(entity.getFinalizedAt());
this.setGrant(entity.getGrant().getLabel());
if (entity.getGrant() != null) {
this.setGrant(entity.getGrant().getLabel());
}
this.groupId = entity.getGroupId();
this.setPublic(entity.isPublic());
this.setPublishedAt(entity.getPublishedAt());

View File

@ -275,8 +275,10 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
this.project.getExistProject().fromDataModel(entity.getProject());
this.associatedUsers = entity.getUsers().stream().map(item -> new UserListingModel().fromDataModel(item.getUser())).collect(Collectors.toList());
this.users = entity.getUsers().stream().map(item -> new UserInfoListingModel().fromDataModel(item)).collect(Collectors.toList());
this.funder = new FunderDMPEditorModel();
this.funder.getExistFunder().fromDataModel(entity.getGrant().getFunder());
if (entity.getGrant() != null) {
this.funder = new FunderDMPEditorModel();
this.funder.getExistFunder().fromDataModel(entity.getGrant().getFunder());
}
this.extraProperties = entity.getExtraProperties() != null ? new org.json.JSONObject(entity.getExtraProperties()).toMap() : null;
return this;

View File

@ -174,9 +174,11 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
entity.setVersion(this.getVersion());
entity.setDataset(this.getDatasets().stream().map(DatasetUrlListing::toDataModel).collect(Collectors.toCollection(LinkedHashSet::new)));
Grant grant = new Grant();
grant.setLabel(this.getGrant());
entity.setGrant(grant);
if (this.getGrant() != null && !this.getGrant().isEmpty()) {
Grant grant = new Grant();
grant.setLabel(this.getGrant());
entity.setGrant(grant);
}
entity.setUsers(this.getUsers().stream().map(UserInfoListingModel::toDataModel).collect(Collectors.toSet()));
return entity;
}

View File

@ -173,9 +173,11 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
entity.setFinalizedAt(this.getFinalizedAt());
entity.setStatus(Integer.valueOf(this.getStatus()).shortValue());
DMP dmp = new DMP();
Grant grant = new Grant();
grant.setLabel(this.getGrant());
dmp.setGrant(grant);
if (this.getGrant() != null && !this.getGrant().isEmpty()) {
Grant grant = new Grant();
grant.setLabel(this.getGrant());
dmp.setGrant(grant);
}
dmp.setLabel(this.getDmp());
dmp.setId(UUID.fromString(this.getDmpId()));
dmp.setPublishedAt(this.getDmpPublishedAt());

View File

@ -162,7 +162,9 @@ public class DmpRDAExportModel {
dmpRda.ethical_issues_exist = "unknown";
dmpRda.language = "en";
dmpRda.modified = formatter.format(new Date());
dmpRda.project = new ProjectRDAExportModel().fromDataModel(entity.getGrant());
if (entity.getGrant() != null) {
dmpRda.project = new ProjectRDAExportModel().fromDataModel(entity.getGrant());
}
dmpRda.title = entity.getLabel();
return dmpRda;

View File

@ -157,9 +157,11 @@ public class DataManagementPlanPublicListingModel implements DataModel<DMP, Data
entity.setPublishedAt(this.getPublishedAt());
entity.setVersion(this.getVersion());
Grant grant = new Grant();
grant.setLabel(this.getGrant());
entity.setGrant(grant);
if (this.getGrant() != null) {
Grant grant = new Grant();
grant.setLabel(this.getGrant());
entity.setGrant(grant);
}
entity.setUsers(this.getUsers().stream().map(UserInfoPublicModel::toDataModel).collect(Collectors.toSet()));
entity.setResearchers(this.getResearchers().stream().map(ResearcherPublicModel::toDataModel).collect(Collectors.toSet()));
return entity;

View File

@ -126,7 +126,9 @@ public class DatasetPublicListingModel implements DataModel<Dataset, DatasetPubl
this.label = entity.getLabel();
this.createdAt = entity.getCreated();
this.modifiedAt = entity.getModified();
this.grant = entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "";
if(entity.getDmp() != null && entity.getDmp().getGrant() != null) {
this.grant = entity.getDmp().getGrant().getLabel();
}
this.dmp = entity.getDmp() != null ? entity.getDmp().getLabel() : "";
this.dmpId = entity.getDmp() != null ? entity.getDmp().getId().toString() : "";
this.profile = entity.getProfile() != null ? new DatasetProfilePublicModel().fromDataModel(entity.getProfile()) : null;
@ -153,9 +155,11 @@ public class DatasetPublicListingModel implements DataModel<Dataset, DatasetPubl
entity.setFinalizedAt(this.getFinalizedAt());
entity.setStatus(Dataset.Status.FINALISED.getValue());
DMP dmp = new DMP();
Grant grant = new Grant();
grant.setLabel(this.getGrant());
dmp.setGrant(grant);
if (this.getGrant() != null && !this.getGrant().isEmpty()) {
Grant grant = new Grant();
grant.setLabel(this.getGrant());
dmp.setGrant(grant);
}
dmp.setLabel(this.getDmp());
dmp.setId(UUID.fromString(this.getDmpId()));
dmp.setPublishedAt(this.getDmpPublishedAt());

View File

@ -178,7 +178,7 @@
<div class="col-2">
<mat-form-field>
<mat-label>Description</mat-label>
<input matInput type="text" name="description" forehmControlName="description">
<input matInput type="text" name="description" formControlName="description">
</mat-form-field>
</div>
<div class="centered-row-item col-1">
@ -247,7 +247,7 @@
<div class="col-4">
<mat-form-field>
<mat-label>Max Multiplicity</mat-label>
<input matInput type="number" min="0" name="maxMultiplicity" formControlName="maxMultiplicity">
<input matInput type="number" min="1" name="maxMultiplicity" formControlName="maxMultiplicity">
</mat-form-field>
</div>
</div>

View File

@ -68,8 +68,10 @@
</button>
</div>
<div class="row header">{{'DMP-OVERVIEW.GRANT' | translate}}</div>
<div class="row dataset-label">{{ dataset.grant.label }}</div>
<div *ngIf="dataset.grant">
<div class="row header">{{'DMP-OVERVIEW.GRANT' | translate}}</div>
<div class="row dataset-label">{{ dataset.grant.label }}</div>
</div>
<div class="row header">{{'DMP-OVERVIEW.RESEARCHERS' | translate}}</div>
<div class="row">