Add Export attribute on Dataset Profile's Field. By Default is set to true. The attribute determines if the field value will be included in the word/pdf export

This commit is contained in:
George Kalampokis 2022-06-07 11:00:13 +03:00
parent 5cd79a6368
commit 54c5017609
19 changed files with 80 additions and 23 deletions

View File

@ -320,7 +320,7 @@ public class WordBuilder {
return false; return false;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
for (Field field: tempFields) { for (Field field: tempFields) {
if (visibilityRuleService.isElementVisible(field.getId())) { if (visibilityRuleService.isElementVisible(field.getId()) && field.getExport()) {
if (!createListing) { if (!createListing) {
try { try {
if(field.getViewStyle().getRenderStyle().equals("upload")){ if(field.getViewStyle().getRenderStyle().equals("upload")){
@ -548,7 +548,7 @@ public class WordBuilder {
} }
private boolean hasVisibleFields(FieldSet compositeFields, VisibilityRuleService visibilityRuleService) { private boolean hasVisibleFields(FieldSet compositeFields, VisibilityRuleService visibilityRuleService) {
return compositeFields.getFields().stream().anyMatch(field -> visibilityRuleService.isElementVisible(field.getId())); return compositeFields.getFields().stream().anyMatch(field -> visibilityRuleService.isElementVisible(field.getId()) && field.getExport());
} }
private Map<String, String> customParse(String value) { private Map<String, String> customParse(String value) {

View File

@ -54,6 +54,7 @@ public class Field implements ViewStyleDefinition<eu.eudat.models.data.entities.
private Object data; private Object data;
private Visibility visible; private Visibility visible;
private List<ValidationType> validations; private List<ValidationType> validations;
private Boolean export;
public String getId() { public String getId() {
return id; return id;
@ -132,6 +133,14 @@ public class Field implements ViewStyleDefinition<eu.eudat.models.data.entities.
this.validations = ValidationType.fromIntegers(validations); this.validations = ValidationType.fromIntegers(validations);
} }
public Boolean getExport() {
return export;
}
public void setExport(Boolean export) {
this.export = export;
}
@Override @Override
public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field field) { public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field field) {
if (this.id == null || this.id.isEmpty()) this.id = "field_" + RandomStringUtils.random(5, true, true); if (this.id == null || this.id.isEmpty()) this.id = "field_" + RandomStringUtils.random(5, true, true);
@ -144,6 +153,7 @@ public class Field implements ViewStyleDefinition<eu.eudat.models.data.entities.
field.setDefaultValue(this.defaultValue); field.setDefaultValue(this.defaultValue);
field.setValidations(this.validations); field.setValidations(this.validations);
field.setRdaCommonStandard(this.rdaCommonStandard); field.setRdaCommonStandard(this.rdaCommonStandard);
field.setExport(this.export);
return field; return field;
} }
@ -157,6 +167,7 @@ public class Field implements ViewStyleDefinition<eu.eudat.models.data.entities.
this.defaultValue = item.getDefaultValue(); this.defaultValue = item.getDefaultValue();
this.validations = item.getValidations(); this.validations = item.getValidations();
this.rdaCommonStandard = item.getRdaCommonStandard(); this.rdaCommonStandard = item.getRdaCommonStandard();
this.export = item.getExport();
} }
@Override @Override

View File

@ -26,6 +26,8 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
private FieldData data; private FieldData data;
private List<eu.eudat.models.data.admin.components.datasetprofile.Field.ValidationType> validations; private List<eu.eudat.models.data.admin.components.datasetprofile.Field.ValidationType> validations;
private Boolean export;
public String getId() { public String getId() {
return id; return id;
} }
@ -89,6 +91,14 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
this.numbering = numbering; this.numbering = numbering;
} }
public Boolean getExport() {
return export;
}
public void setExport(Boolean export) {
this.export = export;
}
@Override @Override
public Element toXml(Document doc) { public Element toXml(Document doc) {
Element rootElement = doc.createElement("field"); Element rootElement = doc.createElement("field");
@ -125,6 +135,7 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
rootElement.appendChild(visibility); rootElement.appendChild(visibility);
rootElement.appendChild(viewStyle); rootElement.appendChild(viewStyle);
if (this.data != null) rootElement.appendChild(this.data.toXml(doc)); if (this.data != null) rootElement.appendChild(this.data.toXml(doc));
rootElement.setAttribute("export", this.export == null || this.export ? "true" : "false");
return rootElement; return rootElement;
} }
@ -173,6 +184,11 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
} }
} }
} }
if (element.hasAttribute("export")) {
this.export = Boolean.parseBoolean(element.getAttribute("export"));
} else {
this.export = true;
}
return this; return this;
} }

