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;
}).collect(Collectors.toList());
for (Field field: tempFields) {
if (visibilityRuleService.isElementVisible(field.getId())) {
if (visibilityRuleService.isElementVisible(field.getId()) && field.getExport()) {
if (!createListing) {
try {
if(field.getViewStyle().getRenderStyle().equals("upload")){
@ -548,7 +548,7 @@ public class WordBuilder {
}
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) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -236,6 +236,8 @@
</mat-select>
</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 -->
<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')"

View File

@ -377,7 +377,8 @@
"ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify",
"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": {
"ADD-CHILD-FIELD": "Add Child Field +"

View File

@ -377,7 +377,8 @@
"ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify",
"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": {
"ADD-CHILD-FIELD": "Add Child Field +"

View File

@ -377,7 +377,8 @@
"ORDER": "Orden",
"COMMENT-PLACEHOLDER": "Por favir especifique",
"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": {
"ADD-CHILD-FIELD": "Añadir un capo hijo+"

View File

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

View File

@ -377,7 +377,8 @@
"ORDER": "Redoslijed",
"COMMENT-PLACEHOLDER": "Navedite",
"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": {
"ADD-CHILD-FIELD": "Dodajte potpolje +"

View File

@ -377,7 +377,8 @@
"ORDER": "Ordem",
"COMMENT-PLACEHOLDER": "Por favor especifique",
"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": {
"ADD-CHILD-FIELD": "Adicionar Campo Subordinado +"

View File

@ -377,7 +377,8 @@
"ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify",
"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": {
"ADD-CHILD-FIELD": "Add Child Field +"

View File

@ -377,7 +377,8 @@
"ORDER": "Redosled",
"COMMENT-PLACEHOLDER": "Navedite",
"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": {
"ADD-CHILD-FIELD": "Dodajte izvedeno polje +"

View File

@ -377,7 +377,8 @@
"ORDER": "Düzen",
"COMMENT-PLACEHOLDER": "Lütfen Belirtiniz",
"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": {
"ADD-CHILD-FIELD": "Alt Alan Ekle +"

View File

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