diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Content.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Content.java index cd3bb937e..bb08a574e 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Content.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Content.java @@ -13,7 +13,7 @@ import java.util.UUID; */ @Entity @Table(name = "\"Content\"") -public class Content implements DataEntity { +public class Content implements DataEntity { //IGNORE ME public enum ParentType { GRANT(0); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java index f13da5c5d..41675e624 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java @@ -135,34 +135,35 @@ public class WordBuilder { private void createPages(List datasetProfilePages, XWPFDocument mainDocumentPart, Boolean createListing, VisibilityRuleService visibilityRuleService) { datasetProfilePages.forEach(item -> { try { - createSections(item.getSections(), mainDocumentPart, ParagraphStyle.HEADER4, 0, createListing, visibilityRuleService); + createSections(item.getSections(), mainDocumentPart, ParagraphStyle.HEADER4, 0, createListing, visibilityRuleService, item.getOrdinal() + 1, null); } catch (Exception e) { logger.error(e.getMessage(), e); } }); } - private void createSections(List
sections, XWPFDocument mainDocumentPart, ParagraphStyle style, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService) { + private void createSections(List
sections, XWPFDocument mainDocumentPart, ParagraphStyle style, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService, Integer page, String sectionString) { if (createListing) this.addListing(mainDocumentPart, indent, false, true); sections.forEach(section -> { + String tempSectionString = sectionString != null ? sectionString + "." + (section.getOrdinal() + 1) : "" + (section.getOrdinal() + 1); if (visibilityRuleService.isElementVisible(section.getId())) { if (!createListing) { - XWPFParagraph paragraph = addParagraphContent(section.getNumbering() + " " + section.getTitle(), mainDocumentPart, style, numId); + XWPFParagraph paragraph = addParagraphContent(page + "." + tempSectionString + " " + section.getTitle(), mainDocumentPart, style, numId); CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); number.setVal(BigInteger.valueOf(indent)); } - createSections(section.getSections(), mainDocumentPart, ParagraphStyle.HEADER5, 1, createListing, visibilityRuleService); - createCompositeFields(section.getCompositeFields(), mainDocumentPart, 2, createListing, visibilityRuleService); + createSections(section.getSections(), mainDocumentPart, ParagraphStyle.HEADER5, 1, createListing, visibilityRuleService, page, tempSectionString); + createCompositeFields(section.getCompositeFields(), mainDocumentPart, 2, createListing, visibilityRuleService, page, tempSectionString); } }); } - private void createCompositeFields(List
compositeFields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService) { + private void createCompositeFields(List
compositeFields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService, Integer page, String section) { if (createListing) this.addListing(mainDocumentPart, indent, true, true); compositeFields.forEach(compositeField -> { if (visibilityRuleService.isElementVisible(compositeField.getId()) && hasVisibleFields(compositeField, visibilityRuleService)) { if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty() && !createListing) { - XWPFParagraph paragraph = addParagraphContent(compositeField.getNumbering() + " " + compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER6, numId); + XWPFParagraph paragraph = addParagraphContent(page + "." + section + "." + (compositeField.getOrdinal() +1) + " " + compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER6, numId); CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); number.setVal(BigInteger.valueOf(indent)); } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/Field.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/Field.java index bffd8d702..917d85542 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/Field.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/Field.java @@ -17,6 +17,7 @@ import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -239,6 +240,18 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin } catch (JsonProcessingException e) { logger.error(e.getMessage(), e); } + } else if (this.value instanceof Collection) { + Collection valueCollection = (Collection) this.value; + StringBuilder valueBuilder = new StringBuilder(); + valueBuilder.append("["); + for (int i = 0; i < valueCollection.size(); i++) { + valueBuilder.append("\"").append(valueCollection.toArray()[i]).append("\""); + if (i < valueCollection.size() - 1) { + valueBuilder.append(", "); + } + } + valueBuilder.append("]"); + fieldValues.put(this.id, valueBuilder.toString()); } else { fieldValues.put(this.id, this.value.toString()); } diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.html b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.html index d8d11022f..08563bcd6 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.html +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.html @@ -17,16 +17,16 @@
-
+ -
-
+ + -
+ {{'GENERAL.VALIDATION.REQUIRED' | translate}} {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} @@ -45,46 +45,46 @@
-
+ -
-
+ + -
+ {{'GENERAL.VALIDATION.REQUIRED' | translate}} {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}
-
+ -
-
+ + -
+ {{'GENERAL.VALIDATION.REQUIRED' | translate}} {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}
-
+ -
-
+ + -
+ {{'GENERAL.VALIDATION.REQUIRED' | translate}} {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} @@ -138,18 +138,18 @@
-
+ -
-
+ + - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
+ + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}
@@ -158,16 +158,16 @@
-
+ -
-
+ + -
+ {{'GENERAL.VALIDATION.REQUIRED' | translate}} {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} @@ -178,16 +178,16 @@
-
+ -
-
+ + -
+ {{'GENERAL.VALIDATION.REQUIRED' | translate}} {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} @@ -198,16 +198,16 @@
-
+ -
-
+ + -
+ {{'GENERAL.VALIDATION.REQUIRED' | translate}} {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts index a76cfcae8..07be0c4c8 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts @@ -106,7 +106,9 @@ export class FormFieldComponent extends BaseComponent implements OnInit { if (this.form.get('data').value.multiList) { const originalValue = this.form.get('value').value; if (originalValue !== null && typeof originalValue === 'string') { - let values = (this.form.get('value').value).slice(1, -1).split(', '); + let values = (this.form.get('value').value).slice(1, -1).split(', ').filter((value) => !value.includes('"')); + let specialValue = (this.form.get('value').value).split('"').filter((value) => !value.startsWith('[') && !value.endsWith(']') && !values.includes(value) && value !== ', '); + specialValue.forEach(value => values.push(value)); if (!originalValue.startsWith('[') && !originalValue.endsWith(']')) { values = undefined; values = [originalValue]; @@ -385,8 +387,8 @@ export class FormFieldComponent extends BaseComponent implements OnInit { parseTags() { try{ - - + + let stringValue = this.form.get('value').value; if (typeof stringValue === 'string') { stringValue = (stringValue).replace(new RegExp('{', 'g'), '{"').replace(new RegExp('=', 'g'), '":"').replace(new RegExp(',', 'g'), '",').replace(new RegExp(', ', 'g'), ', "').replace(new RegExp('}', 'g'), '"}'); diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents-internal/table-of-contents-internal.html b/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents-internal/table-of-contents-internal.html index 187b6cca6..f78625aa2 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents-internal/table-of-contents-internal.html +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents-internal/table-of-contents-internal.html @@ -10,7 +10,7 @@ [ngStyle]="calculateStyle(entry)" [ngClass]="calculateClass(entry)" > - + {{entry.numbering}}. {{entry.label}}