View File

@ -41,6 +41,8 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
private Visibility visible; private Visibility visible;
private String rdaProperty; private String rdaProperty;
private Boolean export;
public List<Field> getMultiplicityItems() { public List<Field> getMultiplicityItems() {
return multiplicityItems; return multiplicityItems;
} }
@ -160,6 +162,14 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
this.rdaProperty = rdaProperty; this.rdaProperty = rdaProperty;
} }
public Boolean getExport() {
return export;
}
public void setExport(Boolean export) {
this.export = export;
}
Field cloneForMultiplicity(String key, Map<String, Object> properties, int index) { Field cloneForMultiplicity(String key, Map<String, Object> properties, int index) {
Field newField = new Field(); Field newField = new Field();
newField.id = key; newField.id = key;
@ -173,6 +183,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
newField.validations = this.validations; newField.validations = this.validations;
newField.rdaProperty = this.rdaProperty; newField.rdaProperty = this.rdaProperty;
newField.numbering = "mult" + index + "_" + this.numbering; newField.numbering = "mult" + index + "_" + this.numbering;
newField.export = this.export;
return newField; return newField;
} }
@ -186,6 +197,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
field.setVisible(this.visible); field.setVisible(this.visible);
field.setValidations(this.validations); field.setValidations(this.validations);
field.setRdaCommonStandard(this.rdaProperty); field.setRdaCommonStandard(this.rdaProperty);
field.setExport(this.export);
return field; return field;
} }
@ -200,6 +212,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
this.visible = item.getVisible(); this.visible = item.getVisible();
this.validations = item.getValidations(); this.validations = item.getValidations();
this.rdaProperty = item.getRdaCommonStandard(); this.rdaProperty = item.getRdaCommonStandard();
this.export = item.getExport();
} }
@Override @Override

View File

