From 3c0efa35d382d4792ead1e11460749b3f1b6ddca Mon Sep 17 00:00:00 2001 From: "CITE\\amentis" Date: Fri, 4 Oct 2024 09:54:04 +0300 Subject: [PATCH] build description common model fix (cherry picked from commit 60b2e9cb90083d2a6e2806ec620a43348b0f5411) --- .../service/description/DescriptionServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/core/src/main/java/org/opencdmp/service/description/DescriptionServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/description/DescriptionServiceImpl.java index c327ffe74..f21eb65a7 100644 --- a/backend/core/src/main/java/org/opencdmp/service/description/DescriptionServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/description/DescriptionServiceImpl.java @@ -1658,7 +1658,8 @@ public class DescriptionServiceImpl implements DescriptionService { if (commonModel.getDescriptionTemplate() != null && commonModel.getDescriptionTemplate().getDefinition() != null && !this.conventionService.isListNullOrEmpty(commonModel.getDescriptionTemplate().getDefinition().getPages())) { if (commonModel.getProperties() != null && commonModel.getProperties().getFieldSets() != null && !commonModel.getProperties().getFieldSets().isEmpty()){ for (String fieldSetId: commonModel.getProperties().getFieldSets().keySet()){ - fieldSetsMap.put(fieldSetId, this.commonModelPropertyDefinitionFieldSetToPersist(commonModel.getProperties().getFieldSets().get(fieldSetId), commonModel.getDescriptionTemplate())); + PropertyDefinitionFieldSetPersist fieldSetPersist = this.commonModelPropertyDefinitionFieldSetToPersist(commonModel.getProperties().getFieldSets().get(fieldSetId), commonModel.getDescriptionTemplate()); + if (fieldSetPersist != null && !this.conventionService.isListNullOrEmpty(fieldSetPersist.getItems())) fieldSetsMap.put(fieldSetId, fieldSetPersist); } } } @@ -1678,7 +1679,8 @@ public class DescriptionServiceImpl implements DescriptionService { if (!this.conventionService.isListNullOrEmpty(commonModel.getItems())){ List items = new ArrayList<>(); for (PropertyDefinitionFieldSetItemModel fieldSetItem: commonModel.getItems()) { - items.add(this.commonModelPropertyDefinitionFieldSetItemToPersist(fieldSetItem, descriptionTemplate)); + PropertyDefinitionFieldSetItemPersist fieldSetItemPersist = this.commonModelPropertyDefinitionFieldSetItemToPersist(fieldSetItem, descriptionTemplate); + if (fieldSetItemPersist != null && !fieldSetItemPersist.getFields().isEmpty()) items.add(fieldSetItemPersist); } persist.setItems(items); return persist;