diff --git a/modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/export/SentryExport.java b/modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/export/SentryExport.java index c5dc351b419..ccf505ccc51 100644 --- a/modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/export/SentryExport.java +++ b/modules/flowable-cmmn-converter/src/main/java/org/flowable/cmmn/converter/export/SentryExport.java @@ -19,6 +19,7 @@ import org.flowable.cmmn.converter.util.CmmnXmlUtil; import org.flowable.cmmn.model.CmmnModel; import org.flowable.cmmn.model.Sentry; +import org.flowable.cmmn.model.SentryIfPart; import org.flowable.cmmn.model.SentryOnPart; public class SentryExport implements CmmnXmlConstants { @@ -65,10 +66,14 @@ public static void writeSentry(CmmnModel model, Sentry sentry, XMLStreamWriter x } // If part - if (sentry.getSentryIfPart() != null) { + SentryIfPart sentryIfPart = sentry.getSentryIfPart(); + if (sentryIfPart != null) { xtw.writeStartElement(ELEMENT_IF_PART); + if (StringUtils.isNotEmpty(sentryIfPart.getId())) { + xtw.writeAttribute(ATTRIBUTE_ID, sentryIfPart.getId()); + } xtw.writeStartElement(ELEMENT_CONDITION); - xtw.writeCData(sentry.getSentryIfPart().getCondition()); + xtw.writeCData(sentryIfPart.getCondition()); xtw.writeEndElement(); xtw.writeEndElement(); } diff --git a/modules/flowable-cmmn-converter/src/test/java/org/flowable/test/cmmn/converter/SentryCmmnXmlConverterTest.java b/modules/flowable-cmmn-converter/src/test/java/org/flowable/test/cmmn/converter/SentryCmmnXmlConverterTest.java index d544d0359dc..c81c1a6bde6 100644 --- a/modules/flowable-cmmn-converter/src/test/java/org/flowable/test/cmmn/converter/SentryCmmnXmlConverterTest.java +++ b/modules/flowable-cmmn-converter/src/test/java/org/flowable/test/cmmn/converter/SentryCmmnXmlConverterTest.java @@ -50,10 +50,10 @@ public void validateModel(CmmnModel cmmnModel) { tuple("sentry1", "sentry name", "sentry doc") ); - assertThat(planModel.getSentries().get(0).getSentryIfPart()) - .isNotNull() - .extracting(SentryIfPart::getCondition) - .isEqualTo("${true}"); + SentryIfPart sentryIfPart = planModel.getSentries().get(0).getSentryIfPart(); + assertThat(sentryIfPart).isNotNull(); + assertThat(sentryIfPart.getId()).isEqualTo("sentryIfPart_sentry1"); + assertThat(sentryIfPart.getCondition()).isEqualTo("${true}"); PlanItem planItemTask1 = cmmnModel.findPlanItem("planItem1"); assertThat(planItemTask1).isNotNull(); diff --git a/modules/flowable-cmmn-converter/src/test/resources/org/flowable/test/cmmn/converter/sentryIfPart.cmmn b/modules/flowable-cmmn-converter/src/test/resources/org/flowable/test/cmmn/converter/sentryIfPart.cmmn index bc8e07cb18a..f74863a40b0 100644 --- a/modules/flowable-cmmn-converter/src/test/resources/org/flowable/test/cmmn/converter/sentryIfPart.cmmn +++ b/modules/flowable-cmmn-converter/src/test/resources/org/flowable/test/cmmn/converter/sentryIfPart.cmmn @@ -9,7 +9,7 @@ - +