bug fixes: 1) when creating description template type check only for non deleted types, 2) dmp docx/pdf export: check if system fields exist 3) when creating/updating dmp check if value for extra fields is set, 4) when unchecking the 'Description Templates' checkbox in the blueprint editor, clear any templates selected
This commit is contained in:
parent
3d10e8ad28
commit
2bf0a857bc
|
@ -23,7 +23,7 @@ public class DescriptionTemplateTypeDaoImpl extends DatabaseAccess<DescriptionTe
|
|||
@Override
|
||||
public DescriptionTemplateType findFromName(String name){
|
||||
try {
|
||||
return this.getDatabaseService().getQueryable(DescriptionTemplateType.class).where((builder, root) -> builder.equal(root.get("name"), name)).getSingle();
|
||||
return this.getDatabaseService().getQueryable(DescriptionTemplateType.class).where((builder, root) -> builder.and(builder.equal(root.get("name"), name), builder.notEqual(root.get("status"), DescriptionTemplateType.Status.DELETED.getValue()))).getSingle();
|
||||
}
|
||||
catch(Exception e){
|
||||
return null;
|
||||
|
|
|
@ -1435,29 +1435,41 @@ public class DataManagementPlanManager {
|
|||
runContact.setColor("116a78");
|
||||
break;
|
||||
case FUNDER:
|
||||
XWPFRun runFunder = systemFieldInput.createRun();
|
||||
runFunder.setText(dmpEntity.getGrant().getFunder().getLabel());
|
||||
runFunder.setColor("116a78");
|
||||
if (dmpEntity.getGrant() != null && dmpEntity.getGrant().getFunder() != null) {
|
||||
XWPFRun runFunder = systemFieldInput.createRun();
|
||||
runFunder.setText(dmpEntity.getGrant().getFunder().getLabel());
|
||||
runFunder.setColor("116a78");
|
||||
}
|
||||
break;
|
||||
case GRANT:
|
||||
XWPFRun runGrant = systemFieldInput.createRun();
|
||||
runGrant.setText(dmpEntity.getGrant().getLabel());
|
||||
runGrant.setColor("116a78");
|
||||
if (dmpEntity.getGrant() != null) {
|
||||
XWPFRun runGrant = systemFieldInput.createRun();
|
||||
runGrant.setText(dmpEntity.getGrant().getLabel());
|
||||
runGrant.setColor("116a78");
|
||||
}
|
||||
break;
|
||||
case PROJECT:
|
||||
XWPFRun runProject = systemFieldInput.createRun();
|
||||
runProject.setText(dmpEntity.getProject().getLabel());
|
||||
runProject.setColor("116a78");
|
||||
if (dmpEntity.getProject() != null ) {
|
||||
XWPFRun runProject = systemFieldInput.createRun();
|
||||
runProject.setText(dmpEntity.getProject().getLabel());
|
||||
runProject.setColor("116a78");
|
||||
}
|
||||
break;
|
||||
case LICENSE:
|
||||
XWPFRun runLicense = systemFieldInput.createRun();
|
||||
runLicense.setText(objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class).get("license").toString());
|
||||
runLicense.setColor("116a78");
|
||||
Map extraProperties = objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class);
|
||||
if (extraProperties.containsKey("license")) {
|
||||
XWPFRun runLicense = systemFieldInput.createRun();
|
||||
runLicense.setText(extraProperties.get("license").toString());
|
||||
runLicense.setColor("116a78");
|
||||
}
|
||||
break;
|
||||
case ACCESS_RIGHTS:
|
||||
XWPFRun runAccessRights = systemFieldInput.createRun();
|
||||
runAccessRights.setText(objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class).get("visible").toString());
|
||||
runAccessRights.setColor("116a78");
|
||||
Map extraPropertiesMap = objectMapper.readValue(dmpEntity.getExtraProperties(), HashMap.class);
|
||||
if (extraPropertiesMap.containsKey("visible")) {
|
||||
XWPFRun runAccessRights = systemFieldInput.createRun();
|
||||
runAccessRights.setText(extraPropertiesMap.get("visible").toString());
|
||||
runAccessRights.setColor("116a78");
|
||||
}
|
||||
break;
|
||||
}
|
||||
document.createParagraph();
|
||||
|
@ -1475,7 +1487,10 @@ public class DataManagementPlanManager {
|
|||
runExtraFieldDescription.setColor("116a78");
|
||||
}
|
||||
XWPFRun runExtraFieldInput = extraFieldParagraph.createRun();
|
||||
runExtraFieldInput.setText(extraField.getLabel());
|
||||
Map dmpProperties = objectMapper.readValue(dmpEntity.getProperties(), HashMap.class);
|
||||
if (dmpProperties.containsKey(field.getId()) && dmpProperties.get(field.getId()) != null) {
|
||||
runExtraFieldInput.setText((String) dmpProperties.get(field.getId()));
|
||||
}
|
||||
runExtraFieldInput.setColor("116a78");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -381,10 +381,12 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
|
|||
if (this.properties != null) {
|
||||
this.extraFields = new ArrayList<>();
|
||||
this.properties.forEach((id, value) -> {
|
||||
ExtraFieldModel extraField = new ExtraFieldModel();
|
||||
extraField.setId(id);
|
||||
extraField.setValue(value.toString());
|
||||
this.extraFields.add(extraField);
|
||||
if (value != null) {
|
||||
ExtraFieldModel extraField = new ExtraFieldModel();
|
||||
extraField.setId(id);
|
||||
extraField.setValue(value.toString());
|
||||
this.extraFields.add(extraField);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (entity.getUsers() != null && entity.getUsers().stream().anyMatch(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())))
|
||||
|
|
|
@ -206,7 +206,7 @@
|
|||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<mat-checkbox formControlName="hasTemplates">
|
||||
<mat-checkbox formControlName="hasTemplates" (change)="checkForProfiles($event, sectionIndex)">
|
||||
Description Templates
|
||||
</mat-checkbox>
|
||||
</div>
|
||||
|
|
|
@ -175,6 +175,13 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
|
|||
}
|
||||
}
|
||||
|
||||
checkForProfiles(event, sectionIndex: number) {
|
||||
if (event.checked === false) {
|
||||
this.descriptionTemplatesPerSection[sectionIndex] = new Array<DatasetProfileModel>();
|
||||
this.descriptionTemplatesArray(sectionIndex).clear();
|
||||
}
|
||||
}
|
||||
|
||||
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
|
||||
const request = new DataTableRequest<DatasetProfileCriteria>(null, null, { fields: ['+label'] });
|
||||
const criteria = new DatasetProfileCriteria();
|
||||
|
|
Loading…
Reference in New Issue