@ -59,6 +59,7 @@ export interface Field {
visible: Visibility; visible: Visibility;
validations: ValidationType[]; validations: ValidationType[];
rdaCommonStandard: string; rdaCommonStandard: string;
export: boolean;
} }
export interface ViewStyle { export interface ViewStyle {

View File

@ -48,6 +48,7 @@ export class FieldEditorModel extends BaseFormModel {
public data: FieldDataEditorModel<any>; public data: FieldDataEditorModel<any>;
public validations: ValidationType[] = []; public validations: ValidationType[] = [];
public rdaCommonStandard: string; public rdaCommonStandard: string;
public export: boolean = true;
fromModel(item: Field): FieldEditorModel { fromModel(item: Field): FieldEditorModel {
this.id = item.id; this.id = item.id;
@ -58,6 +59,7 @@ export class FieldEditorModel extends BaseFormModel {
this.viewStyle = new ViewStyleEditorModel().fromModel(item.viewStyle); this.viewStyle = new ViewStyleEditorModel().fromModel(item.viewStyle);
this.visible = new VisibilityEditorModel().fromModel(item.visible); this.visible = new VisibilityEditorModel().fromModel(item.visible);
this.rdaCommonStandard = item.rdaCommonStandard; this.rdaCommonStandard = item.rdaCommonStandard;
this.export = item.export;
if (item.data) { if (item.data) {
if (this.viewStyle.renderStyle === 'combobox') { if (this.viewStyle.renderStyle === 'combobox') {
@ -103,7 +105,8 @@ export class FieldEditorModel extends BaseFormModel {
page: [{ value: this.page, disabled: (disabled && !skipDisable.includes('FieldEditorModel.page')) }], page: [{ value: this.page, disabled: (disabled && !skipDisable.includes('FieldEditorModel.page')) }],
ordinal: [{ value: this.ordinal, disabled: (disabled && !skipDisable.includes('FieldEditorModel.ordinal')) }], ordinal: [{ value: this.ordinal, disabled: (disabled && !skipDisable.includes('FieldEditorModel.ordinal')) }],
validations: [{ value: this.validations, disabled: (disabled && !skipDisable.includes('FieldEditorModel.validations')) }], validations: [{ value: this.validations, disabled: (disabled && !skipDisable.includes('FieldEditorModel.validations')) }],
rdaCommonStandard: [{value: this.rdaCommonStandard, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.rdaCommonStandard')) }] rdaCommonStandard: [{value: this.rdaCommonStandard, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.rdaCommonStandard')) }],
export: [{value: this.export, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.export'))}]
}); });
formGroup.addControl('defaultValue', this.defaultValue.buildForm(disabled, skipDisable)); formGroup.addControl('defaultValue', this.defaultValue.buildForm(disabled, skipDisable));

View File

@ -535,7 +535,8 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
ordinal: targetOrdinal, ordinal: targetOrdinal,
visible:{rules:[],style:null}, visible:{rules:[],style:null},
validations:[], validations:[],
viewStyle:{} viewStyle:{},
export: true
} as Field; } as Field;

View File

@ -236,6 +236,8 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-checkbox [formControl]="this.form.get('export')" class="col-6" [disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXPORT' | translate}}</mat-checkbox>
<!-- Default Value --> <!-- Default Value -->
<app-component-profile-editor-default-value-component *ngIf="form.get('viewStyle').get('renderStyle').value" class="col-6" <app-component-profile-editor-default-value-component *ngIf="form.get('viewStyle').get('renderStyle').value" class="col-6"
[viewStyle]="form.get('viewStyle').get('renderStyle').value" [form]="this.form.get('defaultValue').get('value')" [formArrayOptions]="form.get('data')?.get('options')" [viewStyle]="form.get('viewStyle').get('renderStyle').value" [form]="this.form.get('defaultValue').get('value')" [formArrayOptions]="form.get('data')?.get('options')"

View File

@ -377,7 +377,8 @@
"ORDER": "Order", "ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify", "COMMENT-PLACEHOLDER": "Please Specify",
"COMMENT-HINT": "Provide additional information or justification about your selection", "COMMENT-HINT": "Provide additional information or justification about your selection",
"RDA-COMMON-STANDARDS": "RDA Common Standards" "RDA-COMMON-STANDARDS": "RDA Common Standards",
"EXPORT": "Include in Export"
}, },
"ACTIONS": { "ACTIONS": {
"ADD-CHILD-FIELD": "Add Child Field +" "ADD-CHILD-FIELD": "Add Child Field +"

View File

@ -377,7 +377,8 @@
"ORDER": "Order", "ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify", "COMMENT-PLACEHOLDER": "Please Specify",
"COMMENT-HINT": "Provide additional information or justification about your selection", "COMMENT-HINT": "Provide additional information or justification about your selection",
"RDA-COMMON-STANDARDS": "RDA Common Standards" "RDA-COMMON-STANDARDS": "RDA Common Standards",
"EXPORT": "Include in Export"
}, },
"ACTIONS": { "ACTIONS": {
"ADD-CHILD-FIELD": "Add Child Field +" "ADD-CHILD-FIELD": "Add Child Field +"

View File

@ -377,7 +377,8 @@
"ORDER": "Orden", "ORDER": "Orden",
"COMMENT-PLACEHOLDER": "Por favir especifique", "COMMENT-PLACEHOLDER": "Por favir especifique",
"COMMENT-HINT": "Proporcione información adicional o justifique su selección", "COMMENT-HINT": "Proporcione información adicional o justifique su selección",
"RDA-COMMON-STANDARDS": "RDA Common estándares" "RDA-COMMON-STANDARDS": "RDA Common estándares",
"EXPORT": "Include in Export"
}, },
"ACTIONS": { "ACTIONS": {
"ADD-CHILD-FIELD": "Añadir un capo hijo+" "ADD-CHILD-FIELD": "Añadir un capo hijo+"

View File

@ -377,7 +377,8 @@
"ORDER": "Εντολή", "ORDER": "Εντολή",
"COMMENT-PLACEHOLDER": "Παρακαλώ προσδιορίστε", "COMMENT-PLACEHOLDER": "Παρακαλώ προσδιορίστε",
"COMMENT-HINT": "Προσθέστε επιπλέον πληροφορίες ή αιτιολόγηση σχετικά με την επιλογή σας", "COMMENT-HINT": "Προσθέστε επιπλέον πληροφορίες ή αιτιολόγηση σχετικά με την επιλογή σας",
"RDA-COMMON-STANDARDS": "RDA Common Standards" "RDA-COMMON-STANDARDS": "RDA Common Standards",
"EXPORT": "Include in Export"
}, },
"ACTIONS": { "ACTIONS": {
"ADD-CHILD-FIELD": "Προσθήκη Πεδίου Υπο-ομάδας +" "ADD-CHILD-FIELD": "Προσθήκη Πεδίου Υπο-ομάδας +"

View File

@ -377,7 +377,8 @@
"ORDER": "Redoslijed", "ORDER": "Redoslijed",
"COMMENT-PLACEHOLDER": "Navedite", "COMMENT-PLACEHOLDER": "Navedite",
"COMMENT-HINT": "Navedite dodatne informacije ili obrazložite izbor", "COMMENT-HINT": "Navedite dodatne informacije ili obrazložite izbor",
"RDA-COMMON-STANDARDS": "RDA zajednički standardi" "RDA-COMMON-STANDARDS": "RDA zajednički standardi",
"EXPORT": "Include in Export"
}, },
"ACTIONS": { "ACTIONS": {
"ADD-CHILD-FIELD": "Dodajte potpolje +" "ADD-CHILD-FIELD": "Dodajte potpolje +"

View File

@ -377,7 +377,8 @@
"ORDER": "Ordem", "ORDER": "Ordem",
"COMMENT-PLACEHOLDER": "Por favor especifique", "COMMENT-PLACEHOLDER": "Por favor especifique",
"COMMENT-HINT": "Disponibilize informação ou justificação adicional sobre a sua seleção", "COMMENT-HINT": "Disponibilize informação ou justificação adicional sobre a sua seleção",
"RDA-COMMON-STANDARDS": "Normas RDA" "RDA-COMMON-STANDARDS": "Normas RDA",
"EXPORT": "Include in Export"
}, },
"ACTIONS": { "ACTIONS": {
"ADD-CHILD-FIELD": "Adicionar Campo Subordinado +" "ADD-CHILD-FIELD": "Adicionar Campo Subordinado +"

View File

@ -377,7 +377,8 @@
"ORDER": "Order", "ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify", "COMMENT-PLACEHOLDER": "Please Specify",
"COMMENT-HINT": "Provide additional information or justification about your selection", "COMMENT-HINT": "Provide additional information or justification about your selection",
"RDA-COMMON-STANDARDS": "RDA Common Standards" "RDA-COMMON-STANDARDS": "RDA Common Standards",
"EXPORT": "Include in Export"
}, },
"ACTIONS": { "ACTIONS": {
"ADD-CHILD-FIELD": "Add Child Field +" "ADD-CHILD-FIELD": "Add Child Field +"

View File

@ -377,7 +377,8 @@
"ORDER": "Redosled", "ORDER": "Redosled",
"COMMENT-PLACEHOLDER": "Navedite", "COMMENT-PLACEHOLDER": "Navedite",
"COMMENT-HINT": "Navedite dodatne informacije ili obrazložite izbor", "COMMENT-HINT": "Navedite dodatne informacije ili obrazložite izbor",
"RDA-COMMON-STANDARDS": "RDA zajednički standardi" "RDA-COMMON-STANDARDS": "RDA zajednički standardi",
"EXPORT": "Include in Export"
}, },
"ACTIONS": { "ACTIONS": {
"ADD-CHILD-FIELD": "Dodajte izvedeno polje +" "ADD-CHILD-FIELD": "Dodajte izvedeno polje +"

View File

@ -377,7 +377,8 @@
"ORDER": "Düzen", "ORDER": "Düzen",
"COMMENT-PLACEHOLDER": "Lütfen Belirtiniz", "COMMENT-PLACEHOLDER": "Lütfen Belirtiniz",
"COMMENT-HINT": "Seçiminiz hakkında gerekçe veya ek bilgi veriniz", "COMMENT-HINT": "Seçiminiz hakkında gerekçe veya ek bilgi veriniz",
"RDA-COMMON-STANDARDS": "RDA Ortak Standartları" "RDA-COMMON-STANDARDS": "RDA Ortak Standartları",
"EXPORT": "Include in Export"
}, },
"ACTIONS": { "ACTIONS": {
"ADD-CHILD-FIELD": "Alt Alan Ekle +" "ADD-CHILD-FIELD": "Alt Alan Ekle +"

View File

@ -11,5 +11,6 @@
"FreeTextFieldDataEditorModel.label", "FreeTextFieldDataEditorModel.label",
"WordListFieldDataEditorModel.label", "WordListFieldDataEditorModel.label",
"FieldDataOptionEditorModel.label", "FieldDataOptionEditorModel.label",
"FieldSetEditorModel.rdaCommonStandard" "FieldSetEditorModel.rdaCommonStandard",
"FieldSetEditorModel.export"
] ]