From 9cb36e0e8b8b45216420970dbb1c2e06decd4635 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sat, 30 Oct 2021 13:10:34 +0300 Subject: [PATCH 01/41] FBP-224. Initial resource commit for swimlanes --- .../src/test/resources/swimlanes.bpmn | 234 ++++++++++++++++++ .../src/test/resources/swimlanes.bpmn20.xml | 164 ++++++++++++ 2 files changed, 398 insertions(+) create mode 100644 camunda-xml-parser/src/test/resources/swimlanes.bpmn create mode 100644 flowable-xml-parser/src/test/resources/swimlanes.bpmn20.xml diff --git a/camunda-xml-parser/src/test/resources/swimlanes.bpmn b/camunda-xml-parser/src/test/resources/swimlanes.bpmn new file mode 100644 index 000000000..1cadddf34 --- /dev/null +++ b/camunda-xml-parser/src/test/resources/swimlanes.bpmn @@ -0,0 +1,234 @@ + + + + + + Some docs + + + + Docs + + + Some docs + + + + + + + + + Lane 1 docs + + + + + + startEvent + endEvent + + + Lane 2 docs + + + + + + task1 + task2 + + + Lane 3 docs + exclusiveGateway + + + + Flow_0azr5ii + + + Flow_0d674ph + Flow_0o7uq2i + + + Flow_0azr5ii + Flow_11nikih + + + Flow_11nikih + Flow_0xg9put + Flow_0o7uq2i + + + Flow_0xg9put + Flow_0d674ph + + + + + + + + + + + task1Participant2 + task2Participant2 + + + task3Participant2 + + + + Flow_0io2j9n + Flow_1gv7f66 + + + Flow_0io2j9n + Flow_0on2aiy + + + + Flow_1gv7f66 + Flow_0on2aiy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/flowable-xml-parser/src/test/resources/swimlanes.bpmn20.xml b/flowable-xml-parser/src/test/resources/swimlanes.bpmn20.xml new file mode 100644 index 000000000..08d6d8e01 --- /dev/null +++ b/flowable-xml-parser/src/test/resources/swimlanes.bpmn20.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + sid-EA3DB0F5-2D74-4B20-A4FE-5B5F80CC7906 + sid-44502611-0CAD-4020-9FF7-4E807DF23B91 + sid-9035BBFD-279C-40C3-A677-B95FEEA51FC8 + sid-1E9FF4A4-7101-474F-989C-1B1AFDDB49CC + + + + + + + + + + + sid-7079C677-5228-47E6-A6FB-CD612D977DE4 + sid-D62875C4-5D78-4A09-BDA8-375C7379460A + sid-0D8FDC6C-4718-4790-B91E-2C79478BB8AC + sid-59D0BC66-482C-4DC6-95D8-4A5B568F6DBE + sid-9DF8CA19-AC71-40D5-855A-929F6434184A + sid-8DE5712B-13BC-45A1-907E-CAC736EF51D6 + + + + + + + + + + + + + sid-B568CF5B-C8F5-472C-8E46-FF7D32675CEE + sid-E06ADE70-0BA1-45FB-AE4A-EE1C14E816C8 + sid-470B217F-723D-4099-8F3F-47E5BD8D7553 + sid-C8FCAD61-0A63-4A28-8C16-633EC5058EE6 + sid-E707356E-1F46-4C15-ACD4-F8B727B0FD6D + sid-5EFA0E75-9CE6-4CF1-9FD8-13F13385FADE + sid-D73CA041-029A-4A70-96B1-3DAD593E377E + sid-2471135F-B873-458B-85A2-D58D7DA1A0B8 + + + sid-61C9C6F3-E51E-4C1B-B33C-9AA190A211B6 + sid-D2F4E732-BCAE-415C-8383-0B97E076A328 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 0f78c27623e902d245b80efde539e9d5398acf27 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 28 Nov 2021 11:27:23 +0200 Subject: [PATCH 02/41] FBP-224. Fixed semantic --- .../src/test/resources/swimlanes.bpmn20.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flowable-xml-parser/src/test/resources/swimlanes.bpmn20.xml b/flowable-xml-parser/src/test/resources/swimlanes.bpmn20.xml index 08d6d8e01..416b213d6 100644 --- a/flowable-xml-parser/src/test/resources/swimlanes.bpmn20.xml +++ b/flowable-xml-parser/src/test/resources/swimlanes.bpmn20.xml @@ -3,7 +3,7 @@ - + @@ -37,8 +37,8 @@ - - + + sid-B568CF5B-C8F5-472C-8E46-FF7D32675CEE sid-E06ADE70-0BA1-45FB-AE4A-EE1C14E816C8 @@ -161,4 +161,4 @@ - \ No newline at end of file + From 28f735d41c616febe378f79826b70a33eb4229bd Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 28 Nov 2021 13:57:18 +0200 Subject: [PATCH 03/41] Initial data structures for swimlane --- .../plugin/activiti/parser/ActivitiParser.kt | 8 +- .../activiti/parser/ActivityParserDumbTest.kt | 16 +- .../plugin/activiti/parser/CommonUtils.kt | 8 +- .../XmlUpdateEventBpmnObjectAddedTest.kt | 6 +- .../XmlUpdateEventDocumentationFormatTest.kt | 8 +- .../XmlWithNestedStructureParserTest.kt | 6 +- .../activiti7/Activity7ParserBasicTest.kt | 7 +- .../CondExpressionWithoutTypeParseable.kt | 8 +- .../bugfix/EmptyCondExpressionParseable.kt | 8 +- ...tivitiStartEventWithNestedExtensionTest.kt | 6 +- .../ActivityBusinessRuleTaskTest.kt | 8 +- .../ActivityCamelTaskTest.kt | 8 +- .../ActivityDecisionTaskTest.kt | 9 +- .../ActivityMailTaskTest.kt | 9 +- .../ActivityManualTaskTest.kt | 8 +- .../ActivityMuleTaskTest.kt | 8 +- .../ActivityReceiveTaskTest.kt | 8 +- .../ActivityScriptTaskTest.kt | 8 +- ...eTaskEmptyUpdateWithNestedExtensionTest.kt | 6 +- .../ActivityServiceTaskTest.kt | 9 +- ...ityServiceTaskWithExtensionElementsTest.kt | 8 +- ...ivityServiceTaskWithNestedExtensionTest.kt | 14 +- .../ActivityUserTaskTest.kt | 9 +- ...ActivityUserTaskWithNestedExtensionTest.kt | 12 +- .../intellij/plugin/core/CanvasBuilder.kt | 6 +- .../intellij/plugin/core/render/Canvas.kt | 4 +- .../plugin/camunda/parser/CamundaParser.kt | 8 +- .../plugin/camunda/parser/nodes/CamundaXml.kt | 672 ++++++++++++------ .../nodes/collaboration/Collaboration.kt | 28 + .../camunda/parser/nodes/process/LaneSet.kt | 20 + .../parser/CamundaParserPopurriTest.kt | 7 +- .../plugin/camunda/parser/CommonUtils.kt | 11 +- .../CondExpressionWithoutTypeParseable.kt | 6 +- .../bugfix/EmptyCondExpressionParseable.kt | 6 +- .../ComplexGatewayWithExtensionIsParseable.kt | 16 +- ...nkCatchingEventWithExtensionIsParseable.kt | 14 +- .../SendTaskWithExtensionIsParseable.kt | 16 +- .../ServiceTaskWithExtensionIsParseable.kt | 13 +- .../StartEventWithExtensionIsParseable.kt | 12 +- .../TaskWithExtensionIsParseable.kt | 15 +- .../UserTaskWithExtensionIsParseable.kt | 13 +- .../SpecialCaseIncomingOutgoingIsParseable.kt | 20 +- .../plugin/flowable/parser/FlowableParser.kt | 8 +- .../parser/CollapsedSubprocessTest.kt | 8 +- .../plugin/flowable/parser/CommonUtils.kt | 10 +- .../flowable/parser/FlowableParserDumbTest.kt | 16 +- .../XmlUpdateEventBpmnObjectAddedTest.kt | 6 +- .../XmlUpdateEventDocumentationFormatTest.kt | 8 +- .../XmlWithNestedStructureParserTest.kt | 6 +- .../CondExpressionWithoutTypeParseable.kt | 6 +- .../bugfix/EmptyCondExpressionParseable.kt | 6 +- ...owableStartEventWithNestedExtensionTest.kt | 6 +- .../FlowableBusinessRuleTaskTest.kt | 8 +- .../FlowableCamelTaskTest.kt | 8 +- .../FlowableDecisionTaskTest.kt | 8 +- .../FlowableHttpTaskTest.kt | 8 +- .../FlowableMailTaskTest.kt | 8 +- .../FlowableManualTaskTest.kt | 8 +- .../FlowableMuleTaskTest.kt | 8 +- .../FlowableReceiveTaskTest.kt | 8 +- .../FlowableScriptTaskTest.kt | 8 +- .../FlowableServiceTaskTest.kt | 8 +- ...bleServiceTaskWithExtensionElementsTest.kt | 8 +- ...wableServiceTaskWithNestedExtensionTest.kt | 14 +- .../FlowableShellTaskTest.kt | 8 +- .../FlowableUserTaskTest.kt | 8 +- ...FlowableUserTaskWithNestedExtensionTest.kt | 10 +- ...BpmnProcessObject.kt => BpmnFileObject.kt} | 34 +- .../intellij/plugin/bpmn/api/BpmnParser.kt | 4 +- .../plugin/bpmn/api/bpmn/BpmnCollaboration.kt | 23 + .../plugin/bpmn/api/bpmn/BpmnProcess.kt | 6 +- .../bpmn/api/bpmn/elements/lanes/Lane.kt | 15 + .../plugin/bpmn/parser/core/BaseBpmnParser.kt | 4 +- 73 files changed, 841 insertions(+), 545 deletions(-) create mode 100644 camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt create mode 100644 camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/process/LaneSet.kt rename xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/{BpmnProcessObject.kt => BpmnFileObject.kt} (90%) create mode 100644 xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnCollaboration.kt create mode 100644 xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/elements/lanes/Lane.kt diff --git a/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivitiParser.kt b/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivitiParser.kt index 89a332778..a50d65487 100644 --- a/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivitiParser.kt +++ b/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivitiParser.kt @@ -5,7 +5,7 @@ import com.fasterxml.jackson.module.kotlin.readValue import com.valb3r.bpmn.intellij.plugin.activiti.parser.nodes.BpmnFile import com.valb3r.bpmn.intellij.plugin.activiti.parser.nodes.DiagramNode import com.valb3r.bpmn.intellij.plugin.activiti.parser.nodes.ProcessNode -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType import com.valb3r.bpmn.intellij.plugin.bpmn.parser.core.BaseBpmnParser import com.valb3r.bpmn.intellij.plugin.bpmn.parser.core.NS @@ -110,18 +110,18 @@ open class ActivitiParser : BaseBpmnParser() { private val mapper: XmlMapper = mapper() - override fun parse(input: String): BpmnProcessObject { + override fun parse(input: String): BpmnFileObject { val dto = mapper.readValue(input) return toProcessObject(dto) } - private fun toProcessObject(dto: BpmnFile): BpmnProcessObject { + private fun toProcessObject(dto: BpmnFile): BpmnFileObject { // TODO - Multi process support? markSubprocessesAndTransactionsThatHaveExternalDiagramAsCollapsed(dto.processes[0], dto.diagrams!!) val process = dto.processes[0].toElement() val diagrams = dto.diagrams!!.map { it.toElement() } - return BpmnProcessObject(process, diagrams) + return BpmnFileObject(process, diagrams) } override fun modelNs(): NS { diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivityParserDumbTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivityParserDumbTest.kt index b630c1fc9..d5c7feaa4 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivityParserDumbTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivityParserDumbTest.kt @@ -1,7 +1,7 @@ package com.valb3r.bpmn.intellij.plugin.activiti.parser import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.* -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.PropertyTable import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.BpmnSequenceFlow @@ -25,7 +25,7 @@ internal class ActivityParserDumbTest { @Test fun `XML process with all Activiti elements is parseable without error`() { - val processObject: BpmnProcessObject? + val processObject: BpmnFileObject? processObject = ActivitiParser().parse("popurri.bpmn20.xml".asResource()!!) @@ -34,7 +34,7 @@ internal class ActivityParserDumbTest { @Test fun `XML process without name should be parseable without error`() { - val processObject: BpmnProcessObject? + val processObject: BpmnFileObject? processObject = ActivitiParser().parse("empty-process-name.bpmn20.xml".asResource()!!) @@ -44,7 +44,7 @@ internal class ActivityParserDumbTest { @Test fun `XML process with interlaced elements of same type should be parseable without error`() { - val processObject: BpmnProcessObject? + val processObject: BpmnFileObject? processObject = ActivitiParser().parse("duplicates.bpmn20.xml".asResource()!!) @@ -53,7 +53,7 @@ internal class ActivityParserDumbTest { @Test fun `XML process with nested subprocess elements of same type should be parseable without error`() { - val processObject: BpmnProcessObject? + val processObject: BpmnFileObject? processObject = ActivitiParser().parse("nested.bpmn20.xml".asResource()!!) @@ -62,7 +62,7 @@ internal class ActivityParserDumbTest { @Test fun `XML process with nested subprocess elements that have interlaced subelems of same type should be parseable without error`() { - val processObject: BpmnProcessObject? + val processObject: BpmnFileObject? processObject = ActivitiParser().parse("nested-interlaced.bpmn20.xml".asResource()!!) @@ -74,7 +74,7 @@ internal class ActivityParserDumbTest { @Test fun `XML process with nested other subprocess elements that have interlaced subelems of same type should be parseable without error`() { - val processObject: BpmnProcessObject? + val processObject: BpmnFileObject? processObject = ActivitiParser().parse("nested-interlaced.bpmn20.xml".asResource()!!) @@ -86,7 +86,7 @@ internal class ActivityParserDumbTest { @Test fun `XML process with nested transactional subprocess elements that have interlaced subelems of same type should be parseable without error`() { - val processObject: BpmnProcessObject? + val processObject: BpmnFileObject? processObject = ActivitiParser().parse("nested-interlaced.bpmn20.xml".asResource()!!) diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/CommonUtils.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/CommonUtils.kt index f3f2a7932..73deeb95d 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/CommonUtils.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/CommonUtils.kt @@ -1,21 +1,21 @@ package com.valb3r.bpmn.intellij.plugin.activiti.parser -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.events.EventPropagatableToXml import org.amshove.kluent.shouldNotBeNull import java.nio.charset.StandardCharsets fun String.asResource(): String? = object {}::class.java.classLoader.getResource(this)?.readText(StandardCharsets.UTF_8) -fun readAndUpdateProcess(parser: ActivitiParser, event: EventPropagatableToXml): BpmnProcessObject { +fun readAndUpdateProcess(parser: ActivitiParser, event: EventPropagatableToXml): BpmnFileObject { return readAndUpdateProcess(parser, "simple-nested.bpmn20.xml", event) } -fun readAndUpdateProcess(parser: ActivitiParser, processName: String, event: EventPropagatableToXml): BpmnProcessObject { +fun readAndUpdateProcess(parser: ActivitiParser, processName: String, event: EventPropagatableToXml): BpmnFileObject { return readAndUpdateProcess(parser, processName, listOf(event)) } -fun readAndUpdateProcess(parser: ActivitiParser, processName: String, events: List): BpmnProcessObject { +fun readAndUpdateProcess(parser: ActivitiParser, processName: String, events: List): BpmnFileObject { val updated = updateBpmnFile(parser, processName, events) return parser.parse(updated) } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventBpmnObjectAddedTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventBpmnObjectAddedTest.kt index 8af3e882e..144e6940a 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventBpmnObjectAddedTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventBpmnObjectAddedTest.kt @@ -1,7 +1,7 @@ package com.valb3r.bpmn.intellij.plugin.activiti.parser import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BpmnShapeObjectAddedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.PropertyTable import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId @@ -394,7 +394,7 @@ internal class XmlUpdateEventBpmnObjectAddedTest { return ctor.call(*args.toTypedArray()) } - private fun readAndUpdateProcess(event: EventPropagatableToXml): BpmnProcessObject { + private fun readAndUpdateProcess(event: EventPropagatableToXml): BpmnFileObject { val updated = parser.update( "simple-nested.bpmn20.xml".asResource()!!, listOf(event) @@ -404,4 +404,4 @@ internal class XmlUpdateEventBpmnObjectAddedTest { return parser.parse(updated) } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventDocumentationFormatTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventDocumentationFormatTest.kt index eba272aa2..bfbc68c43 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventDocumentationFormatTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventDocumentationFormatTest.kt @@ -2,7 +2,7 @@ package com.valb3r.bpmn.intellij.plugin.activiti.parser import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BpmnElementRemovedEvent import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BpmnShapeObjectAddedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.PropertyTable import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithParentId @@ -72,13 +72,13 @@ class XmlUpdateEventDocumentationFormatTest { .shouldBeEqualTo(originalProcess.process.body!!.scriptTask!![0].documentation) } - private fun readProcess(): BpmnProcessObject { + private fun readProcess(): BpmnFileObject { val process = parser.parse(documentationProcessName.asResource()!!) process.shouldNotBeNull() return process } - private fun readAndUpdateProcess(event: EventPropagatableToXml): BpmnProcessObject { + private fun readAndUpdateProcess(event: EventPropagatableToXml): BpmnFileObject { val updated = parser.update( documentationProcessName.asResource()!!, listOf(event) @@ -88,4 +88,4 @@ class XmlUpdateEventDocumentationFormatTest { return parser.parse(updated) } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlWithNestedStructureParserTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlWithNestedStructureParserTest.kt index 0c9231f5f..939735a3b 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlWithNestedStructureParserTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlWithNestedStructureParserTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.activiti.parser -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnProcessBody import org.amshove.kluent.* @@ -13,7 +13,7 @@ internal class XmlWithNestedStructureParserTest { @Test fun `XML file nested process structure parsing test`() { - val processObject: BpmnProcessObject? + val processObject: BpmnFileObject? processObject = ActivitiParser().parse("nested-interlaced.bpmn20.xml".asResource()!!) @@ -178,4 +178,4 @@ internal class XmlWithNestedStructureParserTest { body.inclusiveGateway.shouldBeNull() body.eventBasedGateway.shouldBeNull() } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/activiti7/Activity7ParserBasicTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/activiti7/Activity7ParserBasicTest.kt index 6942d802f..a4513d671 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/activiti7/Activity7ParserBasicTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/activiti7/Activity7ParserBasicTest.kt @@ -1,10 +1,9 @@ package com.valb3r.bpmn.intellij.plugin.activiti.parser.activiti7 import com.valb3r.bpmn.intellij.plugin.activiti.parser.Activiti7ObjectFactory -import com.valb3r.bpmn.intellij.plugin.activiti.parser.ActivitiObjectFactory import com.valb3r.bpmn.intellij.plugin.activiti.parser.ActivitiParser import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import org.amshove.kluent.shouldNotBeNull import org.junit.jupiter.api.Test @@ -12,12 +11,12 @@ internal class Activity7ParserBasicTest { @Test fun `Activiti 7 process should be parseable and its properties readable`() { - val processObject: BpmnProcessObject? + val processObject: BpmnFileObject? processObject = ActivitiParser().parse("activiti7/simple-activiti7-process.bpmn20.xml".asResource()!!) processObject.shouldNotBeNull() - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(Activiti7ObjectFactory()).elemPropertiesByElementId + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(Activiti7ObjectFactory()).elemPropertiesByElementId props.shouldNotBeNull() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/CondExpressionWithoutTypeParseable.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/CondExpressionWithoutTypeParseable.kt index 288374a45..a64180913 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/CondExpressionWithoutTypeParseable.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/CondExpressionWithoutTypeParseable.kt @@ -1,7 +1,7 @@ package com.valb3r.bpmn.intellij.plugin.activiti.parser.bugfix import com.valb3r.bpmn.intellij.plugin.activiti.parser.* -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.ConditionExpression import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -24,7 +24,7 @@ internal class CondExpressionWithoutTypeParseable { sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "\${evection.num<3} ")) - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("\${evection.num<3} ") @@ -38,9 +38,9 @@ internal class CondExpressionWithoutTypeParseable { sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "\${evection.num<3} ")) - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(Activiti7ObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(Activiti7ObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("\${evection.num<3} ") } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/EmptyCondExpressionParseable.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/EmptyCondExpressionParseable.kt index 3932b47d5..7cefb37d8 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/EmptyCondExpressionParseable.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/EmptyCondExpressionParseable.kt @@ -1,7 +1,7 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser.bugfix import com.valb3r.bpmn.intellij.plugin.activiti.parser.* -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.ConditionExpression import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -24,7 +24,7 @@ internal class EmptyCondExpressionParseable { sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "")) - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("") @@ -38,9 +38,9 @@ internal class EmptyCondExpressionParseable { sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "")) - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(Activiti7ObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(Activiti7ObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("") } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/custom/ActivitiStartEventWithNestedExtensionTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/custom/ActivitiStartEventWithNestedExtensionTest.kt index 78e50e951..869aa1b28 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/custom/ActivitiStartEventWithNestedExtensionTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/custom/ActivitiStartEventWithNestedExtensionTest.kt @@ -5,7 +5,7 @@ import com.valb3r.bpmn.intellij.plugin.activiti.parser.ActivitiParser import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource import com.valb3r.bpmn.intellij.plugin.activiti.parser.readAndUpdateProcess import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.begin.BpmnStartEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.Property @@ -30,7 +30,7 @@ internal class ActivitiUsereventWithNestedExtensionTest { val event = readStartEventWithExtensions(processObject) event.id.shouldBeEqualTo(elementId) - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[event.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[event.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(event.id.id) props.getAll(PropertyType.FORM_PROPERTY_ID).shouldContainSame(arrayOf( @@ -81,7 +81,7 @@ internal class ActivitiUsereventWithNestedExtensionTest { return readStartEventWithExtensions(readAndUpdateProcess(parser, FILE, StringValueUpdatedEvent(elementId, property, newValue, propertyIndex = propertyIndex.split(",")))) } - private fun readStartEventWithExtensions(processObject: BpmnProcessObject): BpmnStartEvent { + private fun readStartEventWithExtensions(processObject: BpmnFileObject): BpmnStartEvent { return processObject.process.body!!.startEvent!!.shouldHaveSize(1)[0] } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityBusinessRuleTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityBusinessRuleTaskTest.kt index aac04bca2..f07ad2fcf 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityBusinessRuleTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityBusinessRuleTaskTest.kt @@ -6,7 +6,7 @@ import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource import com.valb3r.bpmn.intellij.plugin.activiti.parser.readAndUpdateProcess import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BooleanValueUpdatedEvent import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnBusinessRuleTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -36,7 +36,7 @@ internal class ActivityBusinessRuleTaskTest { task.resultVariable.shouldBeEqualTo("RESULT_VAR") task.exclude!!.shouldBeTrue() - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -82,7 +82,7 @@ internal class ActivityBusinessRuleTaskTest { return readBusinessRuleTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readBusinessRuleTask(processObject: BpmnProcessObject): BpmnBusinessRuleTask { + private fun readBusinessRuleTask(processObject: BpmnFileObject): BpmnBusinessRuleTask { return processObject.process.body!!.businessRuleTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityCamelTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityCamelTaskTest.kt index 1b0243b87..b2621d421 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityCamelTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityCamelTaskTest.kt @@ -6,7 +6,7 @@ import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource import com.valb3r.bpmn.intellij.plugin.activiti.parser.readAndUpdateProcess import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BooleanValueUpdatedEvent import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnCamelTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -36,7 +36,7 @@ internal class ActivityCamelTaskTest { task.isForCompensation!!.shouldBeTrue() task.camelContext.shouldBeEqualTo("CAMEL_CTX") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -93,7 +93,7 @@ internal class ActivityCamelTaskTest { return readCamelTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readCamelTask(processObject: BpmnProcessObject): BpmnCamelTask { + private fun readCamelTask(processObject: BpmnFileObject): BpmnCamelTask { return processObject.process.body!!.camelTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityDecisionTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityDecisionTaskTest.kt index de491da5d..c1e36839f 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityDecisionTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityDecisionTaskTest.kt @@ -6,13 +6,12 @@ import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource import com.valb3r.bpmn.intellij.plugin.activiti.parser.readAndUpdateProcess import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BooleanValueUpdatedEvent import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnDecisionTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType import org.amshove.kluent.* import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertThrows private const val FILE = "custom-service-tasks/decision-task.bpmn20.xml" @@ -36,7 +35,7 @@ internal class ActivityDecisionTaskTest { task.decisionTaskThrowErrorOnNoHits.shouldBeNull() // Not supported by activity task.fallbackToDefaultTenantCdata.shouldBeNull() // Not supported by activity - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -78,7 +77,7 @@ internal class ActivityDecisionTaskTest { return readDecisionTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readDecisionTask(processObject: BpmnProcessObject): BpmnDecisionTask { + private fun readDecisionTask(processObject: BpmnFileObject): BpmnDecisionTask { return processObject.process.body!!.decisionTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMailTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMailTaskTest.kt index 8b6d61f5b..d8cd35b7d 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMailTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMailTaskTest.kt @@ -6,13 +6,12 @@ import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource import com.valb3r.bpmn.intellij.plugin.activiti.parser.readAndUpdateProcess import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BooleanValueUpdatedEvent import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnMailTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType import org.amshove.kluent.* import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertThrows private const val FILE = "custom-service-tasks/mail-task.bpmn20.xml" @@ -42,7 +41,7 @@ internal class ActivityMailTaskTest { task.html.shouldBeEqualTo("Hello") task.charset.shouldBeEqualTo("UTF-8") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -104,7 +103,7 @@ internal class ActivityMailTaskTest { return readMailTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readMailTask(processObject: BpmnProcessObject): BpmnMailTask { + private fun readMailTask(processObject: BpmnFileObject): BpmnMailTask { return processObject.process.body!!.mailTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityManualTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityManualTaskTest.kt index 17d80bf97..68137a918 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityManualTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityManualTaskTest.kt @@ -6,7 +6,7 @@ import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource import com.valb3r.bpmn.intellij.plugin.activiti.parser.readAndUpdateProcess import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BooleanValueUpdatedEvent import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnManualTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -35,7 +35,7 @@ internal class ActivityManualTaskTest { // TODO 'exclusive' ? task.isForCompensation!!.shouldBeTrue() - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -70,7 +70,7 @@ internal class ActivityManualTaskTest { return readManualTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readManualTask(processObject: BpmnProcessObject): BpmnManualTask { + private fun readManualTask(processObject: BpmnFileObject): BpmnManualTask { return processObject.process.body!!.manualTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMuleTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMuleTaskTest.kt index 01a9abbc3..d560ebc42 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMuleTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMuleTaskTest.kt @@ -6,7 +6,7 @@ import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource import com.valb3r.bpmn.intellij.plugin.activiti.parser.readAndUpdateProcess import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BooleanValueUpdatedEvent import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnMuleTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -39,7 +39,7 @@ internal class ActivityMuleTaskTest { task.payloadExpression.shouldBeEqualTo("\${foo.bar}") task.resultVariableCdata.shouldBeEqualTo("RESULT") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -86,7 +86,7 @@ internal class ActivityMuleTaskTest { return readMuleTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readMuleTask(processObject: BpmnProcessObject): BpmnMuleTask { + private fun readMuleTask(processObject: BpmnFileObject): BpmnMuleTask { return processObject.process.body!!.muleTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityReceiveTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityReceiveTaskTest.kt index e6d3a52da..bb60e5db3 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityReceiveTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityReceiveTaskTest.kt @@ -6,7 +6,7 @@ import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource import com.valb3r.bpmn.intellij.plugin.activiti.parser.readAndUpdateProcess import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BooleanValueUpdatedEvent import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnReceiveTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -35,7 +35,7 @@ internal class ActivityReceiveTaskTest { // TODO 'exclusive' ? task.isForCompensation!!.shouldBeTrue() - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -70,7 +70,7 @@ internal class ActivityReceiveTaskTest { return readReceiveTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readReceiveTask(processObject: BpmnProcessObject): BpmnReceiveTask { + private fun readReceiveTask(processObject: BpmnFileObject): BpmnReceiveTask { return processObject.process.body!!.receiveTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityScriptTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityScriptTaskTest.kt index 435884dbf..032554fc7 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityScriptTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityScriptTaskTest.kt @@ -6,7 +6,7 @@ import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource import com.valb3r.bpmn.intellij.plugin.activiti.parser.readAndUpdateProcess import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BooleanValueUpdatedEvent import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnScriptTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -38,7 +38,7 @@ internal class ActivityScriptTaskTest { task.autoStoreVariables.shouldBeEqualTo(false) task.scriptBody.shouldBeEqualTo("echo \"Foo Bar!\" > /tmp/foo.txt") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -81,7 +81,7 @@ internal class ActivityScriptTaskTest { return readScriptTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readScriptTask(processObject: BpmnProcessObject): BpmnScriptTask { + private fun readScriptTask(processObject: BpmnFileObject): BpmnScriptTask { return processObject.process.body!!.scriptTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskEmptyUpdateWithNestedExtensionTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskEmptyUpdateWithNestedExtensionTest.kt index 9fe325ef2..fa63b7d67 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskEmptyUpdateWithNestedExtensionTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskEmptyUpdateWithNestedExtensionTest.kt @@ -3,7 +3,7 @@ package com.valb3r.bpmn.intellij.plugin.activiti.parser.customservicetasks import com.valb3r.bpmn.intellij.plugin.activiti.parser.ActivitiObjectFactory import com.valb3r.bpmn.intellij.plugin.activiti.parser.ActivitiParser import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnServiceTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -28,14 +28,14 @@ internal class ActivityServiceTaskEmptyUpdateWithNestedExtensionTest { task.name.shouldBeEqualTo("Service task with extension") task.documentation.shouldBeNull() - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props.getAll(PropertyType.FIELD_NAME)[0].value.shouldBeNull() props.getAll(PropertyType.FIELD_EXPRESSION)[0].value.shouldBeNull() props.getAll(PropertyType.FIELD_STRING)[0].value.shouldBeNull() } - private fun readServiceTask(processObject: BpmnProcessObject): BpmnServiceTask { + private fun readServiceTask(processObject: BpmnFileObject): BpmnServiceTask { return processObject.process.body!!.serviceTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskTest.kt index bc0f9ec22..2aaa21894 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskTest.kt @@ -6,13 +6,12 @@ import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource import com.valb3r.bpmn.intellij.plugin.activiti.parser.readAndUpdateProcess import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BooleanValueUpdatedEvent import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnServiceTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType import org.amshove.kluent.* import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertThrows private const val FILE = "custom-service-tasks/service-task.bpmn20.xml" @@ -41,7 +40,7 @@ internal class ActivityServiceTaskTest { task.useLocalScopeForResultVariable.shouldBeNull() // TODO handle deep extension elements - field - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -95,7 +94,7 @@ internal class ActivityServiceTaskTest { return readServiceTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readServiceTask(processObject: BpmnProcessObject): BpmnServiceTask { + private fun readServiceTask(processObject: BpmnFileObject): BpmnServiceTask { return processObject.process.body!!.serviceTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithExtensionElementsTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithExtensionElementsTest.kt index 4a7e0a9e8..80083b5b9 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithExtensionElementsTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithExtensionElementsTest.kt @@ -5,7 +5,7 @@ import com.valb3r.bpmn.intellij.plugin.activiti.parser.ActivitiParser import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource import com.valb3r.bpmn.intellij.plugin.activiti.parser.readAndUpdateProcess import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnServiceTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -28,7 +28,7 @@ internal class ActivityServiceTaskWithExtensionElementsTest { task.id.shouldBeEqualTo(elementId) task.failedJobRetryTimeCycle.shouldBeEqualTo("R10/PT5M") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.FAILED_JOB_RETRY_CYCLE]!!.value.shouldBeEqualTo(task.failedJobRetryTimeCycle) } @@ -41,7 +41,7 @@ internal class ActivityServiceTaskWithExtensionElementsTest { return readServiceTask(readAndUpdateProcess(parser, FILE, StringValueUpdatedEvent(elementId, property, newValue))) } - private fun readServiceTask(processObject: BpmnProcessObject): BpmnServiceTask { + private fun readServiceTask(processObject: BpmnFileObject): BpmnServiceTask { return processObject.process.body!!.serviceTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithNestedExtensionTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithNestedExtensionTest.kt index 28fde1d80..7c6a9c79e 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithNestedExtensionTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithNestedExtensionTest.kt @@ -2,7 +2,7 @@ package com.valb3r.bpmn.intellij.plugin.activiti.parser.customservicetasks import com.valb3r.bpmn.intellij.plugin.activiti.parser.* import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnServiceTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.Property @@ -28,7 +28,7 @@ internal class ActivityServiceTaskWithNestedExtensionTest { task.documentation.shouldBeNull() task.failedJobRetryTimeCycle?.shouldBeEqualTo("R10/PT5M") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -67,7 +67,7 @@ internal class ActivityServiceTaskWithNestedExtensionTest { fun `Add nested extension element`() { val process = readAndUpdateProcess(parser, FILE, StringValueUpdatedEvent(emptyElementId, PropertyType.FIELD_NAME, "new name", propertyIndex = listOf(""))) val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnProcessObject(process.process, process.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val props = BpmnFileObject(process.process, process.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]!!.shouldBeEqualTo(Property("new name", listOf("new name"))) } @@ -82,7 +82,7 @@ internal class ActivityServiceTaskWithNestedExtensionTest { ) ) val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnProcessObject(process.process, process.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val props = BpmnFileObject(process.process, process.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]?.value.shouldBeNull() } @@ -98,7 +98,7 @@ internal class ActivityServiceTaskWithNestedExtensionTest { ) ) val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnProcessObject(process.process, process.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val props = BpmnFileObject(process.process, process.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]!!.shouldBeEqualTo(Property("other new name", listOf("other new name"))) } @@ -113,7 +113,7 @@ internal class ActivityServiceTaskWithNestedExtensionTest { ) ) val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnProcessObject(process.process, process.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val props = BpmnFileObject(process.process, process.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]!!.shouldBeEqualTo(Property("new name", listOf("new name"))) props[PropertyType.FIELD_EXPRESSION]!!.shouldBeEqualTo(Property("expression 1", listOf("new name"))) } @@ -129,7 +129,7 @@ internal class ActivityServiceTaskWithNestedExtensionTest { return readServiceTaskWithExtensions(readAndUpdateProcess(parser, FILE, StringValueUpdatedEvent(elementId, property, newValue, propertyIndex = listOf(propertyIndex)))) } - private fun readServiceTaskWithExtensions(processObject: BpmnProcessObject): BpmnServiceTask { + private fun readServiceTaskWithExtensions(processObject: BpmnFileObject): BpmnServiceTask { return processObject.process.body!!.serviceTask!!.shouldHaveSize(3)[0] } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskTest.kt index 9eb68c874..9dc4e735e 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskTest.kt @@ -6,13 +6,12 @@ import com.valb3r.bpmn.intellij.plugin.activiti.parser.asResource import com.valb3r.bpmn.intellij.plugin.activiti.parser.readAndUpdateProcess import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.BooleanValueUpdatedEvent import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnUserTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType import org.amshove.kluent.* import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertThrows private const val FILE = "custom-service-tasks/user-task.bpmn20.xml" @@ -40,7 +39,7 @@ internal class ActivityUserTaskTest { task.priority.shouldBeEqualTo("1") task.skipExpression.shouldBeNull() // Unsupported by Activity - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -95,7 +94,7 @@ internal class ActivityUserTaskTest { return readUserTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readUserTask(processObject: BpmnProcessObject): BpmnUserTask { + private fun readUserTask(processObject: BpmnFileObject): BpmnUserTask { return processObject.process.body!!.userTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskWithNestedExtensionTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskWithNestedExtensionTest.kt index 50bd09c61..10cbb7c82 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskWithNestedExtensionTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskWithNestedExtensionTest.kt @@ -2,13 +2,11 @@ package com.valb3r.bpmn.intellij.plugin.activiti.parser.customservicetasks import com.valb3r.bpmn.intellij.plugin.activiti.parser.* import com.valb3r.bpmn.intellij.plugin.activiti.parser.testevents.StringValueUpdatedEvent -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnUserTask -import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.FunctionalGroupType import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.Property import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType -import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyValueType import org.amshove.kluent.* import org.junit.jupiter.api.Test @@ -28,7 +26,7 @@ internal class ActivityUserTaskWithNestedExtensionTest { task.name.shouldBeEqualTo("A user task") task.documentation.shouldBeEqualTo("A user task to do") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -94,7 +92,7 @@ internal class ActivityUserTaskWithNestedExtensionTest { val task = readEmptyUserTaskWithExtensions(processObject) task.id.shouldBeEqualTo(BpmnElementId("emptyUserTaskId")) - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! props.getAll(PropertyType.FORM_PROPERTY_ID).shouldHaveSize(1) } @@ -102,11 +100,11 @@ internal class ActivityUserTaskWithNestedExtensionTest { return readUserTaskWithExtensions(readAndUpdateProcess(parser, FILE, StringValueUpdatedEvent(elementId, property, newValue, propertyIndex = propertyIndex.split(",")))) } - private fun readUserTaskWithExtensions(processObject: BpmnProcessObject): BpmnUserTask { + private fun readUserTaskWithExtensions(processObject: BpmnFileObject): BpmnUserTask { return processObject.process.body!!.userTask!!.shouldHaveSize(3)[0] } - private fun readEmptyUserTaskWithExtensions(processObject: BpmnProcessObject): BpmnUserTask { + private fun readEmptyUserTaskWithExtensions(processObject: BpmnFileObject): BpmnUserTask { return processObject.process.body!!.userTask!!.shouldHaveSize(3)[2] } } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/CanvasBuilder.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/CanvasBuilder.kt index 89754edd4..2632b2246 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/CanvasBuilder.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/CanvasBuilder.kt @@ -60,9 +60,9 @@ class CanvasBuilder( initializeUpdateEventsRegistry(project, committerFactory.invoke(parser)) val data = readFile(bpmnFile) - val process = parser.parse(data) + val processes = parser.parse(data) newPropertiesVisualizer(project, properties, dropDownFactory, classEditorFactory, editorFactory, textFieldFactory, multiLineExpandableTextFieldFactory, checkboxFieldFactory, buttonFactory, arrowButtonFactory) - canvas.reset(data, process.toView(newElementsFactory(project)), bpmnProcessRenderer) + canvas.reset(data, processes.toView(newElementsFactory(project))[0], bpmnProcessRenderer) // FIXME - wrapper class for processes currentVfsConnection?.let { it.disconnect(); it.dispose() } currentPaintConnection?.let { it.disconnect(); it.dispose() } @@ -126,4 +126,4 @@ class CanvasBuilder( } private fun readFile(bpmnFile: VirtualFile) = String(bpmnFile.contentsToByteArray(), UTF_8) -} \ No newline at end of file +} diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt index 7aa82377f..b3a6a340b 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt @@ -180,14 +180,14 @@ class Canvas(private val project: Project, private val settings: CanvasConstants return renderedImage } - fun reset(fileContent: String, processObject: BpmnProcessObjectView, renderer: BpmnProcessRenderer) { + fun reset(fileContent: String, processObjects: BpmnProcessObjectView, renderer: BpmnProcessRenderer) { this.cachedTreeState = null this.renderer = renderer this.latestOnScreenModelDimensions = null this.camera = Camera(settings.defaultCameraOrigin, Point2D.Float(settings.defaultZoomRatio, settings.defaultZoomRatio)) this.propsVisualizer = propertiesVisualizer(project) this.propsVisualizer?.clear() - this.stateProvider.resetStateTo(fileContent, processObject) + this.stateProvider.resetStateTo(fileContent, processObjects) selectedElements = mutableSetOf() repaint() } diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt index 77e337f59..6c0f9d13d 100644 --- a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt @@ -2,7 +2,7 @@ package com.valb3r.bpmn.intellij.plugin.camunda.parser import com.fasterxml.jackson.dataformat.xml.XmlMapper import com.fasterxml.jackson.module.kotlin.readValue -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.catching.BpmnIntermediateLinkCatchingEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.gateways.BpmnComplexGateway import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnSendTask @@ -124,18 +124,18 @@ class CamundaParser : BaseBpmnParser() { private val mapper: XmlMapper = mapper() - override fun parse(input: String): BpmnProcessObject { + override fun parse(input: String): BpmnFileObject { val dto = mapper.readValue(input) return toProcessObject(dto) } - private fun toProcessObject(dto: BpmnFile): BpmnProcessObject { + private fun toProcessObject(dto: BpmnFile): BpmnFileObject { // TODO - Multi process support? markSubprocessesAndTransactionsThatHaveExternalDiagramAsCollapsed(dto.processes[0], dto.diagrams!!) val process = dto.processes[0].toElement() val diagrams = dto.diagrams!!.map { it.toElement() } - return BpmnProcessObject(process, diagrams) + return BpmnFileObject(process, diagrams) } override fun modelNs(): NS { diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/CamundaXml.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/CamundaXml.kt index 8cb44eda6..4ba525b5f 100644 --- a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/CamundaXml.kt +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/CamundaXml.kt @@ -18,6 +18,7 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.BpmnEve import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.BpmnSubProcess import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElement +import com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.collaboration.Collaboration import com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.process.* import com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.diagram.DiagramElementIdMapper import com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.diagram.Plane @@ -38,101 +39,155 @@ const val EXTENSION_BOOLEAN_EXTRACTOR = ".map(it -> Boolean.valueOf(it.getString // unfortunately this has failed with Kotlin 'data' classes class BpmnFile( @JacksonXmlProperty(localName = "message") - @JsonMerge - @JacksonXmlElementWrapper(useWrapping = false) - var messages: List? = null, + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var messages: List? = null, + + @JacksonXmlProperty(localName = "collaboration") + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var collaborations: List? = null, @JacksonXmlProperty(localName = "process") - @JsonMerge - @JacksonXmlElementWrapper(useWrapping = false) - var processes: List, + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var processes: List, @JacksonXmlProperty(localName = "BPMNDiagram") - @JsonMerge - @JacksonXmlElementWrapper(useWrapping = false) - var diagrams: List? = null + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var diagrams: List? = null ) data class MessageNode(val id: String, var name: String?) open class ProcessBody { - + + // Collaboration related + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var laneSet: List? = null + // Events - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var startEvent: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var endEvent: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var boundaryEvent: List? = null + // Events-intermediate - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var intermediateCatchEvent: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var intermediateThrowEvent: List? = null // Service task alike: - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var task: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var userTask: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var scriptTask: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var serviceTask: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var businessRuleTask: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var manualTask: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var sendTask: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var receiveTask: List? = null // Sub process alike - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var callActivity: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var subProcess: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var transaction: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var adHocSubProcess: List? = null // Gateways - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var exclusiveGateway: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var parallelGateway: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var inclusiveGateway: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var eventBasedGateway: List? = null - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var complexGateway: List? = null // Linking elements - @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) var sequenceFlow: List? = null } // For mixed lists in XML we need to have JsonSetter/JsonMerge on field // https://github.com/FasterXML/jackson-dataformat-xml/issues/363 // unfortunately this has failed with Kotlin 'data' classes -class ProcessNode: BpmnMappable, ProcessBody() { +class ProcessNode : BpmnMappable, ProcessBody() { private val mappers = ConcurrentHashMap, Any>() - @JacksonXmlProperty(isAttribute = true) var id: String? = null // it is false - it is non-null - @JacksonXmlProperty(isAttribute = true) var name: String? = null + @JacksonXmlProperty(isAttribute = true) + var id: String? = null // it is false - it is non-null + @JacksonXmlProperty(isAttribute = true) + var name: String? = null var documentation: String? = null - @JacksonXmlProperty(isAttribute = true) var isExecutable: Boolean? = null + @JacksonXmlProperty(isAttribute = true) + var isExecutable: Boolean? = null override fun toElement(): BpmnProcess { val result = cachedMapper(ProcessNodeMapping::class.java).convertToDto(this) val mappedBody = mapBody(this) return result.copy( - body = mappedBody, - children = extractNestedProcesses(this) + body = mappedBody, + children = extractNestedProcesses(this) ) } @@ -174,12 +229,12 @@ class ProcessNode: BpmnMappable, ProcessBody() { private fun applyServiceTaskCustomizationByType(process: BpmnProcessBody): BpmnProcessBody { var result = process - result = extractTasksBasedOnType(result, "camel", cachedMapper(CamelMapper::class.java)) { updates, target -> target.copy(camelTask = updates) } - result = extractTasksBasedOnType(result, "http", cachedMapper(HttpMapper::class.java)) { updates, target -> target.copy(httpTask = updates) } - result = extractTasksBasedOnType(result, "mail", cachedMapper(MailMapper::class.java)) { updates, target -> target.copy(mailTask = updates) } - result = extractTasksBasedOnType(result, "mule", cachedMapper(MuleMapper::class.java)) { updates, target -> target.copy(muleTask = updates) } - result = extractTasksBasedOnType(result, "dmn", cachedMapper(DecisionMapper::class.java)) { updates, target -> target.copy(decisionTask = updates) } - result = extractTasksBasedOnType(result, "shell", cachedMapper(ShellMapper::class.java)) { updates, target -> target.copy(shellTask = updates) } + result = extractTasksBasedOnType(result, "camel", cachedMapper(CamelMapper::class.java)) { updates, target -> target.copy(camelTask = updates) } + result = extractTasksBasedOnType(result, "http", cachedMapper(HttpMapper::class.java)) { updates, target -> target.copy(httpTask = updates) } + result = extractTasksBasedOnType(result, "mail", cachedMapper(MailMapper::class.java)) { updates, target -> target.copy(mailTask = updates) } + result = extractTasksBasedOnType(result, "mule", cachedMapper(MuleMapper::class.java)) { updates, target -> target.copy(muleTask = updates) } + result = extractTasksBasedOnType(result, "dmn", cachedMapper(DecisionMapper::class.java)) { updates, target -> target.copy(decisionTask = updates) } + result = extractTasksBasedOnType(result, "shell", cachedMapper(ShellMapper::class.java)) { updates, target -> target.copy(shellTask = updates) } return result } @@ -194,52 +249,110 @@ class ProcessNode: BpmnMappable, ProcessBody() { private fun applyIntermediateCatchEventCustomizationByType(process: BpmnProcessBody): BpmnProcessBody { var result = process - result = extractIntermediateCatchEventsBasedOnType(result, { null != it.timerEventDefinition }, cachedMapper(TimerCatchingMapper::class.java)) { updates, target -> target.copy(intermediateTimerCatchingEvent = updates) } - result = extractIntermediateCatchEventsBasedOnType(result, { null != it.signalEventDefinition }, cachedMapper(SignalCatchingMapper::class.java)) { updates, target -> target.copy(intermediateSignalCatchingEvent = updates) } - result = extractIntermediateCatchEventsBasedOnType(result, { null != it.messageEventDefinition }, cachedMapper(MessageCatchingMapper::class.java)) { updates, target -> target.copy(intermediateMessageCatchingEvent = updates) } - result = extractIntermediateCatchEventsBasedOnType(result, { null != it.conditionalEventDefinition }, cachedMapper(ConditionalCatchingMapper::class.java)) { updates, target -> target.copy(intermediateConditionalCatchingEvent = updates) } - result = extractIntermediateCatchEventsBasedOnType(result, { null != it.linkEventDefinition }, cachedMapper(LinkIntermediateCatchMapper::class.java)) { updates, target -> target.copy(intermediateLinkCatchingEvent = updates) } + result = extractIntermediateCatchEventsBasedOnType(result, { null != it.timerEventDefinition }, cachedMapper(TimerCatchingMapper::class.java)) { updates, target -> + target.copy(intermediateTimerCatchingEvent = updates) + } + result = extractIntermediateCatchEventsBasedOnType(result, { null != it.signalEventDefinition }, cachedMapper(SignalCatchingMapper::class.java)) { updates, target -> + target.copy(intermediateSignalCatchingEvent = updates) + } + result = extractIntermediateCatchEventsBasedOnType(result, { null != it.messageEventDefinition }, cachedMapper(MessageCatchingMapper::class.java)) { updates, target -> + target.copy(intermediateMessageCatchingEvent = updates) + } + result = extractIntermediateCatchEventsBasedOnType(result, { null != it.conditionalEventDefinition }, cachedMapper(ConditionalCatchingMapper::class.java)) { updates, target -> + target.copy(intermediateConditionalCatchingEvent = updates) + } + result = extractIntermediateCatchEventsBasedOnType(result, { null != it.linkEventDefinition }, cachedMapper(LinkIntermediateCatchMapper::class.java)) { updates, target -> + target.copy(intermediateLinkCatchingEvent = updates) + } return result } private fun applyIntermediateThrowingEventCustomizationByType(process: BpmnProcessBody): BpmnProcessBody { var result = process - result = extractIntermediateThrowingEventsBasedOnType(result, { null == it.escalationEventDefinition && null == it.signalEventDefinition }, cachedMapper(NoneThrowMapper::class.java)) { updates, target -> target.copy(intermediateNoneThrowingEvent = updates) } - result = extractIntermediateThrowingEventsBasedOnType(result, { null != it.signalEventDefinition }, cachedMapper(SignalThrowMapper::class.java)) { updates, target -> target.copy(intermediateSignalThrowingEvent = updates) } - result = extractIntermediateThrowingEventsBasedOnType(result, { null != it.escalationEventDefinition }, cachedMapper(EscalationThrowMapper::class.java)) { updates, target -> target.copy(intermediateEscalationThrowingEvent = updates) } + result = extractIntermediateThrowingEventsBasedOnType( + result, + { null == it.escalationEventDefinition && null == it.signalEventDefinition }, + cachedMapper(NoneThrowMapper::class.java) + ) { updates, target -> target.copy(intermediateNoneThrowingEvent = updates) } + result = extractIntermediateThrowingEventsBasedOnType(result, { null != it.signalEventDefinition }, cachedMapper(SignalThrowMapper::class.java)) { updates, target -> + target.copy(intermediateSignalThrowingEvent = updates) + } + result = extractIntermediateThrowingEventsBasedOnType(result, { null != it.escalationEventDefinition }, cachedMapper(EscalationThrowMapper::class.java)) { updates, target -> + target.copy(intermediateEscalationThrowingEvent = updates) + } return result } private fun applyEndEventCustomizationByType(process: BpmnProcessBody): BpmnProcessBody { var result = process - result = extractEndEventsBasedOnType(result, { null != it.errorEventDefinition }, cachedMapper(EndErrorMapper::class.java)) { updates, target -> target.copy(errorEndEvent = updates) } - result = extractEndEventsBasedOnType(result, { null != it.escalationEventDefinition }, cachedMapper(EndEscalationMapper::class.java)) { updates, target -> target.copy(escalationEndEvent = updates) } - result = extractEndEventsBasedOnType(result, { null != it.cancelEventDefinition }, cachedMapper(EndCancelMapper::class.java)) { updates, target -> target.copy(cancelEndEvent = updates) } - result = extractEndEventsBasedOnType(result, { null != it.terminateEventDefinition }, cachedMapper(EndTerminationMapper::class.java)) { updates, target -> target.copy(terminateEndEvent = updates) } + result = extractEndEventsBasedOnType(result, { null != it.errorEventDefinition }, cachedMapper(EndErrorMapper::class.java)) { updates, target -> target.copy(errorEndEvent = updates) } + result = extractEndEventsBasedOnType( + result, + { null != it.escalationEventDefinition }, + cachedMapper(EndEscalationMapper::class.java) + ) { updates, target -> target.copy(escalationEndEvent = updates) } + result = extractEndEventsBasedOnType(result, { null != it.cancelEventDefinition }, cachedMapper(EndCancelMapper::class.java)) { updates, target -> target.copy(cancelEndEvent = updates) } + result = + extractEndEventsBasedOnType(result, { null != it.terminateEventDefinition }, cachedMapper(EndTerminationMapper::class.java)) { updates, target -> target.copy(terminateEndEvent = updates) } return result } private fun applyStartEventCustomizationByType(process: BpmnProcessBody): BpmnProcessBody { var result = process - result = extractStartEventsBasedOnType(result, { null != it.conditionalEventDefinition }, cachedMapper(StartConditionalMapper::class.java)) { updates, target -> target.copy(conditionalStartEvent = updates) } - result = extractStartEventsBasedOnType(result, { null != it.errorEventDefinition }, cachedMapper(StartErrorMapper::class.java)) { updates, target -> target.copy(errorStartEvent = updates) } - result = extractStartEventsBasedOnType(result, { null != it.escalationEventDefinition }, cachedMapper(StartEscalationMapper::class.java)) { updates, target -> target.copy(escalationStartEvent = updates) } - result = extractStartEventsBasedOnType(result, { null != it.messageEventDefinition }, cachedMapper(StartMessageMapper::class.java)) { updates, target -> target.copy(messageStartEvent = updates) } - result = extractStartEventsBasedOnType(result, { null != it.signalEventDefinition }, cachedMapper(StartSignalMapper::class.java)) { updates, target -> target.copy(signalStartEvent = updates) } - result = extractStartEventsBasedOnType(result, { null != it.timerEventDefinition }, cachedMapper(StartTimerMapper::class.java)) { updates, target -> target.copy(timerStartEvent = updates) } + result = extractStartEventsBasedOnType( + result, + { null != it.conditionalEventDefinition }, + cachedMapper(StartConditionalMapper::class.java) + ) { updates, target -> target.copy(conditionalStartEvent = updates) } + result = extractStartEventsBasedOnType(result, { null != it.errorEventDefinition }, cachedMapper(StartErrorMapper::class.java)) { updates, target -> target.copy(errorStartEvent = updates) } + result = extractStartEventsBasedOnType( + result, + { null != it.escalationEventDefinition }, + cachedMapper(StartEscalationMapper::class.java) + ) { updates, target -> target.copy(escalationStartEvent = updates) } + result = + extractStartEventsBasedOnType(result, { null != it.messageEventDefinition }, cachedMapper(StartMessageMapper::class.java)) { updates, target -> target.copy(messageStartEvent = updates) } + result = extractStartEventsBasedOnType(result, { null != it.signalEventDefinition }, cachedMapper(StartSignalMapper::class.java)) { updates, target -> target.copy(signalStartEvent = updates) } + result = extractStartEventsBasedOnType(result, { null != it.timerEventDefinition }, cachedMapper(StartTimerMapper::class.java)) { updates, target -> target.copy(timerStartEvent = updates) } return result } private fun applyBoundaryEventCustomizationByType(process: BpmnProcessBody): BpmnProcessBody { var result = process - result = extractBoundaryEventsBasedOnType(result, { null != it.cancelEventDefinition }, cachedMapper(BoundaryCancelMapper::class.java)) { updates, target -> target.copy(boundaryCancelEvent = updates) } - result = extractBoundaryEventsBasedOnType(result, { null != it.compensateEventDefinition }, cachedMapper(BoundaryCompensationMapper::class.java)) { updates, target -> target.copy(boundaryCompensationEvent = updates) } - result = extractBoundaryEventsBasedOnType(result, { null != it.conditionalEventDefinition }, cachedMapper(BoundaryConditionalMapper::class.java)) { updates, target -> target.copy(boundaryConditionalEvent = updates) } - result = extractBoundaryEventsBasedOnType(result, { null != it.errorEventDefinition }, cachedMapper(BoundaryErrorMapper::class.java)) { updates, target -> target.copy(boundaryErrorEvent = updates) } - result = extractBoundaryEventsBasedOnType(result, { null != it.escalationEventDefinition }, cachedMapper(BoundaryEscalationMapper::class.java)) { updates, target -> target.copy(boundaryEscalationEvent = updates) } - result = extractBoundaryEventsBasedOnType(result, { null != it.messageEventDefinition }, cachedMapper(BoundaryMessageMapper::class.java)) { updates, target -> target.copy(boundaryMessageEvent = updates) } - result = extractBoundaryEventsBasedOnType(result, { null != it.signalEventDefinition }, cachedMapper(BoundarySignalMapper::class.java)) { updates, target -> target.copy(boundarySignalEvent = updates) } - result = extractBoundaryEventsBasedOnType(result, { null != it.timerEventDefinition }, cachedMapper(BoundaryTimerMapper::class.java)) { updates, target -> target.copy(boundaryTimerEvent = updates) } + result = extractBoundaryEventsBasedOnType( + result, + { null != it.cancelEventDefinition }, + cachedMapper(BoundaryCancelMapper::class.java) + ) { updates, target -> target.copy(boundaryCancelEvent = updates) } + result = extractBoundaryEventsBasedOnType(result, { null != it.compensateEventDefinition }, cachedMapper(BoundaryCompensationMapper::class.java)) { updates, target -> + target.copy(boundaryCompensationEvent = updates) + } + result = extractBoundaryEventsBasedOnType(result, { null != it.conditionalEventDefinition }, cachedMapper(BoundaryConditionalMapper::class.java)) { updates, target -> + target.copy(boundaryConditionalEvent = updates) + } + result = extractBoundaryEventsBasedOnType( + result, + { null != it.errorEventDefinition }, + cachedMapper(BoundaryErrorMapper::class.java) + ) { updates, target -> target.copy(boundaryErrorEvent = updates) } + result = extractBoundaryEventsBasedOnType(result, { null != it.escalationEventDefinition }, cachedMapper(BoundaryEscalationMapper::class.java)) { updates, target -> + target.copy(boundaryEscalationEvent = updates) + } + result = extractBoundaryEventsBasedOnType( + result, + { null != it.messageEventDefinition }, + cachedMapper(BoundaryMessageMapper::class.java) + ) { updates, target -> target.copy(boundaryMessageEvent = updates) } + result = extractBoundaryEventsBasedOnType( + result, + { null != it.signalEventDefinition }, + cachedMapper(BoundarySignalMapper::class.java) + ) { updates, target -> target.copy(boundarySignalEvent = updates) } + result = extractBoundaryEventsBasedOnType( + result, + { null != it.timerEventDefinition }, + cachedMapper(BoundaryTimerMapper::class.java) + ) { updates, target -> target.copy(boundaryTimerEvent = updates) } return result } @@ -253,7 +366,12 @@ class ProcessNode: BpmnMappable, ProcessBody() { return process } - private fun extractIntermediateCatchEventsBasedOnType(process: BpmnProcessBody, filter: (BpmnIntermediateCatchingEvent) -> Boolean, mapper: IntermediateCatchEventMapper, update: (List?, BpmnProcessBody) -> BpmnProcessBody): BpmnProcessBody { + private fun extractIntermediateCatchEventsBasedOnType( + process: BpmnProcessBody, + filter: (BpmnIntermediateCatchingEvent) -> Boolean, + mapper: IntermediateCatchEventMapper, + update: (List?, BpmnProcessBody) -> BpmnProcessBody + ): BpmnProcessBody { process.intermediateCatchEvent?.apply { val byTypeGroup = this.groupBy { filter(it) } val newProcess = process.copy(intermediateCatchEvent = byTypeGroup[false]) @@ -263,7 +381,12 @@ class ProcessNode: BpmnMappable, ProcessBody() { return process } - private fun extractIntermediateThrowingEventsBasedOnType(process: BpmnProcessBody, filter: (BpmnIntermediateThrowingEvent) -> Boolean, mapper: IntermediateThrowEventMapper, update: (List?, BpmnProcessBody) -> BpmnProcessBody): BpmnProcessBody { + private fun extractIntermediateThrowingEventsBasedOnType( + process: BpmnProcessBody, + filter: (BpmnIntermediateThrowingEvent) -> Boolean, + mapper: IntermediateThrowEventMapper, + update: (List?, BpmnProcessBody) -> BpmnProcessBody + ): BpmnProcessBody { process.intermediateThrowEvent?.apply { val byTypeGroup = this.groupBy { filter(it) } val newProcess = process.copy(intermediateThrowEvent = byTypeGroup[false]) @@ -273,7 +396,12 @@ class ProcessNode: BpmnMappable, ProcessBody() { return process } - private fun extractEndEventsBasedOnType(process: BpmnProcessBody, filter: (BpmnEndEvent) -> Boolean, mapper: EndEventMapper, update: (List?, BpmnProcessBody) -> BpmnProcessBody): BpmnProcessBody { + private fun extractEndEventsBasedOnType( + process: BpmnProcessBody, + filter: (BpmnEndEvent) -> Boolean, + mapper: EndEventMapper, + update: (List?, BpmnProcessBody) -> BpmnProcessBody + ): BpmnProcessBody { process.endEvent?.apply { val byTypeGroup = this.groupBy { filter(it) } val newProcess = process.copy(endEvent = byTypeGroup[false]) @@ -283,7 +411,12 @@ class ProcessNode: BpmnMappable, ProcessBody() { return process } - private fun extractStartEventsBasedOnType(process: BpmnProcessBody, filter: (BpmnStartEvent) -> Boolean, mapper: StartEventMapper, update: (List?, BpmnProcessBody) -> BpmnProcessBody): BpmnProcessBody { + private fun extractStartEventsBasedOnType( + process: BpmnProcessBody, + filter: (BpmnStartEvent) -> Boolean, + mapper: StartEventMapper, + update: (List?, BpmnProcessBody) -> BpmnProcessBody + ): BpmnProcessBody { process.startEvent?.apply { val byTypeGroup = this.groupBy { filter(it) } val newProcess = process.copy(startEvent = byTypeGroup[false]) @@ -293,7 +426,12 @@ class ProcessNode: BpmnMappable, ProcessBody() { return process } - private fun extractBoundaryEventsBasedOnType(process: BpmnProcessBody, filter: (BpmnBoundaryEvent) -> Boolean, mapper: BoundaryEventMapper, update: (List?, BpmnProcessBody) -> BpmnProcessBody): BpmnProcessBody { + private fun extractBoundaryEventsBasedOnType( + process: BpmnProcessBody, + filter: (BpmnBoundaryEvent) -> Boolean, + mapper: BoundaryEventMapper, + update: (List?, BpmnProcessBody) -> BpmnProcessBody + ): BpmnProcessBody { process.boundaryEvent?.apply { val byTypeGroup = this.groupBy { filter(it) } val newProcess = process.copy(boundaryEvent = byTypeGroup[false]) @@ -312,170 +450,260 @@ class ProcessNode: BpmnMappable, ProcessBody() { fun convertToDto(input: ProcessNode): BpmnProcess } - @Mapper(uses = [ - BpmnElementIdMapper::class, - SubProcess.SubProcessMapping::class, - Transaction.TransactionMapping::class, - BusinessRuleTask.BusinessRuleTaskMapping::class, - ServiceTask.ServiceTaskMapping::class, - ManualTask.ManualTaskMapping::class, - ReceiveTask.ReceiveTaskMapping::class, - ScriptTask.ScriptTaskMapping::class, - UserTask.UserTaskMapping::class, - StartEventNode.StartEventNodeMapping::class, - IntermediateCatchEvent.Mapping::class - ]) + @Mapper( + uses = [ + BpmnElementIdMapper::class, + SubProcess.SubProcessMapping::class, + Transaction.TransactionMapping::class, + BusinessRuleTask.BusinessRuleTaskMapping::class, + ServiceTask.ServiceTaskMapping::class, + ManualTask.ManualTaskMapping::class, + ReceiveTask.ReceiveTaskMapping::class, + ScriptTask.ScriptTaskMapping::class, + UserTask.UserTaskMapping::class, + StartEventNode.StartEventNodeMapping::class, + IntermediateCatchEvent.Mapping::class + ] + ) interface BodyMapping { @Mappings( - Mapping(source = "subProcess", target = "subProcess"), - Mapping(source = "subProcess", target = "collapsedSubProcess"), // will be post-filtered - Mapping(source = "transaction", target = "transaction"), - Mapping(source = "transaction", target = "collapsedTransaction") // will be post-filtered + Mapping(source = "subProcess", target = "subProcess"), + Mapping(source = "subProcess", target = "collapsedSubProcess"), // will be post-filtered + Mapping(source = "transaction", target = "transaction"), + Mapping(source = "transaction", target = "collapsedTransaction") // will be post-filtered ) fun convertToDto(input: ProcessBody): BpmnProcessBody } @Mapper - interface EventSubProcessMapper: SubProcessMapper + interface EventSubProcessMapper : SubProcessMapper @Mapper - interface CamelMapper: ServiceTaskMapper { + interface CamelMapper : ServiceTaskMapper { @Mappings( Mapping(source = "forCompensation", target = "isForCompensation"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"camelContext\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "camelContext") + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"camelContext\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "camelContext" + ) ) override fun convertToDto(input: BpmnServiceTask): BpmnCamelTask } @Mapper - interface HttpMapper: ServiceTaskMapper { + interface HttpMapper : ServiceTaskMapper { @Mappings( - Mapping(source = "forCompensation", target = "isForCompensation"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"requestMethod\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "requestMethod"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"requestUrl\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "requestUrl"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"requestHeaders\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "requestHeaders"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"requestBody\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "requestBody"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"requestBodyEncoding\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "requestBodyEncoding"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"requestTimeout\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "requestTimeout"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"disallowRedirects\".equals(it.getName()))$EXTENSION_BOOLEAN_EXTRACTOR", - target = "disallowRedirects"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"failStatusCodes\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "failStatusCodes"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"handleStatusCodes\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "handleStatusCodes"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"responseVariableName\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "responseVariableName"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"ignoreException\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "ignoreException"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"saveRequestVariables\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "saveRequestVariables"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"saveResponseParameters\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "saveResponseParameters"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"resultVariablePrefix\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "resultVariablePrefix"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"saveResponseParametersTransient\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "saveResponseParametersTransient"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"saveResponseVariableAsJson\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "saveResponseVariableAsJson") + Mapping(source = "forCompensation", target = "isForCompensation"), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"requestMethod\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "requestMethod" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"requestUrl\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "requestUrl" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"requestHeaders\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "requestHeaders" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"requestBody\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "requestBody" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"requestBodyEncoding\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "requestBodyEncoding" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"requestTimeout\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "requestTimeout" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"disallowRedirects\".equals(it.getName()))$EXTENSION_BOOLEAN_EXTRACTOR", + target = "disallowRedirects" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"failStatusCodes\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "failStatusCodes" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"handleStatusCodes\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "handleStatusCodes" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"responseVariableName\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "responseVariableName" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"ignoreException\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "ignoreException" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"saveRequestVariables\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "saveRequestVariables" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"saveResponseParameters\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "saveResponseParameters" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"resultVariablePrefix\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "resultVariablePrefix" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"saveResponseParametersTransient\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "saveResponseParametersTransient" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"saveResponseVariableAsJson\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "saveResponseVariableAsJson" + ) ) override fun convertToDto(input: BpmnServiceTask): BpmnHttpTask } @Mapper - interface MailMapper: ServiceTaskMapper { + interface MailMapper : ServiceTaskMapper { @Mappings( - Mapping(source = "forCompensation", target = "isForCompensation"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"headers\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "headers"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"to\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "to"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"from\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "from"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"subject\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "subject"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"cc\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "cc"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"bcc\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "bcc"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"text\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "text"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"html\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "html"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"charset\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "charset") + Mapping(source = "forCompensation", target = "isForCompensation"), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"headers\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "headers" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"to\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "to" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"from\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "from" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"subject\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "subject" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"cc\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "cc" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"bcc\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "bcc" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"text\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "text" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"html\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "html" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"charset\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "charset" + ) ) override fun convertToDto(input: BpmnServiceTask): BpmnMailTask } @Mapper - interface MuleMapper: ServiceTaskMapper { + interface MuleMapper : ServiceTaskMapper { @Mappings( - Mapping(source = "forCompensation", target = "isForCompensation"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"endpointUrl\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "endpointUrl"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"language\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "language"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"payloadExpression\".equals(it.getName()))$EXTENSION_EXPRESSION_EXTRACTOR", - target = "payloadExpression"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"resultVariable\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "resultVariableCdata") + Mapping(source = "forCompensation", target = "isForCompensation"), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"endpointUrl\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "endpointUrl" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"language\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "language" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"payloadExpression\".equals(it.getName()))$EXTENSION_EXPRESSION_EXTRACTOR", + target = "payloadExpression" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"resultVariable\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "resultVariableCdata" + ) ) override fun convertToDto(input: BpmnServiceTask): BpmnMuleTask } @Mapper - interface DecisionMapper: ServiceTaskMapper { + interface DecisionMapper : ServiceTaskMapper { @Mappings( - Mapping(source = "forCompensation", target = "isForCompensation"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"decisionTableReferenceKey\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "decisionTableReferenceKey"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"decisionTaskThrowErrorOnNoHits\".equals(it.getName()))$EXTENSION_BOOLEAN_EXTRACTOR", - target = "decisionTaskThrowErrorOnNoHits"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"fallbackToDefaultTenant\".equals(it.getName()))$EXTENSION_BOOLEAN_EXTRACTOR", - target = "fallbackToDefaultTenantCdata") + Mapping(source = "forCompensation", target = "isForCompensation"), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"decisionTableReferenceKey\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "decisionTableReferenceKey" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"decisionTaskThrowErrorOnNoHits\".equals(it.getName()))$EXTENSION_BOOLEAN_EXTRACTOR", + target = "decisionTaskThrowErrorOnNoHits" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"fallbackToDefaultTenant\".equals(it.getName()))$EXTENSION_BOOLEAN_EXTRACTOR", + target = "fallbackToDefaultTenantCdata" + ) ) override fun convertToDto(input: BpmnServiceTask): BpmnDecisionTask } @Mapper - interface ShellMapper: ServiceTaskMapper { + interface ShellMapper : ServiceTaskMapper { @Mappings( - Mapping(source = "forCompensation", target = "isForCompensation"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"command\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "command"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"arg1\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "arg1"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"arg2\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "arg2"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"arg3\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "arg3"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"arg4\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "arg4"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"arg5\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "arg5"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"wait\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "wait"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"cleanEnv\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "cleanEnv"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"errorCodeVariable\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "errorCodeVariable"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"outputVariable\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "outputVariable"), - Mapping(expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"directory\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", - target = "directory") + Mapping(source = "forCompensation", target = "isForCompensation"), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"command\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "command" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"arg1\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "arg1" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"arg2\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "arg2" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"arg3\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "arg3" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"arg4\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "arg4" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"arg5\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "arg5" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"wait\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "wait" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"cleanEnv\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "cleanEnv" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"errorCodeVariable\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "errorCodeVariable" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"outputVariable\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "outputVariable" + ), + Mapping( + expression = "$EXTENSION_ELEM_STREAM.filter(it -> \"directory\".equals(it.getName()))$EXTENSION_STRING_EXTRACTOR", + target = "directory" + ) ) override fun convertToDto(input: BpmnServiceTask): BpmnShellTask } @@ -486,98 +714,98 @@ class ProcessNode: BpmnMappable, ProcessBody() { } @Mapper - interface TimerCatchingMapper: IntermediateCatchEventMapper + interface TimerCatchingMapper : IntermediateCatchEventMapper @Mapper - interface SignalCatchingMapper: IntermediateCatchEventMapper + interface SignalCatchingMapper : IntermediateCatchEventMapper @Mapper - interface MessageCatchingMapper: IntermediateCatchEventMapper + interface MessageCatchingMapper : IntermediateCatchEventMapper @Mapper - interface ConditionalCatchingMapper: IntermediateCatchEventMapper + interface ConditionalCatchingMapper : IntermediateCatchEventMapper @Mapper - interface LinkIntermediateCatchMapper: IntermediateCatchEventMapper + interface LinkIntermediateCatchMapper : IntermediateCatchEventMapper interface IntermediateCatchEventMapper { fun convertToDto(input: BpmnIntermediateCatchingEvent): T } @Mapper - interface NoneThrowMapper: IntermediateThrowEventMapper + interface NoneThrowMapper : IntermediateThrowEventMapper @Mapper - interface SignalThrowMapper: IntermediateThrowEventMapper + interface SignalThrowMapper : IntermediateThrowEventMapper @Mapper - interface EscalationThrowMapper: IntermediateThrowEventMapper + interface EscalationThrowMapper : IntermediateThrowEventMapper interface IntermediateThrowEventMapper { fun convertToDto(input: BpmnIntermediateThrowingEvent): T } @Mapper - interface EndCancelMapper: EndEventMapper + interface EndCancelMapper : EndEventMapper @Mapper - interface EndErrorMapper: EndEventMapper + interface EndErrorMapper : EndEventMapper @Mapper - interface EndEscalationMapper: EndEventMapper + interface EndEscalationMapper : EndEventMapper @Mapper - interface EndTerminationMapper: EndEventMapper + interface EndTerminationMapper : EndEventMapper interface EndEventMapper { fun convertToDto(input: BpmnEndEvent): T } @Mapper - interface StartTimerMapper: StartEventMapper + interface StartTimerMapper : StartEventMapper @Mapper - interface StartSignalMapper: StartEventMapper + interface StartSignalMapper : StartEventMapper @Mapper - interface StartMessageMapper: StartEventMapper + interface StartMessageMapper : StartEventMapper @Mapper - interface StartErrorMapper: StartEventMapper + interface StartErrorMapper : StartEventMapper @Mapper - interface StartEscalationMapper: StartEventMapper + interface StartEscalationMapper : StartEventMapper @Mapper - interface StartConditionalMapper: StartEventMapper + interface StartConditionalMapper : StartEventMapper interface StartEventMapper { fun convertToDto(input: BpmnStartEvent): T } @Mapper - interface BoundaryCancelMapper: BoundaryEventMapper + interface BoundaryCancelMapper : BoundaryEventMapper @Mapper - interface BoundaryCompensationMapper: BoundaryEventMapper + interface BoundaryCompensationMapper : BoundaryEventMapper @Mapper - interface BoundaryConditionalMapper: BoundaryEventMapper + interface BoundaryConditionalMapper : BoundaryEventMapper @Mapper - interface BoundaryErrorMapper: BoundaryEventMapper + interface BoundaryErrorMapper : BoundaryEventMapper @Mapper - interface BoundaryEscalationMapper: BoundaryEventMapper + interface BoundaryEscalationMapper : BoundaryEventMapper @Mapper - interface BoundaryMessageMapper: BoundaryEventMapper + interface BoundaryMessageMapper : BoundaryEventMapper @Mapper - interface BoundarySignalMapper: BoundaryEventMapper + interface BoundarySignalMapper : BoundaryEventMapper @Mapper - interface BoundaryTimerMapper: BoundaryEventMapper + interface BoundaryTimerMapper : BoundaryEventMapper interface BoundaryEventMapper { fun convertToDto(input: BpmnBoundaryEvent): T @@ -589,8 +817,8 @@ class ProcessNode: BpmnMappable, ProcessBody() { } data class DiagramNode( - @JacksonXmlProperty(isAttribute = true) val id: String, - @JacksonXmlProperty(localName = "BPMNPlane") val bpmnPlane: Plane + @JacksonXmlProperty(isAttribute = true) val id: String, + @JacksonXmlProperty(localName = "BPMNPlane") val bpmnPlane: Plane ) : BpmnMappable { override fun toElement(): DiagramElement { @@ -601,4 +829,4 @@ data class DiagramNode( interface Mapping { fun convertToDto(input: DiagramNode): DiagramElement } -} \ No newline at end of file +} diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt new file mode 100644 index 000000000..5c8cba3f2 --- /dev/null +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt @@ -0,0 +1,28 @@ +package com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.collaboration + +import com.fasterxml.jackson.annotation.JsonMerge +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty + +data class Collaboration( + @JacksonXmlProperty(isAttribute = true) val id: String, + @JacksonXmlProperty(isAttribute = true) val name: String?, + @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) val participant: List?, + @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) val messageFlow: List?, +) + +data class Participant( + @JacksonXmlProperty(isAttribute = true) val id: String, + @JacksonXmlProperty(isAttribute = true) val name: String?, + @JacksonXmlProperty(isAttribute = true) val processRef: String, + val documentation: String? +) + +data class MessageFlow( + @JacksonXmlProperty(isAttribute = true) val id: String, + @JacksonXmlProperty(isAttribute = true) val name: String?, + val documentation: String?, + @JacksonXmlProperty(isAttribute = true) val sourceRef: String, + @JacksonXmlProperty(isAttribute = true) val targetRef: String, +) + diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/process/LaneSet.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/process/LaneSet.kt new file mode 100644 index 000000000..9aa082d0e --- /dev/null +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/process/LaneSet.kt @@ -0,0 +1,20 @@ +package com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.process + +import com.fasterxml.jackson.annotation.JsonMerge +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty + + +data class LaneSet( + @JacksonXmlProperty(isAttribute = true) val id: String, + @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) val lane: List?, +) + +data class Lane( + @JacksonXmlProperty(isAttribute = true) val id: String, + @JacksonXmlProperty(isAttribute = true) val name: String?, + val documentation: String?, + @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) val flowNodeRef: List?, +) + +data class FlowNodeRef(val ref: String) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParserPopurriTest.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParserPopurriTest.kt index 8c4d0201c..8e20e9f68 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParserPopurriTest.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParserPopurriTest.kt @@ -1,18 +1,15 @@ package com.valb3r.bpmn.intellij.plugin.camunda.parser -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject -import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId -import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import org.amshove.kluent.shouldNotBeNull import org.junit.jupiter.api.Test -import java.util.* internal class CamundaParserPopurriTest { @Test fun `XML process with all Camunda elements is parseable without error`() { - val processObject: BpmnProcessObject? + val processObject: BpmnFileObject? processObject = CamundaParser().parse("popurri.bpmn".asResource()!!) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CommonUtils.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CommonUtils.kt index aeea54be1..8a7a2eace 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CommonUtils.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CommonUtils.kt @@ -1,22 +1,21 @@ package com.valb3r.bpmn.intellij.plugin.camunda.parser -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.events.EventPropagatableToXml -import com.valb3r.bpmn.intellij.plugin.camunda.parser.CamundaParser import org.amshove.kluent.shouldNotBeNull import java.nio.charset.StandardCharsets fun String.asResource(): String? = object {}::class.java.classLoader.getResource(this)?.readText(StandardCharsets.UTF_8) -fun readAndUpdateProcess(parser: CamundaParser, event: EventPropagatableToXml): BpmnProcessObject { +fun readAndUpdateProcess(parser: CamundaParser, event: EventPropagatableToXml): BpmnFileObject { return readAndUpdateProcess(parser, "simple-nested.bpmn20.xml", event) } -fun readAndUpdateProcess(parser: CamundaParser, processName: String, event: EventPropagatableToXml): BpmnProcessObject { +fun readAndUpdateProcess(parser: CamundaParser, processName: String, event: EventPropagatableToXml): BpmnFileObject { return readAndUpdateProcess(parser, processName, listOf(event)) } -fun readAndUpdateProcess(parser: CamundaParser, processName: String, events: List): BpmnProcessObject { +fun readAndUpdateProcess(parser: CamundaParser, processName: String, events: List): BpmnFileObject { val updated = updateBpmnFile(parser, processName, events) return parser.parse(updated) } @@ -29,4 +28,4 @@ fun updateBpmnFile(parser: CamundaParser, processName: String, events: List(input) return toProcessObject(dto) } - private fun toProcessObject(dto: BpmnFile): BpmnProcessObject { + private fun toProcessObject(dto: BpmnFile): BpmnFileObject { // TODO - Multi process support? markSubprocessesAndTransactionsThatHaveExternalDiagramAsCollapsed(dto.processes[0], dto.diagrams!!) val process = dto.processes[0].toElement() val diagrams = dto.diagrams!!.map { it.toElement() } - return BpmnProcessObject(process, diagrams) + return BpmnFileObject(process, diagrams) } override fun modelNs(): NS { diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/CollapsedSubprocessTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/CollapsedSubprocessTest.kt index a0f9c347f..0b18d3f10 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/CollapsedSubprocessTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/CollapsedSubprocessTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import org.amshove.kluent.shouldBeEqualTo import org.amshove.kluent.shouldHaveSingleItem import org.amshove.kluent.shouldNotBeNull @@ -10,7 +10,7 @@ internal class CollapsedSubprocessTest { @Test fun `Collapsed subprocess is readable and mapped`() { - val processObject: BpmnProcessObject? + val processObject: BpmnFileObject? processObject = FlowableParser().parse("simple-collapsed-subprocess.bpmn20.xml".asResource()!!) @@ -21,7 +21,7 @@ internal class CollapsedSubprocessTest { @Test fun `Collapsed transactional subprocess is readable and mapped`() { - val processObject: BpmnProcessObject? + val processObject: BpmnFileObject? processObject = FlowableParser().parse("transactional-collapsed-subprocess.bpmn20.xml".asResource()!!) @@ -29,4 +29,4 @@ internal class CollapsedSubprocessTest { processObject.process.body!!.transaction!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("transactionalSubprocess") processObject.process.body!!.collapsedTransaction!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("transactionalCollapsedSubprocess") } -} \ No newline at end of file +} diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/CommonUtils.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/CommonUtils.kt index 9a55c2c27..5a3f21159 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/CommonUtils.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/CommonUtils.kt @@ -1,21 +1,21 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.events.EventPropagatableToXml import org.amshove.kluent.shouldNotBeNull import java.nio.charset.StandardCharsets fun String.asResource(): String? = object {}::class.java.classLoader.getResource(this)?.readText(StandardCharsets.UTF_8) -fun readAndUpdateProcess(parser: FlowableParser, event: EventPropagatableToXml): BpmnProcessObject { +fun readAndUpdateProcess(parser: FlowableParser, event: EventPropagatableToXml): BpmnFileObject { return readAndUpdateProcess(parser, "simple-nested.bpmn20.xml", event) } -fun readAndUpdateProcess(parser: FlowableParser, processName: String, event: EventPropagatableToXml): BpmnProcessObject { +fun readAndUpdateProcess(parser: FlowableParser, processName: String, event: EventPropagatableToXml): BpmnFileObject { return readAndUpdateProcess(parser, processName, listOf(event)) } -fun readAndUpdateProcess(parser: FlowableParser, processName: String, events: List): BpmnProcessObject { +fun readAndUpdateProcess(parser: FlowableParser, processName: String, events: List): BpmnFileObject { val updated = updateBpmnFile(parser, processName, events) return parser.parse(updated) } @@ -28,4 +28,4 @@ fun updateBpmnFile(parser: FlowableParser, processName: String, events: ListHello") task.charset.shouldBeEqualTo("UTF-8") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -106,7 +106,7 @@ internal class FlowableMailTaskTest { return readMailTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readMailTask(processObject: BpmnProcessObject): BpmnMailTask { + private fun readMailTask(processObject: BpmnFileObject): BpmnMailTask { return processObject.process.body!!.mailTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableManualTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableManualTaskTest.kt index c840738c3..6a628818a 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableManualTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableManualTaskTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser.customservicetasks -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnManualTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -35,7 +35,7 @@ internal class FlowableManualTaskTest { // TODO 'exclusive' ? task.isForCompensation!!.shouldBeTrue() - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -70,7 +70,7 @@ internal class FlowableManualTaskTest { return readManualTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readManualTask(processObject: BpmnProcessObject): BpmnManualTask { + private fun readManualTask(processObject: BpmnFileObject): BpmnManualTask { return processObject.process.body!!.manualTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableMuleTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableMuleTaskTest.kt index 2b866836b..0db6a6e5b 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableMuleTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableMuleTaskTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser.customservicetasks -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnMuleTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -39,7 +39,7 @@ internal class FlowableMuleTaskTest { task.payloadExpression.shouldBeEqualTo("\${foo.bar}") task.resultVariableCdata.shouldBeEqualTo("RESULT") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -86,7 +86,7 @@ internal class FlowableMuleTaskTest { return readMuleTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readMuleTask(processObject: BpmnProcessObject): BpmnMuleTask { + private fun readMuleTask(processObject: BpmnFileObject): BpmnMuleTask { return processObject.process.body!!.muleTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableReceiveTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableReceiveTaskTest.kt index 6578644e4..277c000e7 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableReceiveTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableReceiveTaskTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser.customservicetasks -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnReceiveTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -35,7 +35,7 @@ internal class FlowableReceiveTaskTest { // TODO 'exclusive' ? task.isForCompensation!!.shouldBeTrue() - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -70,7 +70,7 @@ internal class FlowableReceiveTaskTest { return readReceiveTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readReceiveTask(processObject: BpmnProcessObject): BpmnReceiveTask { + private fun readReceiveTask(processObject: BpmnFileObject): BpmnReceiveTask { return processObject.process.body!!.receiveTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableScriptTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableScriptTaskTest.kt index 042cb3543..7769e60b0 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableScriptTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableScriptTaskTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser.customservicetasks -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnScriptTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -38,7 +38,7 @@ internal class FlowableScriptTaskTest { task.autoStoreVariables.shouldBeEqualTo(true) task.scriptBody.shouldBeEqualTo("echo \"Foo Bar!\" > /tmp/foo.txt") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -81,7 +81,7 @@ internal class FlowableScriptTaskTest { return readScriptTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readScriptTask(processObject: BpmnProcessObject): BpmnScriptTask { + private fun readScriptTask(processObject: BpmnFileObject): BpmnScriptTask { return processObject.process.body!!.scriptTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskTest.kt index 914d16565..4086301c4 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser.customservicetasks -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnServiceTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -43,7 +43,7 @@ internal class FlowableServiceTaskTest { task.useLocalScopeForResultVariable!!.shouldBeTrue() // TODO handle deep extension elements - field - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -97,7 +97,7 @@ internal class FlowableServiceTaskTest { return readServiceTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readServiceTask(processObject: BpmnProcessObject): BpmnServiceTask { + private fun readServiceTask(processObject: BpmnFileObject): BpmnServiceTask { return processObject.process.body!!.serviceTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithExtensionElementsTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithExtensionElementsTest.kt index 40947c4b3..da5f07e1b 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithExtensionElementsTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithExtensionElementsTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser.customservicetasks -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnServiceTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -28,7 +28,7 @@ internal class FlowableServiceTaskWithExtensionElementsTest { task.id.shouldBeEqualTo(elementId) task.failedJobRetryTimeCycle.shouldBeEqualTo("R10/PT5M") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.FAILED_JOB_RETRY_CYCLE]!!.value.shouldBeEqualTo(task.failedJobRetryTimeCycle) } @@ -41,7 +41,7 @@ internal class FlowableServiceTaskWithExtensionElementsTest { return readServiceTask(readAndUpdateProcess(parser, FILE, StringValueUpdatedEvent(elementId, property, newValue))) } - private fun readServiceTask(processObject: BpmnProcessObject): BpmnServiceTask { + private fun readServiceTask(processObject: BpmnFileObject): BpmnServiceTask { return processObject.process.body!!.serviceTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithNestedExtensionTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithNestedExtensionTest.kt index 73d5604dc..e0543cd72 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithNestedExtensionTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithNestedExtensionTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser.customservicetasks -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnServiceTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.Property @@ -29,7 +29,7 @@ internal class FlowableServiceTaskWithNestedExtensionTest { task.documentation.shouldBeNull() task.failedJobRetryTimeCycle?.shouldBeEqualTo("R10/PT5M") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -68,7 +68,7 @@ internal class FlowableServiceTaskWithNestedExtensionTest { fun `Add nested extension element`() { val process = readAndUpdateProcess(parser, FILE, StringValueUpdatedEvent(emptyElementId, PropertyType.FIELD_NAME, "new name", propertyIndex = listOf(""))) val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnProcessObject(process.process, process.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val props = BpmnFileObject(process.process, process.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]!!.shouldBeEqualTo(Property("new name", listOf("new name"))) } @@ -83,7 +83,7 @@ internal class FlowableServiceTaskWithNestedExtensionTest { ) ) val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnProcessObject(process.process, process.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val props = BpmnFileObject(process.process, process.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]?.value.shouldBeNull() } @@ -99,7 +99,7 @@ internal class FlowableServiceTaskWithNestedExtensionTest { ) ) val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnProcessObject(process.process, process.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val props = BpmnFileObject(process.process, process.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]!!.shouldBeEqualTo(Property("other new name", listOf("other new name"))) } @@ -114,7 +114,7 @@ internal class FlowableServiceTaskWithNestedExtensionTest { ) ) val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnProcessObject(process.process, process.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val props = BpmnFileObject(process.process, process.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]!!.shouldBeEqualTo(Property("new name", listOf("new name"))) props[PropertyType.FIELD_EXPRESSION]!!.shouldBeEqualTo(Property("expression 1", listOf("new name"))) } @@ -130,7 +130,7 @@ internal class FlowableServiceTaskWithNestedExtensionTest { return readServiceTaskWithExtensions(readAndUpdateProcess(parser, FILE, StringValueUpdatedEvent(elementId, property, newValue, propertyIndex = propertyIndex.split(",")))) } - private fun readServiceTaskWithExtensions(processObject: BpmnProcessObject): BpmnServiceTask { + private fun readServiceTaskWithExtensions(processObject: BpmnFileObject): BpmnServiceTask { return processObject.process.body!!.serviceTask!!.shouldHaveSize(2)[0] } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableShellTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableShellTaskTest.kt index 6a55191a7..204326dce 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableShellTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableShellTaskTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser.customservicetasks -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnShellTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -46,7 +46,7 @@ internal class FlowableShellTaskTest { task.outputVariable.shouldBeEqualTo("OUTPUT_VAR") task.directory.shouldBeEqualTo("/tmp") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -114,7 +114,7 @@ internal class FlowableShellTaskTest { return readShellTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readShellTask(processObject: BpmnProcessObject): BpmnShellTask { + private fun readShellTask(processObject: BpmnFileObject): BpmnShellTask { return processObject.process.body!!.shellTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskTest.kt index 31ada7dc6..d0dc050e1 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser.customservicetasks -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnUserTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -42,7 +42,7 @@ internal class FlowableUserTaskTest { task.priority.shouldBeEqualTo("1") task.skipExpression.shouldBeEqualTo("#{do.skip}") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -97,7 +97,7 @@ internal class FlowableUserTaskTest { return readUserTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readUserTask(processObject: BpmnProcessObject): BpmnUserTask { + private fun readUserTask(processObject: BpmnFileObject): BpmnUserTask { return processObject.process.body!!.userTask!!.shouldHaveSingleItem() } -} \ No newline at end of file +} diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskWithNestedExtensionTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskWithNestedExtensionTest.kt index cb9394800..833a42c1a 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskWithNestedExtensionTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskWithNestedExtensionTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser.customservicetasks -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnUserTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.Property @@ -32,7 +32,7 @@ internal class FlowableUserTaskWithNestedExtensionTest { task.name.shouldBeEqualTo("A user task") task.documentation.shouldBeEqualTo("A user task to do") - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -98,7 +98,7 @@ internal class FlowableUserTaskWithNestedExtensionTest { val task = readEmptyUserTaskWithExtensions(processObject) task.id.shouldBeEqualTo(BpmnElementId("emptyUserTaskId")) - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! props.getAll(PropertyType.FORM_PROPERTY_ID).shouldHaveSize(1) } @@ -106,11 +106,11 @@ internal class FlowableUserTaskWithNestedExtensionTest { return readUserTaskWithExtensions(readAndUpdateProcess(parser, FILE, StringValueUpdatedEvent(elementId, property, newValue, propertyIndex = propertyIndex.split(",")))) } - private fun readUserTaskWithExtensions(processObject: BpmnProcessObject): BpmnUserTask { + private fun readUserTaskWithExtensions(processObject: BpmnFileObject): BpmnUserTask { return processObject.process.body!!.userTask!!.shouldHaveSize(3)[0] } - private fun readEmptyUserTaskWithExtensions(processObject: BpmnProcessObject): BpmnUserTask { + private fun readEmptyUserTaskWithExtensions(processObject: BpmnFileObject): BpmnUserTask { return processObject.process.body!!.userTask!!.shouldHaveSize(3)[2] } } diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnProcessObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt similarity index 90% rename from xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnProcessObject.kt rename to xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index 301eaacd0..aeb1d5417 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnProcessObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -1,5 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.bpmn.api +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnCollaboration import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnProcess import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnProcessBody @@ -11,37 +12,42 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.Property import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType // TODO - move to some implementation module -data class BpmnProcessObject(val process: BpmnProcess, val diagram: List) { +data class BpmnFileObject(val processes: List, val collaborations: List, val diagram: List) { - fun toView(factory: BpmnObjectFactory) : BpmnProcessObjectView { + fun toView(factory: BpmnObjectFactory) : List { val elementByDiagramId = mutableMapOf() val elementByStaticId = mutableMapOf() val propertiesById = mutableMapOf() - fillFor(BpmnElementId(""), factory, process, elementByStaticId, propertiesById) - elementByDiagramId[DiagramElementId(process.id.id)] = process.id + val result = mutableListOf() + for (process in processes) { + fillFor(BpmnElementId(""), factory, process, elementByStaticId, propertiesById) + elementByDiagramId[DiagramElementId(process.id.id)] = process.id - // 1st pass - process.body?.let { extractElementsFromBody(process.id, it, factory, elementByStaticId, propertiesById) } - process.children?.forEach { (id, body) -> extractElementsFromBody(id, body, factory, elementByStaticId, propertiesById)} - // 2nd pass - process.body?.let { reassignParentsBasedOnTargetRef(process.id, it, factory, elementByStaticId, propertiesById) } - process.children?.forEach { (id, body) -> reassignParentsBasedOnTargetRef(id, body, factory, elementByStaticId, propertiesById)} + // 1st pass + process.body?.let { extractElementsFromBody(process.id, it, factory, elementByStaticId, propertiesById) } + process.children?.forEach { (id, body) -> extractElementsFromBody(id, body, factory, elementByStaticId, propertiesById) } + // 2nd pass + process.body?.let { reassignParentsBasedOnTargetRef(process.id, it, factory, elementByStaticId, propertiesById) } + process.children?.forEach { (id, body) -> reassignParentsBasedOnTargetRef(id, body, factory, elementByStaticId, propertiesById) } - diagram.flatMap { it.bpmnPlane.bpmnEdge ?: emptyList()} + diagram.flatMap { it.bpmnPlane.bpmnEdge ?: emptyList() } .filter { null != it.bpmnElement } .forEach { elementByDiagramId[it.id] = it.bpmnElement!! } - diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() } + diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() } .forEach { elementByDiagramId[it.id] = it.bpmnElement } - return BpmnProcessObjectView( + result += BpmnProcessObjectView( process.id, elementByDiagramId, elementByStaticId, propertiesById, diagram - ) + ) + } + + return result } private fun extractElementsFromBody( diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnParser.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnParser.kt index c73e606b9..2f0e99632 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnParser.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnParser.kt @@ -4,11 +4,11 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.events.EventPropagatableToXml interface BpmnParser { - fun parse(input: String): BpmnProcessObject + fun parse(input: String): BpmnFileObject fun validateForErrors(input: String): String? fun validateForWarnings(input: String): String? // Keeping update model simple by following: // https://www.jetbrains.org/intellij/sdk/docs/tutorials/editor_basics/working_with_text.html#safely-replacing-selected-text-in-the-document fun update(input: String, events: List): String -} \ No newline at end of file +} diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnCollaboration.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnCollaboration.kt new file mode 100644 index 000000000..9137dde2e --- /dev/null +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnCollaboration.kt @@ -0,0 +1,23 @@ +package com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn + +data class BpmnCollaboration( + val id: String, + val name: String?, + val participant: List?, + val messageFlow: List?, +) + +data class BpmnParticipant( + val id: String, + val name: String?, + val processRef: String, + val documentation: String? +) + +data class BpmnMessageFlow( + val id: String, + val name: String?, + val documentation: String?, + val sourceRef: String, + val targetRef: String, +) diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnProcess.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnProcess.kt index 13082836b..6585318bb 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnProcess.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnProcess.kt @@ -12,6 +12,7 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.Bp import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.BpmnIntermediateSignalThrowingEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.BpmnIntermediateThrowingEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.gateways.* +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLaneSet import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.* @@ -108,10 +109,11 @@ data class BpmnProcess( // Using flat data approach as CycleAvoidingMappingContext seem to be an issue with @KotlinBuilder // Child BPMN processes in rendering order, flattened, so that i.e. subProcess is flat simple object (id, docs, ...) // and not recursion object - val children: Map? + val children: Map?, + val laneSets: List? ): WithBpmnId { override fun updateBpmnElemId(newId: BpmnElementId): WithBpmnId { return copy(id = newId) } -} \ No newline at end of file +} diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/elements/lanes/Lane.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/elements/lanes/Lane.kt new file mode 100644 index 000000000..ae5e3c460 --- /dev/null +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/elements/lanes/Lane.kt @@ -0,0 +1,15 @@ +package com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes + +data class BpmnLaneSet( + val id: String, + val lanes: List?, +) + +data class BpmnLane( + val id: String, + val name: String?, + val documentation: String?, + val flowNodeRef: List?, +) + +data class BpmnFlowNodeRef(val ref: String) diff --git a/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnParser.kt b/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnParser.kt index 41877f74a..2d0dc3e9a 100644 --- a/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnParser.kt +++ b/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnParser.kt @@ -8,7 +8,7 @@ import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule import com.fasterxml.jackson.dataformat.xml.XmlMapper import com.fasterxml.jackson.module.kotlin.KotlinModule import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnParser -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.BpmnSequenceFlow import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.activities.BpmnCallActivity import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.begin.* @@ -53,7 +53,7 @@ data class PropertyTypeDetails( abstract class BaseBpmnParser: BpmnParser { - abstract override fun parse(input: String): BpmnProcessObject + abstract override fun parse(input: String): BpmnFileObject override fun validateForErrors(input: String): String? { if (!input.contains("BPMNDiagram")) { From 964840e80483da348cf94243d831211389acb4dc Mon Sep 17 00:00:00 2001 From: valb3r Date: Mon, 29 Nov 2021 10:19:17 +0200 Subject: [PATCH 04/41] FBP-224. Fixes to make Camunda parser XML test suite runnable --- .../plugin/activiti/parser/ActivitiParser.kt | 2 +- .../plugin/camunda/parser/CamundaParser.kt | 5 +++-- .../nodes/collaboration/Collaboration.kt | 16 +++++++++++++++- .../camunda/parser/nodes/process/LaneSet.kt | 6 +++++- .../CondExpressionWithoutTypeParseable.kt | 4 ++-- .../bugfix/EmptyCondExpressionParseable.kt | 4 ++-- .../collaboration/CamundaParserPopurriTest.kt | 19 +++++++++++++++++++ .../ComplexGatewayWithExtensionIsParseable.kt | 8 ++++---- ...nkCatchingEventWithExtensionIsParseable.kt | 8 ++++---- .../SendTaskWithExtensionIsParseable.kt | 8 ++++---- .../ServiceTaskWithExtensionIsParseable.kt | 8 ++++---- .../StartEventWithExtensionIsParseable.kt | 8 ++++---- .../TaskWithExtensionIsParseable.kt | 8 ++++---- .../UserTaskWithExtensionIsParseable.kt | 8 ++++---- .../SpecialCaseIncomingOutgoingIsParseable.kt | 16 ++++++++-------- .../plugin/flowable/parser/FlowableParser.kt | 2 +- 16 files changed, 84 insertions(+), 46 deletions(-) create mode 100644 camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/collaboration/CamundaParserPopurriTest.kt diff --git a/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivitiParser.kt b/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivitiParser.kt index a50d65487..b9a4172c2 100644 --- a/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivitiParser.kt +++ b/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivitiParser.kt @@ -121,7 +121,7 @@ open class ActivitiParser : BaseBpmnParser() { val process = dto.processes[0].toElement() val diagrams = dto.diagrams!!.map { it.toElement() } - return BpmnFileObject(process, diagrams) + TODO() } override fun modelNs(): NS { diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt index 6c0f9d13d..f4d009535 100644 --- a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt @@ -132,10 +132,11 @@ class CamundaParser : BaseBpmnParser() { private fun toProcessObject(dto: BpmnFile): BpmnFileObject { // TODO - Multi process support? markSubprocessesAndTransactionsThatHaveExternalDiagramAsCollapsed(dto.processes[0], dto.diagrams!!) - val process = dto.processes[0].toElement() + val processes = dto.processes.map { it.toElement() } + val collaborations = dto.collaborations!!.map { it.toElement() } val diagrams = dto.diagrams!!.map { it.toElement() } - return BpmnFileObject(process, diagrams) + return BpmnFileObject(processes, collaborations, diagrams) } override fun modelNs(): NS { diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt index 5c8cba3f2..c9be19553 100644 --- a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt @@ -3,13 +3,27 @@ package com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.collaboration import com.fasterxml.jackson.annotation.JsonMerge import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnCollaboration +import com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.BpmnMappable +import org.mapstruct.Mapper +import org.mapstruct.factory.Mappers data class Collaboration( @JacksonXmlProperty(isAttribute = true) val id: String, @JacksonXmlProperty(isAttribute = true) val name: String?, @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) val participant: List?, @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) val messageFlow: List?, -) +) : BpmnMappable { + + override fun toElement(): BpmnCollaboration { + return Mappers.getMapper(Mapping::class.java).convertToDto(this) + } + + @Mapper + interface Mapping { + fun convertToDto(input: Collaboration): BpmnCollaboration + } +} data class Participant( @JacksonXmlProperty(isAttribute = true) val id: String, diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/process/LaneSet.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/process/LaneSet.kt index 9aa082d0e..ac5a92269 100644 --- a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/process/LaneSet.kt +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/process/LaneSet.kt @@ -1,8 +1,12 @@ package com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.process import com.fasterxml.jackson.annotation.JsonMerge +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlCData import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText +import com.valb3r.bpmn.intellij.plugin.bpmn.parser.core.CDATA_FIELD data class LaneSet( @@ -17,4 +21,4 @@ data class Lane( @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) val flowNodeRef: List?, ) -data class FlowNodeRef(val ref: String) +data class FlowNodeRef(@JsonProperty(CDATA_FIELD) @JacksonXmlText @JacksonXmlCData val ref: String? = null) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/CondExpressionWithoutTypeParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/CondExpressionWithoutTypeParseable.kt index 477165898..dcc10ba1f 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/CondExpressionWithoutTypeParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/CondExpressionWithoutTypeParseable.kt @@ -22,11 +22,11 @@ internal class CondExpressionWithoutTypeParseable { fun `Sequence flow with empty conditional flow element parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val sequenceFlow = processObject.process.body!!.sequenceFlow!![2] + val sequenceFlow = processObject.processes[0].body!!.sequenceFlow!![2] sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "\${evection.num<3} ")) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("\${evection.num<3} ") diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/EmptyCondExpressionParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/EmptyCondExpressionParseable.kt index f50eb0d5f..3d7b42a83 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/EmptyCondExpressionParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/EmptyCondExpressionParseable.kt @@ -22,11 +22,11 @@ internal class EmptyCondExpressionParseable { fun `Sequence flow with empty conditional flow element parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val sequenceFlow = processObject.process.body!!.sequenceFlow!![0] + val sequenceFlow = processObject.processes[0].body!!.sequenceFlow!![0] sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "")) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("") diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/collaboration/CamundaParserPopurriTest.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/collaboration/CamundaParserPopurriTest.kt new file mode 100644 index 000000000..1b6358c72 --- /dev/null +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/collaboration/CamundaParserPopurriTest.kt @@ -0,0 +1,19 @@ +package com.valb3r.bpmn.intellij.plugin.camunda.parser.collaboration + +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject +import com.valb3r.bpmn.intellij.plugin.camunda.parser.CamundaParser +import com.valb3r.bpmn.intellij.plugin.camunda.parser.asResource +import org.amshove.kluent.shouldNotBeNull +import org.junit.jupiter.api.Test + +internal class CamundaParserCollaborationTest { + + @Test + fun `XML process with swimlane Camunda elements is parseable without error`() { + val processObject: BpmnFileObject? + + processObject = CamundaParser().parse("swimlanes.bpmn".asResource()!!) + + processObject.shouldNotBeNull() + } +} diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ComplexGatewayWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ComplexGatewayWithExtensionIsParseable.kt index 95b7aaa48..5c5bcf410 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ComplexGatewayWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ComplexGatewayWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class ComplexGatewayWithExtensionIsParseable { task.name.shouldBeEqualTo("Single complex gateway") task.documentation.shouldBeEqualTo("Single complex gateway docs") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -53,7 +53,7 @@ internal class ComplexGatewayWithExtensionIsParseable { task.name.shouldBeEqualTo("Multi complex gateway") task.documentation.shouldBeEqualTo("Mutli complex gateway docs") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -71,7 +71,7 @@ internal class ComplexGatewayWithExtensionIsParseable { } private fun readSingleIntermediateLinkCatchingEventSingleProp(processObject: BpmnFileObject): BpmnComplexGateway { - return processObject.process.body!!.complexGateway!!.shouldHaveSize(2)[0] + return processObject.processes[0].body!!.complexGateway!!.shouldHaveSize(2)[0] } private fun readAndUpdateMultiPropIntermediateLinkCatchingEvent(property: PropertyType, newValue: String, propertyIndex: String = ""): BpmnComplexGateway { @@ -79,6 +79,6 @@ internal class ComplexGatewayWithExtensionIsParseable { } private fun readStartEventMultiIntermediateLinkCatchingEvent(processObject: BpmnFileObject): BpmnComplexGateway { - return processObject.process.body!!.complexGateway!!.shouldHaveSize(2)[1] + return processObject.processes[0].body!!.complexGateway!!.shouldHaveSize(2)[1] } } diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/IntermediateLinkCatchingEventWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/IntermediateLinkCatchingEventWithExtensionIsParseable.kt index 6aad52103..58bd19c4e 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/IntermediateLinkCatchingEventWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/IntermediateLinkCatchingEventWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class IntermediateLinkCatchingEventWithExtensionIsParseable { task.name.shouldBeEqualTo("Link intermediate cache event") task.documentation.shouldBeEqualTo("A link intermediate catch event") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -53,7 +53,7 @@ internal class IntermediateLinkCatchingEventWithExtensionIsParseable { task.name.shouldBeEqualTo("Link intermediate cache event") task.documentation.shouldBeEqualTo("A link intermediate catch event") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -71,7 +71,7 @@ internal class IntermediateLinkCatchingEventWithExtensionIsParseable { } private fun readSingleIntermediateLinkCatchingEventSingleProp(processObject: BpmnFileObject): BpmnIntermediateLinkCatchingEvent { - return processObject.process.body!!.intermediateLinkCatchingEvent!!.shouldHaveSize(2)[0] + return processObject.processes[0].body!!.intermediateLinkCatchingEvent!!.shouldHaveSize(2)[0] } private fun readAndUpdateMultiPropIntermediateLinkCatchingEvent(property: PropertyType, newValue: String, propertyIndex: String = ""): BpmnIntermediateLinkCatchingEvent { @@ -79,6 +79,6 @@ internal class IntermediateLinkCatchingEventWithExtensionIsParseable { } private fun readStartEventMultiIntermediateLinkCatchingEvent(processObject: BpmnFileObject): BpmnIntermediateLinkCatchingEvent { - return processObject.process.body!!.intermediateLinkCatchingEvent!!.shouldHaveSize(2)[1] + return processObject.processes[0].body!!.intermediateLinkCatchingEvent!!.shouldHaveSize(2)[1] } } diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/SendTaskWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/SendTaskWithExtensionIsParseable.kt index 95bbfb0be..866c15a8b 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/SendTaskWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/SendTaskWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class SendTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Single send task") task.documentation.shouldBeEqualTo("Single send task docs") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -53,7 +53,7 @@ internal class SendTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Multi send task") task.documentation.shouldBeEqualTo("Multi send task docs") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -71,7 +71,7 @@ internal class SendTaskWithExtensionIsParseable { } private fun readSingleIntermediateLinkCatchingEventSingleProp(processObject: BpmnFileObject): BpmnSendTask { - return processObject.process.body!!.sendTask!!.shouldHaveSize(2)[0] + return processObject.processes[0].body!!.sendTask!!.shouldHaveSize(2)[0] } private fun readAndUpdateMultiPropIntermediateLinkCatchingEvent(property: PropertyType, newValue: String, propertyIndex: String = ""): BpmnSendTask { @@ -79,6 +79,6 @@ internal class SendTaskWithExtensionIsParseable { } private fun readStartEventMultiIntermediateLinkCatchingEvent(processObject: BpmnFileObject): BpmnSendTask { - return processObject.process.body!!.sendTask!!.shouldHaveSize(2)[1] + return processObject.processes[0].body!!.sendTask!!.shouldHaveSize(2)[1] } } diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ServiceTaskWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ServiceTaskWithExtensionIsParseable.kt index 14e786638..b016a903a 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ServiceTaskWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ServiceTaskWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class ServiceTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Service task with single extension") task.documentation.shouldBeEqualTo("Some docs") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -76,7 +76,7 @@ internal class ServiceTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Service task with multiple extensions") task.documentation.shouldBeEqualTo("Some docs") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -124,7 +124,7 @@ internal class ServiceTaskWithExtensionIsParseable { } private fun readStartEventSingleProp(processObject: BpmnFileObject): BpmnServiceTask { - return processObject.process.body!!.serviceTask!!.shouldHaveSize(2)[0] + return processObject.processes[0].body!!.serviceTask!!.shouldHaveSize(2)[0] } private fun readAndUpdateMultiPropTask(property: PropertyType, newValue: String, propertyIndex: String = ""): BpmnServiceTask { @@ -132,6 +132,6 @@ internal class ServiceTaskWithExtensionIsParseable { } private fun readStartEventMultiProp(processObject: BpmnFileObject): BpmnServiceTask { - return processObject.process.body!!.serviceTask!!.shouldHaveSize(2)[1] + return processObject.processes[0].body!!.serviceTask!!.shouldHaveSize(2)[1] } } diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/StartEventWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/StartEventWithExtensionIsParseable.kt index b8d6ba5bc..7617206f6 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/StartEventWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/StartEventWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class StartEventWithExtensionIsParseable { task.name.shouldBeEqualTo("Start event (single)") task.documentation.shouldBeEqualTo("As full as possible start event\nmultiline") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -105,7 +105,7 @@ internal class StartEventWithExtensionIsParseable { task.name.shouldBeEqualTo("Start event(multi)") task.documentation.shouldBeEqualTo("As full as possible start event\nmultiline") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -182,7 +182,7 @@ internal class StartEventWithExtensionIsParseable { } private fun readStartEventSingleProp(processObject: BpmnFileObject): BpmnStartEvent { - return processObject.process.body!!.startEvent!!.shouldHaveSize(2)[0] + return processObject.processes[0].body!!.startEvent!!.shouldHaveSize(2)[0] } private fun readAndUpdateMultiPropTask(property: PropertyType, newValue: String, propertyIndex: String = ""): BpmnStartEvent { @@ -190,6 +190,6 @@ internal class StartEventWithExtensionIsParseable { } private fun readStartEventMultiProp(processObject: BpmnFileObject): BpmnStartEvent { - return processObject.process.body!!.startEvent!!.shouldHaveSize(2)[1] + return processObject.processes[0].body!!.startEvent!!.shouldHaveSize(2)[1] } } diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/TaskWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/TaskWithExtensionIsParseable.kt index 354ede768..db8d84193 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/TaskWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/TaskWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class TaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Simple task") task.documentation.shouldBeEqualTo("Simple task docs") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -53,7 +53,7 @@ internal class TaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Simple multi task") task.documentation.shouldBeEqualTo("Simple multi task docs") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -71,7 +71,7 @@ internal class TaskWithExtensionIsParseable { } private fun readSingleIntermediateLinkCatchingEventSingleProp(processObject: BpmnFileObject): BpmnTask { - return processObject.process.body!!.task!!.shouldHaveSize(2)[0] + return processObject.processes[0].body!!.task!!.shouldHaveSize(2)[0] } private fun readAndUpdateMultiPropIntermediateLinkCatchingEvent(property: PropertyType, newValue: String, propertyIndex: String = ""): BpmnTask { @@ -79,6 +79,6 @@ internal class TaskWithExtensionIsParseable { } private fun readStartEventMultiIntermediateLinkCatchingEvent(processObject: BpmnFileObject): BpmnTask { - return processObject.process.body!!.task!!.shouldHaveSize(2)[1] + return processObject.processes[0].body!!.task!!.shouldHaveSize(2)[1] } } diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/UserTaskWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/UserTaskWithExtensionIsParseable.kt index 82c59cb08..9a5e8c33a 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/UserTaskWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/UserTaskWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class UserTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("User task with single extension") task.documentation.shouldBeEqualTo("Some docs") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -105,7 +105,7 @@ internal class UserTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("User task with multiple extension") task.documentation.shouldBeEqualTo("Some docs") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -182,7 +182,7 @@ internal class UserTaskWithExtensionIsParseable { } private fun readStartEventSingleProp(processObject: BpmnFileObject): BpmnUserTask { - return processObject.process.body!!.userTask!!.shouldHaveSize(2)[0] + return processObject.processes[0].body!!.userTask!!.shouldHaveSize(2)[0] } private fun readAndUpdateMultiPropTask(property: PropertyType, newValue: String, propertyIndex: String = ""): BpmnUserTask { @@ -190,6 +190,6 @@ internal class UserTaskWithExtensionIsParseable { } private fun readStartEventMultiProp(processObject: BpmnFileObject): BpmnUserTask { - return processObject.process.body!!.userTask!!.shouldHaveSize(2)[1] + return processObject.processes[0].body!!.userTask!!.shouldHaveSize(2)[1] } } diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/specialcase/SpecialCaseIncomingOutgoingIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/specialcase/SpecialCaseIncomingOutgoingIsParseable.kt index 08408ebd4..71d2c579d 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/specialcase/SpecialCaseIncomingOutgoingIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/specialcase/SpecialCaseIncomingOutgoingIsParseable.kt @@ -31,9 +31,9 @@ internal class SpecialCaseIncomingOutgoingIsParseable { fun `Service task (single props) with incoming-outgoing is parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val startEventProps = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[singleStartEvent]!! - val serviceTaskProps = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[singleServiceTask]!! - val endEventProps = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[singleEndEvent]!! + val startEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[singleStartEvent]!! + val serviceTaskProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[singleServiceTask]!! + val endEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[singleEndEvent]!! startEventProps[PropertyType.BPMN_INCOMING]?.value?.shouldBeNull() startEventProps[PropertyType.BPMN_OUTGOING]?.shouldBeEqualTo(Property("flowFromStartEvent", listOf("flowFromStartEvent"))) @@ -61,9 +61,9 @@ internal class SpecialCaseIncomingOutgoingIsParseable { fun `Service task (multiple props) with incoming-outgoing is parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val startEventProps = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[multiStartEvent]!! - val serviceTaskProps = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[multiServiceTask]!! - val endEventProps = BpmnFileObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[multiEndEvent]!! + val startEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[multiStartEvent]!! + val serviceTaskProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[multiServiceTask]!! + val endEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[multiEndEvent]!! startEventProps[PropertyType.BPMN_INCOMING]?.value?.shouldBeNull() startEventProps.getAll(PropertyType.BPMN_OUTGOING).shouldBeEqualTo(listOf(Property("fromStart1", listOf("fromStart1")), Property("fromStart2", listOf("fromStart2")))) @@ -92,7 +92,7 @@ internal class SpecialCaseIncomingOutgoingIsParseable { } private fun readStartEventSingleProp(processObject: BpmnFileObject): BpmnServiceTask { - return processObject.process.body!!.serviceTask!!.shouldHaveSize(2)[0] + return processObject.processes[0].body!!.serviceTask!!.shouldHaveSize(2)[0] } private fun readAndUpdateMultiPropTask(property: PropertyType, newValue: String, propertyIndex: String = ""): BpmnServiceTask { @@ -100,6 +100,6 @@ internal class SpecialCaseIncomingOutgoingIsParseable { } private fun readStartEventMultiProp(processObject: BpmnFileObject): BpmnServiceTask { - return processObject.process.body!!.serviceTask!!.shouldHaveSize(2)[1] + return processObject.processes[0].body!!.serviceTask!!.shouldHaveSize(2)[1] } } diff --git a/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/FlowableParser.kt b/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/FlowableParser.kt index bc3fca3b7..89c43809a 100644 --- a/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/FlowableParser.kt +++ b/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/FlowableParser.kt @@ -127,7 +127,7 @@ class FlowableParser : BaseBpmnParser() { val process = dto.processes[0].toElement() val diagrams = dto.diagrams!!.map { it.toElement() } - return BpmnFileObject(process, diagrams) + TODO() } override fun modelNs(): NS { From d631760a62f823de80b6d5b28f539284215ca6ca Mon Sep 17 00:00:00 2001 From: valb3r Date: Mon, 29 Nov 2021 11:40:36 +0200 Subject: [PATCH 05/41] FBP-224. Camunda swimlane parsing test - initial phase --- .../plugin/camunda/parser/nodes/CamundaXml.kt | 18 ++- .../nodes/collaboration/Collaboration.kt | 6 +- .../CamundaParserCollaborationTest.kt | 119 ++++++++++++++++++ .../collaboration/CamundaParserPopurriTest.kt | 19 --- .../plugin/bpmn/api/bpmn/BpmnCollaboration.kt | 6 +- 5 files changed, 141 insertions(+), 27 deletions(-) create mode 100644 camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/collaboration/CamundaParserCollaborationTest.kt delete mode 100644 camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/collaboration/CamundaParserPopurriTest.kt diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/CamundaXml.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/CamundaXml.kt index 4ba525b5f..590ed93e8 100644 --- a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/CamundaXml.kt +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/CamundaXml.kt @@ -14,14 +14,15 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.Bp import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.BpmnIntermediateNoneThrowingEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.BpmnIntermediateSignalThrowingEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.BpmnIntermediateThrowingEvent +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLaneSet import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.BpmnEventSubprocess import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.BpmnSubProcess import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElement import com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.collaboration.Collaboration -import com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.process.* import com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.diagram.DiagramElementIdMapper import com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.diagram.Plane +import com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.process.* import org.mapstruct.Mapper import org.mapstruct.Mapping import org.mapstruct.Mappings @@ -187,7 +188,8 @@ class ProcessNode : BpmnMappable, ProcessBody() { return result.copy( body = mappedBody, - children = extractNestedProcesses(this) + children = extractNestedProcesses(this), + laneSets = laneSet?.map { mapLaneSet(it) } ?: emptyList() ) } @@ -216,6 +218,11 @@ class ProcessNode : BpmnMappable, ProcessBody() { return fillBodyWithDedicatedElements(bodyMapper.convertToDto(body)) } + private fun mapLaneSet(laneSet: LaneSet): BpmnLaneSet { + val laneMapper = cachedMapper(LaneSetMapping::class.java) + return laneMapper.convertToDto(laneSet) + } + private fun fillBodyWithDedicatedElements(processBody: BpmnProcessBody): BpmnProcessBody { var body = processBody body = applySubprocessCustomizationByEventTrigger(body) @@ -476,6 +483,13 @@ class ProcessNode : BpmnMappable, ProcessBody() { fun convertToDto(input: ProcessBody): BpmnProcessBody } + @Mapper + interface LaneSetMapping { + + @Mapping(source = "lane", target = "lanes") + fun convertToDto(input: LaneSet): BpmnLaneSet + } + @Mapper interface EventSubProcessMapper : SubProcessMapper diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt index c9be19553..183f1bdce 100644 --- a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt @@ -28,7 +28,7 @@ data class Collaboration( data class Participant( @JacksonXmlProperty(isAttribute = true) val id: String, @JacksonXmlProperty(isAttribute = true) val name: String?, - @JacksonXmlProperty(isAttribute = true) val processRef: String, + @JacksonXmlProperty(isAttribute = true) val processRef: String?, val documentation: String? ) @@ -36,7 +36,7 @@ data class MessageFlow( @JacksonXmlProperty(isAttribute = true) val id: String, @JacksonXmlProperty(isAttribute = true) val name: String?, val documentation: String?, - @JacksonXmlProperty(isAttribute = true) val sourceRef: String, - @JacksonXmlProperty(isAttribute = true) val targetRef: String, + @JacksonXmlProperty(isAttribute = true) val sourceRef: String?, + @JacksonXmlProperty(isAttribute = true) val targetRef: String?, ) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/collaboration/CamundaParserCollaborationTest.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/collaboration/CamundaParserCollaborationTest.kt new file mode 100644 index 000000000..47b89215b --- /dev/null +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/collaboration/CamundaParserCollaborationTest.kt @@ -0,0 +1,119 @@ +package com.valb3r.bpmn.intellij.plugin.camunda.parser.collaboration + +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject +import com.valb3r.bpmn.intellij.plugin.camunda.parser.CamundaObjectFactory +import com.valb3r.bpmn.intellij.plugin.camunda.parser.CamundaParser +import com.valb3r.bpmn.intellij.plugin.camunda.parser.asResource +import org.amshove.kluent.shouldBeEqualTo +import org.amshove.kluent.shouldBeNull +import org.amshove.kluent.shouldHaveSize +import org.junit.jupiter.api.Test + +internal class CamundaParserCollaborationTest { + + @Test + fun `XML process with swimlane Camunda elements is parseable without error`() { + val processObject: BpmnFileObject? + + processObject = CamundaParser().parse("swimlanes.bpmn".asResource()!!) + + assertCollaborations(processObject) + + processObject.processes.shouldHaveSize(3) + assertProcess0(processObject) + assertProcess1(processObject) + assertProcess2(processObject) + + val allProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()) + } + + private fun assertCollaborations(processObject: BpmnFileObject) { + processObject.collaborations.shouldHaveSize(1) + processObject.collaborations[0].participant!!.shouldHaveSize(3) + processObject.collaborations[0].id.shouldBeEqualTo("laneInParticipant2") + processObject.collaborations[0].participant!![0].id.shouldBeEqualTo("participant") + processObject.collaborations[0].participant!![0].name.shouldBeEqualTo("participant1") + processObject.collaborations[0].participant!![0].processRef.shouldBeEqualTo("Process_1f2g5n1") + processObject.collaborations[0].participant!![0].documentation.shouldBeNull() + processObject.collaborations[0].participant!![1].id.shouldBeEqualTo("participant2") + processObject.collaborations[0].participant!![1].name.shouldBeEqualTo("Participant 2") + processObject.collaborations[0].participant!![1].processRef.shouldBeEqualTo("Process_07fjg5b") + processObject.collaborations[0].participant!![1].documentation.shouldBeEqualTo("Some docs") + processObject.collaborations[0].participant!![2].id.shouldBeEqualTo("participant3") + processObject.collaborations[0].participant!![2].name.shouldBeEqualTo("Participant 3") + processObject.collaborations[0].participant!![2].processRef.shouldBeEqualTo("Process_1yzct8l") + processObject.collaborations[0].messageFlow!!.shouldHaveSize(5) + processObject.collaborations[0].messageFlow!![0].id.shouldBeEqualTo("participant2ToParticipant1Flow") + processObject.collaborations[0].messageFlow!![0].name?.shouldBeEqualTo("Participant 2 to participant 1") + processObject.collaborations[0].messageFlow!![0].documentation?.shouldBeEqualTo("Docs") + processObject.collaborations[0].messageFlow!![0].sourceRef?.shouldBeEqualTo("task1Participant2") + processObject.collaborations[0].messageFlow!![0].targetRef?.shouldBeEqualTo("task1") + processObject.collaborations[0].messageFlow!![1].id.shouldBeEqualTo("participant1ToParticipant2Flow") + processObject.collaborations[0].messageFlow!![1].name?.shouldBeEqualTo("Participant 1 to Participant 2 flow") + processObject.collaborations[0].messageFlow!![1].documentation?.shouldBeEqualTo("Some docs") + processObject.collaborations[0].messageFlow!![1].sourceRef?.shouldBeEqualTo("task2") + processObject.collaborations[0].messageFlow!![1].targetRef?.shouldBeEqualTo("task2Participant2") + processObject.collaborations[0].messageFlow!![2].id.shouldBeEqualTo("Flow_1873mlb") + processObject.collaborations[0].messageFlow!![2].name?.shouldBeNull() + processObject.collaborations[0].messageFlow!![2].documentation?.shouldBeNull() + processObject.collaborations[0].messageFlow!![2].sourceRef?.shouldBeEqualTo("task4participant3") + processObject.collaborations[0].messageFlow!![2].targetRef?.shouldBeEqualTo("participant2") + processObject.collaborations[0].messageFlow!![3].id.shouldBeEqualTo("Flow_1bq8rro") + processObject.collaborations[0].messageFlow!![3].name?.shouldBeNull() + processObject.collaborations[0].messageFlow!![3].documentation?.shouldBeNull() + processObject.collaborations[0].messageFlow!![3].sourceRef?.shouldBeEqualTo("task3Participant2") + processObject.collaborations[0].messageFlow!![3].targetRef?.shouldBeEqualTo("participant3") + processObject.collaborations[0].messageFlow!![4].id.shouldBeEqualTo("task3Participant2ToParticipant1Flow") + processObject.collaborations[0].messageFlow!![4].name?.shouldBeEqualTo("Task 3 Participant 2 to Participant 1 flow") + processObject.collaborations[0].messageFlow!![4].documentation?.shouldBeNull() + processObject.collaborations[0].messageFlow!![4].sourceRef?.shouldBeEqualTo("task3Participant2") + processObject.collaborations[0].messageFlow!![4].targetRef?.shouldBeEqualTo("participant") + } + + private fun assertProcess0(processObject: BpmnFileObject) { + processObject.processes[0].id.id.shouldBeEqualTo("Process_1f2g5n1") + processObject.processes[0].laneSets!!.shouldHaveSize(1) + processObject.processes[0].laneSets!![0].id.shouldBeEqualTo("LaneSet_050m5um") + processObject.processes[0].laneSets!![0].lanes!!.shouldHaveSize(3) + processObject.processes[0].laneSets!![0].lanes!![0].id.shouldBeEqualTo("lane1") + processObject.processes[0].laneSets!![0].lanes!![0].name.shouldBeEqualTo("Lane 1") + processObject.processes[0].laneSets!![0].lanes!![0].documentation.shouldBeEqualTo("Lane 1 docs") + processObject.processes[0].laneSets!![0].lanes!![0].flowNodeRef!!.shouldHaveSize(2) + processObject.processes[0].laneSets!![0].lanes!![0].flowNodeRef!![0].ref.shouldBeEqualTo("startEvent") + processObject.processes[0].laneSets!![0].lanes!![0].flowNodeRef!![1].ref.shouldBeEqualTo("endEvent") + processObject.processes[0].laneSets!![0].lanes!![1].id.shouldBeEqualTo("Lane2") + processObject.processes[0].laneSets!![0].lanes!![1].name.shouldBeEqualTo("Lane 2") + processObject.processes[0].laneSets!![0].lanes!![1].documentation.shouldBeEqualTo("Lane 2 docs") + processObject.processes[0].laneSets!![0].lanes!![1].flowNodeRef!!.shouldHaveSize(2) + processObject.processes[0].laneSets!![0].lanes!![1].flowNodeRef!![0].ref.shouldBeEqualTo("task1") + processObject.processes[0].laneSets!![0].lanes!![1].flowNodeRef!![1].ref.shouldBeEqualTo("task2") + processObject.processes[0].laneSets!![0].lanes!![2].id.shouldBeEqualTo("lane3") + processObject.processes[0].laneSets!![0].lanes!![2].name.shouldBeEqualTo("Lane3") + processObject.processes[0].laneSets!![0].lanes!![2].documentation.shouldBeEqualTo("Lane 3 docs") + processObject.processes[0].laneSets!![0].lanes!![2].flowNodeRef!!.shouldHaveSize(1) + processObject.processes[0].laneSets!![0].lanes!![2].flowNodeRef!![0].ref.shouldBeEqualTo("exclusiveGateway") + } + + private fun assertProcess1(processObject: BpmnFileObject) { + processObject.processes[1].id.id.shouldBeEqualTo("Process_07fjg5b") + processObject.processes[1].laneSets!!.shouldHaveSize(1) + processObject.processes[1].laneSets!![0].id.shouldBeEqualTo("LaneSet_137rl2x") + processObject.processes[1].laneSets!![0].lanes!!.shouldHaveSize(2) + processObject.processes[1].laneSets!![0].lanes!![0].id.shouldBeEqualTo("lane1Participant2") + processObject.processes[1].laneSets!![0].lanes!![0].name.shouldBeEqualTo("Lane 1 Participant 2") + processObject.processes[1].laneSets!![0].lanes!![0].documentation.shouldBeNull() + processObject.processes[1].laneSets!![0].lanes!![0].flowNodeRef!!.shouldHaveSize(2) + processObject.processes[1].laneSets!![0].lanes!![0].flowNodeRef!![0].ref.shouldBeEqualTo("task1Participant2") + processObject.processes[1].laneSets!![0].lanes!![0].flowNodeRef!![1].ref.shouldBeEqualTo("task2Participant2") + processObject.processes[1].laneSets!![0].lanes!![1].id.shouldBeEqualTo("lane2Participant2") + processObject.processes[1].laneSets!![0].lanes!![1].name.shouldBeEqualTo("Lane 2 participant 2") + processObject.processes[1].laneSets!![0].lanes!![1].documentation.shouldBeNull() + processObject.processes[1].laneSets!![0].lanes!![1].flowNodeRef!!.shouldHaveSize(1) + processObject.processes[1].laneSets!![0].lanes!![1].flowNodeRef!![0].ref.shouldBeEqualTo("task3Participant2") + } + + private fun assertProcess2(processObject: BpmnFileObject) { + processObject.processes[2].id.id.shouldBeEqualTo("Process_1yzct8l") + processObject.processes[2].laneSets!!.shouldHaveSize(0) + } +} diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/collaboration/CamundaParserPopurriTest.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/collaboration/CamundaParserPopurriTest.kt deleted file mode 100644 index 1b6358c72..000000000 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/collaboration/CamundaParserPopurriTest.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.valb3r.bpmn.intellij.plugin.camunda.parser.collaboration - -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject -import com.valb3r.bpmn.intellij.plugin.camunda.parser.CamundaParser -import com.valb3r.bpmn.intellij.plugin.camunda.parser.asResource -import org.amshove.kluent.shouldNotBeNull -import org.junit.jupiter.api.Test - -internal class CamundaParserCollaborationTest { - - @Test - fun `XML process with swimlane Camunda elements is parseable without error`() { - val processObject: BpmnFileObject? - - processObject = CamundaParser().parse("swimlanes.bpmn".asResource()!!) - - processObject.shouldNotBeNull() - } -} diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnCollaboration.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnCollaboration.kt index 9137dde2e..2af737152 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnCollaboration.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnCollaboration.kt @@ -10,7 +10,7 @@ data class BpmnCollaboration( data class BpmnParticipant( val id: String, val name: String?, - val processRef: String, + val processRef: String?, val documentation: String? ) @@ -18,6 +18,6 @@ data class BpmnMessageFlow( val id: String, val name: String?, val documentation: String?, - val sourceRef: String, - val targetRef: String, + val sourceRef: String?, + val targetRef: String?, ) From c8416df17c7e91370871b8410c9a3df3e132f3e9 Mon Sep 17 00:00:00 2001 From: valb3r Date: Thu, 2 Dec 2021 10:04:30 +0200 Subject: [PATCH 06/41] FBP-224. Rename properties according to their scope --- .../intellij/plugin/core/tests/BaseUiTest.kt | 7 ++-- .../actions/ElementRemoveActionHandler.kt | 4 +-- .../copypaste/CopyPasteActionHandler.kt | 11 +++--- .../core/properties/PropertiesVisualizer.kt | 2 +- .../intellij/plugin/core/render/Canvas.kt | 10 +++--- .../core/render/DefaultBpmnProcessRenderer.kt | 10 +++--- .../elements/anchors/PhysicalWaypoint.kt | 8 ++--- .../elements/edges/BaseEdgeRenderElement.kt | 14 ++++---- .../elements/edges/EdgeRenderElement.kt | 6 ++-- .../elements/shapes/ShapeRenderElement.kt | 18 +++++----- .../plugin/core/state/CurrentState.kt | 36 +++++++++---------- .../plugin/BoundaryEventAttachTest.kt | 26 +++++++------- .../plugin/StateBasedPropertyUpdateTest.kt | 12 +++---- .../intellij/plugin/UiEditorLightE2ETest.kt | 6 ++-- camunda-intellij-plugin/build.gradle | 6 +++- .../CondExpressionWithoutTypeParseable.kt | 2 +- .../bugfix/EmptyCondExpressionParseable.kt | 2 +- .../ComplexGatewayWithExtensionIsParseable.kt | 4 +-- ...nkCatchingEventWithExtensionIsParseable.kt | 4 +-- .../SendTaskWithExtensionIsParseable.kt | 4 +-- .../ServiceTaskWithExtensionIsParseable.kt | 4 +-- .../StartEventWithExtensionIsParseable.kt | 4 +-- .../TaskWithExtensionIsParseable.kt | 4 +-- .../UserTaskWithExtensionIsParseable.kt | 4 +-- .../SpecialCaseIncomingOutgoingIsParseable.kt | 12 +++---- .../plugin/bpmn/api/BpmnFileObject.kt | 18 +++++----- 26 files changed, 119 insertions(+), 119 deletions(-) diff --git a/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt b/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt index 59ff8cbf6..abd51c32a 100644 --- a/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt +++ b/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt @@ -49,7 +49,6 @@ import java.nio.charset.StandardCharsets import java.util.* import javax.swing.Icon import javax.swing.JButton -import javax.swing.JComponent import javax.swing.JTable import javax.swing.plaf.basic.BasicArrowButton import javax.swing.table.TableColumn @@ -237,7 +236,7 @@ abstract class BaseUiTest { clickOnId(diagramElementId) propertiesVisualizer(project).visualize( newElementsFactory(project), - currentStateProvider(project).currentState().elemPropertiesByStaticElementId, + currentStateProvider(project).currentState().processElemPropertiesByStaticElementId, elementId ) whenever(textFieldsConstructed[id]!!.text).thenReturn(newId) @@ -248,7 +247,7 @@ abstract class BaseUiTest { val id = Pair(elementId, PropertyType.ID) propertiesVisualizer(project).visualize( newElementsFactory(project), - currentStateProvider(project).currentState().elemPropertiesByStaticElementId, + currentStateProvider(project).currentState().processElemPropertiesByStaticElementId, elementId ) whenever(textFieldsConstructed[id]!!.text).thenReturn(newId) @@ -679,4 +678,4 @@ abstract class BaseUiTest { val txt = BaseUiTest::class.java.classLoader.getResource(this)?.readText(StandardCharsets.UTF_8)!! return SvgIcon(txt, Hashing.goodFastHash(64).hashString(txt, StandardCharsets.UTF_8).asLong()) } -} \ No newline at end of file +} diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/ElementRemoveActionHandler.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/ElementRemoveActionHandler.kt index bd48851d9..7424e5f43 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/ElementRemoveActionHandler.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/ElementRemoveActionHandler.kt @@ -28,9 +28,9 @@ class ElementRemoveActionHandler(private val project: Project) { updateEventsRegistry(project).addElementRemovedEvent( targetIds.map { DiagramElementRemovedEvent(it) }, - targetIds.mapNotNull { state.currentState.elementByDiagramId[it] }.map { BpmnElementRemovedEvent(it) } + targetIds.mapNotNull { state.currentState.allElementsByDiagramId[it] }.map { BpmnElementRemovedEvent(it) } ) currentCanvas(project).repaint() } -} \ No newline at end of file +} diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/copypaste/CopyPasteActionHandler.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/copypaste/CopyPasteActionHandler.kt index 57b0df5ed..e02ca18fb 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/copypaste/CopyPasteActionHandler.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/copypaste/CopyPasteActionHandler.kt @@ -3,7 +3,6 @@ package com.valb3r.bpmn.intellij.plugin.core.actions.copypaste import com.fasterxml.jackson.annotation.JsonAutoDetect import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.module.kotlin.KotlinModule import com.fasterxml.jackson.module.kotlin.registerKotlinModule import com.google.common.annotations.VisibleForTesting import com.intellij.openapi.project.Project @@ -90,7 +89,7 @@ class CopyPasteActionHandler(private val clipboard: SystemClipboard) { val alreadyRemovedBpmn = mutableSetOf() val elemsToDelete = elementIdsToCopyOrCut(ctx) - .mapNotNull { ctx.currentState.elementByDiagramId[it] } + .mapNotNull { ctx.currentState.allElementsByDiagramId[it] } .filter { if (alreadyRemovedBpmn.contains(it)) false else { alreadyRemovedBpmn += it; true } } .mapNotNull { elementsById[it] } @@ -264,7 +263,7 @@ class CopyPasteActionHandler(private val clipboard: SystemClipboard) { private fun ensureRootElementsComeFirst(idsToCopy: MutableList, ctx: RenderState, elementsById: Map): MutableList { return idsToCopy - .sortedByDescending { ctx.currentState.elementByDiagramId[it]?.let {id -> elementsById[id] }?.zIndex() ?: 0 } + .sortedByDescending { ctx.currentState.allElementsByDiagramId[it]?.let { id -> elementsById[id] }?.zIndex() ?: 0 } .toMutableList() } @@ -293,9 +292,9 @@ class CopyPasteActionHandler(private val clipboard: SystemClipboard) { idReplacements: MutableMap, processedElementIds: MutableSet ) { - val bpmnId = ctx.currentState.elementByDiagramId[diagramId] ?: return - val withParentId = ctx.currentState.elementByBpmnId[bpmnId] ?: return - val props = ctx.currentState.elemPropertiesByStaticElementId[bpmnId] ?: return + val bpmnId = ctx.currentState.allElementsByDiagramId[diagramId] ?: return + val withParentId = ctx.currentState.processElementByBpmnId[bpmnId] ?: return + val props = ctx.currentState.processElemPropertiesByStaticElementId[bpmnId] ?: return if (processedElementIds.contains(bpmnId)) { return } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/properties/PropertiesVisualizer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/properties/PropertiesVisualizer.kt index 4be0d91e3..843d13874 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/properties/PropertiesVisualizer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/properties/PropertiesVisualizer.kt @@ -302,7 +302,7 @@ class PropertiesVisualizer( val supportedTypes = newElemsProvider.propertyTypes().map { it.name }.toSet() events += type.actionUiOnlyResult.filter { supportedTypes.contains(it.propertyType) }.map { UiOnlyValueAddedEvent(bpmnElementId, propertyType(it.propertyType), it.valuePattern, propertyIndex = propertyIndex + it.uiOnlyaddedIndex) } updateEventsRegistry(project).addEvents(events) - visualize(newElementsFactory(project), currentStateProvider(project).currentState().elemPropertiesByStaticElementId, bpmnElementId, expandedElems.toSet()) + visualize(newElementsFactory(project), currentStateProvider(project).currentState().processElemPropertiesByStaticElementId, bpmnElementId, expandedElems.toSet()) } } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt index b3a6a340b..00c5a121a 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt @@ -417,13 +417,13 @@ class Canvas(private val project: Project, private val settings: CanvasConstants val elementIdForPropertiesTable = propertiesForElement.firstOrNull() val state = stateProvider.currentState() state - .elementByDiagramId[elementIdForPropertiesTable] + .allElementsByDiagramId[elementIdForPropertiesTable] ?.let { elemId -> - state.elemPropertiesByStaticElementId[elemId]?.let { + state.processElemPropertiesByStaticElementId[elemId]?.let { propsVisualizer?.visualize( newElementsFactory( project - ), state.elemPropertiesByStaticElementId, elemId + ), state.processElemPropertiesByStaticElementId, elemId ) } } ?: propsVisualizer?.clear() @@ -472,8 +472,8 @@ class Canvas(private val project: Project, private val settings: CanvasConstants continue } - val bpmnId = setOf(stateProvider.currentState().elementByDiagramId[elem.first], elem.second.bpmnElementId).filterNotNull().firstOrNull() ?: continue - val bpmnElem = stateProvider.currentState().elementByBpmnId[bpmnId] + val bpmnId = setOf(stateProvider.currentState().allElementsByDiagramId[elem.first], elem.second.bpmnElementId).filterNotNull().firstOrNull() ?: continue + val bpmnElem = stateProvider.currentState().processElementByBpmnId[bpmnId] if (bpmnElem?.element is BpmnSequenceFlow) { continue } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index 0f32ff2d0..afd8a174b 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -47,7 +47,7 @@ data class RenderedState(val state: RenderState, val elementsById: Map): Set { val result = mutableSetOf() - result += elem.map { state.currentState.elementByDiagramId[it] } + result += elem.map { state.currentState.allElementsByDiagramId[it] } .mapNotNull { elementsById[it] } .flatMap { allChildrenOf(it) } @@ -175,7 +175,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr private fun createShapes(state: () -> RenderState, elements: MutableList, elementsById: MutableMap) { state().currentState.shapes.forEach { - val elem = state().currentState.elementByBpmnId[it.bpmnElement] + val elem = state().currentState.processElementByBpmnId[it.bpmnElement] elem?.let { bpmn -> mapFromShape(state, it.id, it, bpmn.element).let { shape -> elements += shape @@ -195,7 +195,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr private fun linkChildrenToParent(state: () -> RenderState, elementsById: MutableMap) { elementsById.forEach { (id, renderElem) -> - val elem = state().currentState.elementByBpmnId[id] + val elem = state().currentState.processElementByBpmnId[id] elem?.parent?.let {elementsById[it]}?.let { if (it is BaseBpmnRenderElement) it else null }?.let { parent -> parent.children.add(renderElem) parent.let { renderElem.parents.add(it) } @@ -270,7 +270,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr } private fun isCollapsed(id: BpmnElementId, state: () -> RenderState): Boolean { - return !(state().currentState.elemUiOnlyPropertiesByStaticElementId[id]?.get(UiOnlyPropertyType.EXPANDED)?.value as Boolean? ?: false) + return !(state().currentState.processElemUiOnlyPropertiesByStaticElementId[id]?.get(UiOnlyPropertyType.EXPANDED)?.value as Boolean? ?: false) } private fun drawSelectionRect(state: RenderContext) { diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/anchors/PhysicalWaypoint.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/anchors/PhysicalWaypoint.kt index 71e219dbb..d07e2fab4 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/anchors/PhysicalWaypoint.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/anchors/PhysicalWaypoint.kt @@ -81,7 +81,7 @@ class PhysicalWaypoint( } val state = state().currentState - val currentProps = state.propertyWithElementByPropertyType + val currentProps = state.processPropertyWithElementByPropertyType val rootProcessId = state.processId if (null != droppedOn && !multipleElementsSelected() && !multipleElementsDragged()) { if (edgePhysicalSize - 1 == physicalPos) { @@ -128,8 +128,8 @@ class PhysicalWaypoint( private fun isEdgeBegin() = 0 == physicalPos private fun isEdgeEnd() = edgePhysicalSize - 1 == physicalPos - private fun isSourceRefAttached() = null != state().currentState.elemPropertiesByStaticElementId[parentElementBpmnId]?.get(PropertyType.SOURCE_REF)?.value - private fun isTargetRefAttached() = null != state().currentState.elemPropertiesByStaticElementId[parentElementBpmnId]?.get(PropertyType.TARGET_REF)?.value + private fun isSourceRefAttached() = null != state().currentState.processElemPropertiesByStaticElementId[parentElementBpmnId]?.get(PropertyType.SOURCE_REF)?.value + private fun isTargetRefAttached() = null != state().currentState.processElemPropertiesByStaticElementId[parentElementBpmnId]?.get(PropertyType.TARGET_REF)?.value private fun isEdgeBeginOrEnd() = edgePhysicalSize - 1 == physicalPos || 0 == physicalPos private fun handleBpmnOutgoingCascade( @@ -186,4 +186,4 @@ class PhysicalWaypoint( result += orthoIconId to AreaWithZindex(rightAngleIcon, areaType, mutableSetOf(), mutableSetOf(), ICON_Z_INDEX, elementId) return bounds } -} \ No newline at end of file +} diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/BaseEdgeRenderElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/BaseEdgeRenderElement.kt index 8497c381e..8fd4d6590 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/BaseEdgeRenderElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/BaseEdgeRenderElement.kt @@ -109,7 +109,7 @@ abstract class BaseEdgeRenderElement( } private fun drawNameIfAvailable(waypoints: List, color: Color) { - val name = state().currentState.elemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.NAME)?.value as String? ?: return + val name = state().currentState.processElemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.NAME)?.value as String? ?: return val longestSegment = waypoints .mapIndexedNotNull {pos, it -> if (0 == pos) null else Pair(waypoints[pos - 1], it)} .maxBy { it.first.distance(it.second) } ?: return @@ -127,7 +127,7 @@ abstract class BaseEdgeRenderElement( } private fun renderDefaultMarkIfNeeded(ctx: RenderContext, anchors: List): Area { - val sourceRefOfExists = state().currentState.propertyWithElementByPropertyType[PropertyType.DEFAULT_FLOW]?.any { it.value.value == bpmnElementId.id } ?: false + val sourceRefOfExists = state().currentState.processPropertyWithElementByPropertyType[PropertyType.DEFAULT_FLOW]?.any { it.value.value == bpmnElementId.id } ?: false if (!sourceRefOfExists) { return Area() } @@ -162,14 +162,14 @@ abstract class BaseEdgeRenderElement( private fun findAttachedToElement(physicalPos: Int, numPhysicals: Int): DiagramElementId? { return when (physicalPos) { 0 -> { - val bpmnElemId = state().currentState.elemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.SOURCE_REF)?.value as String? - bpmnElemId?.let {state().currentState.diagramByElementId[BpmnElementId(it)] } + val bpmnElemId = state().currentState.processElemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.SOURCE_REF)?.value as String? + bpmnElemId?.let {state().currentState.allDiagramByElementId[BpmnElementId(it)] } } numPhysicals - 1 -> { - val bpmnElemId = state().currentState.elemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.TARGET_REF)?.value as String? - bpmnElemId?.let {state().currentState.diagramByElementId[BpmnElementId(it)] } + val bpmnElemId = state().currentState.processElemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.TARGET_REF)?.value as String? + bpmnElemId?.let {state().currentState.allDiagramByElementId[BpmnElementId(it)] } } else -> null } } -} \ No newline at end of file +} diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/EdgeRenderElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/EdgeRenderElement.kt index 681a135cd..cac291645 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/EdgeRenderElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/EdgeRenderElement.kt @@ -6,8 +6,6 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.BoundsElement import com.valb3r.bpmn.intellij.plugin.bpmn.api.events.EdgeWithIdentifiableWaypoints import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType import com.valb3r.bpmn.intellij.plugin.core.Colors -import com.valb3r.bpmn.intellij.plugin.core.events.BpmnElementRemovedEvent -import com.valb3r.bpmn.intellij.plugin.core.events.DiagramElementRemovedEvent import com.valb3r.bpmn.intellij.plugin.core.render.AreaType import com.valb3r.bpmn.intellij.plugin.core.render.AreaWithZindex import com.valb3r.bpmn.intellij.plugin.core.render.ICON_Z_INDEX @@ -30,7 +28,7 @@ class EdgeRenderElement( val delId = elementId.elemIdToRemove() val deleteIconArea = state().ctx.canvas.drawIcon(BoundsElement(x, y - ACTIONS_ICO_SIZE, ACTIONS_ICO_SIZE, ACTIONS_ICO_SIZE), state().icons.recycleBin) state().ctx.interactionContext.clickCallbacks[delId] = { dest -> - val currentProps = state().currentState.propertyWithElementByPropertyType + val currentProps = state().currentState.processPropertyWithElementByPropertyType val cascadeEvents = computeCascadeChangeOfBpmnIncomingOutgoingIndex(bpmnElementId, currentProps, PropertyType.BPMN_INCOMING).toMutableList() + computeCascadeChangeOfBpmnIncomingOutgoingIndex(bpmnElementId, currentProps, PropertyType.BPMN_OUTGOING) dest.addElementRemovedEvent(getEventsToDeleteDiagram(), getEventsToDeleteElement(), cascadeEvents) @@ -38,4 +36,4 @@ class EdgeRenderElement( return mutableMapOf(delId to AreaWithZindex(deleteIconArea, AreaType.POINT, mutableSetOf(), mutableSetOf(), ICON_Z_INDEX, elementId)) } -} \ No newline at end of file +} diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeRenderElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeRenderElement.kt index e46309097..3045eebdc 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeRenderElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeRenderElement.kt @@ -52,8 +52,8 @@ abstract class ShapeRenderElement( get() = shape override fun doRenderWithoutChildren(ctx: RenderContext): Map { - val elem = state().currentState.elementByDiagramId[shape.id] - val props = state().currentState.elemPropertiesByStaticElementId[elem] + val elem = state().currentState.allElementsByDiagramId[shape.id] + val props = state().currentState.processElemPropertiesByStaticElementId[elem] val name = props?.get(PropertyType.NAME)?.value as String? state().ctx.interactionContext.dragEndCallbacks[elementId] = { @@ -204,12 +204,12 @@ abstract class ShapeRenderElement( if (null != nests && nests != currentParent?.bpmnElementId) { newEvents += BpmnParentChangedEvent(shape.bpmnElement, nests) // Cascade parent change to waypoint owning edge - newEvents += cascadeTargets.mapNotNull { state().currentState.elementByDiagramId[it.parentEdgeId] }.map { BpmnParentChangedEvent(it, nests) } + newEvents += cascadeTargets.mapNotNull { state().currentState.allElementsByDiagramId[it.parentEdgeId] }.map { BpmnParentChangedEvent(it, nests) } } else if (null != parentProcess && parentProcess != parents.firstOrNull()?.bpmnElementId) { newEvents += BpmnParentChangedEvent(shape.bpmnElement, parentProcess) // Cascade parent change to waypoint owning edge - newEvents += cascadeTargets.mapNotNull { state().currentState.elementByDiagramId[it.parentEdgeId] }.map { BpmnParentChangedEvent(it, parentProcess) } + newEvents += cascadeTargets.mapNotNull { state().currentState.allElementsByDiagramId[it.parentEdgeId] }.map { BpmnParentChangedEvent(it, parentProcess) } } return newEvents } @@ -218,10 +218,10 @@ abstract class ShapeRenderElement( val idCascadesTo = setOf(PropertyType.SOURCE_REF, PropertyType.TARGET_REF) val result = mutableSetOf() val elemToDiagramId = mutableMapOf>() - state().currentState.elementByDiagramId.forEach { elemToDiagramId.computeIfAbsent(it.value) { mutableSetOf() }.add(it.key) } - state().currentState.elemPropertiesByStaticElementId.forEach { (owner, props) -> + state().currentState.allElementsByDiagramId.forEach { elemToDiagramId.computeIfAbsent(it.value) { mutableSetOf() }.add(it.key) } + state().currentState.processElemPropertiesByStaticElementId.forEach { (owner, props) -> idCascadesTo.intersect(props.keys).filter { props[it]?.value == shape.bpmnElement.id }.forEach { type -> - when (state().currentState.elementByBpmnId[owner]?.element) { + when (state().currentState.processElementByBpmnId[owner]?.element) { is BpmnSequenceFlow -> { result += computeCascadeToWaypoint(state().currentState, shape.bpmnElement, owner, type) } } } @@ -295,7 +295,7 @@ abstract class ShapeRenderElement( return mutableListOf() } - val sourceElem = state().currentState.elementByBpmnId[bpmnElementId] ?: return mutableListOf() + val sourceElem = state().currentState.processElementByBpmnId[bpmnElementId] ?: return mutableListOf() val newSequenceBpmn = newElementsFactory(state().ctx.project).newOutgoingSequence(sourceElem.element) val anchors = findSequenceAnchors(targetArea) ?: return mutableListOf() @@ -390,4 +390,4 @@ abstract class ShapeRenderElement( fun cartesianProduct(first: Collection, second: Collection): Sequence> { return first.asSequence().flatMap { lhsElem -> second.asSequence().map { rhsElem -> lhsElem to rhsElem } } } -} \ No newline at end of file +} diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt index fcd130e9d..5dbde89f3 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt @@ -29,17 +29,17 @@ fun currentStateProvider(project: Project): CurrentStateProvider { } data class CurrentState( - var processId: BpmnElementId, - val shapes: List, - val edges: List, - val elementByDiagramId: Map, - val elementByBpmnId: Map, - val elemPropertiesByStaticElementId: Map, - val propertyWithElementByPropertyType: Map>, - val elemUiOnlyPropertiesByStaticElementId: Map>, - val undoRedo: Set, - val version: Long, - val diagramByElementId: Map = elementByDiagramId.map { Pair(it.value, it.key) }.toMap(), + var processId: BpmnElementId, + val shapes: List, + val edges: List, + val allElementsByDiagramId: Map, + val processElementByBpmnId: Map, + val processElemPropertiesByStaticElementId: Map, + val processPropertyWithElementByPropertyType: Map>, + val processElemUiOnlyPropertiesByStaticElementId: Map>, + val undoRedo: Set, + val version: Long, + val allDiagramByElementId: Map = allElementsByDiagramId.map { Pair(it.value, it.key) }.toMap(), ) { fun processDiagramId(): DiagramElementId { return processDiagramId(processId) @@ -66,9 +66,9 @@ class CurrentStateProvider(private val project: Project) { processObject.processId, processObject.diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() }, processObject.diagram.flatMap { it.bpmnPlane.bpmnEdge ?: emptyList() }.map { EdgeElementState(it) }, - processObject.elementByDiagramId, - processObject.elementByStaticId, - processObject.elemPropertiesByElementId, + processObject.allElementsByDiagramId, + processObject.processElementByStaticId, + processObject.processElemPropertiesByElementId, emptyMap(), emptyMap(), emptySet(), @@ -85,11 +85,11 @@ class CurrentStateProvider(private val project: Project) { private fun handleUpdates(state: CurrentState): CurrentState { var updatedShapes = state.shapes.toMutableList() var updatedEdges = state.edges.toMutableList() - val updatedElementByDiagramId = state.elementByDiagramId.toMutableMap() - val updatedElementByStaticId = state.elementByBpmnId.toMutableMap() - val updatedElemPropertiesByStaticElementId = state.elemPropertiesByStaticElementId.mapValues { it.value.copy() }.toMutableMap() + val updatedElementByDiagramId = state.allElementsByDiagramId.toMutableMap() + val updatedElementByStaticId = state.processElementByBpmnId.toMutableMap() + val updatedElemPropertiesByStaticElementId = state.processElemPropertiesByStaticElementId.mapValues { it.value.copy() }.toMutableMap() val updatedPropertyWithElementByPropertyType = mutableMapOf>() - val updatedElemUiOnlyPropertiesByStaticElementId = state.elemUiOnlyPropertiesByStaticElementId.toMutableMap() + val updatedElemUiOnlyPropertiesByStaticElementId = state.processElemUiOnlyPropertiesByStaticElementId.toMutableMap() var updatedProcessId = state.processId val updateEventsRegistry: ProcessModelUpdateEvents = updateEventsRegistry(project) diff --git a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/BoundaryEventAttachTest.kt b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/BoundaryEventAttachTest.kt index 088b83e08..5649130be 100644 --- a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/BoundaryEventAttachTest.kt +++ b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/BoundaryEventAttachTest.kt @@ -42,7 +42,7 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) + lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -76,7 +76,7 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) + lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -109,7 +109,7 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) + lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -142,8 +142,8 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parent.shouldBeEqualTo(subprocessInSubProcessBpmnId) - lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) + lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parent.shouldBeEqualTo(subprocessInSubProcessBpmnId) + lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -177,8 +177,8 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parent.shouldBeEqualTo(subprocessBpmnId) - lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) + lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parent.shouldBeEqualTo(subprocessBpmnId) + lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -211,7 +211,7 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) + lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -244,10 +244,10 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.elementByBpmnId[serviceTaskStartBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) - lastRenderedState(project)!!.state.currentState.elementByBpmnId[serviceTaskStartBpmnId]!!.parent.shouldBeEqualTo(subprocessBpmnId) - lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) - lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parent.shouldBeEqualTo(serviceTaskStartBpmnId) + lastRenderedState(project)!!.state.currentState.processElementByBpmnId[serviceTaskStartBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) + lastRenderedState(project)!!.state.currentState.processElementByBpmnId[serviceTaskStartBpmnId]!!.parent.shouldBeEqualTo(subprocessBpmnId) + lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) + lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parent.shouldBeEqualTo(serviceTaskStartBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -331,4 +331,4 @@ internal class BoundaryEventAttachTest: BaseUiTest() { edgeBpmn.props[PropertyType.TARGET_REF]!!.value.shouldBeEqualTo(serviceTaskStartBpmnId.id) } } -} \ No newline at end of file +} diff --git a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/StateBasedPropertyUpdateTest.kt b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/StateBasedPropertyUpdateTest.kt index b527633fb..d89662300 100644 --- a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/StateBasedPropertyUpdateTest.kt +++ b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/StateBasedPropertyUpdateTest.kt @@ -24,30 +24,30 @@ internal class StateBasedPropertyUpdateTest: BaseUiTest() { @Test fun `Group based update event updates state properly`() { prepareTwoServiceTaskView() - currentStateProvider(project).currentState().elemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] + currentStateProvider(project).currentState().processElemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] ?.value?.shouldBeNull() updateEventsRegistry(project).addPropertyUpdateEvent(StringValueUpdatedEvent(serviceTaskStartBpmnId, PropertyType.FIELD_NAME, "1", propertyIndex = null)) - currentStateProvider(project).currentState().elemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] + currentStateProvider(project).currentState().processElemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] ?.shouldBeEqualTo(Property("1", null)) updateEventsRegistry(project).addPropertyUpdateEvent(StringValueUpdatedEvent(serviceTaskStartBpmnId, PropertyType.FIELD_NAME, "", propertyIndex = null)) - currentStateProvider(project).currentState().elemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] + currentStateProvider(project).currentState().processElemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] ?.shouldBeEqualTo(Property("", null)) } @Test fun `Group based multiple update event updates state properly`() { prepareTwoServiceTaskView() - currentStateProvider(project).currentState().elemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] + currentStateProvider(project).currentState().processElemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] ?.value?.shouldBeNull() updateEventsRegistry(project).addPropertyUpdateEvent(StringValueUpdatedEvent(serviceTaskStartBpmnId, PropertyType.FIELD_EXPRESSION, "expression 1", propertyIndex = null)) updateEventsRegistry(project).addPropertyUpdateEvent(StringValueUpdatedEvent(serviceTaskStartBpmnId, PropertyType.FIELD_NAME, "new name", propertyIndex = null)) updateEventsRegistry(project).addEvents(listOf(IndexUiOnlyValueUpdatedEvent(serviceTaskStartBpmnId, PropertyType.FIELD_EXPRESSION, listOf(), listOf("new name")))) - currentStateProvider(project).currentState().elemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] + currentStateProvider(project).currentState().processElemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] ?.shouldBeEqualTo(Property("new name", null)) - currentStateProvider(project).currentState().elemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_EXPRESSION] + currentStateProvider(project).currentState().processElemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_EXPRESSION] ?.shouldBeEqualTo(Property("expression 1", listOf("new name"))) } } diff --git a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt index 074802671..68166c92a 100644 --- a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt +++ b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt @@ -1235,7 +1235,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { canvas.click(onlyRootProcessPoint) lastRenderedState(project)!!.state.ctx.selectedIds.shouldBeEmpty() lastRenderedState(project)!!.state.ctx.stateProvider.currentState() - .elementByDiagramId[CurrentState.processDiagramId(BpmnElementId(newRootProcessId))].shouldNotBeNull() + .allElementsByDiagramId[CurrentState.processDiagramId(BpmnElementId(newRootProcessId))].shouldNotBeNull() val anotherNewRootProcessId = "another-new-root-process-id" @@ -1247,6 +1247,6 @@ internal class UiEditorLightE2ETest: BaseUiTest() { canvas.click(onlyRootProcessPoint) lastRenderedState(project)!!.state.ctx.selectedIds.shouldBeEmpty() lastRenderedState(project)!!.state.ctx.stateProvider.currentState() - .elementByDiagramId[CurrentState.processDiagramId(BpmnElementId(anotherNewRootProcessId))].shouldNotBeNull() + .allElementsByDiagramId[CurrentState.processDiagramId(BpmnElementId(anotherNewRootProcessId))].shouldNotBeNull() } -} \ No newline at end of file +} diff --git a/camunda-intellij-plugin/build.gradle b/camunda-intellij-plugin/build.gradle index 2f2849478..32d77d623 100644 --- a/camunda-intellij-plugin/build.gradle +++ b/camunda-intellij-plugin/build.gradle @@ -42,6 +42,10 @@ intellij { plugins = intellijPlatformPlugins } +runIde { + jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition") +} + publishPlugin { token = intellijPublishToken } @@ -82,4 +86,4 @@ jacocoTestReport { xml.enabled true csv.enabled false } -} \ No newline at end of file +} diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/CondExpressionWithoutTypeParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/CondExpressionWithoutTypeParseable.kt index dcc10ba1f..9b80d407c 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/CondExpressionWithoutTypeParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/CondExpressionWithoutTypeParseable.kt @@ -26,7 +26,7 @@ internal class CondExpressionWithoutTypeParseable { sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "\${evection.num<3} ")) - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("\${evection.num<3} ") diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/EmptyCondExpressionParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/EmptyCondExpressionParseable.kt index 3d7b42a83..e064ce84c 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/EmptyCondExpressionParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/EmptyCondExpressionParseable.kt @@ -26,7 +26,7 @@ internal class EmptyCondExpressionParseable { sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "")) - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("") diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ComplexGatewayWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ComplexGatewayWithExtensionIsParseable.kt index 5c5bcf410..7ae2066db 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ComplexGatewayWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ComplexGatewayWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class ComplexGatewayWithExtensionIsParseable { task.name.shouldBeEqualTo("Single complex gateway") task.documentation.shouldBeEqualTo("Single complex gateway docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -53,7 +53,7 @@ internal class ComplexGatewayWithExtensionIsParseable { task.name.shouldBeEqualTo("Multi complex gateway") task.documentation.shouldBeEqualTo("Mutli complex gateway docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/IntermediateLinkCatchingEventWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/IntermediateLinkCatchingEventWithExtensionIsParseable.kt index 58bd19c4e..9878f651b 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/IntermediateLinkCatchingEventWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/IntermediateLinkCatchingEventWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class IntermediateLinkCatchingEventWithExtensionIsParseable { task.name.shouldBeEqualTo("Link intermediate cache event") task.documentation.shouldBeEqualTo("A link intermediate catch event") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -53,7 +53,7 @@ internal class IntermediateLinkCatchingEventWithExtensionIsParseable { task.name.shouldBeEqualTo("Link intermediate cache event") task.documentation.shouldBeEqualTo("A link intermediate catch event") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/SendTaskWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/SendTaskWithExtensionIsParseable.kt index 866c15a8b..e8f3a217f 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/SendTaskWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/SendTaskWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class SendTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Single send task") task.documentation.shouldBeEqualTo("Single send task docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -53,7 +53,7 @@ internal class SendTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Multi send task") task.documentation.shouldBeEqualTo("Multi send task docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ServiceTaskWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ServiceTaskWithExtensionIsParseable.kt index b016a903a..3650118b1 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ServiceTaskWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ServiceTaskWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class ServiceTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Service task with single extension") task.documentation.shouldBeEqualTo("Some docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -76,7 +76,7 @@ internal class ServiceTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Service task with multiple extensions") task.documentation.shouldBeEqualTo("Some docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/StartEventWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/StartEventWithExtensionIsParseable.kt index 7617206f6..15cd5254b 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/StartEventWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/StartEventWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class StartEventWithExtensionIsParseable { task.name.shouldBeEqualTo("Start event (single)") task.documentation.shouldBeEqualTo("As full as possible start event\nmultiline") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -105,7 +105,7 @@ internal class StartEventWithExtensionIsParseable { task.name.shouldBeEqualTo("Start event(multi)") task.documentation.shouldBeEqualTo("As full as possible start event\nmultiline") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/TaskWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/TaskWithExtensionIsParseable.kt index db8d84193..603b6e190 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/TaskWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/TaskWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class TaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Simple task") task.documentation.shouldBeEqualTo("Simple task docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -53,7 +53,7 @@ internal class TaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Simple multi task") task.documentation.shouldBeEqualTo("Simple multi task docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/UserTaskWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/UserTaskWithExtensionIsParseable.kt index 9a5e8c33a..0a4318b17 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/UserTaskWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/UserTaskWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class UserTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("User task with single extension") task.documentation.shouldBeEqualTo("Some docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -105,7 +105,7 @@ internal class UserTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("User task with multiple extension") task.documentation.shouldBeEqualTo("Some docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/specialcase/SpecialCaseIncomingOutgoingIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/specialcase/SpecialCaseIncomingOutgoingIsParseable.kt index 71d2c579d..37e482613 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/specialcase/SpecialCaseIncomingOutgoingIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/specialcase/SpecialCaseIncomingOutgoingIsParseable.kt @@ -31,9 +31,9 @@ internal class SpecialCaseIncomingOutgoingIsParseable { fun `Service task (single props) with incoming-outgoing is parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val startEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[singleStartEvent]!! - val serviceTaskProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[singleServiceTask]!! - val endEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[singleEndEvent]!! + val startEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[singleStartEvent]!! + val serviceTaskProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[singleServiceTask]!! + val endEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[singleEndEvent]!! startEventProps[PropertyType.BPMN_INCOMING]?.value?.shouldBeNull() startEventProps[PropertyType.BPMN_OUTGOING]?.shouldBeEqualTo(Property("flowFromStartEvent", listOf("flowFromStartEvent"))) @@ -61,9 +61,9 @@ internal class SpecialCaseIncomingOutgoingIsParseable { fun `Service task (multiple props) with incoming-outgoing is parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val startEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[multiStartEvent]!! - val serviceTaskProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[multiServiceTask]!! - val endEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].elemPropertiesByElementId[multiEndEvent]!! + val startEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[multiStartEvent]!! + val serviceTaskProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[multiServiceTask]!! + val endEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[multiEndEvent]!! startEventProps[PropertyType.BPMN_INCOMING]?.value?.shouldBeNull() startEventProps.getAll(PropertyType.BPMN_OUTGOING).shouldBeEqualTo(listOf(Property("fromStart1", listOf("fromStart1")), Property("fromStart2", listOf("fromStart2")))) diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index aeb1d5417..1ff6369ea 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -15,12 +15,12 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType data class BpmnFileObject(val processes: List, val collaborations: List, val diagram: List) { fun toView(factory: BpmnObjectFactory) : List { - val elementByDiagramId = mutableMapOf() - val elementByStaticId = mutableMapOf() - val propertiesById = mutableMapOf() - val result = mutableListOf() for (process in processes) { + val elementByDiagramId = mutableMapOf() + val elementByStaticId = mutableMapOf() + val propertiesById = mutableMapOf() + fillFor(BpmnElementId(""), factory, process, elementByStaticId, propertiesById) elementByDiagramId[DiagramElementId(process.id.id)] = process.id @@ -175,11 +175,11 @@ data class BpmnFileObject(val processes: List, val collaborations: } data class BpmnProcessObjectView( - val processId: BpmnElementId, - val elementByDiagramId: Map, - val elementByStaticId: Map, - val elemPropertiesByElementId: Map, - val diagram: List + val processId: BpmnElementId, + val allElementsByDiagramId: Map, + val processElementByStaticId: Map, + val processElemPropertiesByElementId: Map, + val diagram: List ) data class PropertyTable(private val properties: MutableMap>) { From 62d6ecbd1e253972c6135ec54d6c511828940eef Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 5 Dec 2021 17:57:41 +0200 Subject: [PATCH 07/41] FBP-224. Allow null collaboration --- .../valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt index f4d009535..d35bc3595 100644 --- a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt @@ -133,7 +133,7 @@ class CamundaParser : BaseBpmnParser() { // TODO - Multi process support? markSubprocessesAndTransactionsThatHaveExternalDiagramAsCollapsed(dto.processes[0], dto.diagrams!!) val processes = dto.processes.map { it.toElement() } - val collaborations = dto.collaborations!!.map { it.toElement() } + val collaborations = dto.collaborations?.map { it.toElement() } ?: emptyList() val diagrams = dto.diagrams!!.map { it.toElement() } return BpmnFileObject(processes, collaborations, diagrams) From 05739364dc086274c12b929881c4cfc414d44f24 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 5 Dec 2021 19:31:14 +0200 Subject: [PATCH 08/41] FBP-224. Wrap collaboration and view to dto --- .../bpmn/intellij/plugin/core/CanvasBuilder.kt | 4 +++- .../bpmn/intellij/plugin/core/render/Canvas.kt | 6 +++--- .../intellij/plugin/core/state/CurrentState.kt | 4 +++- .../intellij/plugin/bpmn/api/BpmnFileObject.kt | 18 ++++++++++++++---- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/CanvasBuilder.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/CanvasBuilder.kt index 2632b2246..717fb1521 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/CanvasBuilder.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/CanvasBuilder.kt @@ -61,8 +61,10 @@ class CanvasBuilder( initializeUpdateEventsRegistry(project, committerFactory.invoke(parser)) val data = readFile(bpmnFile) val processes = parser.parse(data) + val factory = newElementsFactory(project) + val view = processes.toView(factory) newPropertiesVisualizer(project, properties, dropDownFactory, classEditorFactory, editorFactory, textFieldFactory, multiLineExpandableTextFieldFactory, checkboxFieldFactory, buttonFactory, arrowButtonFactory) - canvas.reset(data, processes.toView(newElementsFactory(project))[0], bpmnProcessRenderer) // FIXME - wrapper class for processes + canvas.reset(data, view, bpmnProcessRenderer) // FIXME - wrapper class for processes currentVfsConnection?.let { it.disconnect(); it.dispose() } currentPaintConnection?.let { it.disconnect(); it.dispose() } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt index 00c5a121a..5e7d6ce6b 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt @@ -6,7 +6,7 @@ import com.google.common.collect.EvictingQueue import com.google.common.math.Quantiles.percentiles import com.intellij.openapi.project.Project import com.intellij.util.ui.UIUtil -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObjectView +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileView import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.BpmnSequenceFlow import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId @@ -180,14 +180,14 @@ class Canvas(private val project: Project, private val settings: CanvasConstants return renderedImage } - fun reset(fileContent: String, processObjects: BpmnProcessObjectView, renderer: BpmnProcessRenderer) { + fun reset(fileContent: String, view: BpmnFileView, renderer: BpmnProcessRenderer) { this.cachedTreeState = null this.renderer = renderer this.latestOnScreenModelDimensions = null this.camera = Camera(settings.defaultCameraOrigin, Point2D.Float(settings.defaultZoomRatio, settings.defaultZoomRatio)) this.propsVisualizer = propertiesVisualizer(project) this.propsVisualizer?.clear() - this.stateProvider.resetStateTo(fileContent, processObjects) + this.stateProvider.resetStateTo(fileContent, view) selectedElements = mutableSetOf() repaint() } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt index 5dbde89f3..18b2e3613 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt @@ -1,6 +1,7 @@ package com.valb3r.bpmn.intellij.plugin.core.state import com.intellij.openapi.project.Project +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileView import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObjectView import com.valb3r.bpmn.intellij.plugin.bpmn.api.PropertyTable import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId @@ -60,8 +61,9 @@ class CurrentStateProvider(private val project: Project) { private var currentState = CurrentState(BpmnElementId(""), emptyList(), emptyList(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptySet(), 0L) private val version = AtomicLong(0L) - fun resetStateTo(fileContent: String, processObject: BpmnProcessObjectView) { + fun resetStateTo(fileContent: String, view: BpmnFileView) { version.set(0L) + val processObject = view.processes[0] fileState = CurrentState( processObject.processId, processObject.diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() }, diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index 1ff6369ea..c53a220f7 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -14,8 +14,8 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType // TODO - move to some implementation module data class BpmnFileObject(val processes: List, val collaborations: List, val diagram: List) { - fun toView(factory: BpmnObjectFactory) : List { - val result = mutableListOf() + fun toView(factory: BpmnObjectFactory) : BpmnFileView { + val mappedProcesses = mutableListOf() for (process in processes) { val elementByDiagramId = mutableMapOf() val elementByStaticId = mutableMapOf() @@ -38,7 +38,7 @@ data class BpmnFileObject(val processes: List, val collaborations: diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() } .forEach { elementByDiagramId[it.id] = it.bpmnElement } - result += BpmnProcessObjectView( + mappedProcesses += BpmnProcessObjectView( process.id, elementByDiagramId, elementByStaticId, @@ -47,7 +47,7 @@ data class BpmnFileObject(val processes: List, val collaborations: ) } - return result + return BpmnFileView(mappedProcesses, emptyList()) } private fun extractElementsFromBody( @@ -174,6 +174,16 @@ data class BpmnFileObject(val processes: List, val collaborations: } } +data class BpmnFileView( + val processes: List, + val collaborations: List +) + +data class BpmnCollaborationView( + val collaborationElementByStaticId: Map, + val collaborationElemPropertiesByElementId: Map +) + data class BpmnProcessObjectView( val processId: BpmnElementId, val allElementsByDiagramId: Map, From efae57cd6f1dcf8ea68b6f65849574d9cefc598b Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 12 Dec 2021 16:49:31 +0200 Subject: [PATCH 09/41] FBP-224. Handle collaboration in toView --- .../nodes/collaboration/Collaboration.kt | 3 +- .../plugin/bpmn/api/BpmnFileObject.kt | 33 ++++++++++++++++++- .../plugin/bpmn/api/bpmn/BpmnCollaboration.kt | 29 ++++++++++++---- .../bpmn/parser/core/BaseBpmnObjectFactory.kt | 6 ++-- 4 files changed, 60 insertions(+), 11 deletions(-) diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt index 183f1bdce..469f11e56 100644 --- a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/collaboration/Collaboration.kt @@ -5,6 +5,7 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnCollaboration import com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.BpmnMappable +import com.valb3r.bpmn.intellij.plugin.camunda.parser.nodes.process.BpmnElementIdMapper import org.mapstruct.Mapper import org.mapstruct.factory.Mappers @@ -19,7 +20,7 @@ data class Collaboration( return Mappers.getMapper(Mapping::class.java).convertToDto(this) } - @Mapper + @Mapper(uses = [BpmnElementIdMapper::class]) interface Mapping { fun convertToDto(input: Collaboration): BpmnCollaboration } diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index c53a220f7..8b3991420 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -15,6 +15,36 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType data class BpmnFileObject(val processes: List, val collaborations: List, val diagram: List) { fun toView(factory: BpmnObjectFactory) : BpmnFileView { + val mappedProcesses = mapProcesses(factory) + val mappedCollaborations = mapCollaborations(factory) + + return BpmnFileView(mappedProcesses, mappedCollaborations) + } + + private fun mapCollaborations(factory: BpmnObjectFactory): List { + val mappedCollaborations = mutableListOf() + for (collaboration in collaborations) { + val elementByDiagramId = mutableMapOf() + val elementByStaticId = mutableMapOf() + val propertiesById = mutableMapOf() + + fillFor(BpmnElementId(""), factory, collaboration, elementByStaticId, propertiesById) + elementByDiagramId[DiagramElementId(collaboration.id.id)] = collaboration.id + + collaboration.participant?.forEach { fillFor(collaboration.id, factory, it, elementByStaticId, propertiesById)} + collaboration.messageFlow?.forEach { fillFor(collaboration.id, factory, it, elementByStaticId, propertiesById)} + + mappedCollaborations += BpmnCollaborationView( + collaboration.id, + elementByStaticId, + propertiesById + ) + } + + return mappedCollaborations + } + + private fun mapProcesses(factory: BpmnObjectFactory): List { val mappedProcesses = mutableListOf() for (process in processes) { val elementByDiagramId = mutableMapOf() @@ -47,7 +77,7 @@ data class BpmnFileObject(val processes: List, val collaborations: ) } - return BpmnFileView(mappedProcesses, emptyList()) + return mappedProcesses } private fun extractElementsFromBody( @@ -180,6 +210,7 @@ data class BpmnFileView( ) data class BpmnCollaborationView( + val collaborationId: BpmnElementId, val collaborationElementByStaticId: Map, val collaborationElemPropertiesByElementId: Map ) diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnCollaboration.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnCollaboration.kt index 2af737152..15f2c4965 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnCollaboration.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/BpmnCollaboration.kt @@ -1,23 +1,40 @@ package com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId + data class BpmnCollaboration( - val id: String, + override val id: BpmnElementId, val name: String?, val participant: List?, val messageFlow: List?, -) +): WithBpmnId { + + override fun updateBpmnElemId(newId: BpmnElementId): WithBpmnId { + return copy(id = newId) + } +} data class BpmnParticipant( - val id: String, + override val id: BpmnElementId, val name: String?, val processRef: String?, val documentation: String? -) +): WithBpmnId { + + override fun updateBpmnElemId(newId: BpmnElementId): WithBpmnId { + return copy(id = newId) + } +} data class BpmnMessageFlow( - val id: String, + override val id: BpmnElementId, val name: String?, val documentation: String?, val sourceRef: String?, val targetRef: String?, -) +): WithBpmnId { + + override fun updateBpmnElemId(newId: BpmnElementId): WithBpmnId { + return copy(id = newId) + } +} diff --git a/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnObjectFactory.kt b/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnObjectFactory.kt index 45c072b2c..6e857a999 100644 --- a/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnObjectFactory.kt +++ b/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnObjectFactory.kt @@ -5,8 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.node.NullNode import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnObjectFactory import com.valb3r.bpmn.intellij.plugin.bpmn.api.PropertyTable -import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId -import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnProcess +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.BpmnSequenceFlow import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.ConditionExpression import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId @@ -136,7 +135,8 @@ abstract class BaseBpmnObjectFactory : BpmnObjectFactory { is BpmnExclusiveGateway, is BpmnParallelGateway, is BpmnInclusiveGateway, is BpmnEventGateway, is BpmnComplexGateway, is BpmnIntermediateTimerCatchingEvent, is BpmnIntermediateMessageCatchingEvent, is BpmnIntermediateSignalCatchingEvent, is BpmnIntermediateConditionalCatchingEvent, is BpmnIntermediateNoneThrowingEvent, is BpmnIntermediateSignalThrowingEvent, is BpmnIntermediateEscalationThrowingEvent, is BpmnIntermediateLinkCatchingEvent, - is BpmnProcess + is BpmnProcess, + is BpmnCollaboration, is BpmnParticipant, is BpmnMessageFlow -> processDtoToPropertyMap(obj) is BpmnCallActivity -> fillForCallActivity(obj) From 8e680a002296e7bec9f7f0ae6dc69ee6daa954b8 Mon Sep 17 00:00:00 2001 From: valb3r Date: Mon, 13 Dec 2021 22:29:35 +0200 Subject: [PATCH 10/41] FBP-224. Extract process id from collaboration --- .../valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt | 6 +++++- .../valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt index 18b2e3613..c1d66c6c8 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt @@ -63,7 +63,7 @@ class CurrentStateProvider(private val project: Project) { fun resetStateTo(fileContent: String, view: BpmnFileView) { version.set(0L) - val processObject = view.processes[0] + val processObject = findProcessFromCollaborations(view) ?: view.processes[0] fileState = CurrentState( processObject.processId, processObject.diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() }, @@ -347,4 +347,8 @@ class CurrentStateProvider(private val project: Project) { private fun updateWaypointLocation(elem: EdgeWithIdentifiableWaypoints, update: NewWaypoints): EdgeWithIdentifiableWaypoints { return EdgeElementState(elem, update.waypoints, update.epoch) } + + private fun findProcessFromCollaborations(view: BpmnFileView): BpmnProcessObjectView? { + return view.collaborations.firstOrNull()?.primaryProcessId?.let { processId -> view.processes.firstOrNull { processId == it.processId } } + } } diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index 8b3991420..d8558bb95 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -36,6 +36,7 @@ data class BpmnFileObject(val processes: List, val collaborations: mappedCollaborations += BpmnCollaborationView( collaboration.id, + collaboration.participant?.first()?.id, elementByStaticId, propertiesById ) @@ -211,6 +212,7 @@ data class BpmnFileView( data class BpmnCollaborationView( val collaborationId: BpmnElementId, + val primaryProcessId: BpmnElementId?, val collaborationElementByStaticId: Map, val collaborationElemPropertiesByElementId: Map ) From bf008ef44cff5771b5a3609a9f824a5ddf01b35f Mon Sep 17 00:00:00 2001 From: valb3r Date: Mon, 13 Dec 2021 22:44:41 +0200 Subject: [PATCH 11/41] FBP-224. Extract process id from collaboration --- .../intellij/plugin/core/state/CurrentState.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt index c1d66c6c8..7541deb1c 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt @@ -63,14 +63,14 @@ class CurrentStateProvider(private val project: Project) { fun resetStateTo(fileContent: String, view: BpmnFileView) { version.set(0L) - val processObject = findProcessFromCollaborations(view) ?: view.processes[0] + val primaryProcessObject = findPrimaryProcessFromCollaborations(view) ?: view.processes[0] fileState = CurrentState( - processObject.processId, - processObject.diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() }, - processObject.diagram.flatMap { it.bpmnPlane.bpmnEdge ?: emptyList() }.map { EdgeElementState(it) }, - processObject.allElementsByDiagramId, - processObject.processElementByStaticId, - processObject.processElemPropertiesByElementId, + primaryProcessObject.processId, + primaryProcessObject.diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() }, + primaryProcessObject.diagram.flatMap { it.bpmnPlane.bpmnEdge ?: emptyList() }.map { EdgeElementState(it) }, + primaryProcessObject.allElementsByDiagramId, + primaryProcessObject.processElementByStaticId, + primaryProcessObject.processElemPropertiesByElementId, emptyMap(), emptyMap(), emptySet(), @@ -348,7 +348,7 @@ class CurrentStateProvider(private val project: Project) { return EdgeElementState(elem, update.waypoints, update.epoch) } - private fun findProcessFromCollaborations(view: BpmnFileView): BpmnProcessObjectView? { + private fun findPrimaryProcessFromCollaborations(view: BpmnFileView): BpmnProcessObjectView? { return view.collaborations.firstOrNull()?.primaryProcessId?.let { processId -> view.processes.firstOrNull { processId == it.processId } } } } From 6f868ac22a7bb457ed18ba4fb4f5169f18336b31 Mon Sep 17 00:00:00 2001 From: valb3r Date: Tue, 14 Dec 2021 07:17:37 +0200 Subject: [PATCH 12/41] FBP-224. Map all elements and properties in CurrentState --- .../bpmn/intellij/plugin/core/state/CurrentState.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt index 7541deb1c..11081fcb6 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt @@ -1,5 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.core.state +import com.intellij.database.dialects.base.introspector.group import com.intellij.openapi.project.Project import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileView import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObjectView @@ -66,11 +67,11 @@ class CurrentStateProvider(private val project: Project) { val primaryProcessObject = findPrimaryProcessFromCollaborations(view) ?: view.processes[0] fileState = CurrentState( primaryProcessObject.processId, - primaryProcessObject.diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() }, - primaryProcessObject.diagram.flatMap { it.bpmnPlane.bpmnEdge ?: emptyList() }.map { EdgeElementState(it) }, - primaryProcessObject.allElementsByDiagramId, - primaryProcessObject.processElementByStaticId, - primaryProcessObject.processElemPropertiesByElementId, + view.processes.flatMap { proc -> proc.diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() } }, + view.processes.flatMap { proc -> proc.diagram.flatMap { it.bpmnPlane.bpmnEdge ?: emptyList() }.map { EdgeElementState(it) } }, + view.processes.flatMap { proc -> proc.allElementsByDiagramId.entries }.groupBy { it.key }.mapValues { it.value.first().value }, + view.processes.flatMap { proc -> proc.processElementByStaticId.entries }.groupBy { it.key }.mapValues { it.value.first().value }, + view.processes.flatMap { proc -> proc.processElemPropertiesByElementId.entries }.groupBy { it.key }.mapValues { it.value.first().value }, emptyMap(), emptyMap(), emptySet(), From c33d324a1c8a8214bfa146528013c0d07ae3fcac Mon Sep 17 00:00:00 2001 From: valb3r Date: Tue, 14 Dec 2021 07:25:50 +0200 Subject: [PATCH 13/41] FBP-224. Rename CurrentState properties --- .../core/actions/ElementRemoveActionHandler.kt | 2 +- .../actions/copypaste/CopyPasteActionHandler.kt | 6 +++--- .../bpmn/intellij/plugin/core/render/Canvas.kt | 4 ++-- .../core/render/DefaultBpmnProcessRenderer.kt | 10 +++++----- .../render/elements/anchors/PhysicalWaypoint.kt | 2 +- .../render/elements/edges/BaseEdgeRenderElement.kt | 4 ++-- .../render/elements/shapes/ShapeRenderElement.kt | 8 ++++---- .../bpmn/intellij/plugin/core/state/CurrentState.kt | 13 ++++++------- .../bpmn/intellij/plugin/UiEditorLightE2ETest.kt | 4 ++-- 9 files changed, 26 insertions(+), 27 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/ElementRemoveActionHandler.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/ElementRemoveActionHandler.kt index 7424e5f43..ef9433b62 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/ElementRemoveActionHandler.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/ElementRemoveActionHandler.kt @@ -28,7 +28,7 @@ class ElementRemoveActionHandler(private val project: Project) { updateEventsRegistry(project).addElementRemovedEvent( targetIds.map { DiagramElementRemovedEvent(it) }, - targetIds.mapNotNull { state.currentState.allElementsByDiagramId[it] }.map { BpmnElementRemovedEvent(it) } + targetIds.mapNotNull { state.currentState.elementsByDiagramId[it] }.map { BpmnElementRemovedEvent(it) } ) currentCanvas(project).repaint() diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/copypaste/CopyPasteActionHandler.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/copypaste/CopyPasteActionHandler.kt index e02ca18fb..ceea48772 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/copypaste/CopyPasteActionHandler.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/copypaste/CopyPasteActionHandler.kt @@ -89,7 +89,7 @@ class CopyPasteActionHandler(private val clipboard: SystemClipboard) { val alreadyRemovedBpmn = mutableSetOf() val elemsToDelete = elementIdsToCopyOrCut(ctx) - .mapNotNull { ctx.currentState.allElementsByDiagramId[it] } + .mapNotNull { ctx.currentState.elementsByDiagramId[it] } .filter { if (alreadyRemovedBpmn.contains(it)) false else { alreadyRemovedBpmn += it; true } } .mapNotNull { elementsById[it] } @@ -263,7 +263,7 @@ class CopyPasteActionHandler(private val clipboard: SystemClipboard) { private fun ensureRootElementsComeFirst(idsToCopy: MutableList, ctx: RenderState, elementsById: Map): MutableList { return idsToCopy - .sortedByDescending { ctx.currentState.allElementsByDiagramId[it]?.let { id -> elementsById[id] }?.zIndex() ?: 0 } + .sortedByDescending { ctx.currentState.elementsByDiagramId[it]?.let { id -> elementsById[id] }?.zIndex() ?: 0 } .toMutableList() } @@ -292,7 +292,7 @@ class CopyPasteActionHandler(private val clipboard: SystemClipboard) { idReplacements: MutableMap, processedElementIds: MutableSet ) { - val bpmnId = ctx.currentState.allElementsByDiagramId[diagramId] ?: return + val bpmnId = ctx.currentState.elementsByDiagramId[diagramId] ?: return val withParentId = ctx.currentState.processElementByBpmnId[bpmnId] ?: return val props = ctx.currentState.processElemPropertiesByStaticElementId[bpmnId] ?: return if (processedElementIds.contains(bpmnId)) { diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt index 5e7d6ce6b..782e478d4 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt @@ -417,7 +417,7 @@ class Canvas(private val project: Project, private val settings: CanvasConstants val elementIdForPropertiesTable = propertiesForElement.firstOrNull() val state = stateProvider.currentState() state - .allElementsByDiagramId[elementIdForPropertiesTable] + .elementsByDiagramId[elementIdForPropertiesTable] ?.let { elemId -> state.processElemPropertiesByStaticElementId[elemId]?.let { propsVisualizer?.visualize( @@ -472,7 +472,7 @@ class Canvas(private val project: Project, private val settings: CanvasConstants continue } - val bpmnId = setOf(stateProvider.currentState().allElementsByDiagramId[elem.first], elem.second.bpmnElementId).filterNotNull().firstOrNull() ?: continue + val bpmnId = setOf(stateProvider.currentState().elementsByDiagramId[elem.first], elem.second.bpmnElementId).filterNotNull().firstOrNull() ?: continue val bpmnElem = stateProvider.currentState().processElementByBpmnId[bpmnId] if (bpmnElem?.element is BpmnSequenceFlow) { continue diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index afd8a174b..c186f2bf1 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -47,7 +47,7 @@ data class RenderedState(val state: RenderState, val elementsById: Map): Set { val result = mutableSetOf() - result += elem.map { state.currentState.allElementsByDiagramId[it] } + result += elem.map { state.currentState.elementsByDiagramId[it] } .mapNotNull { elementsById[it] } .flatMap { allChildrenOf(it) } @@ -105,7 +105,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr private fun doRender(ctx: RenderContext, onlyDiagram: Boolean = false): RenderResult { val elementsByDiagramId = mutableMapOf() val currentState = ctx.stateProvider.currentState() - val history = currentDebugger(project)?.executionSequence(project, currentState.processId.id)?.history ?: emptyList() + val history = currentDebugger(project)?.executionSequence(project, currentState.primaryProcessId.id)?.history ?: emptyList() val state = RenderState( elementsByDiagramId, mutableMapOf(), @@ -167,9 +167,9 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr } private fun createRootProcessElem(state: () -> RenderState, elements: MutableList, elementsById: MutableMap): BaseBpmnRenderElement { - val processElem = PlaneRenderElement(state().currentState.processDiagramId(), state().currentState.processId, state, mutableListOf()) + val processElem = PlaneRenderElement(state().currentState.processDiagramId(), state().currentState.primaryProcessId, state, mutableListOf()) elements += processElem - elementsById[state().currentState.processId] = processElem + elementsById[state().currentState.primaryProcessId] = processElem return processElem } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/anchors/PhysicalWaypoint.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/anchors/PhysicalWaypoint.kt index d07e2fab4..f21d3770f 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/anchors/PhysicalWaypoint.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/anchors/PhysicalWaypoint.kt @@ -82,7 +82,7 @@ class PhysicalWaypoint( val state = state().currentState val currentProps = state.processPropertyWithElementByPropertyType - val rootProcessId = state.processId + val rootProcessId = state.primaryProcessId if (null != droppedOn && !multipleElementsSelected() && !multipleElementsDragged()) { if (edgePhysicalSize - 1 == physicalPos) { events += StringValueUpdatedEvent(parentElementBpmnId, PropertyType.TARGET_REF, droppedOn.id) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/BaseEdgeRenderElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/BaseEdgeRenderElement.kt index 8fd4d6590..e3f7a8c7e 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/BaseEdgeRenderElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/BaseEdgeRenderElement.kt @@ -163,11 +163,11 @@ abstract class BaseEdgeRenderElement( return when (physicalPos) { 0 -> { val bpmnElemId = state().currentState.processElemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.SOURCE_REF)?.value as String? - bpmnElemId?.let {state().currentState.allDiagramByElementId[BpmnElementId(it)] } + bpmnElemId?.let {state().currentState.diagramByElementId[BpmnElementId(it)] } } numPhysicals - 1 -> { val bpmnElemId = state().currentState.processElemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.TARGET_REF)?.value as String? - bpmnElemId?.let {state().currentState.allDiagramByElementId[BpmnElementId(it)] } + bpmnElemId?.let {state().currentState.diagramByElementId[BpmnElementId(it)] } } else -> null } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeRenderElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeRenderElement.kt index 3045eebdc..fd8e3a80d 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeRenderElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeRenderElement.kt @@ -52,7 +52,7 @@ abstract class ShapeRenderElement( get() = shape override fun doRenderWithoutChildren(ctx: RenderContext): Map { - val elem = state().currentState.allElementsByDiagramId[shape.id] + val elem = state().currentState.elementsByDiagramId[shape.id] val props = state().currentState.processElemPropertiesByStaticElementId[elem] val name = props?.get(PropertyType.NAME)?.value as String? @@ -204,12 +204,12 @@ abstract class ShapeRenderElement( if (null != nests && nests != currentParent?.bpmnElementId) { newEvents += BpmnParentChangedEvent(shape.bpmnElement, nests) // Cascade parent change to waypoint owning edge - newEvents += cascadeTargets.mapNotNull { state().currentState.allElementsByDiagramId[it.parentEdgeId] }.map { BpmnParentChangedEvent(it, nests) } + newEvents += cascadeTargets.mapNotNull { state().currentState.elementsByDiagramId[it.parentEdgeId] }.map { BpmnParentChangedEvent(it, nests) } } else if (null != parentProcess && parentProcess != parents.firstOrNull()?.bpmnElementId) { newEvents += BpmnParentChangedEvent(shape.bpmnElement, parentProcess) // Cascade parent change to waypoint owning edge - newEvents += cascadeTargets.mapNotNull { state().currentState.allElementsByDiagramId[it.parentEdgeId] }.map { BpmnParentChangedEvent(it, parentProcess) } + newEvents += cascadeTargets.mapNotNull { state().currentState.elementsByDiagramId[it.parentEdgeId] }.map { BpmnParentChangedEvent(it, parentProcess) } } return newEvents } @@ -218,7 +218,7 @@ abstract class ShapeRenderElement( val idCascadesTo = setOf(PropertyType.SOURCE_REF, PropertyType.TARGET_REF) val result = mutableSetOf() val elemToDiagramId = mutableMapOf>() - state().currentState.allElementsByDiagramId.forEach { elemToDiagramId.computeIfAbsent(it.value) { mutableSetOf() }.add(it.key) } + state().currentState.elementsByDiagramId.forEach { elemToDiagramId.computeIfAbsent(it.value) { mutableSetOf() }.add(it.key) } state().currentState.processElemPropertiesByStaticElementId.forEach { (owner, props) -> idCascadesTo.intersect(props.keys).filter { props[it]?.value == shape.bpmnElement.id }.forEach { type -> when (state().currentState.processElementByBpmnId[owner]?.element) { diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt index 11081fcb6..50b20d858 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt @@ -1,6 +1,5 @@ package com.valb3r.bpmn.intellij.plugin.core.state -import com.intellij.database.dialects.base.introspector.group import com.intellij.openapi.project.Project import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileView import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObjectView @@ -31,20 +30,20 @@ fun currentStateProvider(project: Project): CurrentStateProvider { } data class CurrentState( - var processId: BpmnElementId, + var primaryProcessId: BpmnElementId, val shapes: List, val edges: List, - val allElementsByDiagramId: Map, + val elementsByDiagramId: Map, val processElementByBpmnId: Map, val processElemPropertiesByStaticElementId: Map, val processPropertyWithElementByPropertyType: Map>, val processElemUiOnlyPropertiesByStaticElementId: Map>, val undoRedo: Set, val version: Long, - val allDiagramByElementId: Map = allElementsByDiagramId.map { Pair(it.value, it.key) }.toMap(), + val diagramByElementId: Map = elementsByDiagramId.map { Pair(it.value, it.key) }.toMap(), ) { fun processDiagramId(): DiagramElementId { - return processDiagramId(processId) + return processDiagramId(primaryProcessId) } companion object { @@ -88,12 +87,12 @@ class CurrentStateProvider(private val project: Project) { private fun handleUpdates(state: CurrentState): CurrentState { var updatedShapes = state.shapes.toMutableList() var updatedEdges = state.edges.toMutableList() - val updatedElementByDiagramId = state.allElementsByDiagramId.toMutableMap() + val updatedElementByDiagramId = state.elementsByDiagramId.toMutableMap() val updatedElementByStaticId = state.processElementByBpmnId.toMutableMap() val updatedElemPropertiesByStaticElementId = state.processElemPropertiesByStaticElementId.mapValues { it.value.copy() }.toMutableMap() val updatedPropertyWithElementByPropertyType = mutableMapOf>() val updatedElemUiOnlyPropertiesByStaticElementId = state.processElemUiOnlyPropertiesByStaticElementId.toMutableMap() - var updatedProcessId = state.processId + var updatedProcessId = state.primaryProcessId val updateEventsRegistry: ProcessModelUpdateEvents = updateEventsRegistry(project) val undoRedoStatus = updateEventsRegistry.undoRedoStatus() diff --git a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt index 68166c92a..62b08d84e 100644 --- a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt +++ b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt @@ -1235,7 +1235,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { canvas.click(onlyRootProcessPoint) lastRenderedState(project)!!.state.ctx.selectedIds.shouldBeEmpty() lastRenderedState(project)!!.state.ctx.stateProvider.currentState() - .allElementsByDiagramId[CurrentState.processDiagramId(BpmnElementId(newRootProcessId))].shouldNotBeNull() + .elementsByDiagramId[CurrentState.processDiagramId(BpmnElementId(newRootProcessId))].shouldNotBeNull() val anotherNewRootProcessId = "another-new-root-process-id" @@ -1247,6 +1247,6 @@ internal class UiEditorLightE2ETest: BaseUiTest() { canvas.click(onlyRootProcessPoint) lastRenderedState(project)!!.state.ctx.selectedIds.shouldBeEmpty() lastRenderedState(project)!!.state.ctx.stateProvider.currentState() - .allElementsByDiagramId[CurrentState.processDiagramId(BpmnElementId(anotherNewRootProcessId))].shouldNotBeNull() + .elementsByDiagramId[CurrentState.processDiagramId(BpmnElementId(anotherNewRootProcessId))].shouldNotBeNull() } } From fd97cee1b1f9ef4837401e2bd353bd9a1feb5ea6 Mon Sep 17 00:00:00 2001 From: valb3r Date: Tue, 14 Dec 2021 10:50:41 +0200 Subject: [PATCH 14/41] Further mapping of elements --- .../core/render/DefaultBpmnProcessRenderer.kt | 3 +- .../shapes/ShapeSetInFixedBoundary.kt | 38 +++++++++++++++++++ .../plugin/core/state/CurrentState.kt | 16 +++----- .../intellij/plugin/UiEditorLightE2ETest.kt | 4 +- .../plugin/bpmn/api/BpmnFileObject.kt | 12 +++--- 5 files changed, 54 insertions(+), 19 deletions(-) create mode 100644 bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeSetInFixedBoundary.kt diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index c186f2bf1..605e42935 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -155,6 +155,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr val result = TreeState(state, elementsById, elementsByDiagramId, version) + TODO("Create collaboration processes") val root = createRootProcessElem({ result.state }, elements, elementsById) createShapes({ result.state }, elements, elementsById) createEdges({ result.state }, elements, elementsById) @@ -167,7 +168,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr } private fun createRootProcessElem(state: () -> RenderState, elements: MutableList, elementsById: MutableMap): BaseBpmnRenderElement { - val processElem = PlaneRenderElement(state().currentState.processDiagramId(), state().currentState.primaryProcessId, state, mutableListOf()) + val processElem = PlaneRenderElement(state().currentState.primaryProcessDiagramId(), state().currentState.primaryProcessId, state, mutableListOf()) elements += processElem elementsById[state().currentState.primaryProcessId] = processElem return processElem diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeSetInFixedBoundary.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeSetInFixedBoundary.kt new file mode 100644 index 000000000..9ba725c98 --- /dev/null +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeSetInFixedBoundary.kt @@ -0,0 +1,38 @@ +package com.valb3r.bpmn.intellij.plugin.core.render.elements.shapes + +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.ShapeElement +import com.valb3r.bpmn.intellij.plugin.core.Colors +import com.valb3r.bpmn.intellij.plugin.core.render.AreaType +import com.valb3r.bpmn.intellij.plugin.core.render.AreaWithZindex +import com.valb3r.bpmn.intellij.plugin.core.render.RenderContext +import com.valb3r.bpmn.intellij.plugin.core.render.elements.RenderState +import java.awt.Stroke + +class ShapeSetInFixedBoundary( + elementId: DiagramElementId, + bpmnElementId: BpmnElementId, + shape: ShapeElement, + state: () -> RenderState, + private val backgroundColor: Colors = Colors.CALL_ACTIVITY_COLOR, + private val borderColor: Colors = Colors.ELEMENT_BORDER_COLOR, + private val textColor: Colors = Colors.INNER_TEXT_COLOR, + private val borderStroke: Stroke? = null, + override val areaType: AreaType = AreaType.SHAPE +) : ResizeableShapeRenderElement(elementId, bpmnElementId, shape, state) { + + override fun doRender(ctx: RenderContext, shapeCtx: ShapeCtx): Map { + + val area = ctx.canvas.drawRoundedRect( + shapeCtx.shape, + shapeCtx.name, + color(backgroundColor), + borderColor.color, + textColor.color, + borderStroke + ) + + return mapOf(shapeCtx.diagramId to AreaWithZindex(area, areaType, waypointAnchors(ctx.canvas.camera), shapeAnchors(ctx.canvas.camera), index = zIndex(), bpmnElementId = shape.bpmnElement)) + } +} diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt index 50b20d858..0f8ea9d6b 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt @@ -2,7 +2,6 @@ package com.valb3r.bpmn.intellij.plugin.core.state import com.intellij.openapi.project.Project import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileView -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObjectView import com.valb3r.bpmn.intellij.plugin.bpmn.api.PropertyTable import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithParentId @@ -42,12 +41,12 @@ data class CurrentState( val version: Long, val diagramByElementId: Map = elementsByDiagramId.map { Pair(it.value, it.key) }.toMap(), ) { - fun processDiagramId(): DiagramElementId { - return processDiagramId(primaryProcessId) + fun primaryProcessDiagramId(): DiagramElementId { + return primaryProcessDiagramId(primaryProcessId) } companion object { - fun processDiagramId(processId: BpmnElementId): DiagramElementId { + fun primaryProcessDiagramId(processId: BpmnElementId): DiagramElementId { return DiagramElementId(processId.id) } } @@ -63,9 +62,8 @@ class CurrentStateProvider(private val project: Project) { fun resetStateTo(fileContent: String, view: BpmnFileView) { version.set(0L) - val primaryProcessObject = findPrimaryProcessFromCollaborations(view) ?: view.processes[0] fileState = CurrentState( - primaryProcessObject.processId, + view.primaryProcessId, view.processes.flatMap { proc -> proc.diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() } }, view.processes.flatMap { proc -> proc.diagram.flatMap { it.bpmnPlane.bpmnEdge ?: emptyList() }.map { EdgeElementState(it) } }, view.processes.flatMap { proc -> proc.allElementsByDiagramId.entries }.groupBy { it.key }.mapValues { it.value.first().value }, @@ -325,7 +323,7 @@ class CurrentStateProvider(private val project: Project) { updatedElemPropertiesByStaticElementId[newElementId] = elemPropUpdated if (elementId == processId) { - updatedElementByDiagramId[CurrentState.processDiagramId(newElementId)] = newElementId + updatedElementByDiagramId[CurrentState.primaryProcessDiagramId(newElementId)] = newElementId return newElementId } @@ -347,8 +345,4 @@ class CurrentStateProvider(private val project: Project) { private fun updateWaypointLocation(elem: EdgeWithIdentifiableWaypoints, update: NewWaypoints): EdgeWithIdentifiableWaypoints { return EdgeElementState(elem, update.waypoints, update.epoch) } - - private fun findPrimaryProcessFromCollaborations(view: BpmnFileView): BpmnProcessObjectView? { - return view.collaborations.firstOrNull()?.primaryProcessId?.let { processId -> view.processes.firstOrNull { processId == it.processId } } - } } diff --git a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt index 62b08d84e..e9ac7874f 100644 --- a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt +++ b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt @@ -1235,7 +1235,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { canvas.click(onlyRootProcessPoint) lastRenderedState(project)!!.state.ctx.selectedIds.shouldBeEmpty() lastRenderedState(project)!!.state.ctx.stateProvider.currentState() - .elementsByDiagramId[CurrentState.processDiagramId(BpmnElementId(newRootProcessId))].shouldNotBeNull() + .elementsByDiagramId[CurrentState.primaryProcessDiagramId(BpmnElementId(newRootProcessId))].shouldNotBeNull() val anotherNewRootProcessId = "another-new-root-process-id" @@ -1247,6 +1247,6 @@ internal class UiEditorLightE2ETest: BaseUiTest() { canvas.click(onlyRootProcessPoint) lastRenderedState(project)!!.state.ctx.selectedIds.shouldBeEmpty() lastRenderedState(project)!!.state.ctx.stateProvider.currentState() - .elementsByDiagramId[CurrentState.processDiagramId(BpmnElementId(anotherNewRootProcessId))].shouldNotBeNull() + .elementsByDiagramId[CurrentState.primaryProcessDiagramId(BpmnElementId(anotherNewRootProcessId))].shouldNotBeNull() } } diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index d8558bb95..89e88e104 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -15,10 +15,11 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType data class BpmnFileObject(val processes: List, val collaborations: List, val diagram: List) { fun toView(factory: BpmnObjectFactory) : BpmnFileView { - val mappedProcesses = mapProcesses(factory) val mappedCollaborations = mapCollaborations(factory) + val primaryProcessId = mappedCollaborations.firstOrNull()?.primaryProcessId ?: processes[0].id + val mappedProcesses = mapProcesses(factory, primaryProcessId) - return BpmnFileView(mappedProcesses, mappedCollaborations) + return BpmnFileView(primaryProcessId, mappedProcesses, mappedCollaborations) } private fun mapCollaborations(factory: BpmnObjectFactory): List { @@ -36,7 +37,7 @@ data class BpmnFileObject(val processes: List, val collaborations: mappedCollaborations += BpmnCollaborationView( collaboration.id, - collaboration.participant?.first()?.id, + collaboration.participant?.first()?.processRef?.let { BpmnElementId(it) }, elementByStaticId, propertiesById ) @@ -45,14 +46,14 @@ data class BpmnFileObject(val processes: List, val collaborations: return mappedCollaborations } - private fun mapProcesses(factory: BpmnObjectFactory): List { + private fun mapProcesses(factory: BpmnObjectFactory, primaryProcessId: BpmnElementId): List { val mappedProcesses = mutableListOf() for (process in processes) { val elementByDiagramId = mutableMapOf() val elementByStaticId = mutableMapOf() val propertiesById = mutableMapOf() - fillFor(BpmnElementId(""), factory, process, elementByStaticId, propertiesById) + fillFor(if (process.id == primaryProcessId) BpmnElementId("") else primaryProcessId, factory, process, elementByStaticId, propertiesById) elementByDiagramId[DiagramElementId(process.id.id)] = process.id // 1st pass @@ -206,6 +207,7 @@ data class BpmnFileObject(val processes: List, val collaborations: } data class BpmnFileView( + val primaryProcessId: BpmnElementId, val processes: List, val collaborations: List ) From c3339bfdbb49347c3836213f1338f1e728658b91 Mon Sep 17 00:00:00 2001 From: valb3r Date: Wed, 15 Dec 2021 11:04:09 +0200 Subject: [PATCH 15/41] FBP-224. Render collaboration process --- .../intellij/plugin/core/tests/BaseUiTest.kt | 4 +-- .../copypaste/CopyPasteActionHandler.kt | 4 +-- .../core/properties/PropertiesVisualizer.kt | 2 +- .../intellij/plugin/core/render/Canvas.kt | 6 ++-- .../core/render/DefaultBpmnProcessRenderer.kt | 21 ++++++++--- .../elements/anchors/PhysicalWaypoint.kt | 6 ++-- .../elements/edges/BaseEdgeRenderElement.kt | 8 ++--- .../elements/edges/EdgeRenderElement.kt | 2 +- .../elements/shapes/ShapeRenderElement.kt | 8 ++--- .../plugin/core/state/CurrentState.kt | 35 +++++++++++++------ .../plugin/BoundaryEventAttachTest.kt | 24 ++++++------- .../plugin/StateBasedPropertyUpdateTest.kt | 12 +++---- .../plugin/bpmn/api/events/EventInterfaces.kt | 6 +++- 13 files changed, 83 insertions(+), 55 deletions(-) diff --git a/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt b/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt index abd51c32a..1a66c575f 100644 --- a/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt +++ b/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt @@ -236,7 +236,7 @@ abstract class BaseUiTest { clickOnId(diagramElementId) propertiesVisualizer(project).visualize( newElementsFactory(project), - currentStateProvider(project).currentState().processElemPropertiesByStaticElementId, + currentStateProvider(project).currentState().elemPropertiesByStaticElementId, elementId ) whenever(textFieldsConstructed[id]!!.text).thenReturn(newId) @@ -247,7 +247,7 @@ abstract class BaseUiTest { val id = Pair(elementId, PropertyType.ID) propertiesVisualizer(project).visualize( newElementsFactory(project), - currentStateProvider(project).currentState().processElemPropertiesByStaticElementId, + currentStateProvider(project).currentState().elemPropertiesByStaticElementId, elementId ) whenever(textFieldsConstructed[id]!!.text).thenReturn(newId) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/copypaste/CopyPasteActionHandler.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/copypaste/CopyPasteActionHandler.kt index ceea48772..210fb3804 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/copypaste/CopyPasteActionHandler.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/copypaste/CopyPasteActionHandler.kt @@ -293,8 +293,8 @@ class CopyPasteActionHandler(private val clipboard: SystemClipboard) { processedElementIds: MutableSet ) { val bpmnId = ctx.currentState.elementsByDiagramId[diagramId] ?: return - val withParentId = ctx.currentState.processElementByBpmnId[bpmnId] ?: return - val props = ctx.currentState.processElemPropertiesByStaticElementId[bpmnId] ?: return + val withParentId = ctx.currentState.elementByBpmnId[bpmnId] ?: return + val props = ctx.currentState.elemPropertiesByStaticElementId[bpmnId] ?: return if (processedElementIds.contains(bpmnId)) { return } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/properties/PropertiesVisualizer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/properties/PropertiesVisualizer.kt index 843d13874..4be0d91e3 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/properties/PropertiesVisualizer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/properties/PropertiesVisualizer.kt @@ -302,7 +302,7 @@ class PropertiesVisualizer( val supportedTypes = newElemsProvider.propertyTypes().map { it.name }.toSet() events += type.actionUiOnlyResult.filter { supportedTypes.contains(it.propertyType) }.map { UiOnlyValueAddedEvent(bpmnElementId, propertyType(it.propertyType), it.valuePattern, propertyIndex = propertyIndex + it.uiOnlyaddedIndex) } updateEventsRegistry(project).addEvents(events) - visualize(newElementsFactory(project), currentStateProvider(project).currentState().processElemPropertiesByStaticElementId, bpmnElementId, expandedElems.toSet()) + visualize(newElementsFactory(project), currentStateProvider(project).currentState().elemPropertiesByStaticElementId, bpmnElementId, expandedElems.toSet()) } } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt index 782e478d4..321bc7a63 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt @@ -419,11 +419,11 @@ class Canvas(private val project: Project, private val settings: CanvasConstants state .elementsByDiagramId[elementIdForPropertiesTable] ?.let { elemId -> - state.processElemPropertiesByStaticElementId[elemId]?.let { + state.elemPropertiesByStaticElementId[elemId]?.let { propsVisualizer?.visualize( newElementsFactory( project - ), state.processElemPropertiesByStaticElementId, elemId + ), state.elemPropertiesByStaticElementId, elemId ) } } ?: propsVisualizer?.clear() @@ -473,7 +473,7 @@ class Canvas(private val project: Project, private val settings: CanvasConstants } val bpmnId = setOf(stateProvider.currentState().elementsByDiagramId[elem.first], elem.second.bpmnElementId).filterNotNull().firstOrNull() ?: continue - val bpmnElem = stateProvider.currentState().processElementByBpmnId[bpmnId] + val bpmnElem = stateProvider.currentState().elementByBpmnId[bpmnId] if (bpmnElem?.element is BpmnSequenceFlow) { continue } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index 605e42935..93c65cd3a 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -155,8 +155,8 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr val result = TreeState(state, elementsById, elementsByDiagramId, version) - TODO("Create collaboration processes") val root = createRootProcessElem({ result.state }, elements, elementsById) + createCollaborationProcesses({ result.state }, elements, elementsById) createShapes({ result.state }, elements, elementsById) createEdges({ result.state }, elements, elementsById) linkChildrenToParent({ result.state }, elementsById) @@ -174,9 +174,20 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr return processElem } + private fun createCollaborationProcesses(state: () -> RenderState, elements: MutableList, elementsById: MutableMap) { + val rootProcessId = state().currentState.primaryProcessId + val collaborations = state().currentState.processes.filter { it != rootProcessId } + collaborations.forEach { + val id = DiagramElementId("__process_${it.id}") + val processElem = ShapeSetInFixedBoundary(id, it, ShapeElement(id, it, BoundsElement(0.0f, 0.0f, 10.0f, 10.0f)), state) + elements += processElem + elementsById[it] = processElem + } + } + private fun createShapes(state: () -> RenderState, elements: MutableList, elementsById: MutableMap) { state().currentState.shapes.forEach { - val elem = state().currentState.processElementByBpmnId[it.bpmnElement] + val elem = state().currentState.elementByBpmnId[it.bpmnElement] elem?.let { bpmn -> mapFromShape(state, it.id, it, bpmn.element).let { shape -> elements += shape @@ -196,8 +207,8 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr private fun linkChildrenToParent(state: () -> RenderState, elementsById: MutableMap) { elementsById.forEach { (id, renderElem) -> - val elem = state().currentState.processElementByBpmnId[id] - elem?.parent?.let {elementsById[it]}?.let { if (it is BaseBpmnRenderElement) it else null }?.let { parent -> + val elem = state().currentState.elementByBpmnId[id] + elem?.parent?.let { elementsById[it] }?.let { if (it is BaseBpmnRenderElement) it else null }?.let { parent -> parent.children.add(renderElem) parent.let { renderElem.parents.add(it) } } @@ -271,7 +282,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr } private fun isCollapsed(id: BpmnElementId, state: () -> RenderState): Boolean { - return !(state().currentState.processElemUiOnlyPropertiesByStaticElementId[id]?.get(UiOnlyPropertyType.EXPANDED)?.value as Boolean? ?: false) + return !(state().currentState.elemUiOnlyPropertiesByStaticElementId[id]?.get(UiOnlyPropertyType.EXPANDED)?.value as Boolean? ?: false) } private fun drawSelectionRect(state: RenderContext) { diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/anchors/PhysicalWaypoint.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/anchors/PhysicalWaypoint.kt index f21d3770f..3a359b97c 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/anchors/PhysicalWaypoint.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/anchors/PhysicalWaypoint.kt @@ -81,7 +81,7 @@ class PhysicalWaypoint( } val state = state().currentState - val currentProps = state.processPropertyWithElementByPropertyType + val currentProps = state.propertyWithElementByPropertyType val rootProcessId = state.primaryProcessId if (null != droppedOn && !multipleElementsSelected() && !multipleElementsDragged()) { if (edgePhysicalSize - 1 == physicalPos) { @@ -128,8 +128,8 @@ class PhysicalWaypoint( private fun isEdgeBegin() = 0 == physicalPos private fun isEdgeEnd() = edgePhysicalSize - 1 == physicalPos - private fun isSourceRefAttached() = null != state().currentState.processElemPropertiesByStaticElementId[parentElementBpmnId]?.get(PropertyType.SOURCE_REF)?.value - private fun isTargetRefAttached() = null != state().currentState.processElemPropertiesByStaticElementId[parentElementBpmnId]?.get(PropertyType.TARGET_REF)?.value + private fun isSourceRefAttached() = null != state().currentState.elemPropertiesByStaticElementId[parentElementBpmnId]?.get(PropertyType.SOURCE_REF)?.value + private fun isTargetRefAttached() = null != state().currentState.elemPropertiesByStaticElementId[parentElementBpmnId]?.get(PropertyType.TARGET_REF)?.value private fun isEdgeBeginOrEnd() = edgePhysicalSize - 1 == physicalPos || 0 == physicalPos private fun handleBpmnOutgoingCascade( diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/BaseEdgeRenderElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/BaseEdgeRenderElement.kt index e3f7a8c7e..56477ef03 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/BaseEdgeRenderElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/BaseEdgeRenderElement.kt @@ -109,7 +109,7 @@ abstract class BaseEdgeRenderElement( } private fun drawNameIfAvailable(waypoints: List, color: Color) { - val name = state().currentState.processElemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.NAME)?.value as String? ?: return + val name = state().currentState.elemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.NAME)?.value as String? ?: return val longestSegment = waypoints .mapIndexedNotNull {pos, it -> if (0 == pos) null else Pair(waypoints[pos - 1], it)} .maxBy { it.first.distance(it.second) } ?: return @@ -127,7 +127,7 @@ abstract class BaseEdgeRenderElement( } private fun renderDefaultMarkIfNeeded(ctx: RenderContext, anchors: List): Area { - val sourceRefOfExists = state().currentState.processPropertyWithElementByPropertyType[PropertyType.DEFAULT_FLOW]?.any { it.value.value == bpmnElementId.id } ?: false + val sourceRefOfExists = state().currentState.propertyWithElementByPropertyType[PropertyType.DEFAULT_FLOW]?.any { it.value.value == bpmnElementId.id } ?: false if (!sourceRefOfExists) { return Area() } @@ -162,11 +162,11 @@ abstract class BaseEdgeRenderElement( private fun findAttachedToElement(physicalPos: Int, numPhysicals: Int): DiagramElementId? { return when (physicalPos) { 0 -> { - val bpmnElemId = state().currentState.processElemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.SOURCE_REF)?.value as String? + val bpmnElemId = state().currentState.elemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.SOURCE_REF)?.value as String? bpmnElemId?.let {state().currentState.diagramByElementId[BpmnElementId(it)] } } numPhysicals - 1 -> { - val bpmnElemId = state().currentState.processElemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.TARGET_REF)?.value as String? + val bpmnElemId = state().currentState.elemPropertiesByStaticElementId[bpmnElementId]?.get(PropertyType.TARGET_REF)?.value as String? bpmnElemId?.let {state().currentState.diagramByElementId[BpmnElementId(it)] } } else -> null diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/EdgeRenderElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/EdgeRenderElement.kt index cac291645..88b660a93 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/EdgeRenderElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/edges/EdgeRenderElement.kt @@ -28,7 +28,7 @@ class EdgeRenderElement( val delId = elementId.elemIdToRemove() val deleteIconArea = state().ctx.canvas.drawIcon(BoundsElement(x, y - ACTIONS_ICO_SIZE, ACTIONS_ICO_SIZE, ACTIONS_ICO_SIZE), state().icons.recycleBin) state().ctx.interactionContext.clickCallbacks[delId] = { dest -> - val currentProps = state().currentState.processPropertyWithElementByPropertyType + val currentProps = state().currentState.propertyWithElementByPropertyType val cascadeEvents = computeCascadeChangeOfBpmnIncomingOutgoingIndex(bpmnElementId, currentProps, PropertyType.BPMN_INCOMING).toMutableList() + computeCascadeChangeOfBpmnIncomingOutgoingIndex(bpmnElementId, currentProps, PropertyType.BPMN_OUTGOING) dest.addElementRemovedEvent(getEventsToDeleteDiagram(), getEventsToDeleteElement(), cascadeEvents) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeRenderElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeRenderElement.kt index fd8e3a80d..7390bc155 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeRenderElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeRenderElement.kt @@ -53,7 +53,7 @@ abstract class ShapeRenderElement( override fun doRenderWithoutChildren(ctx: RenderContext): Map { val elem = state().currentState.elementsByDiagramId[shape.id] - val props = state().currentState.processElemPropertiesByStaticElementId[elem] + val props = state().currentState.elemPropertiesByStaticElementId[elem] val name = props?.get(PropertyType.NAME)?.value as String? state().ctx.interactionContext.dragEndCallbacks[elementId] = { @@ -219,9 +219,9 @@ abstract class ShapeRenderElement( val result = mutableSetOf() val elemToDiagramId = mutableMapOf>() state().currentState.elementsByDiagramId.forEach { elemToDiagramId.computeIfAbsent(it.value) { mutableSetOf() }.add(it.key) } - state().currentState.processElemPropertiesByStaticElementId.forEach { (owner, props) -> + state().currentState.elemPropertiesByStaticElementId.forEach { (owner, props) -> idCascadesTo.intersect(props.keys).filter { props[it]?.value == shape.bpmnElement.id }.forEach { type -> - when (state().currentState.processElementByBpmnId[owner]?.element) { + when (state().currentState.elementByBpmnId[owner]?.element) { is BpmnSequenceFlow -> { result += computeCascadeToWaypoint(state().currentState, shape.bpmnElement, owner, type) } } } @@ -295,7 +295,7 @@ abstract class ShapeRenderElement( return mutableListOf() } - val sourceElem = state().currentState.processElementByBpmnId[bpmnElementId] ?: return mutableListOf() + val sourceElem = state().currentState.elementByBpmnId[bpmnElementId] ?: return mutableListOf() val newSequenceBpmn = newElementsFactory(state().ctx.project).newOutgoingSequence(sourceElem.element) val anchors = findSequenceAnchors(targetArea) ?: return mutableListOf() diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt index 0f8ea9d6b..9cb536e50 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt @@ -29,14 +29,15 @@ fun currentStateProvider(project: Project): CurrentStateProvider { } data class CurrentState( - var primaryProcessId: BpmnElementId, + val primaryProcessId: BpmnElementId, + val processes: Set, val shapes: List, val edges: List, val elementsByDiagramId: Map, - val processElementByBpmnId: Map, - val processElemPropertiesByStaticElementId: Map, - val processPropertyWithElementByPropertyType: Map>, - val processElemUiOnlyPropertiesByStaticElementId: Map>, + val elementByBpmnId: Map, + val elemPropertiesByStaticElementId: Map, + val propertyWithElementByPropertyType: Map>, + val elemUiOnlyPropertiesByStaticElementId: Map>, val undoRedo: Set, val version: Long, val diagramByElementId: Map = elementsByDiagramId.map { Pair(it.value, it.key) }.toMap(), @@ -52,18 +53,21 @@ data class CurrentState( } } +private val ZERO_STATE = CurrentState(BpmnElementId(""), emptySet(), emptyList(), emptyList(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptySet(), 0L) + // Global singleton class CurrentStateProvider(private val project: Project) { private val mapper = Mappers.getMapper(MapTransactionalSubprocessToSubprocess::class.java) - private var fileState = CurrentState(BpmnElementId(""), emptyList(), emptyList(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptySet(), 0L) - private var currentState = CurrentState(BpmnElementId(""), emptyList(), emptyList(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptySet(), 0L) + private var fileState = ZERO_STATE.copy() + private var currentState = ZERO_STATE.copy() private val version = AtomicLong(0L) fun resetStateTo(fileContent: String, view: BpmnFileView) { version.set(0L) fileState = CurrentState( view.primaryProcessId, + view.processes.map { it.processId }.toSet(), view.processes.flatMap { proc -> proc.diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() } }, view.processes.flatMap { proc -> proc.diagram.flatMap { it.bpmnPlane.bpmnEdge ?: emptyList() }.map { EdgeElementState(it) } }, view.processes.flatMap { proc -> proc.allElementsByDiagramId.entries }.groupBy { it.key }.mapValues { it.value.first().value }, @@ -86,11 +90,12 @@ class CurrentStateProvider(private val project: Project) { var updatedShapes = state.shapes.toMutableList() var updatedEdges = state.edges.toMutableList() val updatedElementByDiagramId = state.elementsByDiagramId.toMutableMap() - val updatedElementByStaticId = state.processElementByBpmnId.toMutableMap() - val updatedElemPropertiesByStaticElementId = state.processElemPropertiesByStaticElementId.mapValues { it.value.copy() }.toMutableMap() + val updatedElementByStaticId = state.elementByBpmnId.toMutableMap() + val updatedElemPropertiesByStaticElementId = state.elemPropertiesByStaticElementId.mapValues { it.value.copy() }.toMutableMap() val updatedPropertyWithElementByPropertyType = mutableMapOf>() - val updatedElemUiOnlyPropertiesByStaticElementId = state.processElemUiOnlyPropertiesByStaticElementId.toMutableMap() + val updatedElemUiOnlyPropertiesByStaticElementId = state.elemUiOnlyPropertiesByStaticElementId.toMutableMap() var updatedProcessId = state.primaryProcessId + val updatedProcessSet = state.processes.toMutableSet() val updateEventsRegistry: ProcessModelUpdateEvents = updateEventsRegistry(project) val undoRedoStatus = updateEventsRegistry.undoRedoStatus() @@ -110,11 +115,16 @@ class CurrentStateProvider(private val project: Project) { updatedEdges = updatedEdges.map { edge -> if (edge.id == event.edgeElementId) updateWaypointLocation(edge, event) else edge }.toMutableList() } is BpmnElementRemoved -> { - handleRemoved(event.bpmnElementId, updatedShapes, updatedEdges, updatedElementByDiagramId, updatedElementByStaticId, updatedElemPropertiesByStaticElementId) + handleRemoved(event.bpmnElementId, updatedProcessSet, updatedShapes, updatedEdges, updatedElementByDiagramId, updatedElementByStaticId, updatedElemPropertiesByStaticElementId) } is DiagramElementRemoved -> { handleDiagramRemoved(event.elementId, updatedShapes, updatedEdges, updatedElementByDiagramId) } + is BpmnProcessObjectAdded -> { + updatedProcessSet.add(event.bpmnObject.id) + updatedElementByStaticId[event.bpmnObject.id] = event.bpmnObject + updatedElemPropertiesByStaticElementId[event.bpmnObject.id] = event.props.copy() + } is BpmnShapeObjectAdded -> { updatedShapes.add(event.shape) updatedElementByDiagramId[event.shape.id] = event.bpmnObject.id @@ -159,6 +169,7 @@ class CurrentStateProvider(private val project: Project) { return CurrentState( updatedProcessId, + updatedProcessSet, updatedShapes, updatedEdges, updatedElementByDiagramId, @@ -273,12 +284,14 @@ class CurrentStateProvider(private val project: Project) { private fun handleRemoved( elementId: BpmnElementId, + processes: MutableSet, updatedShapes: MutableList, updatedEdges: MutableList, updatedElementByDiagramId: MutableMap, updatedElementByStaticId: MutableMap, updatedElemPropertiesByStaticElementId: MutableMap ) { + processes.remove(elementId) val shape = updatedShapes.find { it.bpmnElement == elementId } val edge = updatedEdges.find { it.bpmnElement == elementId } shape?.let { updatedElementByDiagramId.remove(it.id); updatedShapes.remove(it) } diff --git a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/BoundaryEventAttachTest.kt b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/BoundaryEventAttachTest.kt index 5649130be..50ff841b2 100644 --- a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/BoundaryEventAttachTest.kt +++ b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/BoundaryEventAttachTest.kt @@ -42,7 +42,7 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) + lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -76,7 +76,7 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) + lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -109,7 +109,7 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) + lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -142,8 +142,8 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parent.shouldBeEqualTo(subprocessInSubProcessBpmnId) - lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) + lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parent.shouldBeEqualTo(subprocessInSubProcessBpmnId) + lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -177,8 +177,8 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parent.shouldBeEqualTo(subprocessBpmnId) - lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) + lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parent.shouldBeEqualTo(subprocessBpmnId) + lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -211,7 +211,7 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) + lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(parentProcessBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) @@ -244,10 +244,10 @@ internal class BoundaryEventAttachTest: BaseUiTest() { canvas.paintComponent(graphics) canvas.stopDragOrSelect() canvas.paintComponent(graphics) - lastRenderedState(project)!!.state.currentState.processElementByBpmnId[serviceTaskStartBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) - lastRenderedState(project)!!.state.currentState.processElementByBpmnId[serviceTaskStartBpmnId]!!.parent.shouldBeEqualTo(subprocessBpmnId) - lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) - lastRenderedState(project)!!.state.currentState.processElementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parent.shouldBeEqualTo(serviceTaskStartBpmnId) + lastRenderedState(project)!!.state.currentState.elementByBpmnId[serviceTaskStartBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) + lastRenderedState(project)!!.state.currentState.elementByBpmnId[serviceTaskStartBpmnId]!!.parent.shouldBeEqualTo(subprocessBpmnId) + lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parentIdForXml.shouldBeEqualTo(subprocessBpmnId) + lastRenderedState(project)!!.state.currentState.elementByBpmnId[optionalBoundaryErrorEventBpmnId]!!.parent.shouldBeEqualTo(serviceTaskStartBpmnId) argumentCaptor>().apply { verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) diff --git a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/StateBasedPropertyUpdateTest.kt b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/StateBasedPropertyUpdateTest.kt index d89662300..b527633fb 100644 --- a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/StateBasedPropertyUpdateTest.kt +++ b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/StateBasedPropertyUpdateTest.kt @@ -24,30 +24,30 @@ internal class StateBasedPropertyUpdateTest: BaseUiTest() { @Test fun `Group based update event updates state properly`() { prepareTwoServiceTaskView() - currentStateProvider(project).currentState().processElemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] + currentStateProvider(project).currentState().elemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] ?.value?.shouldBeNull() updateEventsRegistry(project).addPropertyUpdateEvent(StringValueUpdatedEvent(serviceTaskStartBpmnId, PropertyType.FIELD_NAME, "1", propertyIndex = null)) - currentStateProvider(project).currentState().processElemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] + currentStateProvider(project).currentState().elemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] ?.shouldBeEqualTo(Property("1", null)) updateEventsRegistry(project).addPropertyUpdateEvent(StringValueUpdatedEvent(serviceTaskStartBpmnId, PropertyType.FIELD_NAME, "", propertyIndex = null)) - currentStateProvider(project).currentState().processElemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] + currentStateProvider(project).currentState().elemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] ?.shouldBeEqualTo(Property("", null)) } @Test fun `Group based multiple update event updates state properly`() { prepareTwoServiceTaskView() - currentStateProvider(project).currentState().processElemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] + currentStateProvider(project).currentState().elemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] ?.value?.shouldBeNull() updateEventsRegistry(project).addPropertyUpdateEvent(StringValueUpdatedEvent(serviceTaskStartBpmnId, PropertyType.FIELD_EXPRESSION, "expression 1", propertyIndex = null)) updateEventsRegistry(project).addPropertyUpdateEvent(StringValueUpdatedEvent(serviceTaskStartBpmnId, PropertyType.FIELD_NAME, "new name", propertyIndex = null)) updateEventsRegistry(project).addEvents(listOf(IndexUiOnlyValueUpdatedEvent(serviceTaskStartBpmnId, PropertyType.FIELD_EXPRESSION, listOf(), listOf("new name")))) - currentStateProvider(project).currentState().processElemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] + currentStateProvider(project).currentState().elemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_NAME] ?.shouldBeEqualTo(Property("new name", null)) - currentStateProvider(project).currentState().processElemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_EXPRESSION] + currentStateProvider(project).currentState().elemPropertiesByStaticElementId[serviceTaskStartBpmnId]!![PropertyType.FIELD_EXPRESSION] ?.shouldBeEqualTo(Property("expression 1", listOf("new name"))) } } diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/events/EventInterfaces.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/events/EventInterfaces.kt index c63685b32..8b43a85cf 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/events/EventInterfaces.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/events/EventInterfaces.kt @@ -9,7 +9,6 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.ShapeElement import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.Translatable import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.WaypointElement import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.WithDiagramId -import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.Property import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType import java.awt.geom.Point2D @@ -53,6 +52,11 @@ interface BpmnShapeObjectAdded: EventPropagatableToXml { val props: PropertyTable } +interface BpmnProcessObjectAdded: EventPropagatableToXml { + val bpmnObject: WithParentId + val props: PropertyTable +} + interface BpmnShapeResizedAndMoved: EventPropagatableToXml { val diagramElementId: DiagramElementId val cx: Float From bbbe46e7dd568f307fdbe36ac4132daa780e18c1 Mon Sep 17 00:00:00 2001 From: valb3r Date: Wed, 15 Dec 2021 13:29:16 +0200 Subject: [PATCH 16/41] FBP-224. Propagating lane rendering --- .../core/render/DefaultBpmnProcessRenderer.kt | 4 ++ .../core/render/elements/shapes/NamedShape.kt | 38 +++++++++++++++++++ .../plugin/camunda/parser/nodes/CamundaXml.kt | 2 +- .../plugin/bpmn/api/BpmnFileObject.kt | 13 ++++++- .../bpmn/api/bpmn/elements/lanes/Lane.kt | 21 ++++++++-- .../bpmn/parser/core/BaseBpmnObjectFactory.kt | 8 +++- 6 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/NamedShape.kt diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index 93c65cd3a..7b1c6133f 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -12,6 +12,8 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.Bp import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.BpmnIntermediateNoneThrowingEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.BpmnIntermediateSignalThrowingEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.gateways.* +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLane +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLaneSet import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId @@ -259,6 +261,8 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr is BpmnTransactionCollapsedSubprocess -> ExpandableShapeNoIcon(id, bpmn.id, isCollapsed(bpmn.id, state), icons.plus, icons.minus, shape, state, areaType = AreaType.SHAPE_THAT_NESTS) is BpmnCallActivity -> NoIconShape(id, bpmn.id, shape, state) is BpmnAdHocSubProcess -> BottomMiddleIconShape(id, bpmn.id, icons.tilde, shape, state, areaType = AreaType.SHAPE_THAT_NESTS) + is BpmnLaneSet -> ShapeSetInFixedBoundary(id, bpmn.id, shape, state, Colors.PROCESS_COLOR, Colors.ELEMENT_BORDER_COLOR, Colors.SUBPROCESS_TEXT_COLOR, areaType = AreaType.SHAPE_THAT_NESTS) + is BpmnLane -> NamedShape(id, bpmn.id, shape, state, Colors.PROCESS_COLOR, Colors.ELEMENT_BORDER_COLOR, Colors.SUBPROCESS_TEXT_COLOR, areaType = AreaType.SHAPE_THAT_NESTS) is BpmnExclusiveGateway -> IconShape(id, bpmn.id, icons.exclusiveGateway, shape, state) is BpmnParallelGateway -> IconShape(id, bpmn.id, icons.parallelGateway, shape, state) is BpmnInclusiveGateway -> IconShape(id, bpmn.id, icons.inclusiveGateway, shape, state) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/NamedShape.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/NamedShape.kt new file mode 100644 index 000000000..ace3e17bb --- /dev/null +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/NamedShape.kt @@ -0,0 +1,38 @@ +package com.valb3r.bpmn.intellij.plugin.core.render.elements.shapes + +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.ShapeElement +import com.valb3r.bpmn.intellij.plugin.core.Colors +import com.valb3r.bpmn.intellij.plugin.core.render.AreaType +import com.valb3r.bpmn.intellij.plugin.core.render.AreaWithZindex +import com.valb3r.bpmn.intellij.plugin.core.render.RenderContext +import com.valb3r.bpmn.intellij.plugin.core.render.elements.RenderState +import java.awt.Stroke + +class NamedShape( + elementId: DiagramElementId, + bpmnElementId: BpmnElementId, + shape: ShapeElement, + state: () -> RenderState, + private val backgroundColor: Colors = Colors.CALL_ACTIVITY_COLOR, + private val borderColor: Colors = Colors.ELEMENT_BORDER_COLOR, + private val textColor: Colors = Colors.INNER_TEXT_COLOR, + private val borderStroke: Stroke? = null, + override val areaType: AreaType = AreaType.SHAPE +) : ResizeableShapeRenderElement(elementId, bpmnElementId, shape, state) { + + override fun doRender(ctx: RenderContext, shapeCtx: ShapeCtx): Map { + + val area = ctx.canvas.drawRoundedRect( + shapeCtx.shape, + shapeCtx.name, + color(backgroundColor), + borderColor.color, + textColor.color, + borderStroke + ) + + return mapOf(shapeCtx.diagramId to AreaWithZindex(area, areaType, waypointAnchors(ctx.canvas.camera), shapeAnchors(ctx.canvas.camera), index = zIndex(), bpmnElementId = shape.bpmnElement)) + } +} diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/CamundaXml.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/CamundaXml.kt index 590ed93e8..29c48b483 100644 --- a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/CamundaXml.kt +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/nodes/CamundaXml.kt @@ -483,7 +483,7 @@ class ProcessNode : BpmnMappable, ProcessBody() { fun convertToDto(input: ProcessBody): BpmnProcessBody } - @Mapper + @Mapper(uses = [BpmnElementIdMapper::class]) interface LaneSetMapping { @Mapping(source = "lane", target = "lanes") diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index 89e88e104..01af1afa7 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -6,6 +6,7 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnProcess import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnProcessBody import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithParentId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLaneSet import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElement import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.Property @@ -59,10 +60,10 @@ data class BpmnFileObject(val processes: List, val collaborations: // 1st pass process.body?.let { extractElementsFromBody(process.id, it, factory, elementByStaticId, propertiesById) } process.children?.forEach { (id, body) -> extractElementsFromBody(id, body, factory, elementByStaticId, propertiesById) } + process.laneSets?.forEach { extractElementsFromLanes(process.id, it, factory, elementByStaticId, propertiesById) } // 2nd pass process.body?.let { reassignParentsBasedOnTargetRef(process.id, it, factory, elementByStaticId, propertiesById) } process.children?.forEach { (id, body) -> reassignParentsBasedOnTargetRef(id, body, factory, elementByStaticId, propertiesById) } - diagram.flatMap { it.bpmnPlane.bpmnEdge ?: emptyList() } .filter { null != it.bpmnElement } .forEach { elementByDiagramId[it.id] = it.bpmnElement!! } @@ -160,6 +161,16 @@ data class BpmnFileObject(val processes: List, val collaborations: body.sequenceFlow?.forEach { fillFor(parentId, factory, it, elementByStaticId, propertiesById) } } + private fun extractElementsFromLanes( + parentId: BpmnElementId, + laneSet: BpmnLaneSet, + factory: BpmnObjectFactory, + elementByStaticId: MutableMap, + propertiesById: MutableMap) { + fillFor(parentId, factory, laneSet, elementByStaticId, propertiesById) + laneSet.lanes?.forEach { fillFor(laneSet.id, factory, it, elementByStaticId, propertiesById) } + } + private fun reassignParentsBasedOnTargetRef( parentId: BpmnElementId, body: BpmnProcessBody, diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/elements/lanes/Lane.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/elements/lanes/Lane.kt index ae5e3c460..80d5d78b4 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/elements/lanes/Lane.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/bpmn/elements/lanes/Lane.kt @@ -1,15 +1,28 @@ package com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId + data class BpmnLaneSet( - val id: String, + override val id: BpmnElementId, val lanes: List?, -) +): WithBpmnId { + + override fun updateBpmnElemId(newId: BpmnElementId): WithBpmnId { + return copy(id = newId) + } +} data class BpmnLane( - val id: String, + override val id: BpmnElementId, val name: String?, val documentation: String?, val flowNodeRef: List?, -) +): WithBpmnId { + + override fun updateBpmnElemId(newId: BpmnElementId): WithBpmnId { + return copy(id = newId) + } +} data class BpmnFlowNodeRef(val ref: String) diff --git a/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnObjectFactory.kt b/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnObjectFactory.kt index 6e857a999..a8e6a5ea2 100644 --- a/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnObjectFactory.kt +++ b/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnObjectFactory.kt @@ -18,6 +18,8 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.Bp import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.BpmnIntermediateNoneThrowingEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.BpmnIntermediateSignalThrowingEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.gateways.* +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLane +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLaneSet import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId @@ -25,7 +27,9 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.BoundsElement import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.EdgeElement import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.ShapeElement import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.WithDiagramId -import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.* +import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.Property +import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType +import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyValueType import java.util.* import kotlin.reflect.KClass @@ -136,7 +140,7 @@ abstract class BaseBpmnObjectFactory : BpmnObjectFactory { is BpmnIntermediateTimerCatchingEvent, is BpmnIntermediateMessageCatchingEvent, is BpmnIntermediateSignalCatchingEvent, is BpmnIntermediateConditionalCatchingEvent, is BpmnIntermediateNoneThrowingEvent, is BpmnIntermediateSignalThrowingEvent, is BpmnIntermediateEscalationThrowingEvent, is BpmnIntermediateLinkCatchingEvent, is BpmnProcess, - is BpmnCollaboration, is BpmnParticipant, is BpmnMessageFlow + is BpmnCollaboration, is BpmnParticipant, is BpmnMessageFlow, is BpmnLaneSet, is BpmnLane -> processDtoToPropertyMap(obj) is BpmnCallActivity -> fillForCallActivity(obj) From c75b234ccd942d6450503b90535f1ceec697b0eb Mon Sep 17 00:00:00 2001 From: valb3r Date: Thu, 16 Dec 2021 12:03:37 +0200 Subject: [PATCH 17/41] FBP-224. Fixed parent element selection --- .../bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index 01af1afa7..73e6cfde9 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -49,13 +49,13 @@ data class BpmnFileObject(val processes: List, val collaborations: private fun mapProcesses(factory: BpmnObjectFactory, primaryProcessId: BpmnElementId): List { val mappedProcesses = mutableListOf() + val allElementsByDiagramId = mutableMapOf() for (process in processes) { - val elementByDiagramId = mutableMapOf() val elementByStaticId = mutableMapOf() val propertiesById = mutableMapOf() fillFor(if (process.id == primaryProcessId) BpmnElementId("") else primaryProcessId, factory, process, elementByStaticId, propertiesById) - elementByDiagramId[DiagramElementId(process.id.id)] = process.id + allElementsByDiagramId[DiagramElementId(process.id.id)] = process.id // 1st pass process.body?.let { extractElementsFromBody(process.id, it, factory, elementByStaticId, propertiesById) } @@ -66,14 +66,14 @@ data class BpmnFileObject(val processes: List, val collaborations: process.children?.forEach { (id, body) -> reassignParentsBasedOnTargetRef(id, body, factory, elementByStaticId, propertiesById) } diagram.flatMap { it.bpmnPlane.bpmnEdge ?: emptyList() } .filter { null != it.bpmnElement } - .forEach { elementByDiagramId[it.id] = it.bpmnElement!! } + .forEach { allElementsByDiagramId[it.id] = it.bpmnElement!! } diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() } - .forEach { elementByDiagramId[it.id] = it.bpmnElement } + .forEach { allElementsByDiagramId[it.id] = it.bpmnElement } mappedProcesses += BpmnProcessObjectView( process.id, - elementByDiagramId, + allElementsByDiagramId, elementByStaticId, propertiesById, diagram @@ -167,8 +167,7 @@ data class BpmnFileObject(val processes: List, val collaborations: factory: BpmnObjectFactory, elementByStaticId: MutableMap, propertiesById: MutableMap) { - fillFor(parentId, factory, laneSet, elementByStaticId, propertiesById) - laneSet.lanes?.forEach { fillFor(laneSet.id, factory, it, elementByStaticId, propertiesById) } + laneSet.lanes?.forEach { fillFor(parentId, factory, it, elementByStaticId, propertiesById) } } private fun reassignParentsBasedOnTargetRef( From 3d65a99159f2776e1fc52fd8b146b1b71f8860fb Mon Sep 17 00:00:00 2001 From: valb3r Date: Fri, 17 Dec 2021 22:28:56 +0200 Subject: [PATCH 18/41] FBP-224. Properly draw no swimlane participants --- activiti-intellij-plugin/build.gradle | 5 ++ .../core/render/DefaultBpmnProcessRenderer.kt | 17 ++++- .../elements/internal/InvisibleShape.kt | 63 +++++++++++++++++++ .../plugin/core/state/CurrentState.kt | 17 ++++- build.gradle | 3 +- camunda-intellij-plugin/build.gradle | 1 + .../src/test/resources/swimlanes.bpmn | 4 +- flowable-intellij-plugin/build.gradle | 5 ++ gradle.properties | 1 + .../plugin/bpmn/api/BpmnFileObject.kt | 7 +-- 10 files changed, 110 insertions(+), 13 deletions(-) create mode 100644 bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/internal/InvisibleShape.kt diff --git a/activiti-intellij-plugin/build.gradle b/activiti-intellij-plugin/build.gradle index 742687344..09975bc50 100644 --- a/activiti-intellij-plugin/build.gradle +++ b/activiti-intellij-plugin/build.gradle @@ -42,6 +42,11 @@ intellij { plugins = intellijPlatformPlugins } +runIde { + jbrVersion = jbrJdkVersion + jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition") +} + publishPlugin { token = intellijPublishToken } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index 7b1c6133f..6d710260c 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -1,7 +1,9 @@ package com.valb3r.bpmn.intellij.plugin.core.render import com.intellij.openapi.project.Project +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnCollaboration import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnParticipant import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.activities.BpmnCallActivity import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.begin.* @@ -29,6 +31,7 @@ import com.valb3r.bpmn.intellij.plugin.core.render.elements.BaseDiagramRenderEle import com.valb3r.bpmn.intellij.plugin.core.render.elements.RenderState import com.valb3r.bpmn.intellij.plugin.core.render.elements.edges.EdgeRenderElement import com.valb3r.bpmn.intellij.plugin.core.render.elements.elemIdToRemove +import com.valb3r.bpmn.intellij.plugin.core.render.elements.internal.InvisibleShape import com.valb3r.bpmn.intellij.plugin.core.render.elements.planes.PlaneRenderElement import com.valb3r.bpmn.intellij.plugin.core.render.elements.shapes.* import com.valb3r.bpmn.intellij.plugin.core.render.uieventbus.* @@ -158,7 +161,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr val result = TreeState(state, elementsById, elementsByDiagramId, version) val root = createRootProcessElem({ result.state }, elements, elementsById) - createCollaborationProcesses({ result.state }, elements, elementsById) + createCollaborationAndCollaborationProcesses({ result.state }, elements, elementsById) createShapes({ result.state }, elements, elementsById) createEdges({ result.state }, elements, elementsById) linkChildrenToParent({ result.state }, elementsById) @@ -176,9 +179,15 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr return processElem } - private fun createCollaborationProcesses(state: () -> RenderState, elements: MutableList, elementsById: MutableMap) { + private fun createCollaborationAndCollaborationProcesses(state: () -> RenderState, elements: MutableList, elementsById: MutableMap) { + state().currentState.elementByBpmnId.values.map { it.element }.filterIsInstance().forEach { + val processElem = InvisibleShape(DiagramElementId("__collaboration_${it.id}"), it.id, state) + elements += processElem + elementsById[it.id] = processElem + } + val rootProcessId = state().currentState.primaryProcessId - val collaborations = state().currentState.processes.filter { it != rootProcessId } + val collaborations = state().currentState.processes.filter { it != rootProcessId } collaborations.forEach { val id = DiagramElementId("__process_${it.id}") val processElem = ShapeSetInFixedBoundary(id, it, ShapeElement(id, it, BoundsElement(0.0f, 0.0f, 10.0f, 10.0f)), state) @@ -263,6 +272,8 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr is BpmnAdHocSubProcess -> BottomMiddleIconShape(id, bpmn.id, icons.tilde, shape, state, areaType = AreaType.SHAPE_THAT_NESTS) is BpmnLaneSet -> ShapeSetInFixedBoundary(id, bpmn.id, shape, state, Colors.PROCESS_COLOR, Colors.ELEMENT_BORDER_COLOR, Colors.SUBPROCESS_TEXT_COLOR, areaType = AreaType.SHAPE_THAT_NESTS) is BpmnLane -> NamedShape(id, bpmn.id, shape, state, Colors.PROCESS_COLOR, Colors.ELEMENT_BORDER_COLOR, Colors.SUBPROCESS_TEXT_COLOR, areaType = AreaType.SHAPE_THAT_NESTS) + is BpmnParticipant -> NamedShape(id, bpmn.id, shape, state, Colors.PROCESS_COLOR, Colors.ELEMENT_BORDER_COLOR, Colors.SUBPROCESS_TEXT_COLOR, areaType = AreaType.SHAPE_THAT_NESTS) + is BpmnCollaboration -> InvisibleShape(id, bpmn.id, state) is BpmnExclusiveGateway -> IconShape(id, bpmn.id, icons.exclusiveGateway, shape, state) is BpmnParallelGateway -> IconShape(id, bpmn.id, icons.parallelGateway, shape, state) is BpmnInclusiveGateway -> IconShape(id, bpmn.id, icons.inclusiveGateway, shape, state) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/internal/InvisibleShape.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/internal/InvisibleShape.kt new file mode 100644 index 000000000..3dab70acf --- /dev/null +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/internal/InvisibleShape.kt @@ -0,0 +1,63 @@ +package com.valb3r.bpmn.intellij.plugin.core.render.elements.internal + +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.events.Event +import com.valb3r.bpmn.intellij.plugin.core.render.AreaType +import com.valb3r.bpmn.intellij.plugin.core.render.AreaWithZindex +import com.valb3r.bpmn.intellij.plugin.core.render.Camera +import com.valb3r.bpmn.intellij.plugin.core.render.RenderContext +import com.valb3r.bpmn.intellij.plugin.core.render.elements.Anchor +import com.valb3r.bpmn.intellij.plugin.core.render.elements.BaseBpmnRenderElement +import com.valb3r.bpmn.intellij.plugin.core.render.elements.RenderState +import java.awt.geom.Rectangle2D + +class InvisibleShape( + elementId: DiagramElementId, + bpmnElementId: BpmnElementId, + state: () -> RenderState +) : BaseBpmnRenderElement(elementId, bpmnElementId, state) { + + override fun doRenderWithoutChildren(ctx: RenderContext): Map { + return emptyMap() + } + + override val areaType: AreaType + get() = AreaType.POINT + + override fun drawActionsRight(x: Float, y: Float): Map { + return emptyMap() + } + + override fun doDragToWithoutChildren(dx: Float, dy: Float) { + // NOP + } + + override fun doOnDragEndWithoutChildren(dx: Float, dy: Float, droppedOn: BpmnElementId?, allDroppedOnAreas: Map): MutableList { + return mutableListOf() + } + + override fun doResizeWithoutChildren(dw: Float, dh: Float) { + // NOP + } + + override fun doResizeEndWithoutChildren(dw: Float, dh: Float): MutableList { + return mutableListOf() + } + + override fun currentRect(): Rectangle2D.Float { + return Rectangle2D.Float(0.0f, 0.0f, 0.0f, 0.0f) + } + + override fun currentOnScreenRect(camera: Camera): Rectangle2D.Float { + return Rectangle2D.Float(0.0f, 0.0f, 0.0f, 0.0f) + } + + override fun waypointAnchors(camera: Camera): MutableSet { + return mutableSetOf() + } + + override fun shapeAnchors(camera: Camera): MutableSet { + return mutableSetOf() + } +} diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt index 9cb536e50..dec93e243 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt @@ -70,9 +70,9 @@ class CurrentStateProvider(private val project: Project) { view.processes.map { it.processId }.toSet(), view.processes.flatMap { proc -> proc.diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() } }, view.processes.flatMap { proc -> proc.diagram.flatMap { it.bpmnPlane.bpmnEdge ?: emptyList() }.map { EdgeElementState(it) } }, - view.processes.flatMap { proc -> proc.allElementsByDiagramId.entries }.groupBy { it.key }.mapValues { it.value.first().value }, - view.processes.flatMap { proc -> proc.processElementByStaticId.entries }.groupBy { it.key }.mapValues { it.value.first().value }, - view.processes.flatMap { proc -> proc.processElemPropertiesByElementId.entries }.groupBy { it.key }.mapValues { it.value.first().value }, + extractDiagramElementToBpmnIds(view), + extractBpmnElements(view), + extractProperties(view), emptyMap(), emptyMap(), emptySet(), @@ -86,6 +86,17 @@ class CurrentStateProvider(private val project: Project) { return handleUpdates(currentState) } + private fun extractProperties(view: BpmnFileView) = + view.processes.flatMap { proc -> proc.processElemPropertiesByElementId.entries }.groupBy { it.key }.mapValues { it.value.first().value } + + view.collaborations.flatMap { coll -> coll.collaborationElemPropertiesByElementId.entries }.groupBy { it.key }.mapValues { it.value.first().value } + + private fun extractBpmnElements(view: BpmnFileView) = + view.processes.flatMap { proc -> proc.processElementByStaticId.entries }.groupBy { it.key }.mapValues { it.value.first().value } + + view.collaborations.flatMap { coll -> coll.collaborationElementByStaticId.entries }.groupBy { it.key }.mapValues { it.value.first().value } + + private fun extractDiagramElementToBpmnIds(view: BpmnFileView) = + view.processes.flatMap { proc -> proc.allElementsByDiagramId.entries }.groupBy { it.key }.mapValues { it.value.first().value } + private fun handleUpdates(state: CurrentState): CurrentState { var updatedShapes = state.shapes.toMutableList() var updatedEdges = state.edges.toMutableList() diff --git a/build.gradle b/build.gradle index 8bb7118ad..4b9d47f94 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,8 @@ plugins { } ext { - intellijPlatform = 'IU-2019.3' + intellijPlatform = 'IU-2021.3' + jbrJdkVersion = 'jbr_dcevm-11_0_11b1341.60' intellijPlatformPlugins = ['java', 'DatabaseTools'] // DatabaseTools is for BPMN process 'debugging' kotlinStdlib = '1.5.30' diff --git a/camunda-intellij-plugin/build.gradle b/camunda-intellij-plugin/build.gradle index 32d77d623..d906148fa 100644 --- a/camunda-intellij-plugin/build.gradle +++ b/camunda-intellij-plugin/build.gradle @@ -43,6 +43,7 @@ intellij { } runIde { + jbrVersion = jbrJdkVersion jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition") } diff --git a/camunda-xml-parser/src/test/resources/swimlanes.bpmn b/camunda-xml-parser/src/test/resources/swimlanes.bpmn index 1cadddf34..a73b3164d 100644 --- a/camunda-xml-parser/src/test/resources/swimlanes.bpmn +++ b/camunda-xml-parser/src/test/resources/swimlanes.bpmn @@ -1,6 +1,6 @@ - + Some docs @@ -99,7 +99,7 @@ - + diff --git a/flowable-intellij-plugin/build.gradle b/flowable-intellij-plugin/build.gradle index 227c417f2..223afe837 100644 --- a/flowable-intellij-plugin/build.gradle +++ b/flowable-intellij-plugin/build.gradle @@ -42,6 +42,11 @@ intellij { plugins = intellijPlatformPlugins } +runIde { + jbrVersion = jbrJdkVersion + jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition") +} + publishPlugin { token = intellijPublishToken } diff --git a/gradle.properties b/gradle.properties index 7f3680244..6a9d21fb2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,2 @@ +org.gradle.jvmargs=--illegal-access=permit intellijPublishToken= diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index 73e6cfde9..52f27f9fd 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -26,19 +26,18 @@ data class BpmnFileObject(val processes: List, val collaborations: private fun mapCollaborations(factory: BpmnObjectFactory): List { val mappedCollaborations = mutableListOf() for (collaboration in collaborations) { - val elementByDiagramId = mutableMapOf() val elementByStaticId = mutableMapOf() val propertiesById = mutableMapOf() + val primaryProcessId = collaboration.participant?.first()?.processRef?.let { BpmnElementId(it) } ?: BpmnElementId("") - fillFor(BpmnElementId(""), factory, collaboration, elementByStaticId, propertiesById) - elementByDiagramId[DiagramElementId(collaboration.id.id)] = collaboration.id + fillFor(primaryProcessId, factory, collaboration, elementByStaticId, propertiesById) collaboration.participant?.forEach { fillFor(collaboration.id, factory, it, elementByStaticId, propertiesById)} collaboration.messageFlow?.forEach { fillFor(collaboration.id, factory, it, elementByStaticId, propertiesById)} mappedCollaborations += BpmnCollaborationView( collaboration.id, - collaboration.participant?.first()?.processRef?.let { BpmnElementId(it) }, + primaryProcessId, elementByStaticId, propertiesById ) From 9d74a1eec705098d921caf632844b31de7122c3f Mon Sep 17 00:00:00 2001 From: valb3r Date: Sat, 18 Dec 2021 07:45:42 +0200 Subject: [PATCH 19/41] FBP-224. Customize for higher DCEVM xmx --- activiti-intellij-plugin/build.gradle | 2 +- camunda-intellij-plugin/build.gradle | 2 +- flowable-intellij-plugin/build.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/activiti-intellij-plugin/build.gradle b/activiti-intellij-plugin/build.gradle index 09975bc50..358d8f421 100644 --- a/activiti-intellij-plugin/build.gradle +++ b/activiti-intellij-plugin/build.gradle @@ -44,7 +44,7 @@ intellij { runIde { jbrVersion = jbrJdkVersion - jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition") + jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition", "-Xmx2G") } publishPlugin { diff --git a/camunda-intellij-plugin/build.gradle b/camunda-intellij-plugin/build.gradle index d906148fa..83515154c 100644 --- a/camunda-intellij-plugin/build.gradle +++ b/camunda-intellij-plugin/build.gradle @@ -44,7 +44,7 @@ intellij { runIde { jbrVersion = jbrJdkVersion - jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition") + jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition", "-Xmx2G") } publishPlugin { diff --git a/flowable-intellij-plugin/build.gradle b/flowable-intellij-plugin/build.gradle index 223afe837..0fc9b4816 100644 --- a/flowable-intellij-plugin/build.gradle +++ b/flowable-intellij-plugin/build.gradle @@ -44,7 +44,7 @@ intellij { runIde { jbrVersion = jbrJdkVersion - jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition") + jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition", "-Xmx2G") } publishPlugin { From 9ecf9e922421da9e6733a420565346550911024c Mon Sep 17 00:00:00 2001 From: valb3r Date: Sat, 18 Dec 2021 14:49:23 +0200 Subject: [PATCH 20/41] FBP-224. Dev helper functionality --- .../core/render/DefaultBpmnProcessRenderer.kt | 9 +++++++-- .../intellij/plugin/core/render/DevHelper.kt | 17 +++++++++++++++++ .../intellij/plugin/core/render/IconProvider.kt | 2 ++ .../settings/BpmnPluginSettingsComponent.form | 12 ++++++++++-- .../settings/BpmnPluginSettingsComponent.kt | 5 ++++- .../core/settings/BpmnPluginSettingsState.kt | 3 +++ 6 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index 6d710260c..439ba3f84 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -35,6 +35,7 @@ import com.valb3r.bpmn.intellij.plugin.core.render.elements.internal.InvisibleSh import com.valb3r.bpmn.intellij.plugin.core.render.elements.planes.PlaneRenderElement import com.valb3r.bpmn.intellij.plugin.core.render.elements.shapes.* import com.valb3r.bpmn.intellij.plugin.core.render.uieventbus.* +import com.valb3r.bpmn.intellij.plugin.core.settings.currentSettings import groovy.lang.Tuple2 import java.awt.BasicStroke import java.awt.geom.Point2D @@ -367,7 +368,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr locationY += drawIconWithAction(state, zoomOutId, locationX, locationY, renderedArea, { currentUiEventBus(project).publish(ZoomOutEvent()) }, icons.zoomOut).second + iconMargin locationX = undoRedoStartMargin locationX += drawIconWithAction(state, zoomResetId, locationX, locationY, renderedArea, { currentUiEventBus(project).publish(ResetAndCenterEvent()) }, icons.zoomReset).first + iconMargin - locationY += drawIconWithAction(state, centerImageId, locationX, locationY, renderedArea, { currentUiEventBus(project).publish(CenterModelEvent()) }, icons.centerImage).first + iconMargin + locationY += drawIconWithAction(state, centerImageId, locationX, locationY, renderedArea, { currentUiEventBus(project).publish(CenterModelEvent()) }, icons.centerImage).second + iconMargin locationX = undoRedoStartMargin val currentGridState = gridState.get() val gridIcon = gridIcons[currentGridState]() @@ -377,7 +378,11 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr } locationX += drawIconWithAction(state, gridStateId, locationX, locationY, renderedArea, nextGridStep, gridIcon).first + iconMargin val verticalAnchors = verticalAnchorsEnabled.get() - drawIconWithAction(state, anchorEnabled, locationX, locationY, renderedArea, { verticalAnchorsEnabled.set(!verticalAnchors)}, if (verticalAnchors) icons.anchorOff else icons.anchorOn).first + iconMargin + locationY += drawIconWithAction(state, anchorEnabled, locationX, locationY, renderedArea, { verticalAnchorsEnabled.set(!verticalAnchors)}, if (verticalAnchors) icons.anchorOff else icons.anchorOn).second + iconMargin + + if (currentSettings().enableDevelopmentFunctions) { + locationX += drawIconWithAction(state, DiagramElementId("__development_tool_render_tree_state"), locationX, locationY, renderedArea, { dumpRenderTree(project) }, icons.dumpRenderTree).first + iconMargin + } } private fun drawIconWithAction( diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt new file mode 100644 index 000000000..1306032d7 --- /dev/null +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt @@ -0,0 +1,17 @@ +package com.valb3r.bpmn.intellij.plugin.core.render + +import com.intellij.openapi.project.Project + +fun dumpRenderTree(project: Project) { + val renderState = lastRenderedState(project)!! + println("===== Mapped XML tree: =====") + dumpTree(renderState.state.currentState.elementByBpmnId.entries.groupBy { it.key.id }.mapValues { it.value.first().value.id.id }) + println("===== End XML tree =====") + + println("===== Render tree: =====") + println("===== End Render tree =====") +} + +private fun dumpTree(elems: Map) { + +} diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/IconProvider.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/IconProvider.kt index 1ab48143f..17e72635f 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/IconProvider.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/IconProvider.kt @@ -37,6 +37,7 @@ interface IconProvider { val sequence: Icon val anchorOn: Icon val anchorOff: Icon + val dumpRenderTree: Icon val exclusiveGateway: SvgIcon val parallelGateway: SvgIcon val inclusiveGateway: SvgIcon @@ -123,6 +124,7 @@ data class IconProviderImpl( override val sequence: Icon = IconLoader.getIcon("/icons/ui-icons/sequence.png"), override val anchorOn: Icon = IconLoader.getIcon("/icons/actions/anchor.png"), override val anchorOff: Icon = IconLoader.getIcon("/icons/actions/anchor-off.png"), + override val dumpRenderTree: Icon = IconLoader.getIcon("/icons/actions/dump-render-tree.png"), override val plus: Icon = IconLoader.getIcon("/icons/ui-icons/plus.png"), override val minus: Icon = IconLoader.getIcon("/icons/ui-icons/minus.png"), override val exclusiveGateway: SvgIcon = "/icons/ui-icons/svg/exclusive-gateway.svg".asResource()!!, diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsComponent.form b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsComponent.form index 4f4063400..3e19e59b3 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsComponent.form +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsComponent.form @@ -1,9 +1,9 @@
- + - + @@ -204,6 +204,14 @@ + + + + + + + + diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsComponent.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsComponent.kt index d0b347e60..27c632251 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsComponent.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsComponent.kt @@ -26,6 +26,7 @@ class BpmnPluginSettingsComponent() { private lateinit var dataFontSize: JSpinner private lateinit var openExtensions: JTextField private lateinit var enableFps: JCheckBox + private lateinit var enableDevelopmentFunctions: JCheckBox init { AutoCompleteDecorator.decorate(uiFontName) @@ -65,6 +66,7 @@ class BpmnPluginSettingsComponent() { dataFontSize.value = state.dataFontSize openExtensions.text = state.openExtensions.joinToString(DELIMITER) enableFps.isSelected = state.enableFps + enableDevelopmentFunctions.isSelected = state.enableDevelopmentFunctions } private fun populateFontComboboxes(actualUiFont: Font, actualDataFont: Font) { @@ -110,10 +112,11 @@ class BpmnPluginSettingsComponent() { } }) enableFps.addChangeListener { state.enableFps = enableFps.isSelected } + enableDevelopmentFunctions.addChangeListener { state.enableDevelopmentFunctions = enableDevelopmentFunctions.isSelected } } private fun extensions() = openExtensions.text.split(DELIMITER).toSet() private fun Float.asSlider(): Int = (this * 100.0f).toInt() private fun Int.fromSlider(): Float = this / 100.0f -} \ No newline at end of file +} diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsState.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsState.kt index e316ff168..296da2425 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsState.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsState.kt @@ -50,6 +50,7 @@ abstract class BaseBpmnPluginSettingsState: PersistentStateComponent Date: Sat, 18 Dec 2021 19:03:02 +0200 Subject: [PATCH 21/41] FBP-224. Added dev helper tooling --- .../core/render/DefaultBpmnProcessRenderer.kt | 1 + .../intellij/plugin/core/render/DevHelper.kt | 32 ++++++++++++++++-- .../settings/BpmnPluginSettingsComponent.form | 2 +- .../icons/actions/dump-render-tree.png | Bin 0 -> 318 bytes .../icons/actions/dump-render-tree_dark.png | Bin 0 -> 4860 bytes 5 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 bpmn-intellij-plugin-core/src/main/resources/icons/actions/dump-render-tree.png create mode 100644 bpmn-intellij-plugin-core/src/main/resources/icons/actions/dump-render-tree_dark.png diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index 439ba3f84..4d22230dc 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -379,6 +379,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr locationX += drawIconWithAction(state, gridStateId, locationX, locationY, renderedArea, nextGridStep, gridIcon).first + iconMargin val verticalAnchors = verticalAnchorsEnabled.get() locationY += drawIconWithAction(state, anchorEnabled, locationX, locationY, renderedArea, { verticalAnchorsEnabled.set(!verticalAnchors)}, if (verticalAnchors) icons.anchorOff else icons.anchorOn).second + iconMargin + locationX = undoRedoStartMargin if (currentSettings().enableDevelopmentFunctions) { locationX += drawIconWithAction(state, DiagramElementId("__development_tool_render_tree_state"), locationX, locationY, renderedArea, { dumpRenderTree(project) }, icons.dumpRenderTree).first + iconMargin diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt index 1306032d7..08fa53c73 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt @@ -5,13 +5,41 @@ import com.intellij.openapi.project.Project fun dumpRenderTree(project: Project) { val renderState = lastRenderedState(project)!! println("===== Mapped XML tree: =====") - dumpTree(renderState.state.currentState.elementByBpmnId.entries.groupBy { it.key.id }.mapValues { it.value.first().value.id.id }) + val parentToElems = renderState.state.currentState.elementByBpmnId.entries + .groupBy { it.value.parent.id } + .mapValues { entry -> entry.value.map { it.key.id }.toSet() } + dumpTree(parentToElems) println("===== End XML tree =====") println("===== Render tree: =====") + val treeElems = renderState.elementsById.entries + .groupBy { it.value.parents.map { it.bpmnElementId.id }.firstOrNull() ?: "" } + .mapValues { entry -> entry.value.map { it.key.id }.toSet() } + dumpTree(treeElems) println("===== End Render tree =====") } -private fun dumpTree(elems: Map) { +private fun dumpTree(elemsByParent: Map>) { + val childElems = elemsByParent.values.flatten().toSet() + val roots = elemsByParent.keys.filter { !childElems.contains(it) }.toSet() + println("{") + dumpTree(roots, elemsByParent) + println("}") +} + +private fun dumpTree(front: Set, elemsByParent: Map>, prefix: Int = 4) { + fun separatorIfNeeded(ind: Int) = if (ind != front.size - 1) "," else "" + val prefixStr = " ".repeat(prefix) + front.forEachIndexed { ind, elem -> + val children = elemsByParent[elem] + if (null != children) { + println("$prefixStr\"$elem\":") + println("$prefixStr{") + dumpTree(children, elemsByParent, prefix + 4) + println("$prefixStr}${separatorIfNeeded(ind)}") + } else { + println("$prefixStr\"$elem\"${separatorIfNeeded(ind)}") + } + } } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsComponent.form b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsComponent.form index 3e19e59b3..037725d91 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsComponent.form +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/settings/BpmnPluginSettingsComponent.form @@ -204,7 +204,7 @@ - + diff --git a/bpmn-intellij-plugin-core/src/main/resources/icons/actions/dump-render-tree.png b/bpmn-intellij-plugin-core/src/main/resources/icons/actions/dump-render-tree.png new file mode 100644 index 0000000000000000000000000000000000000000..48db3db13b4ecede4add5389d35bb67401051a13 GIT binary patch literal 318 zcmeAS@N?(olHy`uVBq!ia0vp^q9Dw{1|(OCFP#RYI14-?iy0XB4ude`@%$AjKtah8 z*NBqf{Irtt#G+J&^73-M%)IR4}$j4+T;2O`t z>G9-LX@rc$A=!!H5!M6!f##pr|>M)NAs@6Pr(A_vI8s;Y84F&OvHNcXBSP?oAQTo#h<5F zs|{VVrv8zYU?^T0VfEK4>`$~;i|CY^+?7+q7cV>!beuy`MdvFETbYZ-q5BgWf!<>9 MboFyt=akR{0JJ-Lv;Y7A literal 0 HcmV?d00001 diff --git a/bpmn-intellij-plugin-core/src/main/resources/icons/actions/dump-render-tree_dark.png b/bpmn-intellij-plugin-core/src/main/resources/icons/actions/dump-render-tree_dark.png new file mode 100644 index 0000000000000000000000000000000000000000..9209d78ddfcb5c59c0b8f4084ecc90c7d5a63ecd GIT binary patch literal 4860 zcmeHKc~leU77q%tiMXIx;mI_L1vJ}aoiSktgBlErsEEQOGl`LGBm-f2Xhkd(7nD*_ zTM-osXw@RP;fg|CKv8RJwJbhdQE{s+idx^7fQsk!AJ2LH&*aQx=6?77?!CWzzkBk1 zDGi_E zj$PqAeY$*gcVfb8U+M2<4`&1xjr%fp^u{FnpQnkRxtB~U*|=%X*LVN?W5l0ndoRCG zj?tG_^ayMCwTDE0%Ah~LIPTRHl@NNiLrEFV_f(C(wl!t?c<(#P%8EH-k$}MYH#?8` zP-BNJT!eJGeSL7suCC7YF}D))gq{alx~64ZTO4*%{K~cY%C51C_qlC~RAro5)RO2F zf0BQFVk}*pe8Bhaxmc2^%UQ1PvQH=2Ee`gRr-mebe|J?GbMKKZuZ=z|J?#vq;=-1+ znvG~+lW@d1p5g&CI@I<0nR!|9s{)rh4bBmGr6jn{e!gnikbTMbIv?G7B(#fK4~=U4 zPgg-(Cbr{Ohv0A84+O?Ftx;zWyRqd*&d|-to-^~U{m%S8GS0@DyW4$kDYfc_ch$sK z8N*Lm#WEu<6lbhf#|;n6g>G%yb?2|1J9t0sa!pZdO8dPwbnT4h zc^RF*9KPH($oUh2U+5>ie_y&VK{Baqefc?9)AM~bZPFf3)y=Z)lja_|yO6)f@m~Iu zLEPGk#{oVQu1cI@s&lLxlD5@u@`13fn9pPzE4dD!vzoDF|jCFPaRtdb)2xdOZ*d`E7cVByF->8F<*cA)FxdTbXCbV_oK&u(0{Bx)cgubFZ}j2Ws|?Kkvu_dgNoZ~$a631v6w=a z4r50}fa~~0H)`)cal4&$Vo~uYyo;4-9n31}0{MZJb1q1~EYBU6w=Lp`-}T+c)0S7q z?%aJ#^xQEB(GctJadOriqppPlKVRW9)$2syikOuyBfPKXXFSVsKPslLkMm?2CY1~r zS#aI<_0sm%4bM;8^Sxbc(RlR>xwYMc0V_9X7JK}ba^2caIB-^MV|?X6_NLOyv9UMo z?))~0zH{z|L$+}bC`)J5;^I{^-xMHx8HEm>+M#I z^2%tv-a4=A@T-jPuCzNJBn|bejpysYoN`xzc{E!x9hK`ebPU(Y2zshU59SqxBJ@ku zWAa3Tgk*$Lr4>;h9z05gRJe#biz{JD^g+Y|l{no%M5TvE%hMC(2u}6$br7ba06;^K z7?i3}YmI2Ch-$$_!LwP+ph6ZEGEqdGEs;V&Is*Z5=o~te7Luw;fvLU@kkEiD(8%D> zJ_zt8qAnmwJ<4F1OeVUCP1hNe3>JbQ3?|HgVH(h&8Pl{RmP*qa$C)8|F@g!B+@R8v zDxDTGV`4I0GAW``!8-INK8;=?c?+*K_OSr?V5DMt28+&QXf%xe7Dh581%UJg^tTqq zXfW0pk%Uo~Y>*QnDTJ0B*B=6xzqQvV8`PF`a5;le6B?ju1YTM1xttOvk-oJsQ=n97 z^cE{X_IsM7O7V`Y_hK`zSkmbq2rz$(`=0ij+%3vLOCmvob@F6$cwxaJs@Xq^>*OjN zwLCIe0xk>8K2Fk$$5MZ!e`4_Fv9HzF~gt&U5TmtM`eb>0TjYg@MRo=PeU*s zhsMDbavH`Gz%+$`17k86XY;td(cp44RAVnKFc48Cm>ilB^=>6vr6Hn7%uFYX$3_Hf0m6e34vWw14cY=2Ll}&p70sY5CLI=7 z%*}N{K{kL{%-pB|z#<39pg{%#BXx#oolY&Hnjs*wrKP_iVQ*E$DkIQHGq-$S(?=0W zy>GpHK&`SYL6D_yQB2s^vBz_dyNZ1BF0dLvi;O|@V^Bf{mvphhx4 zF%Ktbph!F#3zl)&IE#Zb1^oBXjXDKs!VE-!5@ZUp0Ucz?2J-6V())dN(*nXw6cc6v zOd3lN&ElaP1cl*=Oc-S{sf@mi8RmWcCS@Vxe@GEp6#5MUVAm@H0|v}1#@m6_N1B<( zfAG^+jDOGrfd1&@gZTYO*GIZOh=C7M{@7g~>G~iBK1lgvcm3b!a(H*-A++FckO>@U zicE(lgTv4u*|aIal-K5O$>H*^fW%%eo@1m?hMX{8Rws28I1t*BVUiHrn}dfBVU1e3 z?W_ifE`$XKL<<_b3aW-!MGOsbUL*C{xAmvHcj|3hp4t56Us+vt(WB(2X6O5#c~u6N z|J=EtIJCGm^9e6v|LO4z_UTOH!?3h;_tC8`&9g`CVD|+Q6Y3OY1Pa6CK$3u3rp`WrI||XS8SOVAKC3u*`9l; lMH5sb4ntjjEpV&+?DH#A+sAk;ngEicgoT6$?+i@H`Y#woLk|D| literal 0 HcmV?d00001 From c612a9f0e0aa0a61d6fb4aa713e5c5b219724cf7 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 19 Dec 2021 09:01:35 +0200 Subject: [PATCH 22/41] FBP-224. Directly dump render tree --- .../core/render/DefaultBpmnProcessRenderer.kt | 2 ++ .../intellij/plugin/core/render/DevHelper.kt | 20 +++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index 4d22230dc..0a169cc25 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -74,6 +74,8 @@ data class RenderedState(val state: RenderState, val elementsById: Map entry.value.map { it.key.id }.toSet() } - dumpTree(treeElems) + dumpTree(rootToElemsByParent(renderState, renderState.state.ctx.cachedDom!!.domRoot)) println("===== End Render tree =====") } +private fun rootToElemsByParent(state: RenderedState, root: BaseBpmnRenderElement): Map> { + val elemMap = state.state.elemMap + val front = mutableSetOf(root) + val result = mutableMapOf>() + while (front.isNotEmpty()) { + front.forEach { result.computeIfAbsent(it.parents.firstOrNull()?.bpmnElementId?.id ?: "") { mutableSetOf() }.add(it.bpmnElementId.id) } + val newFront = front.flatMap { it.children }.map { elemMap[it.elementId] }.filterIsInstance() + front.clear() + front.addAll(newFront) + } + + return result +} + private fun dumpTree(elemsByParent: Map>) { val childElems = elemsByParent.values.flatten().toSet() val roots = elemsByParent.keys.filter { !childElems.contains(it) }.toSet() From 9578f8680e37cc53163cf1f1ff41d4b4de46e64b Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 19 Dec 2021 10:22:52 +0200 Subject: [PATCH 23/41] FBP-224. Detect cyclic structure --- .../bpmn/intellij/plugin/core/render/DevHelper.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt index e83e4c680..2f94ebfe0 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt @@ -34,6 +34,16 @@ private fun rootToElemsByParent(state: RenderedState, root: BaseBpmnRenderElemen private fun dumpTree(elemsByParent: Map>) { val childElems = elemsByParent.values.flatten().toSet() val roots = elemsByParent.keys.filter { !childElems.contains(it) }.toSet() + if (roots.isEmpty()) { + println("Cyclic structure detected, none of ${elemsByParent.keys} is standalone root") + elemsByParent.keys.forEach { possibleRoot -> + elemsByParent.forEach { (k, v) -> + if (v.contains(possibleRoot)) { + println("Possible root $possibleRoot is child of $k") + } + } + } + } println("{") dumpTree(roots, elemsByParent) println("}") From 2baed508167f6ff29d49e778da6432e22e7a78e1 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 19 Dec 2021 10:59:38 +0200 Subject: [PATCH 24/41] FBP-224. Detect cyclic structure --- .../bpmn/intellij/plugin/core/render/DevHelper.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt index 2f94ebfe0..641a213ed 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt @@ -1,5 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.core.render +import com.intellij.grazie.utils.toLinkedSet import com.intellij.openapi.project.Project import com.valb3r.bpmn.intellij.plugin.core.render.elements.BaseBpmnRenderElement @@ -8,7 +9,7 @@ fun dumpRenderTree(project: Project) { println("===== Mapped XML tree: =====") val parentToElems = renderState.state.currentState.elementByBpmnId.entries .groupBy { it.value.parent.id } - .mapValues { entry -> entry.value.map { it.key.id }.toSet() } + .mapValues { entry -> entry.value.map { it.key.id }.toLinkedSet() } dumpTree(parentToElems) println("===== End XML tree =====") @@ -19,8 +20,8 @@ fun dumpRenderTree(project: Project) { private fun rootToElemsByParent(state: RenderedState, root: BaseBpmnRenderElement): Map> { val elemMap = state.state.elemMap - val front = mutableSetOf(root) - val result = mutableMapOf>() + val front = linkedSetOf(root) + val result = linkedMapOf>() while (front.isNotEmpty()) { front.forEach { result.computeIfAbsent(it.parents.firstOrNull()?.bpmnElementId?.id ?: "") { mutableSetOf() }.add(it.bpmnElementId.id) } val newFront = front.flatMap { it.children }.map { elemMap[it.elementId] }.filterIsInstance() @@ -32,8 +33,8 @@ private fun rootToElemsByParent(state: RenderedState, root: BaseBpmnRenderElemen } private fun dumpTree(elemsByParent: Map>) { - val childElems = elemsByParent.values.flatten().toSet() - val roots = elemsByParent.keys.filter { !childElems.contains(it) }.toSet() + val childElems = elemsByParent.values.flatten().toLinkedSet() + val roots = elemsByParent.keys.filter { !childElems.contains(it) }.toLinkedSet() if (roots.isEmpty()) { println("Cyclic structure detected, none of ${elemsByParent.keys} is standalone root") elemsByParent.keys.forEach { possibleRoot -> From f66542b0c26615fef090b3c0b59bf2da8d307a91 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 19 Dec 2021 11:13:20 +0200 Subject: [PATCH 25/41] FBP-224. Fixed rendering tree for collaboration --- .../core/render/DefaultBpmnProcessRenderer.kt | 12 +++++------ .../plugin/bpmn/api/BpmnFileObject.kt | 21 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index 0a169cc25..beb1b6a0a 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -164,8 +164,8 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr val result = TreeState(state, elementsById, elementsByDiagramId, version) val root = createRootProcessElem({ result.state }, elements, elementsById) - createCollaborationAndCollaborationProcesses({ result.state }, elements, elementsById) - createShapes({ result.state }, elements, elementsById) + createCollaborationAndCollaborationProcesses({ result.state }, root, elements, elementsById) + createShapes({ result.state }, root, elements, elementsById) createEdges({ result.state }, elements, elementsById) linkChildrenToParent({ result.state }, elementsById) // Not all elements have BpmnElementId, but they have DiagramElementId @@ -182,8 +182,8 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr return processElem } - private fun createCollaborationAndCollaborationProcesses(state: () -> RenderState, elements: MutableList, elementsById: MutableMap) { - state().currentState.elementByBpmnId.values.map { it.element }.filterIsInstance().forEach { + private fun createCollaborationAndCollaborationProcesses(state: () -> RenderState, root: BaseBpmnRenderElement, elements: MutableList, elementsById: MutableMap) { + state().currentState.elementByBpmnId.values.map { it.element }.filterIsInstance().filter { it.id != root.bpmnElementId }.forEach { val processElem = InvisibleShape(DiagramElementId("__collaboration_${it.id}"), it.id, state) elements += processElem elementsById[it.id] = processElem @@ -199,8 +199,8 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr } } - private fun createShapes(state: () -> RenderState, elements: MutableList, elementsById: MutableMap) { - state().currentState.shapes.forEach { + private fun createShapes(state: () -> RenderState, root: BaseBpmnRenderElement, elements: MutableList, elementsById: MutableMap) { + state().currentState.shapes.filter { it.bpmnElement != root.bpmnElementId }.forEach { val elem = state().currentState.elementByBpmnId[it.bpmnElement] elem?.let { bpmn -> mapFromShape(state, it.id, it, bpmn.element).let { shape -> diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index 52f27f9fd..615bbdb53 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -17,10 +17,14 @@ data class BpmnFileObject(val processes: List, val collaborations: fun toView(factory: BpmnObjectFactory) : BpmnFileView { val mappedCollaborations = mapCollaborations(factory) - val primaryProcessId = mappedCollaborations.firstOrNull()?.primaryProcessId ?: processes[0].id - val mappedProcesses = mapProcesses(factory, primaryProcessId) - - return BpmnFileView(primaryProcessId, mappedProcesses, mappedCollaborations) + val rootProcessOrCollaborationId = mappedCollaborations.firstOrNull()?.collaborationId ?: processes.firstOrNull()?.id ?: BpmnElementId("") + val collaborationProcessRoots = collaborations.flatMap { it.participant ?: emptyList() } + .filter { null != it.processRef } + .groupBy { it.processRef!! } + .mapValues { entry -> entry.value.first().id } + val mappedProcesses = mapProcesses(factory, rootProcessOrCollaborationId, collaborationProcessRoots) + + return BpmnFileView(rootProcessOrCollaborationId, mappedProcesses, mappedCollaborations) } private fun mapCollaborations(factory: BpmnObjectFactory): List { @@ -28,16 +32,14 @@ data class BpmnFileObject(val processes: List, val collaborations: for (collaboration in collaborations) { val elementByStaticId = mutableMapOf() val propertiesById = mutableMapOf() - val primaryProcessId = collaboration.participant?.first()?.processRef?.let { BpmnElementId(it) } ?: BpmnElementId("") - fillFor(primaryProcessId, factory, collaboration, elementByStaticId, propertiesById) + fillFor(BpmnElementId(""), factory, collaboration, elementByStaticId, propertiesById) collaboration.participant?.forEach { fillFor(collaboration.id, factory, it, elementByStaticId, propertiesById)} collaboration.messageFlow?.forEach { fillFor(collaboration.id, factory, it, elementByStaticId, propertiesById)} mappedCollaborations += BpmnCollaborationView( collaboration.id, - primaryProcessId, elementByStaticId, propertiesById ) @@ -46,14 +48,14 @@ data class BpmnFileObject(val processes: List, val collaborations: return mappedCollaborations } - private fun mapProcesses(factory: BpmnObjectFactory, primaryProcessId: BpmnElementId): List { + private fun mapProcesses(factory: BpmnObjectFactory, rootId: BpmnElementId, collaborationByProcess: Map): List { val mappedProcesses = mutableListOf() val allElementsByDiagramId = mutableMapOf() for (process in processes) { val elementByStaticId = mutableMapOf() val propertiesById = mutableMapOf() - fillFor(if (process.id == primaryProcessId) BpmnElementId("") else primaryProcessId, factory, process, elementByStaticId, propertiesById) + fillFor(collaborationByProcess.getOrDefault(process.id.id, rootId), factory, process, elementByStaticId, propertiesById) allElementsByDiagramId[DiagramElementId(process.id.id)] = process.id // 1st pass @@ -223,7 +225,6 @@ data class BpmnFileView( data class BpmnCollaborationView( val collaborationId: BpmnElementId, - val primaryProcessId: BpmnElementId?, val collaborationElementByStaticId: Map, val collaborationElemPropertiesByElementId: Map ) From 917e3e93417a0c07bbac2769c7a46731a1bc3972 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 19 Dec 2021 11:21:40 +0200 Subject: [PATCH 26/41] FBP-224. Fixed circular tree for non-collaboration processes --- .../com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index 615bbdb53..c86640509 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -17,7 +17,7 @@ data class BpmnFileObject(val processes: List, val collaborations: fun toView(factory: BpmnObjectFactory) : BpmnFileView { val mappedCollaborations = mapCollaborations(factory) - val rootProcessOrCollaborationId = mappedCollaborations.firstOrNull()?.collaborationId ?: processes.firstOrNull()?.id ?: BpmnElementId("") + val rootProcessOrCollaborationId = mappedCollaborations.firstOrNull()?.collaborationId ?: BpmnElementId("") val collaborationProcessRoots = collaborations.flatMap { it.participant ?: emptyList() } .filter { null != it.processRef } .groupBy { it.processRef!! } From 01c373c2487aa679f97cc74effd1cf4c3e75c506 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 19 Dec 2021 12:00:52 +0200 Subject: [PATCH 27/41] FBP-224. Properly align elements to lanes --- .../intellij/plugin/bpmn/api/BpmnFileObject.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index c86640509..276aa75e1 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -6,6 +6,7 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnProcess import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnProcessBody import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithParentId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLane import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLaneSet import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElement import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId @@ -72,6 +73,8 @@ data class BpmnFileObject(val processes: List, val collaborations: diagram.flatMap { it.bpmnPlane.bpmnShape ?: emptyList() } .forEach { allElementsByDiagramId[it.id] = it.bpmnElement } + remapElementsToLanes(elementByStaticId) + mappedProcesses += BpmnProcessObjectView( process.id, allElementsByDiagramId, @@ -84,6 +87,18 @@ data class BpmnFileObject(val processes: List, val collaborations: return mappedProcesses } + private fun remapElementsToLanes(elems: MutableMap) { + val lanes = elems.values.map { it.element }.filterIsInstance() + val elementByParentLane = lanes.flatMap { lane -> lane.flowNodeRef?.map { it to lane.id } ?: emptyList() } + .groupBy { it.first.ref } + .mapValues { it.value.first().second.id } + + elems.replaceAll { k, v -> + val laneId = elementByParentLane[k.id]?.let { BpmnElementId(it) } + return@replaceAll v.copy(parent = laneId ?: v.parent) + } + } + private fun extractElementsFromBody( parentId: BpmnElementId, body: BpmnProcessBody, From e2d9cd838f1ceee5f1cc5e9fc91c6c8ebad6a05b Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 19 Dec 2021 16:34:23 +0200 Subject: [PATCH 28/41] FBP-224. Better diagnostic logging + do not render processes --- .../core/render/DefaultBpmnProcessRenderer.kt | 3 +-- .../intellij/plugin/core/render/DevHelper.kt | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index beb1b6a0a..fee757240 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -192,8 +192,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr val rootProcessId = state().currentState.primaryProcessId val collaborations = state().currentState.processes.filter { it != rootProcessId } collaborations.forEach { - val id = DiagramElementId("__process_${it.id}") - val processElem = ShapeSetInFixedBoundary(id, it, ShapeElement(id, it, BoundsElement(0.0f, 0.0f, 10.0f, 10.0f)), state) + val processElem = InvisibleShape(DiagramElementId("__collaboration_process_${it.id}"), it, state) elements += processElem elementsById[it] = processElem } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt index 641a213ed..099e34a71 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt @@ -2,7 +2,9 @@ package com.valb3r.bpmn.intellij.plugin.core.render import com.intellij.grazie.utils.toLinkedSet import com.intellij.openapi.project.Project +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.core.render.elements.BaseBpmnRenderElement +import com.valb3r.bpmn.intellij.plugin.core.render.elements.BaseDiagramRenderElement fun dumpRenderTree(project: Project) { val renderState = lastRenderedState(project)!! @@ -10,11 +12,11 @@ fun dumpRenderTree(project: Project) { val parentToElems = renderState.state.currentState.elementByBpmnId.entries .groupBy { it.value.parent.id } .mapValues { entry -> entry.value.map { it.key.id }.toLinkedSet() } - dumpTree(parentToElems) + dumpTree(renderState.elementsById, parentToElems) println("===== End XML tree =====") println("===== Render tree: =====") - dumpTree(rootToElemsByParent(renderState, renderState.state.ctx.cachedDom!!.domRoot)) + dumpTree(renderState.elementsById, rootToElemsByParent(renderState, renderState.state.ctx.cachedDom!!.domRoot)) println("===== End Render tree =====") } @@ -32,7 +34,7 @@ private fun rootToElemsByParent(state: RenderedState, root: BaseBpmnRenderElemen return result } -private fun dumpTree(elemsByParent: Map>) { +private fun dumpTree(elementsById: Map, elemsByParent: Map>) { val childElems = elemsByParent.values.flatten().toLinkedSet() val roots = elemsByParent.keys.filter { !childElems.contains(it) }.toLinkedSet() if (roots.isEmpty()) { @@ -46,22 +48,22 @@ private fun dumpTree(elemsByParent: Map>) { } } println("{") - dumpTree(roots, elemsByParent) + dumpTree(elementsById, roots, elemsByParent) println("}") } -private fun dumpTree(front: Set, elemsByParent: Map>, prefix: Int = 4) { +private fun dumpTree(elementsById: Map, front: Set, elemsByParent: Map>, prefix: Int = 4) { fun separatorIfNeeded(ind: Int) = if (ind != front.size - 1) "," else "" val prefixStr = " ".repeat(prefix) front.forEachIndexed { ind, elem -> val children = elemsByParent[elem] if (null != children) { - println("$prefixStr\"$elem\":") + println("$prefixStr\"$elem (diagram id: ${elementsById[BpmnElementId(elem)]?.elementId?.id})\":") println("$prefixStr{") - dumpTree(children, elemsByParent, prefix + 4) + dumpTree(elementsById, children, elemsByParent, prefix + 4) println("$prefixStr}${separatorIfNeeded(ind)}") } else { - println("$prefixStr\"$elem\"${separatorIfNeeded(ind)}") + println("$prefixStr\"$elem (diagram id: ${elementsById[BpmnElementId(elem)]?.elementId?.id})\"${separatorIfNeeded(ind)}") } } From ae981b179ff42d19cfc07b6071a4c90090fc8481 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 19 Dec 2021 17:35:10 +0200 Subject: [PATCH 29/41] FBP-224. Make edge elements visible when they pass through lanes --- .../intellij/plugin/core/render/elements/shapes/NamedShape.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/NamedShape.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/NamedShape.kt index ace3e17bb..688c44ae8 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/NamedShape.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/NamedShape.kt @@ -35,4 +35,8 @@ class NamedShape( return mapOf(shapeCtx.diagramId to AreaWithZindex(area, areaType, waypointAnchors(ctx.canvas.camera), shapeAnchors(ctx.canvas.camera), index = zIndex(), bpmnElementId = shape.bpmnElement)) } + + override fun zIndex(): Int { + return (parents.firstOrNull()?.zIndex() ?: -1) + 1 + } } From 831b1b6a235ca0e57444e1b91e0907185634af99 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 19 Dec 2021 19:44:27 +0200 Subject: [PATCH 30/41] FBP-224. Improve edge selection --- .../intellij/plugin/core/render/Canvas.kt | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt index 321bc7a63..6943e4ede 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/Canvas.kt @@ -24,6 +24,9 @@ import java.awt.Color import java.awt.Graphics import java.awt.Graphics2D import java.awt.RenderingHints +import java.awt.geom.AffineTransform +import java.awt.geom.Area +import java.awt.geom.PathIterator.SEG_CLOSE import java.awt.geom.Point2D import java.awt.geom.Rectangle2D import java.awt.image.BufferedImage @@ -503,15 +506,30 @@ class Canvas(private val project: Project, private val settings: CanvasConstants val intersection = areaByElement?.filter { it.value.area.intersects(withinRect) } val maxZindex = intersection?.maxBy { it: Map.Entry -> it.value.index } val result = mutableListOf() - val centerRect = Point2D.Float(withinRect.centerX.toFloat(), withinRect.centerY.toFloat()) + val minDistSq = fun (area: Area, pt: Point2D.Float): Float { + var minDist = Float.MAX_VALUE + val pts = FloatArray(6) + val iter = area.getPathIterator(AffineTransform()) + while (!iter.isDone) { + if (SEG_CLOSE == iter.currentSegment(pts)) { + iter.next() + continue + } + val curvePt = Point2D.Float(pts[0], pts[1]) + val dist = curvePt.distanceSq(pt).toFloat() + if (dist < minDist) { + minDist = dist + } + iter.next() + } + return minDist + } + intersection ?.filter { !excludeAreas.contains(it.value.areaType) } - ?.filter { it.value.index == maxZindex?.value?.index } + ?.filter { it.value.index == maxZindex?.value?.index || it.value.areaType == AreaType.EDGE } ?.minBy { it: Map.Entry -> - Point2D.Float( - it.value.area.bounds2D.centerX.toFloat(), - it.value.area.bounds2D.centerY.toFloat() - ).distance(centerRect) + minDistSq(it.value.area, cursorPoint) } ?.let { result += it.key; it.value.parentToSelect?.apply { result += this } } return result From 086561f5949018e06f5c51f3442f17b9cffbde28 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 2 Jan 2022 10:14:55 +0200 Subject: [PATCH 31/41] FBP-224. Remove redundant shape and add new type --- .../plugin/core/render/DefaultBpmnProcessRenderer.kt | 6 ++---- .../bpmn/intellij/plugin/core/render/DevHelper.kt | 6 ++++-- ...hapeSetInFixedBoundary.kt => ShapeGroupElement.kt} | 11 ++++++++++- .../{NamedShape.kt => ShapeGroupParentElement.kt} | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) rename bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/{ShapeSetInFixedBoundary.kt => ShapeGroupElement.kt} (82%) rename bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/{NamedShape.kt => ShapeGroupParentElement.kt} (98%) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index 0009657a0..3b53b1fd8 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -15,7 +15,6 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.Bp import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.BpmnIntermediateSignalThrowingEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.gateways.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLane -import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLaneSet import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId @@ -272,9 +271,8 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr is BpmnTransactionCollapsedSubprocess -> ExpandableShapeNoIcon(id, bpmn.id, isCollapsed(bpmn.id, state), icons.plus, icons.minus, shape, state, areaType = AreaType.SHAPE_THAT_NESTS) is BpmnCallActivity -> NoIconShape(id, bpmn.id, shape, state) is BpmnAdHocSubProcess -> BottomMiddleIconShape(id, bpmn.id, icons.tilde, shape, state, areaType = AreaType.SHAPE_THAT_NESTS) - is BpmnLaneSet -> ShapeSetInFixedBoundary(id, bpmn.id, shape, state, Colors.PROCESS_COLOR, Colors.ELEMENT_BORDER_COLOR, Colors.SUBPROCESS_TEXT_COLOR, areaType = AreaType.SHAPE_THAT_NESTS) - is BpmnLane -> NamedShape(id, bpmn.id, shape, state, Colors.PROCESS_COLOR, Colors.ELEMENT_BORDER_COLOR, Colors.SUBPROCESS_TEXT_COLOR, areaType = AreaType.SHAPE_THAT_NESTS) - is BpmnParticipant -> NamedShape(id, bpmn.id, shape, state, Colors.PROCESS_COLOR, Colors.ELEMENT_BORDER_COLOR, Colors.SUBPROCESS_TEXT_COLOR, areaType = AreaType.SHAPE_THAT_NESTS) + is BpmnLane -> ShapeGroupElement(id, bpmn.id, shape, state, Colors.PROCESS_COLOR, Colors.ELEMENT_BORDER_COLOR, Colors.SUBPROCESS_TEXT_COLOR, areaType = AreaType.SHAPE_THAT_NESTS) + is BpmnParticipant -> ShapeGroupParentElement(id, bpmn.id, shape, state, Colors.PROCESS_COLOR, Colors.ELEMENT_BORDER_COLOR, Colors.SUBPROCESS_TEXT_COLOR, areaType = AreaType.SHAPE_THAT_NESTS) is BpmnCollaboration -> InvisibleShape(id, bpmn.id, state) is BpmnExclusiveGateway -> IconShape(id, bpmn.id, icons.exclusiveGateway, shape, state) is BpmnParallelGateway -> IconShape(id, bpmn.id, icons.parallelGateway, shape, state) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt index 099e34a71..d3bb4e67b 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt @@ -57,13 +57,15 @@ private fun dumpTree(elementsById: Map, val prefixStr = " ".repeat(prefix) front.forEachIndexed { ind, elem -> val children = elemsByParent[elem] + val diagramElem = elementsById[BpmnElementId(elem)] + val clazz = if (null != diagramElem) diagramElem::class.simpleName else null if (null != children) { - println("$prefixStr\"$elem (diagram id: ${elementsById[BpmnElementId(elem)]?.elementId?.id})\":") + println("$prefixStr\"$elem [$clazz] (diagram id: ${diagramElem?.elementId?.id})\":") println("$prefixStr{") dumpTree(elementsById, children, elemsByParent, prefix + 4) println("$prefixStr}${separatorIfNeeded(ind)}") } else { - println("$prefixStr\"$elem (diagram id: ${elementsById[BpmnElementId(elem)]?.elementId?.id})\"${separatorIfNeeded(ind)}") + println("$prefixStr\"$elem [$clazz] (diagram id: ${diagramElem?.elementId?.id})\"${separatorIfNeeded(ind)}") } } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeSetInFixedBoundary.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupElement.kt similarity index 82% rename from bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeSetInFixedBoundary.kt rename to bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupElement.kt index 9ba725c98..bf3c16831 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeSetInFixedBoundary.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupElement.kt @@ -3,6 +3,7 @@ package com.valb3r.bpmn.intellij.plugin.core.render.elements.shapes import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.ShapeElement +import com.valb3r.bpmn.intellij.plugin.bpmn.api.events.Event import com.valb3r.bpmn.intellij.plugin.core.Colors import com.valb3r.bpmn.intellij.plugin.core.render.AreaType import com.valb3r.bpmn.intellij.plugin.core.render.AreaWithZindex @@ -10,7 +11,7 @@ import com.valb3r.bpmn.intellij.plugin.core.render.RenderContext import com.valb3r.bpmn.intellij.plugin.core.render.elements.RenderState import java.awt.Stroke -class ShapeSetInFixedBoundary( +class ShapeGroupElement( elementId: DiagramElementId, bpmnElementId: BpmnElementId, shape: ShapeElement, @@ -35,4 +36,12 @@ class ShapeSetInFixedBoundary( return mapOf(shapeCtx.diagramId to AreaWithZindex(area, areaType, waypointAnchors(ctx.canvas.camera), shapeAnchors(ctx.canvas.camera), index = zIndex(), bpmnElementId = shape.bpmnElement)) } + + override fun onDragEnd(dx: Float, dy: Float, droppedOn: BpmnElementId?, allDroppedOnAreas: Map): MutableList { + return mutableListOf() + } + + override fun zIndex(): Int { + return (parents.firstOrNull()?.zIndex() ?: -1) + 1 + } } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/NamedShape.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupParentElement.kt similarity index 98% rename from bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/NamedShape.kt rename to bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupParentElement.kt index 688c44ae8..0edc44c8b 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/NamedShape.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupParentElement.kt @@ -10,7 +10,7 @@ import com.valb3r.bpmn.intellij.plugin.core.render.RenderContext import com.valb3r.bpmn.intellij.plugin.core.render.elements.RenderState import java.awt.Stroke -class NamedShape( +class ShapeGroupParentElement( elementId: DiagramElementId, bpmnElementId: BpmnElementId, shape: ShapeElement, From 52c4594758ad6efdaae00ca528943b182603e966 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 2 Jan 2022 11:14:36 +0200 Subject: [PATCH 32/41] FBP-224. Correctly handle drag for lane (no drag end action unless parent is also dragging) --- .../plugin/core/render/elements/shapes/ShapeGroupElement.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupElement.kt index bf3c16831..203609ea4 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupElement.kt @@ -38,7 +38,11 @@ class ShapeGroupElement( } override fun onDragEnd(dx: Float, dy: Float, droppedOn: BpmnElementId?, allDroppedOnAreas: Map): MutableList { - return mutableListOf() + if (null != droppedOn) { + return mutableListOf() + } + + return super.onDragEnd(dx, dy, droppedOn, allDroppedOnAreas) } override fun zIndex(): Int { From 80a8a09f0deb652a760955d7cd84e87ae173ff73 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 26 Jun 2022 07:20:47 +0300 Subject: [PATCH 33/41] Dropped usage 'toLinkedHashSet' --- .../valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt | 7 +++---- .../plugin/core/render/elements/BaseBpmnRenderElement.kt | 4 ++++ .../core/render/elements/BaseDiagramRenderElement.kt | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt index d3bb4e67b..61f53c577 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt @@ -1,6 +1,5 @@ package com.valb3r.bpmn.intellij.plugin.core.render -import com.intellij.grazie.utils.toLinkedSet import com.intellij.openapi.project.Project import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.core.render.elements.BaseBpmnRenderElement @@ -11,7 +10,7 @@ fun dumpRenderTree(project: Project) { println("===== Mapped XML tree: =====") val parentToElems = renderState.state.currentState.elementByBpmnId.entries .groupBy { it.value.parent.id } - .mapValues { entry -> entry.value.map { it.key.id }.toLinkedSet() } + .mapValues { entry -> LinkedHashSet(entry.value.map { it.key.id }) } dumpTree(renderState.elementsById, parentToElems) println("===== End XML tree =====") @@ -35,8 +34,8 @@ private fun rootToElemsByParent(state: RenderedState, root: BaseBpmnRenderElemen } private fun dumpTree(elementsById: Map, elemsByParent: Map>) { - val childElems = elemsByParent.values.flatten().toLinkedSet() - val roots = elemsByParent.keys.filter { !childElems.contains(it) }.toLinkedSet() + val childElems = LinkedHashSet(elemsByParent.values.flatten()) + val roots = LinkedHashSet(elemsByParent.keys.filter { !childElems.contains(it) }) if (roots.isEmpty()) { println("Cyclic structure detected, none of ${elemsByParent.keys} is standalone root") elemsByParent.keys.forEach { possibleRoot -> diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseBpmnRenderElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseBpmnRenderElement.kt index 3443443a0..ce66129ac 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseBpmnRenderElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseBpmnRenderElement.kt @@ -16,4 +16,8 @@ abstract class BaseBpmnRenderElement( delete += BpmnElementRemovedEvent(bpmnElementId) return delete } + + override fun toString(): String { + return bpmnElementId.id + } } \ No newline at end of file diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseDiagramRenderElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseDiagramRenderElement.kt index 1ef61ebcb..db173161b 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseDiagramRenderElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseDiagramRenderElement.kt @@ -283,4 +283,8 @@ abstract class BaseDiagramRenderElement( currentOnScreenRect(state().ctx.canvas.camera) children.forEach {it.currentOnScreenRect(state().ctx.canvas.camera)} } + + override fun toString(): String { + return "DIAG:${elementId.id}" + } } \ No newline at end of file From 7fee095fdf82e713b3890e1371a1c77da4a4300e Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 26 Jun 2022 07:28:33 +0300 Subject: [PATCH 34/41] Ensure Collaboration virtual IDs can't exists due to illegal character --- .../intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt index eee922793..44ca43392 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DefaultBpmnProcessRenderer.kt @@ -183,7 +183,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr private fun createCollaborationAndCollaborationProcesses(state: () -> RenderState, root: BaseBpmnRenderElement, elements: MutableList, elementsById: MutableMap) { state().currentState.elementByBpmnId.values.map { it.element }.filterIsInstance().filter { it.id != root.bpmnElementId }.forEach { - val processElem = InvisibleShape(DiagramElementId("__collaboration_${it.id}"), it.id, state) + val processElem = InvisibleShape(DiagramElementId("__collaboration:_${it.id}"), it.id, state) elements += processElem elementsById[it.id] = processElem } @@ -191,7 +191,7 @@ class DefaultBpmnProcessRenderer(private val project: Project, val icons: IconPr val rootProcessId = state().currentState.primaryProcessId val collaborations = state().currentState.processes.filter { it != rootProcessId } collaborations.forEach { - val processElem = InvisibleShape(DiagramElementId("__collaboration_process_${it.id}"), it, state) + val processElem = InvisibleShape(DiagramElementId("__collaboration:_process_${it.id}"), it, state) elements += processElem elementsById[it] = processElem } From bf1e4c67a537c6b334b41dbbcd6c83438111fe38 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 26 Jun 2022 08:44:41 +0300 Subject: [PATCH 35/41] Fixed majority of XML tests --- .../plugin/activiti/parser/ActivitiParser.kt | 6 +- .../activiti/parser/nodes/ActivitiXml.kt | 35 +++-- .../nodes/collaboration/Collaboration.kt | 43 ++++++ .../activiti/parser/ActivityParserDumbTest.kt | 26 ++-- .../parser/WindowsEncodingAndCrLfTest.kt | 2 +- .../parser/XmlUpdateEventApplyTest.kt | 54 +++---- .../XmlUpdateEventBpmnObjectAddedTest.kt | 92 ++++++------ .../XmlUpdateEventDocumentationFormatTest.kt | 4 +- .../XmlWithNestedStructureParserTest.kt | 34 ++--- .../activiti7/Activity7ParserBasicTest.kt | 3 +- .../CondExpressionWithoutTypeParseable.kt | 8 +- .../bugfix/EmptyCondExpressionParseable.kt | 8 +- ...tivitiStartEventWithNestedExtensionTest.kt | 4 +- .../ActivityBusinessRuleTaskTest.kt | 4 +- .../ActivityCamelTaskTest.kt | 4 +- .../ActivityDecisionTaskTest.kt | 4 +- .../ActivityMailTaskTest.kt | 4 +- .../ActivityManualTaskTest.kt | 4 +- .../ActivityMuleTaskTest.kt | 4 +- .../ActivityReceiveTaskTest.kt | 4 +- .../ActivityScriptTaskTest.kt | 4 +- ...eTaskEmptyUpdateWithNestedExtensionTest.kt | 4 +- .../ActivityServiceTaskTest.kt | 4 +- ...ityServiceTaskWithExtensionElementsTest.kt | 6 +- ...ivityServiceTaskWithNestedExtensionTest.kt | 20 +-- .../ActivityUserTaskTest.kt | 4 +- ...ActivityUserTaskWithNestedExtensionTest.kt | 8 +- .../intellij/plugin/core/tests/BaseUiTest.kt | 134 ++++++++++-------- .../plugin/camunda/parser/CamundaParser.kt | 1 - .../CondExpressionWithoutTypeParseable.kt | 2 +- .../bugfix/EmptyCondExpressionParseable.kt | 2 +- .../CamundaExternalTaskTest.kt | 8 +- .../ComplexGatewayWithExtensionIsParseable.kt | 4 +- ...nkCatchingEventWithExtensionIsParseable.kt | 4 +- .../SendTaskWithExtensionIsParseable.kt | 4 +- .../ServiceTaskWithExtensionIsParseable.kt | 4 +- .../StartEventWithExtensionIsParseable.kt | 4 +- .../TaskWithExtensionIsParseable.kt | 4 +- .../UserTaskWithExtensionIsParseable.kt | 4 +- .../SpecialCaseIncomingOutgoingIsParseable.kt | 12 +- .../plugin/flowable/parser/FlowableParser.kt | 6 +- .../flowable/parser/nodes/FlowableXml.kt | 34 +++-- .../nodes/collaboration/Collaboration.kt | 43 ++++++ .../parser/CollapsedSubprocessTest.kt | 8 +- .../flowable/parser/FlowableParserDumbTest.kt | 26 ++-- .../parser/WindowsEncodingAndCrLfTest.kt | 2 +- .../parser/XmlUpdateEventApplyTest.kt | 54 +++---- .../XmlUpdateEventBpmnObjectAddedTest.kt | 92 ++++++------ .../XmlUpdateEventDocumentationFormatTest.kt | 4 +- .../XmlWithNestedStructureParserTest.kt | 34 ++--- .../CondExpressionWithoutTypeParseable.kt | 4 +- .../bugfix/EmptyCondExpressionParseable.kt | 4 +- ...owableStartEventWithNestedExtensionTest.kt | 4 +- .../FlowableBusinessRuleTaskTest.kt | 4 +- .../FlowableCamelTaskTest.kt | 4 +- .../FlowableDecisionTaskTest.kt | 4 +- .../FlowableExternalTaskTest.kt | 9 +- .../FlowableHttpTaskTest.kt | 4 +- .../FlowableMailTaskTest.kt | 4 +- .../FlowableManualTaskTest.kt | 4 +- .../FlowableMuleTaskTest.kt | 4 +- .../FlowableReceiveTaskTest.kt | 4 +- .../FlowableScriptTaskTest.kt | 4 +- .../FlowableServiceTaskTest.kt | 4 +- ...bleServiceTaskWithExtensionElementsTest.kt | 6 +- ...wableServiceTaskWithNestedExtensionTest.kt | 20 +-- .../FlowableShellTaskTest.kt | 4 +- .../FlowableUserTaskTest.kt | 4 +- ...FlowableUserTaskWithNestedExtensionTest.kt | 8 +- .../plugin/bpmn/api/BpmnFileObject.kt | 2 + 70 files changed, 549 insertions(+), 443 deletions(-) create mode 100644 activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/nodes/collaboration/Collaboration.kt create mode 100644 flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/nodes/collaboration/Collaboration.kt diff --git a/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivitiParser.kt b/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivitiParser.kt index 98d496a02..00e1b0294 100644 --- a/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivitiParser.kt +++ b/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivitiParser.kt @@ -118,12 +118,12 @@ open class ActivitiParser : BaseBpmnParser() { } private fun toProcessObject(dto: BpmnFile): BpmnFileObject { - // TODO - Multi process support? markSubprocessesAndTransactionsThatHaveExternalDiagramAsCollapsed(dto.processes[0], dto.diagrams!!) - val process = dto.processes[0].toElement() + val processes = dto.processes.map { it.toElement() } + val collaborations = dto.collaborations?.map { it.toElement() } ?: emptyList() val diagrams = dto.diagrams!!.map { it.toElement() } - TODO() + return BpmnFileObject(processes, collaborations, diagrams) } override fun modelNs(): NS { diff --git a/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/nodes/ActivitiXml.kt b/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/nodes/ActivitiXml.kt index bc01ea9f0..84a88e69a 100644 --- a/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/nodes/ActivitiXml.kt +++ b/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/nodes/ActivitiXml.kt @@ -21,12 +21,12 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.BpmnEve import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.BpmnSubProcess import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElement +import com.valb3r.bpmn.intellij.plugin.activiti.parser.nodes.collaboration.Collaboration import org.mapstruct.Mapper import org.mapstruct.Mapping import org.mapstruct.Mappings import org.mapstruct.factory.Mappers import java.util.concurrent.ConcurrentHashMap -import kotlin.reflect.KClass const val EXTENSION_ELEM_STREAM = "java(null == input.getExtensionElements() ? null : input.getExtensionElements().stream()" @@ -38,20 +38,25 @@ const val EXTENSION_BOOLEAN_EXTRACTOR = ".map(it -> Boolean.valueOf(it.getString // https://github.com/FasterXML/jackson-dataformat-xml/issues/363 // unfortunately this has failed with Kotlin 'data' classes class BpmnFile( - @JacksonXmlProperty(localName = "message") - @JsonMerge - @JacksonXmlElementWrapper(useWrapping = false) - var messages: List? = null, - - @JacksonXmlProperty(localName = "process") - @JsonMerge - @JacksonXmlElementWrapper(useWrapping = false) - var processes: List, - - @JacksonXmlProperty(localName = "BPMNDiagram") - @JsonMerge - @JacksonXmlElementWrapper(useWrapping = false) - var diagrams: List? = null + @JacksonXmlProperty(localName = "message") + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var messages: List? = null, + + @JacksonXmlProperty(localName = "collaboration") + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var collaborations: List? = null, + + @JacksonXmlProperty(localName = "process") + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var processes: List, + + @JacksonXmlProperty(localName = "BPMNDiagram") + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var diagrams: List? = null ) data class MessageNode(val id: String, var name: String?) diff --git a/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/nodes/collaboration/Collaboration.kt b/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/nodes/collaboration/Collaboration.kt new file mode 100644 index 000000000..60e8b09bd --- /dev/null +++ b/activiti-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/nodes/collaboration/Collaboration.kt @@ -0,0 +1,43 @@ +package com.valb3r.bpmn.intellij.plugin.activiti.parser.nodes.collaboration + +import com.fasterxml.jackson.annotation.JsonMerge +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty +import com.valb3r.bpmn.intellij.plugin.activiti.parser.nodes.BpmnMappable +import com.valb3r.bpmn.intellij.plugin.activiti.parser.nodes.process.BpmnElementIdMapper +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnCollaboration +import org.mapstruct.Mapper +import org.mapstruct.factory.Mappers + +data class Collaboration( + @JacksonXmlProperty(isAttribute = true) val id: String, + @JacksonXmlProperty(isAttribute = true) val name: String?, + @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) val participant: List?, + @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) val messageFlow: List?, +) : BpmnMappable { + + override fun toElement(): BpmnCollaboration { + return Mappers.getMapper(Mapping::class.java).convertToDto(this) + } + + @Mapper(uses = [BpmnElementIdMapper::class]) + interface Mapping { + fun convertToDto(input: Collaboration): BpmnCollaboration + } +} + +data class Participant( + @JacksonXmlProperty(isAttribute = true) val id: String, + @JacksonXmlProperty(isAttribute = true) val name: String?, + @JacksonXmlProperty(isAttribute = true) val processRef: String?, + val documentation: String? +) + +data class MessageFlow( + @JacksonXmlProperty(isAttribute = true) val id: String, + @JacksonXmlProperty(isAttribute = true) val name: String?, + val documentation: String?, + @JacksonXmlProperty(isAttribute = true) val sourceRef: String?, + @JacksonXmlProperty(isAttribute = true) val targetRef: String?, +) + diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivityParserDumbTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivityParserDumbTest.kt index d5c7feaa4..d040ab6e4 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivityParserDumbTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/ActivityParserDumbTest.kt @@ -67,9 +67,9 @@ internal class ActivityParserDumbTest { processObject = ActivitiParser().parse("nested-interlaced.bpmn20.xml".asResource()!!) processObject.shouldNotBeNull() - processObject.process.body!!.serviceTask!!.map { it.id.id }.shouldContainAll(arrayOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask")) - processObject.process.children!![BpmnElementId("sid-9E62AF47-D4DF-4492-BA2F-E531CEB29A03")]!!.serviceTask!!.shouldHaveSize(2) - processObject.process.children!![BpmnElementId("sid-9E62AF47-D4DF-4492-BA2F-E531CEB29A03")]!!.serviceTask!!.map { it.id.id }.shouldContain("nestedServiceTaskInterlaced") + processObject.processes[0].body!!.serviceTask!!.map { it.id.id }.shouldContainAll(arrayOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask")) + processObject.processes[0].children!![BpmnElementId("sid-9E62AF47-D4DF-4492-BA2F-E531CEB29A03")]!!.serviceTask!!.shouldHaveSize(2) + processObject.processes[0].children!![BpmnElementId("sid-9E62AF47-D4DF-4492-BA2F-E531CEB29A03")]!!.serviceTask!!.map { it.id.id }.shouldContain("nestedServiceTaskInterlaced") } @Test @@ -79,9 +79,9 @@ internal class ActivityParserDumbTest { processObject = ActivitiParser().parse("nested-interlaced.bpmn20.xml".asResource()!!) processObject.shouldNotBeNull() - processObject.process.body!!.serviceTask!!.map { it.id.id }.shouldContainAll(arrayOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask")) - processObject.process.children!![BpmnElementId("sid-0B5D0923-5542-44DA-B86D-C3E4B2883DC2")]!!.serviceTask!!.shouldHaveSize(2) - processObject.process.children!![BpmnElementId("sid-0B5D0923-5542-44DA-B86D-C3E4B2883DC2")]!!.serviceTask!!.map { it.id.id }.shouldContain("nestedServiceTaskInterlacedOther") + processObject.processes[0].body!!.serviceTask!!.map { it.id.id }.shouldContainAll(arrayOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask")) + processObject.processes[0].children!![BpmnElementId("sid-0B5D0923-5542-44DA-B86D-C3E4B2883DC2")]!!.serviceTask!!.shouldHaveSize(2) + processObject.processes[0].children!![BpmnElementId("sid-0B5D0923-5542-44DA-B86D-C3E4B2883DC2")]!!.serviceTask!!.map { it.id.id }.shouldContain("nestedServiceTaskInterlacedOther") } @Test @@ -91,9 +91,9 @@ internal class ActivityParserDumbTest { processObject = ActivitiParser().parse("nested-interlaced.bpmn20.xml".asResource()!!) processObject.shouldNotBeNull() - processObject.process.body!!.serviceTask!!.map { it.id.id }.shouldContainAll(arrayOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask")) - processObject.process.children!![BpmnElementId("sid-77F95F37-ADC3-4EBB-8F21-AEF1C015D5EB")]!!.serviceTask!!.shouldHaveSize(2) - processObject.process.children!![BpmnElementId("sid-77F95F37-ADC3-4EBB-8F21-AEF1C015D5EB")]!!.serviceTask!!.map { it.id.id }.shouldContain("nestedServiceTaskInterlacedYetOther") + processObject.processes[0].body!!.serviceTask!!.map { it.id.id }.shouldContainAll(arrayOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask")) + processObject.processes[0].children!![BpmnElementId("sid-77F95F37-ADC3-4EBB-8F21-AEF1C015D5EB")]!!.serviceTask!!.shouldHaveSize(2) + processObject.processes[0].children!![BpmnElementId("sid-77F95F37-ADC3-4EBB-8F21-AEF1C015D5EB")]!!.serviceTask!!.map { it.id.id }.shouldContain("nestedServiceTaskInterlacedYetOther") } @Test @@ -223,7 +223,7 @@ internal class ActivityParserDumbTest { updated.shouldNotBeNull() val updatedProcess = ActivitiParser().parse(updated) - updatedProcess.process.children!![BpmnElementId("sid-1334170C-BA4D-4387-99BD-44229D18942C")]!!.sequenceFlow!!.map { it.id }.shouldContain(newId) + updatedProcess.processes[0].children!![BpmnElementId("sid-1334170C-BA4D-4387-99BD-44229D18942C")]!!.sequenceFlow!!.map { it.id }.shouldContain(newId) } @Test @@ -258,7 +258,7 @@ internal class ActivityParserDumbTest { updated.shouldNotBeNull() val processObject = ActivitiParser().parse(updated) - processObject.process.body!!.transaction!!.map { it.id.id }.shouldContain("sid-9DBEBCA6-7BE8-4170-ACC3-4548A2244C40") + processObject.processes[0].body!!.transaction!!.map { it.id.id }.shouldContain("sid-9DBEBCA6-7BE8-4170-ACC3-4548A2244C40") } @Test @@ -280,7 +280,7 @@ internal class ActivityParserDumbTest { updated.shouldNotBeNull() val updatedProcess = ActivitiParser().parse(updated) - val sequenceFlow = updatedProcess.process.body!!.sequenceFlow!!.filter { it.id.id == "sid-2CF229A2-6399-4510-AED6-45B5C553458C"}.shouldHaveSingleItem() + val sequenceFlow = updatedProcess.processes[0].body!!.sequenceFlow!!.filter { it.id.id == "sid-2CF229A2-6399-4510-AED6-45B5C553458C"}.shouldHaveSingleItem() sequenceFlow.conditionExpression!!.text.shouldBeNull() } @@ -293,7 +293,7 @@ internal class ActivityParserDumbTest { updated.shouldNotBeNull() val updatedProcess = ActivitiParser().parse(updated) - val sequenceFlow = updatedProcess.process.body!!.sequenceFlow!!.filter { it.id.id == "sid-BFF510EA-1AD5-4353-AB11-DF8B2090A9FD"}.shouldHaveSingleItem() + val sequenceFlow = updatedProcess.processes[0].body!!.sequenceFlow!!.filter { it.id.id == "sid-BFF510EA-1AD5-4353-AB11-DF8B2090A9FD"}.shouldHaveSingleItem() sequenceFlow.conditionExpression!!.text.shouldBeNull() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/WindowsEncodingAndCrLfTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/WindowsEncodingAndCrLfTest.kt index e5fb4371e..a38252c2f 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/WindowsEncodingAndCrLfTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/WindowsEncodingAndCrLfTest.kt @@ -19,7 +19,7 @@ class WindowsEncodingAndCrLfTest { val updateNameTo = "提交请假" val ActivityParser = ActivitiParser() val updated = ActivityParser.update(initial, listOf(StringValueUpdatedEvent(BpmnElementId("empty-process-name"), PropertyType.NAME, updateNameTo))) - ActivityParser.parse(updated).process.name.shouldBeEqualTo(updateNameTo) + ActivityParser.parse(updated).processes[0].name.shouldBeEqualTo(updateNameTo) } private fun setKoi8DefaultEncoding() { diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventApplyTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventApplyTest.kt index 9baac3e0c..417557e3b 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventApplyTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventApplyTest.kt @@ -34,7 +34,7 @@ internal class XmlUpdateEventApplyTest { val newValue = "Start task name" val updatedProcess = readAndUpdateProcess(parser, StringValueUpdatedEvent(startEventId, PropertyType.NAME, newValue)) - updatedProcess.process.body!!.startEvent!!.filter { it.id == startEventId }.shouldHaveSingleItem().name.shouldBeEqualTo(newValue) + updatedProcess.processes[0].body!!.startEvent!!.filter { it.id == startEventId }.shouldHaveSingleItem().name.shouldBeEqualTo(newValue) } @Test @@ -42,7 +42,7 @@ internal class XmlUpdateEventApplyTest { val newValue = "Nested service task name" val updatedProcess = readAndUpdateProcess(parser, StringValueUpdatedEvent(nestedServiceTaskFirstId, PropertyType.NAME, newValue)) - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem().name.shouldBeEqualTo(newValue) + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem().name.shouldBeEqualTo(newValue) } @Test @@ -50,8 +50,8 @@ internal class XmlUpdateEventApplyTest { val newValue = "newAwesomeStartEventId" val updatedProcess = readAndUpdateProcess(parser, StringValueUpdatedEvent(startEventId, PropertyType.ID, newValue)) - updatedProcess.process.body!!.startEvent!!.filter { it.id == BpmnElementId(newValue) }.shouldHaveSingleItem() - updatedProcess.process.body!!.startEvent!!.filter { it.id == startEventId }.shouldBeEmpty() + updatedProcess.processes[0].body!!.startEvent!!.filter { it.id == BpmnElementId(newValue) }.shouldHaveSingleItem() + updatedProcess.processes[0].body!!.startEvent!!.filter { it.id == startEventId }.shouldBeEmpty() } @Test @@ -59,8 +59,8 @@ internal class XmlUpdateEventApplyTest { val newValue = "newAwesomeNestedServiceId" val updatedProcess = readAndUpdateProcess(parser, StringValueUpdatedEvent(nestedServiceTaskFirstId, PropertyType.ID, newValue)) - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == BpmnElementId(newValue) }.shouldHaveSingleItem() - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == BpmnElementId(newValue) }.shouldHaveSingleItem() + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() } @Test @@ -68,7 +68,7 @@ internal class XmlUpdateEventApplyTest { val newValue = "Some new docs" val updatedProcess = readAndUpdateProcess(parser, StringValueUpdatedEvent(startEventId, PropertyType.DOCUMENTATION, newValue)) - updatedProcess.process.body!!.startEvent!!.filter { it.id == startEventId }.shouldHaveSingleItem().documentation.shouldBeEqualTo(newValue) + updatedProcess.processes[0].body!!.startEvent!!.filter { it.id == startEventId }.shouldHaveSingleItem().documentation.shouldBeEqualTo(newValue) } @Test @@ -76,31 +76,31 @@ internal class XmlUpdateEventApplyTest { val newValue = "Some new docs" val updatedProcess = readAndUpdateProcess(parser, StringValueUpdatedEvent(nestedServiceTaskFirstId, PropertyType.DOCUMENTATION, newValue)) - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem().documentation.shouldBeEqualTo(newValue) + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem().documentation.shouldBeEqualTo(newValue) } @Test fun `Boolean value update event on flat element works (attribute)`() { val updatedProcess = readAndUpdateProcess(parser, BooleanValueUpdatedEvent(flatServiceTaskId, PropertyType.ASYNC, true)) - updatedProcess.process.body!!.serviceTask!!.filter { it.id == flatServiceTaskId }.shouldHaveSingleItem().async.shouldBeEqualTo(true) + updatedProcess.processes[0].body!!.serviceTask!!.filter { it.id == flatServiceTaskId }.shouldHaveSingleItem().async.shouldBeEqualTo(true) } @Test fun `Boolean value update event on nested element works (attribute)`() { val updatedProcess = readAndUpdateProcess(parser, BooleanValueUpdatedEvent(nestedServiceTaskFirstId, PropertyType.ASYNC, true)) - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem().async.shouldBeEqualTo(true) + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem().async.shouldBeEqualTo(true) } @Test fun `Element type pdate event on flat element works (attribute)`() { val updatedProcess = readAndUpdateProcess(parser, BooleanValueUpdatedEvent(subProcessId, PropertyType.IS_TRANSACTIONAL_SUBPROCESS, true)) - updatedProcess.process.body!!.transaction!!.filter { it.id == subProcessId }.shouldHaveSingleItem() - updatedProcess.process.body!!.subProcess.shouldBeNull() - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.shouldHaveSize(2) - updatedProcess.process.children!![subProcessId]!!.sequenceFlow!!.shouldHaveSize(1) + updatedProcess.processes[0].body!!.transaction!!.filter { it.id == subProcessId }.shouldHaveSingleItem() + updatedProcess.processes[0].body!!.subProcess.shouldBeNull() + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.shouldHaveSize(2) + updatedProcess.processes[0].children!![subProcessId]!!.sequenceFlow!!.shouldHaveSize(1) } @@ -177,14 +177,14 @@ internal class XmlUpdateEventApplyTest { fun `BPMN element removed event on flat element works`() { val updatedProcess = readAndUpdateProcess(parser, BpmnElementRemovedEvent(flatServiceTaskId)) - updatedProcess.process.body!!.serviceTask.shouldBeNull() + updatedProcess.processes[0].body!!.serviceTask.shouldBeNull() } @Test fun `BPMN element removed event on nested element works`() { val updatedProcess = readAndUpdateProcess(parser, BpmnElementRemovedEvent(nestedServiceTaskFirstId)) - updatedProcess.process.body!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() + updatedProcess.processes[0].body!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() } // BPMN Object added is tested in XmlUpdateEventBpmnObjectAdded @@ -208,7 +208,7 @@ internal class XmlUpdateEventApplyTest { PropertyTable(mutableMapOf(Pair(PropertyType.ID, mutableListOf(Property(id.id))), Pair(PropertyType.NAME, mutableListOf(Property(nameOnProp))))) )) - updatedProcess.process.body!!.sequenceFlow!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.sequenceFlow!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test @@ -230,7 +230,7 @@ internal class XmlUpdateEventApplyTest { PropertyTable(mutableMapOf(Pair(PropertyType.ID, mutableListOf(Property(id.id))), Pair(PropertyType.NAME, mutableListOf(Property(nameOnProp))))) )) - updatedProcess.process.children!![subProcessId]!!.sequenceFlow!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].children!![subProcessId]!!.sequenceFlow!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) val addedEdge = updatedProcess.diagram.filter { it.id == parentDiagramElementId }.shouldHaveSingleItem().bpmnPlane.bpmnEdge!!.filter { it.id == diagramId }.shouldHaveSingleItem() addedEdge.waypoint!![0].x.shouldBeNear(100.0f, EPSILON) addedEdge.waypoint!![0].y.shouldBeNear(100.0f, EPSILON) @@ -258,9 +258,9 @@ internal class XmlUpdateEventApplyTest { fun `BPMN parent changed event on flat element works`() { val updatedProcess = readAndUpdateProcess(parser, BpmnParentChangedEvent(flatServiceTaskId, subProcessId)) - updatedProcess.process.body!!.serviceTask.shouldBeNull() - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == flatServiceTaskId }.shouldHaveSingleItem() - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.map { it.id }.shouldContainSame( + updatedProcess.processes[0].body!!.serviceTask.shouldBeNull() + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == flatServiceTaskId }.shouldHaveSingleItem() + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.map { it.id }.shouldContainSame( listOf(flatServiceTaskId, nestedServiceTaskFirstId, nestedServiceTaskSecondId) ) } @@ -269,9 +269,9 @@ internal class XmlUpdateEventApplyTest { fun `BPMN parent changed event on nested element works`() { val updatedProcess = readAndUpdateProcess(parser, BpmnParentChangedEvent(nestedServiceTaskFirstId, processId)) - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() - updatedProcess.process.body!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem() - updatedProcess.process.body!!.serviceTask!!.map { it.id }.shouldContainSame( + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() + updatedProcess.processes[0].body!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem() + updatedProcess.processes[0].body!!.serviceTask!!.map { it.id }.shouldContainSame( listOf(flatServiceTaskId, nestedServiceTaskFirstId) ) } @@ -280,8 +280,8 @@ internal class XmlUpdateEventApplyTest { fun `BPMN parent changed event without propagation flag on nested element works`() { val updatedProcess = readAndUpdateProcess(parser, BpmnParentChangedEvent(nestedServiceTaskFirstId, processId, false)) - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem() - updatedProcess.process.body!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() - updatedProcess.process.body!!.serviceTask!!.filter { it.id == flatServiceTaskId }.shouldHaveSingleItem() + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem() + updatedProcess.processes[0].body!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() + updatedProcess.processes[0].body!!.serviceTask!!.filter { it.id == flatServiceTaskId }.shouldHaveSingleItem() } } \ No newline at end of file diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventBpmnObjectAddedTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventBpmnObjectAddedTest.kt index 144e6940a..391101f49 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventBpmnObjectAddedTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventBpmnObjectAddedTest.kt @@ -53,322 +53,322 @@ internal class XmlUpdateEventBpmnObjectAddedTest { fun `Added start event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartEvent::class)) - updatedProcess.process.body!!.startEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.startEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added start timer event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartTimerEvent::class)) - updatedProcess.process.body!!.timerStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.timerStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added start signal event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartSignalEvent::class)) - updatedProcess.process.body!!.signalStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.signalStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added start message event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartMessageEvent::class)) - updatedProcess.process.body!!.messageStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.messageStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added start error event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartErrorEvent::class)) - updatedProcess.process.body!!.errorStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.errorStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added start conditional event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartConditionalEvent::class)) - updatedProcess.process.body!!.conditionalStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.conditionalStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added start escalation event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartEscalationEvent::class)) - updatedProcess.process.body!!.escalationStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.escalationStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added end event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEndEvent::class)) - updatedProcess.process.body!!.endEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.endEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added end termination event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEndTerminateEvent::class)) - updatedProcess.process.body!!.terminateEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.terminateEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added end escalation event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEndEscalationEvent::class)) - updatedProcess.process.body!!.escalationEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.escalationEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added end cancel event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEndCancelEvent::class)) - updatedProcess.process.body!!.cancelEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.cancelEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added end error event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEndErrorEvent::class)) - updatedProcess.process.body!!.errorEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.errorEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary cancel event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryCancelEvent::class)) - updatedProcess.process.body!!.boundaryCancelEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryCancelEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary compensation event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryCompensationEvent::class)) - updatedProcess.process.body!!.boundaryCompensationEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryCompensationEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary condtional event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryConditionalEvent::class)) - updatedProcess.process.body!!.boundaryConditionalEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryConditionalEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary error event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryErrorEvent::class)) - updatedProcess.process.body!!.boundaryErrorEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryErrorEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary escalation event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryEscalationEvent::class)) - updatedProcess.process.body!!.boundaryEscalationEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryEscalationEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary message event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryMessageEvent::class)) - updatedProcess.process.body!!.boundaryMessageEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryMessageEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary signal event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundarySignalEvent::class)) - updatedProcess.process.body!!.boundarySignalEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundarySignalEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary timer event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryTimerEvent::class)) - updatedProcess.process.body!!.boundaryTimerEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryTimerEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate timer catching event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateTimerCatchingEvent::class)) - updatedProcess.process.body!!.intermediateTimerCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateTimerCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate message catching event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateMessageCatchingEvent::class)) - updatedProcess.process.body!!.intermediateMessageCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateMessageCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate signal catching event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateSignalCatchingEvent::class)) - updatedProcess.process.body!!.intermediateSignalCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateSignalCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate conditional catching event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateConditionalCatchingEvent::class)) - updatedProcess.process.body!!.intermediateConditionalCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateConditionalCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate none throwing event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateNoneThrowingEvent::class)) - updatedProcess.process.body!!.intermediateNoneThrowingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateNoneThrowingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate signal throwing event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateSignalThrowingEvent::class)) - updatedProcess.process.body!!.intermediateSignalThrowingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateSignalThrowingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate escalation throwing event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateEscalationThrowingEvent::class)) - updatedProcess.process.body!!.intermediateEscalationThrowingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateEscalationThrowingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added user task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnUserTask::class)) - updatedProcess.process.body!!.userTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.userTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added script task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnScriptTask::class)) - updatedProcess.process.body!!.scriptTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.scriptTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added service task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnServiceTask::class)) - updatedProcess.process.body!!.serviceTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.serviceTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added business rule task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBusinessRuleTask::class)) - updatedProcess.process.body!!.businessRuleTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.businessRuleTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added receive task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnReceiveTask::class)) - updatedProcess.process.body!!.receiveTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.receiveTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added camel task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnCamelTask::class)) - updatedProcess.process.body!!.camelTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.camelTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added http task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnHttpTask::class)) - updatedProcess.process.body!!.httpTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.httpTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added mule task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnMuleTask::class)) - updatedProcess.process.body!!.muleTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.muleTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added decision task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnDecisionTask::class)) - updatedProcess.process.body!!.decisionTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.decisionTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added shell task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnShellTask::class)) - updatedProcess.process.body!!.shellTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.shellTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added call activity event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnCallActivity::class)) - updatedProcess.process.body!!.callActivity!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.callActivity!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added sub process event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnSubProcess::class)) - updatedProcess.process.body!!.subProcess!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.subProcess!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added event sub process event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEventSubprocess::class)) - updatedProcess.process.body!!.eventSubProcess!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.eventSubProcess!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added adhoc sub process event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnAdHocSubProcess::class)) - updatedProcess.process.body!!.adHocSubProcess!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.adHocSubProcess!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added transactional sub process event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnTransactionalSubProcess::class)) - updatedProcess.process.body!!.transaction!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.transaction!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added exclusive gateway works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnExclusiveGateway::class)) - updatedProcess.process.body!!.exclusiveGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.exclusiveGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added parallel gateway works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnParallelGateway::class)) - updatedProcess.process.body!!.parallelGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.parallelGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added inclusive gateway works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnInclusiveGateway::class)) - updatedProcess.process.body!!.inclusiveGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.inclusiveGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added event gateway works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEventGateway::class)) - updatedProcess.process.body!!.eventBasedGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.eventBasedGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } private fun generateUpdateEvent(clazz: KClass): EventPropagatableToXml { diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventDocumentationFormatTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventDocumentationFormatTest.kt index bfbc68c43..81113b0ea 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventDocumentationFormatTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlUpdateEventDocumentationFormatTest.kt @@ -68,8 +68,8 @@ class XmlUpdateEventDocumentationFormatTest { fun `Removing element does not break 'documentation' element formatting`() { val originalProcess = readProcess() val updatedProcess = readAndUpdateProcess(BpmnElementRemovedEvent(BpmnElementId(startEventId))) - updatedProcess.process.body!!.scriptTask!![0].documentation - .shouldBeEqualTo(originalProcess.process.body!!.scriptTask!![0].documentation) + updatedProcess.processes[0].body!!.scriptTask!![0].documentation + .shouldBeEqualTo(originalProcess.processes[0].body!!.scriptTask!![0].documentation) } private fun readProcess(): BpmnFileObject { diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlWithNestedStructureParserTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlWithNestedStructureParserTest.kt index 939735a3b..53f46c4f4 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlWithNestedStructureParserTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/XmlWithNestedStructureParserTest.kt @@ -19,15 +19,15 @@ internal class XmlWithNestedStructureParserTest { // Assert the process structure processObject.shouldNotBeNull() - processObject.process.id.shouldBeEqualTo(BpmnElementId("nested-test")) - processObject.process.body.shouldNotBeNull() - processObject.process.body!!.startEvent!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("startGlobal") - processObject.process.body!!.endEvent!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("endGlobal") - processObject.process.body!!.serviceTask!!.map { it.id.id }.shouldContainSame( + processObject.processes[0].id.shouldBeEqualTo(BpmnElementId("nested-test")) + processObject.processes[0].body.shouldNotBeNull() + processObject.processes[0].body!!.startEvent!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("startGlobal") + processObject.processes[0].body!!.endEvent!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("endGlobal") + processObject.processes[0].body!!.serviceTask!!.map { it.id.id }.shouldContainSame( listOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask") ) - processObject.process.body!!.exclusiveGateway!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("basicGateway") - processObject.process.body!!.sequenceFlow!!.map { it.id.id }.shouldContainSame( + processObject.processes[0].body!!.exclusiveGateway!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("basicGateway") + processObject.processes[0].body!!.sequenceFlow!!.map { it.id.id }.shouldContainSame( listOf( "sid-96EFCF3C-548C-4556-B36C-2F10C675DD3E", "sid-B87070EE-2490-4FEC-AC02-099A30CFD986", @@ -38,12 +38,12 @@ internal class XmlWithNestedStructureParserTest { ) ) - processObject.process.body!!.subProcess!!.map { it.id.id }.shouldContainAll( + processObject.processes[0].body!!.subProcess!!.map { it.id.id }.shouldContainAll( listOf("sid-9DBEBCA6-7BE8-4170-ACC3-4548A2244C40", "sid-0B5D0923-5542-44DA-B86D-C3E4B2883DC2") ) - processObject.process.body!!.adHocSubProcess.shouldBeNull() // Activity does not support Ad-Hoc subprocess - processObject.process.body!!.transaction!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("sid-77F95F37-ADC3-4EBB-8F21-AEF1C015D5EB") - processObject.process.children!!.keys.map { it.id }.shouldContainSame( + processObject.processes[0].body!!.adHocSubProcess.shouldBeNull() // Activity does not support Ad-Hoc subprocess + processObject.processes[0].body!!.transaction!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("sid-77F95F37-ADC3-4EBB-8F21-AEF1C015D5EB") + processObject.processes[0].children!!.keys.map { it.id }.shouldContainSame( listOf( "sid-9DBEBCA6-7BE8-4170-ACC3-4548A2244C40", "sid-9E62AF47-D4DF-4492-BA2F-E531CEB29A03", @@ -53,13 +53,13 @@ internal class XmlWithNestedStructureParserTest { ) ) - validateDirectChildSubProcess(processObject.process.children!![BpmnElementId("sid-9DBEBCA6-7BE8-4170-ACC3-4548A2244C40")]!!) - validateInSubProcessNestedChildSubProcess(processObject.process.children!![BpmnElementId("sid-9E62AF47-D4DF-4492-BA2F-E531CEB29A03")]!!) - validateAnotherDirectSubProcess(processObject.process.children!![BpmnElementId("sid-0B5D0923-5542-44DA-B86D-C3E4B2883DC2")]!!) - validateAnotherDirectSubProcessNestedChildSubProcess(processObject.process.children!![BpmnElementId("sid-1334170C-BA4D-4387-99BD-44229D18942C")]!!) - validateDirectTransactionSubProcess(processObject.process.children!![BpmnElementId("sid-77F95F37-ADC3-4EBB-8F21-AEF1C015D5EB")]!!) + validateDirectChildSubProcess(processObject.processes[0].children!![BpmnElementId("sid-9DBEBCA6-7BE8-4170-ACC3-4548A2244C40")]!!) + validateInSubProcessNestedChildSubProcess(processObject.processes[0].children!![BpmnElementId("sid-9E62AF47-D4DF-4492-BA2F-E531CEB29A03")]!!) + validateAnotherDirectSubProcess(processObject.processes[0].children!![BpmnElementId("sid-0B5D0923-5542-44DA-B86D-C3E4B2883DC2")]!!) + validateAnotherDirectSubProcessNestedChildSubProcess(processObject.processes[0].children!![BpmnElementId("sid-1334170C-BA4D-4387-99BD-44229D18942C")]!!) + validateDirectTransactionSubProcess(processObject.processes[0].children!![BpmnElementId("sid-77F95F37-ADC3-4EBB-8F21-AEF1C015D5EB")]!!) - othersAreEmpty(processObject.process.body!!) + othersAreEmpty(processObject.processes[0].body!!) } private fun validateDirectChildSubProcess(subProcess: BpmnProcessBody) { diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/activiti7/Activity7ParserBasicTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/activiti7/Activity7ParserBasicTest.kt index a4513d671..8ce4566ef 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/activiti7/Activity7ParserBasicTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/activiti7/Activity7ParserBasicTest.kt @@ -16,7 +16,8 @@ internal class Activity7ParserBasicTest { processObject = ActivitiParser().parse("activiti7/simple-activiti7-process.bpmn20.xml".asResource()!!) processObject.shouldNotBeNull() - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(Activiti7ObjectFactory()).elemPropertiesByElementId + val props = BpmnFileObject(processObject.processes, diagram = processObject.diagram, collaborations = listOf()) + .toView(Activiti7ObjectFactory()).processes[0].processElemPropertiesByElementId props.shouldNotBeNull() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/CondExpressionWithoutTypeParseable.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/CondExpressionWithoutTypeParseable.kt index a64180913..d785138a8 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/CondExpressionWithoutTypeParseable.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/CondExpressionWithoutTypeParseable.kt @@ -20,11 +20,11 @@ internal class CondExpressionWithoutTypeParseable { fun `Sequence flow with empty conditional flow element parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val sequenceFlow = processObject.process.body!!.sequenceFlow!![2] + val sequenceFlow = processObject.processes[0].body!!.sequenceFlow!![2] sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "\${evection.num<3} ")) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("\${evection.num<3} ") @@ -34,11 +34,11 @@ internal class CondExpressionWithoutTypeParseable { fun `Sequence flow with empty conditional flow element parseable (Activiti 7)`() { val processObject = Activiti7Parser().parse(FILE.asResource()!!) - val sequenceFlow = processObject.process.body!!.sequenceFlow!![2] + val sequenceFlow = processObject.processes[0].body!!.sequenceFlow!![2] sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "\${evection.num<3} ")) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(Activiti7ObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(Activiti7ObjectFactory()).processes[0].processElemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("\${evection.num<3} ") diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/EmptyCondExpressionParseable.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/EmptyCondExpressionParseable.kt index 7cefb37d8..e900d3261 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/EmptyCondExpressionParseable.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/bugfix/EmptyCondExpressionParseable.kt @@ -20,11 +20,11 @@ internal class EmptyCondExpressionParseable { fun `Sequence flow with empty conditional flow element parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val sequenceFlow = processObject.process.body!!.sequenceFlow!![0] + val sequenceFlow = processObject.processes[0].body!!.sequenceFlow!![0] sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "")) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("") @@ -34,11 +34,11 @@ internal class EmptyCondExpressionParseable { fun `Sequence flow with empty conditional flow element parseable (Activiti 7)`() { val processObject = Activiti7Parser().parse(FILE.asResource()!!) - val sequenceFlow = processObject.process.body!!.sequenceFlow!![0] + val sequenceFlow = processObject.processes[0].body!!.sequenceFlow!![0] sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "")) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(Activiti7ObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(Activiti7ObjectFactory()).processes[0].processElemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("") diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/custom/ActivitiStartEventWithNestedExtensionTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/custom/ActivitiStartEventWithNestedExtensionTest.kt index 869aa1b28..23c0a65fe 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/custom/ActivitiStartEventWithNestedExtensionTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/custom/ActivitiStartEventWithNestedExtensionTest.kt @@ -30,7 +30,7 @@ internal class ActivitiUsereventWithNestedExtensionTest { val event = readStartEventWithExtensions(processObject) event.id.shouldBeEqualTo(elementId) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[event.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[event.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(event.id.id) props.getAll(PropertyType.FORM_PROPERTY_ID).shouldContainSame(arrayOf( @@ -82,6 +82,6 @@ internal class ActivitiUsereventWithNestedExtensionTest { } private fun readStartEventWithExtensions(processObject: BpmnFileObject): BpmnStartEvent { - return processObject.process.body!!.startEvent!!.shouldHaveSize(1)[0] + return processObject.processes[0].body!!.startEvent!!.shouldHaveSize(1)[0] } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityBusinessRuleTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityBusinessRuleTaskTest.kt index f07ad2fcf..665702635 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityBusinessRuleTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityBusinessRuleTaskTest.kt @@ -36,7 +36,7 @@ internal class ActivityBusinessRuleTaskTest { task.resultVariable.shouldBeEqualTo("RESULT_VAR") task.exclude!!.shouldBeTrue() - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -83,6 +83,6 @@ internal class ActivityBusinessRuleTaskTest { } private fun readBusinessRuleTask(processObject: BpmnFileObject): BpmnBusinessRuleTask { - return processObject.process.body!!.businessRuleTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.businessRuleTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityCamelTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityCamelTaskTest.kt index b2621d421..35bc05c97 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityCamelTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityCamelTaskTest.kt @@ -36,7 +36,7 @@ internal class ActivityCamelTaskTest { task.isForCompensation!!.shouldBeTrue() task.camelContext.shouldBeEqualTo("CAMEL_CTX") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -94,6 +94,6 @@ internal class ActivityCamelTaskTest { } private fun readCamelTask(processObject: BpmnFileObject): BpmnCamelTask { - return processObject.process.body!!.camelTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.camelTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityDecisionTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityDecisionTaskTest.kt index c1e36839f..2e3c2edfc 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityDecisionTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityDecisionTaskTest.kt @@ -35,7 +35,7 @@ internal class ActivityDecisionTaskTest { task.decisionTaskThrowErrorOnNoHits.shouldBeNull() // Not supported by activity task.fallbackToDefaultTenantCdata.shouldBeNull() // Not supported by activity - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -78,6 +78,6 @@ internal class ActivityDecisionTaskTest { } private fun readDecisionTask(processObject: BpmnFileObject): BpmnDecisionTask { - return processObject.process.body!!.decisionTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.decisionTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMailTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMailTaskTest.kt index d8cd35b7d..ae9807544 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMailTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMailTaskTest.kt @@ -41,7 +41,7 @@ internal class ActivityMailTaskTest { task.html.shouldBeEqualTo("Hello") task.charset.shouldBeEqualTo("UTF-8") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -104,6 +104,6 @@ internal class ActivityMailTaskTest { } private fun readMailTask(processObject: BpmnFileObject): BpmnMailTask { - return processObject.process.body!!.mailTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.mailTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityManualTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityManualTaskTest.kt index 68137a918..d5f115669 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityManualTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityManualTaskTest.kt @@ -35,7 +35,7 @@ internal class ActivityManualTaskTest { // TODO 'exclusive' ? task.isForCompensation!!.shouldBeTrue() - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -71,6 +71,6 @@ internal class ActivityManualTaskTest { } private fun readManualTask(processObject: BpmnFileObject): BpmnManualTask { - return processObject.process.body!!.manualTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.manualTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMuleTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMuleTaskTest.kt index d560ebc42..49618969c 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMuleTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityMuleTaskTest.kt @@ -39,7 +39,7 @@ internal class ActivityMuleTaskTest { task.payloadExpression.shouldBeEqualTo("\${foo.bar}") task.resultVariableCdata.shouldBeEqualTo("RESULT") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -87,6 +87,6 @@ internal class ActivityMuleTaskTest { } private fun readMuleTask(processObject: BpmnFileObject): BpmnMuleTask { - return processObject.process.body!!.muleTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.muleTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityReceiveTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityReceiveTaskTest.kt index bb60e5db3..4257bd779 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityReceiveTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityReceiveTaskTest.kt @@ -35,7 +35,7 @@ internal class ActivityReceiveTaskTest { // TODO 'exclusive' ? task.isForCompensation!!.shouldBeTrue() - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -71,6 +71,6 @@ internal class ActivityReceiveTaskTest { } private fun readReceiveTask(processObject: BpmnFileObject): BpmnReceiveTask { - return processObject.process.body!!.receiveTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.receiveTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityScriptTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityScriptTaskTest.kt index 032554fc7..81c780f65 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityScriptTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityScriptTaskTest.kt @@ -38,7 +38,7 @@ internal class ActivityScriptTaskTest { task.autoStoreVariables.shouldBeEqualTo(false) task.scriptBody.shouldBeEqualTo("echo \"Foo Bar!\" > /tmp/foo.txt") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -82,6 +82,6 @@ internal class ActivityScriptTaskTest { } private fun readScriptTask(processObject: BpmnFileObject): BpmnScriptTask { - return processObject.process.body!!.scriptTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.scriptTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskEmptyUpdateWithNestedExtensionTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskEmptyUpdateWithNestedExtensionTest.kt index fa63b7d67..1641d4cb0 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskEmptyUpdateWithNestedExtensionTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskEmptyUpdateWithNestedExtensionTest.kt @@ -28,7 +28,7 @@ internal class ActivityServiceTaskEmptyUpdateWithNestedExtensionTest { task.name.shouldBeEqualTo("Service task with extension") task.documentation.shouldBeNull() - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props.getAll(PropertyType.FIELD_NAME)[0].value.shouldBeNull() props.getAll(PropertyType.FIELD_EXPRESSION)[0].value.shouldBeNull() @@ -36,6 +36,6 @@ internal class ActivityServiceTaskEmptyUpdateWithNestedExtensionTest { } private fun readServiceTask(processObject: BpmnFileObject): BpmnServiceTask { - return processObject.process.body!!.serviceTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.serviceTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskTest.kt index 2aaa21894..7518e6e3b 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskTest.kt @@ -40,7 +40,7 @@ internal class ActivityServiceTaskTest { task.useLocalScopeForResultVariable.shouldBeNull() // TODO handle deep extension elements - field - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -95,6 +95,6 @@ internal class ActivityServiceTaskTest { } private fun readServiceTask(processObject: BpmnFileObject): BpmnServiceTask { - return processObject.process.body!!.serviceTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.serviceTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithExtensionElementsTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithExtensionElementsTest.kt index 80083b5b9..d017ede3e 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithExtensionElementsTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithExtensionElementsTest.kt @@ -23,12 +23,12 @@ internal class ActivityServiceTaskWithExtensionElementsTest { @Test fun `Service task with failedJobRetryTimeCycle is parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val task = processObject.process.body!!.serviceTask!![0] + val task = processObject.processes[0].body!!.serviceTask!![0] task.id.shouldBeEqualTo(elementId) task.failedJobRetryTimeCycle.shouldBeEqualTo("R10/PT5M") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.FAILED_JOB_RETRY_CYCLE]!!.value.shouldBeEqualTo(task.failedJobRetryTimeCycle) } @@ -42,6 +42,6 @@ internal class ActivityServiceTaskWithExtensionElementsTest { } private fun readServiceTask(processObject: BpmnFileObject): BpmnServiceTask { - return processObject.process.body!!.serviceTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.serviceTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithNestedExtensionTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithNestedExtensionTest.kt index 7c6a9c79e..d07ec57ee 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithNestedExtensionTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityServiceTaskWithNestedExtensionTest.kt @@ -28,7 +28,7 @@ internal class ActivityServiceTaskWithNestedExtensionTest { task.documentation.shouldBeNull() task.failedJobRetryTimeCycle?.shouldBeEqualTo("R10/PT5M") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -66,8 +66,8 @@ internal class ActivityServiceTaskWithNestedExtensionTest { @Test fun `Add nested extension element`() { val process = readAndUpdateProcess(parser, FILE, StringValueUpdatedEvent(emptyElementId, PropertyType.FIELD_NAME, "new name", propertyIndex = listOf(""))) - val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnFileObject(process.process, process.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val emptyTask = process.processes[0].body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() + val props = BpmnFileObject(process.processes, process.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]!!.shouldBeEqualTo(Property("new name", listOf("new name"))) } @@ -81,8 +81,8 @@ internal class ActivityServiceTaskWithNestedExtensionTest { StringValueUpdatedEvent(emptyElementId, PropertyType.FIELD_NAME, "", propertyIndex = listOf("new name")) ) ) - val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnFileObject(process.process, process.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val emptyTask = process.processes[0].body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() + val props = BpmnFileObject(process.processes, process.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]?.value.shouldBeNull() } @@ -97,8 +97,8 @@ internal class ActivityServiceTaskWithNestedExtensionTest { StringValueUpdatedEvent(emptyElementId, PropertyType.FIELD_NAME, "other new name", propertyIndex = listOf("")), ) ) - val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnFileObject(process.process, process.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val emptyTask = process.processes[0].body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() + val props = BpmnFileObject(process.processes, process.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]!!.shouldBeEqualTo(Property("other new name", listOf("other new name"))) } @@ -112,8 +112,8 @@ internal class ActivityServiceTaskWithNestedExtensionTest { StringValueUpdatedEvent(emptyElementId, PropertyType.FIELD_NAME, "new name", propertyIndex = listOf("")), ) ) - val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnFileObject(process.process, process.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val emptyTask = process.processes[0].body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() + val props = BpmnFileObject(process.processes, process.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]!!.shouldBeEqualTo(Property("new name", listOf("new name"))) props[PropertyType.FIELD_EXPRESSION]!!.shouldBeEqualTo(Property("expression 1", listOf("new name"))) } @@ -130,6 +130,6 @@ internal class ActivityServiceTaskWithNestedExtensionTest { } private fun readServiceTaskWithExtensions(processObject: BpmnFileObject): BpmnServiceTask { - return processObject.process.body!!.serviceTask!!.shouldHaveSize(3)[0] + return processObject.processes[0].body!!.serviceTask!!.shouldHaveSize(3)[0] } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskTest.kt index 7cb8f8bf0..1310104e3 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskTest.kt @@ -41,7 +41,7 @@ internal class ActivityUserTaskTest { task.priority.shouldBeEqualTo("1") task.skipExpression.shouldBeNull() // Unsupported by Activity - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -103,6 +103,6 @@ internal class ActivityUserTaskTest { } private fun readUserTask(processObject: BpmnFileObject): BpmnUserTask { - return processObject.process.body!!.userTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.userTask!!.shouldHaveSingleItem() } } diff --git a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskWithNestedExtensionTest.kt b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskWithNestedExtensionTest.kt index 10cbb7c82..4ee466791 100644 --- a/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskWithNestedExtensionTest.kt +++ b/activiti-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/activiti/parser/customservicetasks/ActivityUserTaskWithNestedExtensionTest.kt @@ -26,7 +26,7 @@ internal class ActivityUserTaskWithNestedExtensionTest { task.name.shouldBeEqualTo("A user task") task.documentation.shouldBeEqualTo("A user task to do") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -92,7 +92,7 @@ internal class ActivityUserTaskWithNestedExtensionTest { val task = readEmptyUserTaskWithExtensions(processObject) task.id.shouldBeEqualTo(BpmnElementId("emptyUserTaskId")) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(ActivitiObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(ActivitiObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props.getAll(PropertyType.FORM_PROPERTY_ID).shouldHaveSize(1) } @@ -101,10 +101,10 @@ internal class ActivityUserTaskWithNestedExtensionTest { } private fun readUserTaskWithExtensions(processObject: BpmnFileObject): BpmnUserTask { - return processObject.process.body!!.userTask!!.shouldHaveSize(3)[0] + return processObject.processes[0].body!!.userTask!!.shouldHaveSize(3)[0] } private fun readEmptyUserTaskWithExtensions(processObject: BpmnFileObject): BpmnUserTask { - return processObject.process.body!!.userTask!!.shouldHaveSize(3)[2] + return processObject.processes[0].body!!.userTask!!.shouldHaveSize(3)[2] } } diff --git a/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt b/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt index 3792220ec..091526c7c 100644 --- a/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt +++ b/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt @@ -6,8 +6,8 @@ import com.intellij.openapi.vfs.VirtualFile import com.intellij.util.messages.MessageBus import com.intellij.util.messages.MessageBusConnection import com.nhaarman.mockitokotlin2.* +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnParser -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.PropertyTable import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnProcess @@ -124,17 +124,22 @@ abstract class BaseUiTest { protected val uiEventBus = setUiEventBus(project, UiEventBus()) protected var renderResult: RenderResult? = null - protected val basicProcess = BpmnProcessObject( + protected val basicProcess = BpmnFileObject( + listOf( BpmnProcess( - parentProcessBpmnId, - "mainProcess", - null, - null, - null, - null - ), - mutableListOf() + parentProcessBpmnId, + "mainProcess", + null, + null, + null, + null, + null + ) + ), + mutableListOf(), + mutableListOf() ) + protected val mainProcessOfBasicProcess = basicProcess.processes[0] protected val basicProcessBody = BpmnProcessBody(null, null, null, null, null, null, null, null, null, null, @@ -262,7 +267,7 @@ abstract class BaseUiTest { bounds = BoundsElement(intermediateX, intermediateY, serviceTaskSize, serviceTaskSize) ) updateEventsRegistry(project).addObjectEvent( - BpmnShapeObjectAddedEvent(WithParentId(basicProcess.process.id, task), shape, PropertyTable(mutableMapOf(PropertyType.ID to mutableListOf(Property(task.id))))) + BpmnShapeObjectAddedEvent(WithParentId(mainProcessOfBasicProcess.id, task), shape, PropertyTable(mutableMapOf(PropertyType.ID to mutableListOf(Property(task.id))))) ) return task.id @@ -353,12 +358,12 @@ abstract class BaseUiTest { protected fun prepareOneSubProcessView() { val process = basicProcess.copy( - basicProcess.process.copy( - body = basicProcessBody.copy(subProcess = listOf(bpmnSubProcess)) + listOf( + mainProcessOfBasicProcess.copy(body = basicProcessBody.copy(subProcess = listOf(bpmnSubProcess))) ), - listOf(DiagramElement( + diagram = listOf(DiagramElement( diagramMainElementId, - PlaneElement(diagramMainPlaneElementId, basicProcess.process.id, listOf(diagramSubProcess), listOf())) + PlaneElement(diagramMainPlaneElementId, mainProcessOfBasicProcess.id, listOf(diagramSubProcess), listOf())) ) ) whenever(parser.parse("")).thenReturn(process) @@ -367,18 +372,19 @@ abstract class BaseUiTest { protected fun prepareOneSubProcessWithTwoServiceTasksView() { val process = basicProcess.copy( - basicProcess.process.copy( + listOf( + mainProcessOfBasicProcess.copy( body = basicProcessBody.copy(serviceTask = listOf(bpmnServiceTaskStart, bpmnServiceTaskEnd), subProcess = listOf(bpmnSubProcess)), children = mapOf( subprocessBpmnId to basicProcessBody.copy(serviceTask = listOf(bpmnServiceTaskStart, bpmnServiceTaskEnd)) - ) + )) ), - listOf( + diagram = listOf( DiagramElement( diagramMainElementId, PlaneElement( diagramMainPlaneElementId, - basicProcess.process.id, + mainProcessOfBasicProcess.id, listOf(diagramSubProcess, diagramServiceTaskStart, diagramServiceTaskEnd), listOf() ) @@ -391,18 +397,19 @@ abstract class BaseUiTest { protected fun prepareOneSubProcessWithTwoLinkedServiceTasksView() { val process = basicProcess.copy( - basicProcess.process.copy( + listOf( + mainProcessOfBasicProcess.copy( body = basicProcessBody.copy(subProcess = listOf(bpmnSubProcess)), children = mapOf( subprocessBpmnId to basicProcessBody.copy(serviceTask = listOf(bpmnServiceTaskStart, bpmnServiceTaskEnd)) - ) + )) ), - listOf( + diagram = listOf( DiagramElement( diagramMainElementId, PlaneElement( diagramMainPlaneElementId, - basicProcess.process.id, + mainProcessOfBasicProcess.id, listOf(diagramSubProcess, diagramServiceTaskStart, diagramServiceTaskEnd), listOf() ) @@ -417,19 +424,19 @@ abstract class BaseUiTest { protected fun prepareOneSubProcessThenNestedSubProcessWithOneServiceTaskView() { val process = basicProcess.copy( - basicProcess.process.copy( + listOf(mainProcessOfBasicProcess.copy( body = basicProcessBody.copy(serviceTask = listOf(bpmnServiceTaskStart, bpmnServiceTaskEnd), subProcess = listOf(bpmnSubProcess)), children = mapOf( subprocessBpmnId to basicProcessBody.copy(subProcess = listOf(bpmnNestedSubProcess)), subprocessInSubProcessBpmnId to basicProcessBody.copy(serviceTask = listOf(bpmnServiceTaskStart)) - ) + )) ), - listOf( + diagram = listOf( DiagramElement( diagramMainElementId, PlaneElement( diagramMainPlaneElementId, - basicProcess.process.id, + mainProcessOfBasicProcess.id, listOf(diagramSubProcess, diagramNestedSubProcess, diagramServiceTaskStart), listOf() ) @@ -449,19 +456,20 @@ abstract class BaseUiTest { ) val process = basicProcess.copy( - basicProcess.process.copy( + listOf( + mainProcessOfBasicProcess.copy( body = basicProcessBody.copy(serviceTask = listOf(bpmnServiceTaskStart, bpmnServiceTaskEnd), subProcess = listOf(bpmnSubProcess), boundaryErrorEvent = listOf(boundaryEventOnRoot)), children = mapOf( subprocessBpmnId to basicProcessBody.copy(subProcess = listOf(bpmnNestedSubProcess)), subprocessInSubProcessBpmnId to basicProcessBody.copy(serviceTask = listOf(bpmnServiceTaskStart)) - ) + )) ), - listOf( + diagram = listOf( DiagramElement( diagramMainElementId, PlaneElement( diagramMainPlaneElementId, - basicProcess.process.id, + mainProcessOfBasicProcess.id, listOf(diagramSubProcess, diagramNestedSubProcess, diagramServiceTaskStart, boundaryEventOnRootShape), listOf() ) @@ -474,19 +482,19 @@ abstract class BaseUiTest { protected fun prepareOneSubProcessThenNestedSubProcessWithReversedChildParentOrder() { val process = basicProcess.copy( - basicProcess.process.copy( + listOf(mainProcessOfBasicProcess.copy( body = basicProcessBody.copy(subProcess = listOf(bpmnSubProcess)), children = mapOf( subprocessBpmnId to basicProcessBody.copy(subProcess = listOf(bpmnNestedSubProcess)), subprocessInSubProcessBpmnId to basicProcessBody.copy() - ) + )) ), - listOf( + diagram = listOf( DiagramElement( diagramMainElementId, PlaneElement( diagramMainPlaneElementId, - basicProcess.process.id, + mainProcessOfBasicProcess.id, listOf(diagramNestedSubProcess, diagramSubProcess), listOf() ) @@ -504,12 +512,12 @@ abstract class BaseUiTest { protected fun prepareTwoServiceTaskView(one: BpmnServiceTask, two: BpmnServiceTask) { val process = basicProcess.copy( - basicProcess.process.copy( + listOf(mainProcessOfBasicProcess.copy( body = basicProcessBody.copy(serviceTask = listOf(one, two)) - ), - listOf(DiagramElement( + )), + diagram = listOf(DiagramElement( diagramMainElementId, - PlaneElement(diagramMainPlaneElementId, basicProcess.process.id, listOf(diagramServiceTaskStart, diagramServiceTaskEnd), listOf())) + PlaneElement(diagramMainPlaneElementId, mainProcessOfBasicProcess.id, listOf(diagramServiceTaskStart, diagramServiceTaskEnd), listOf())) ) ) whenever(parser.parse("")).thenReturn(process) @@ -525,12 +533,12 @@ abstract class BaseUiTest { ) val process = basicProcess.copy( - basicProcess.process.copy( + listOf(mainProcessOfBasicProcess.copy( body = basicProcessBody.copy(serviceTask = listOf(bpmnServiceTaskStart), boundaryErrorEvent = listOf(boundaryEventOnServiceTask)) - ), - listOf(DiagramElement( + )), + diagram = listOf(DiagramElement( diagramMainElementId, - PlaneElement(diagramMainPlaneElementId, basicProcess.process.id, listOf(diagramServiceTaskStart, boundaryEventOnServiceTaskShape), listOf())) + PlaneElement(diagramMainPlaneElementId, mainProcessOfBasicProcess.id, listOf(diagramServiceTaskStart, boundaryEventOnServiceTaskShape), listOf())) ) ) whenever(parser.parse("")).thenReturn(process) @@ -546,12 +554,12 @@ abstract class BaseUiTest { ) val process = basicProcess.copy( - basicProcess.process.copy( + listOf(mainProcessOfBasicProcess.copy( body = basicProcessBody.copy(serviceTask = listOf(bpmnServiceTaskStart), boundaryErrorEvent = listOf(boundaryEventOnRoot)) - ), - listOf(DiagramElement( + )), + diagram = listOf(DiagramElement( diagramMainElementId, - PlaneElement(diagramMainPlaneElementId, basicProcess.process.id, listOf(diagramServiceTaskStart, boundaryEventOnRootShape), listOf())) + PlaneElement(diagramMainPlaneElementId, mainProcessOfBasicProcess.id, listOf(diagramServiceTaskStart, boundaryEventOnRootShape), listOf())) ) ) whenever(parser.parse("")).thenReturn(process) @@ -567,15 +575,15 @@ abstract class BaseUiTest { ) val process = basicProcess.copy( - basicProcess.process.copy( + listOf(mainProcessOfBasicProcess.copy( body = basicProcessBody.copy(subProcess = listOf(bpmnSubProcess), boundaryErrorEvent = listOf(boundaryEventOnRoot)), children = mapOf( subprocessBpmnId to basicProcessBody.copy(serviceTask = listOf(bpmnServiceTaskStart)) ) - ), - listOf(DiagramElement( + )), + diagram = listOf(DiagramElement( diagramMainElementId, - PlaneElement(diagramMainPlaneElementId, basicProcess.process.id, listOf(diagramSubProcess, diagramServiceTaskStart, boundaryEventOnRootShape), listOf())) + PlaneElement(diagramMainPlaneElementId, mainProcessOfBasicProcess.id, listOf(diagramSubProcess, diagramServiceTaskStart, boundaryEventOnRootShape), listOf())) ) ) whenever(parser.parse("")).thenReturn(process) @@ -591,15 +599,15 @@ abstract class BaseUiTest { ) val process = basicProcess.copy( - basicProcess.process.copy( + listOf(mainProcessOfBasicProcess.copy( body = basicProcessBody.copy(subProcess = listOf(bpmnSubProcess)), children = mapOf( subprocessBpmnId to basicProcessBody.copy(serviceTask = listOf(bpmnServiceTaskStart), boundaryErrorEvent = listOf(boundaryEventOnServiceTask)) ) - ), - listOf(DiagramElement( + )), + diagram = listOf(DiagramElement( diagramMainElementId, - PlaneElement(diagramMainPlaneElementId, basicProcess.process.id, listOf(diagramSubProcess, diagramServiceTaskStart, boundaryEventOnServiceTaskShape), listOf())) + PlaneElement(diagramMainPlaneElementId, mainProcessOfBasicProcess.id, listOf(diagramSubProcess, diagramServiceTaskStart, boundaryEventOnServiceTaskShape), listOf())) ) ) whenever(parser.parse("")).thenReturn(process) @@ -615,13 +623,13 @@ abstract class BaseUiTest { ) val process = basicProcess.copy( - basicProcess.process.copy( + listOf(mainProcessOfBasicProcess.copy( body = basicProcessBody.copy(serviceTask = listOf(bpmnServiceTaskStart), boundaryErrorEvent = listOf(boundaryEventOnServiceTask), subProcess = listOf(bpmnSubProcess)), children = mapOf(subprocessBpmnId to basicProcessBody) - ), - listOf(DiagramElement( + )), + diagram = listOf(DiagramElement( diagramMainElementId, - PlaneElement(diagramMainPlaneElementId, basicProcess.process.id, listOf(diagramSubProcess, diagramServiceTaskStart, boundaryEventOnServiceTaskShape), listOf())) + PlaneElement(diagramMainPlaneElementId, mainProcessOfBasicProcess.id, listOf(diagramSubProcess, diagramServiceTaskStart, boundaryEventOnServiceTaskShape), listOf())) ) ) whenever(parser.parse("")).thenReturn(process) @@ -637,7 +645,7 @@ abstract class BaseUiTest { ) val process = basicProcess.copy( - basicProcess.process.copy( + listOf(mainProcessOfBasicProcess.copy( body = basicProcessBody.copy(subProcess = listOf(bpmnSubProcess)), children = mapOf( subprocessBpmnId to basicProcessBody.copy( @@ -650,13 +658,13 @@ abstract class BaseUiTest { sequenceFlow = listOf(bpmnSequenceFlow) ) ) - ), - listOf( + )), + diagram = listOf( DiagramElement( diagramMainElementId, PlaneElement( diagramMainPlaneElementId, - basicProcess.process.id, + mainProcessOfBasicProcess.id, listOf(diagramNestedSubProcess, diagramSubProcess, diagramServiceTaskStart, diagramServiceTaskEnd, boundaryEventOnServiceTaskShape), listOf(diagramSequenceFlow) ) diff --git a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt index d0ed1a311..e6aab1164 100644 --- a/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt +++ b/camunda-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/CamundaParser.kt @@ -135,7 +135,6 @@ class CamundaParser : BaseBpmnParser() { } private fun toProcessObject(dto: BpmnFile): BpmnFileObject { - // TODO - Multi process support? markSubprocessesAndTransactionsThatHaveExternalDiagramAsCollapsed(dto.processes[0], dto.diagrams!!) val processes = dto.processes.map { it.toElement() } val collaborations = dto.collaborations?.map { it.toElement() } ?: emptyList() diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/CondExpressionWithoutTypeParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/CondExpressionWithoutTypeParseable.kt index 9b80d407c..0441c0335 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/CondExpressionWithoutTypeParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/CondExpressionWithoutTypeParseable.kt @@ -26,7 +26,7 @@ internal class CondExpressionWithoutTypeParseable { sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "\${evection.num<3} ")) - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("\${evection.num<3} ") diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/EmptyCondExpressionParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/EmptyCondExpressionParseable.kt index e064ce84c..9de1db293 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/EmptyCondExpressionParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/bugfix/EmptyCondExpressionParseable.kt @@ -26,7 +26,7 @@ internal class EmptyCondExpressionParseable { sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "")) - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("") diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/customservicetask/CamundaExternalTaskTest.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/customservicetask/CamundaExternalTaskTest.kt index b7b7b1f6e..1ae64bd37 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/customservicetask/CamundaExternalTaskTest.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/customservicetask/CamundaExternalTaskTest.kt @@ -1,6 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.camunda.parser.customservicetask -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnExternalTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -37,7 +37,7 @@ class CamundaExternalTaskTest { task.asyncAfter!!.shouldBeTrue() // TODO 'exclusive' ? // CamundaObjectFactory - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(CamundaObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -78,7 +78,7 @@ class CamundaExternalTaskTest { return readExternalTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readExternalTask(processObject: BpmnProcessObject): BpmnExternalTask { - return processObject.process.body!!.externalTask!!.shouldHaveSingleItem() + private fun readExternalTask(processObject: BpmnFileObject): BpmnExternalTask { + return processObject.processes[0].body!!.externalTask!!.shouldHaveSingleItem() } } diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ComplexGatewayWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ComplexGatewayWithExtensionIsParseable.kt index 7ae2066db..ff4b20fb0 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ComplexGatewayWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ComplexGatewayWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class ComplexGatewayWithExtensionIsParseable { task.name.shouldBeEqualTo("Single complex gateway") task.documentation.shouldBeEqualTo("Single complex gateway docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -53,7 +53,7 @@ internal class ComplexGatewayWithExtensionIsParseable { task.name.shouldBeEqualTo("Multi complex gateway") task.documentation.shouldBeEqualTo("Mutli complex gateway docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/IntermediateLinkCatchingEventWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/IntermediateLinkCatchingEventWithExtensionIsParseable.kt index 9878f651b..4cfbbc290 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/IntermediateLinkCatchingEventWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/IntermediateLinkCatchingEventWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class IntermediateLinkCatchingEventWithExtensionIsParseable { task.name.shouldBeEqualTo("Link intermediate cache event") task.documentation.shouldBeEqualTo("A link intermediate catch event") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -53,7 +53,7 @@ internal class IntermediateLinkCatchingEventWithExtensionIsParseable { task.name.shouldBeEqualTo("Link intermediate cache event") task.documentation.shouldBeEqualTo("A link intermediate catch event") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/SendTaskWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/SendTaskWithExtensionIsParseable.kt index e8f3a217f..e5ddc2800 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/SendTaskWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/SendTaskWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class SendTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Single send task") task.documentation.shouldBeEqualTo("Single send task docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -53,7 +53,7 @@ internal class SendTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Multi send task") task.documentation.shouldBeEqualTo("Multi send task docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ServiceTaskWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ServiceTaskWithExtensionIsParseable.kt index 3650118b1..141b6e185 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ServiceTaskWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/ServiceTaskWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class ServiceTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Service task with single extension") task.documentation.shouldBeEqualTo("Some docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -76,7 +76,7 @@ internal class ServiceTaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Service task with multiple extensions") task.documentation.shouldBeEqualTo("Some docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/StartEventWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/StartEventWithExtensionIsParseable.kt index 15cd5254b..649dcde46 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/StartEventWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/StartEventWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class StartEventWithExtensionIsParseable { task.name.shouldBeEqualTo("Start event (single)") task.documentation.shouldBeEqualTo("As full as possible start event\nmultiline") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -105,7 +105,7 @@ internal class StartEventWithExtensionIsParseable { task.name.shouldBeEqualTo("Start event(multi)") task.documentation.shouldBeEqualTo("As full as possible start event\nmultiline") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/TaskWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/TaskWithExtensionIsParseable.kt index 603b6e190..d302170b1 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/TaskWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/TaskWithExtensionIsParseable.kt @@ -30,7 +30,7 @@ internal class TaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Simple task") task.documentation.shouldBeEqualTo("Simple task docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -53,7 +53,7 @@ internal class TaskWithExtensionIsParseable { task.name.shouldBeEqualTo("Simple multi task") task.documentation.shouldBeEqualTo("Simple multi task docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/UserTaskWithExtensionIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/UserTaskWithExtensionIsParseable.kt index 077918183..761a8110c 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/UserTaskWithExtensionIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/fullelements/UserTaskWithExtensionIsParseable.kt @@ -33,7 +33,7 @@ internal class UserTaskWithExtensionIsParseable { task.candidateGroups.shouldBeEqualTo("candidates1") task.documentation.shouldBeEqualTo("Some docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.ASSIGNEE]!!.value.shouldBeEqualTo(task.assignee) @@ -117,7 +117,7 @@ internal class UserTaskWithExtensionIsParseable { task.candidateGroups.shouldBeEqualTo("candidates1") task.documentation.shouldBeEqualTo("Some docs") - val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.ASSIGNEE]!!.value.shouldBeEqualTo(task.assignee) diff --git a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/specialcase/SpecialCaseIncomingOutgoingIsParseable.kt b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/specialcase/SpecialCaseIncomingOutgoingIsParseable.kt index 37e482613..dc44f19d9 100644 --- a/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/specialcase/SpecialCaseIncomingOutgoingIsParseable.kt +++ b/camunda-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/camunda/parser/specialcase/SpecialCaseIncomingOutgoingIsParseable.kt @@ -31,9 +31,9 @@ internal class SpecialCaseIncomingOutgoingIsParseable { fun `Service task (single props) with incoming-outgoing is parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val startEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[singleStartEvent]!! - val serviceTaskProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[singleServiceTask]!! - val endEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[singleEndEvent]!! + val startEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[singleStartEvent]!! + val serviceTaskProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[singleServiceTask]!! + val endEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[singleEndEvent]!! startEventProps[PropertyType.BPMN_INCOMING]?.value?.shouldBeNull() startEventProps[PropertyType.BPMN_OUTGOING]?.shouldBeEqualTo(Property("flowFromStartEvent", listOf("flowFromStartEvent"))) @@ -61,9 +61,9 @@ internal class SpecialCaseIncomingOutgoingIsParseable { fun `Service task (multiple props) with incoming-outgoing is parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val startEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[multiStartEvent]!! - val serviceTaskProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[multiServiceTask]!! - val endEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory())[0].processElemPropertiesByElementId[multiEndEvent]!! + val startEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[multiStartEvent]!! + val serviceTaskProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[multiServiceTask]!! + val endEventProps = BpmnFileObject(processObject.processes, processObject.collaborations, processObject.diagram).toView(CamundaObjectFactory()).processes[0].processElemPropertiesByElementId[multiEndEvent]!! startEventProps[PropertyType.BPMN_INCOMING]?.value?.shouldBeNull() startEventProps.getAll(PropertyType.BPMN_OUTGOING).shouldBeEqualTo(listOf(Property("fromStart1", listOf("fromStart1")), Property("fromStart2", listOf("fromStart2")))) diff --git a/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/FlowableParser.kt b/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/FlowableParser.kt index 88c0aa59e..ac764c4ac 100644 --- a/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/FlowableParser.kt +++ b/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/FlowableParser.kt @@ -131,12 +131,12 @@ class FlowableParser : BaseBpmnParser() { } private fun toProcessObject(dto: BpmnFile): BpmnFileObject { - // TODO - Multi process support? markSubprocessesAndTransactionsThatHaveExternalDiagramAsCollapsed(dto.processes[0], dto.diagrams!!) - val process = dto.processes[0].toElement() + val processes = dto.processes.map { it.toElement() } + val collaborations = dto.collaborations?.map { it.toElement() } ?: emptyList() val diagrams = dto.diagrams!!.map { it.toElement() } - TODO() + return BpmnFileObject(processes, collaborations, diagrams) } override fun modelNs(): NS { diff --git a/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/nodes/FlowableXml.kt b/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/nodes/FlowableXml.kt index b95bc53d5..5f6b23de2 100644 --- a/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/nodes/FlowableXml.kt +++ b/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/nodes/FlowableXml.kt @@ -18,6 +18,7 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.BpmnEve import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.BpmnSubProcess import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.* import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElement +import com.valb3r.bpmn.intellij.plugin.flowable.parser.nodes.collaboration.Collaboration import com.valb3r.bpmn.intellij.plugin.flowable.parser.nodes.diagram.DiagramElementIdMapper import com.valb3r.bpmn.intellij.plugin.flowable.parser.nodes.diagram.Plane import com.valb3r.bpmn.intellij.plugin.flowable.parser.nodes.process.* @@ -39,20 +40,25 @@ const val EXTENSION_BOOLEAN_EXTRACTOR = ".map(it -> Boolean.valueOf(it.getString // https://github.com/FasterXML/jackson-dataformat-xml/issues/363 // unfortunately this has failed with Kotlin 'data' classes class BpmnFile( - @JacksonXmlProperty(localName = "message") - @JsonMerge - @JacksonXmlElementWrapper(useWrapping = false) - var messages: List? = null, - - @JacksonXmlProperty(localName = "process") - @JsonMerge - @JacksonXmlElementWrapper(useWrapping = false) - var processes: List, - - @JacksonXmlProperty(localName = "BPMNDiagram") - @JsonMerge - @JacksonXmlElementWrapper(useWrapping = false) - var diagrams: List? = null + @JacksonXmlProperty(localName = "message") + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var messages: List? = null, + + @JacksonXmlProperty(localName = "collaboration") + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var collaborations: List? = null, + + @JacksonXmlProperty(localName = "process") + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var processes: List, + + @JacksonXmlProperty(localName = "BPMNDiagram") + @JsonMerge + @JacksonXmlElementWrapper(useWrapping = false) + var diagrams: List? = null ) data class MessageNode(val id: String, var name: String?) diff --git a/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/nodes/collaboration/Collaboration.kt b/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/nodes/collaboration/Collaboration.kt new file mode 100644 index 000000000..37a70d606 --- /dev/null +++ b/flowable-xml-parser/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/nodes/collaboration/Collaboration.kt @@ -0,0 +1,43 @@ +package com.valb3r.bpmn.intellij.plugin.flowable.parser.nodes.collaboration + +import com.fasterxml.jackson.annotation.JsonMerge +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnCollaboration +import com.valb3r.bpmn.intellij.plugin.flowable.parser.nodes.BpmnMappable +import com.valb3r.bpmn.intellij.plugin.flowable.parser.nodes.process.BpmnElementIdMapper +import org.mapstruct.Mapper +import org.mapstruct.factory.Mappers + +data class Collaboration( + @JacksonXmlProperty(isAttribute = true) val id: String, + @JacksonXmlProperty(isAttribute = true) val name: String?, + @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) val participant: List?, + @JsonMerge @JacksonXmlElementWrapper(useWrapping = false) val messageFlow: List?, +) : BpmnMappable { + + override fun toElement(): BpmnCollaboration { + return Mappers.getMapper(Mapping::class.java).convertToDto(this) + } + + @Mapper(uses = [BpmnElementIdMapper::class]) + interface Mapping { + fun convertToDto(input: Collaboration): BpmnCollaboration + } +} + +data class Participant( + @JacksonXmlProperty(isAttribute = true) val id: String, + @JacksonXmlProperty(isAttribute = true) val name: String?, + @JacksonXmlProperty(isAttribute = true) val processRef: String?, + val documentation: String? +) + +data class MessageFlow( + @JacksonXmlProperty(isAttribute = true) val id: String, + @JacksonXmlProperty(isAttribute = true) val name: String?, + val documentation: String?, + @JacksonXmlProperty(isAttribute = true) val sourceRef: String?, + @JacksonXmlProperty(isAttribute = true) val targetRef: String?, +) + diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/CollapsedSubprocessTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/CollapsedSubprocessTest.kt index 0b18d3f10..3a7cf8b54 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/CollapsedSubprocessTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/CollapsedSubprocessTest.kt @@ -15,8 +15,8 @@ internal class CollapsedSubprocessTest { processObject = FlowableParser().parse("simple-collapsed-subprocess.bpmn20.xml".asResource()!!) processObject.shouldNotBeNull() - processObject.process.body!!.subProcess!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("subProcess") - processObject.process.body!!.collapsedSubProcess!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("collapsedSubProcess") + processObject.processes[0].body!!.subProcess!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("subProcess") + processObject.processes[0].body!!.collapsedSubProcess!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("collapsedSubProcess") } @Test @@ -26,7 +26,7 @@ internal class CollapsedSubprocessTest { processObject = FlowableParser().parse("transactional-collapsed-subprocess.bpmn20.xml".asResource()!!) processObject.shouldNotBeNull() - processObject.process.body!!.transaction!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("transactionalSubprocess") - processObject.process.body!!.collapsedTransaction!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("transactionalCollapsedSubprocess") + processObject.processes[0].body!!.transaction!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("transactionalSubprocess") + processObject.processes[0].body!!.collapsedTransaction!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("transactionalCollapsedSubprocess") } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/FlowableParserDumbTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/FlowableParserDumbTest.kt index 40fa39910..e0106c226 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/FlowableParserDumbTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/FlowableParserDumbTest.kt @@ -67,9 +67,9 @@ internal class FlowableParserDumbTest { processObject = FlowableParser().parse("nested-interlaced.bpmn20.xml".asResource()!!) processObject.shouldNotBeNull() - processObject.process.body!!.serviceTask!!.map { it.id.id }.shouldContainAll(arrayOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask")) - processObject.process.children!![BpmnElementId("sid-775FFB07-8CFB-4F82-A6EA-AB0E9BBB79A6")]!!.serviceTask!!.shouldHaveSize(2) - processObject.process.children!![BpmnElementId("sid-775FFB07-8CFB-4F82-A6EA-AB0E9BBB79A6")]!!.serviceTask!!.map { it.id.id }.shouldContain("nestedServiceTaskInterlaced") + processObject.processes[0].body!!.serviceTask!!.map { it.id.id }.shouldContainAll(arrayOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask")) + processObject.processes[0].children!![BpmnElementId("sid-775FFB07-8CFB-4F82-A6EA-AB0E9BBB79A6")]!!.serviceTask!!.shouldHaveSize(2) + processObject.processes[0].children!![BpmnElementId("sid-775FFB07-8CFB-4F82-A6EA-AB0E9BBB79A6")]!!.serviceTask!!.map { it.id.id }.shouldContain("nestedServiceTaskInterlaced") } @Test @@ -79,9 +79,9 @@ internal class FlowableParserDumbTest { processObject = FlowableParser().parse("nested-interlaced.bpmn20.xml".asResource()!!) processObject.shouldNotBeNull() - processObject.process.body!!.serviceTask!!.map { it.id.id }.shouldContainAll(arrayOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask")) - processObject.process.children!![BpmnElementId("sid-5EEB495F-ACAC-4C04-99E1-691D906B3A30")]!!.serviceTask!!.shouldHaveSize(2) - processObject.process.children!![BpmnElementId("sid-5EEB495F-ACAC-4C04-99E1-691D906B3A30")]!!.serviceTask!!.map { it.id.id }.shouldContain("nestedServiceTaskInterlacedOther") + processObject.processes[0].body!!.serviceTask!!.map { it.id.id }.shouldContainAll(arrayOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask")) + processObject.processes[0].children!![BpmnElementId("sid-5EEB495F-ACAC-4C04-99E1-691D906B3A30")]!!.serviceTask!!.shouldHaveSize(2) + processObject.processes[0].children!![BpmnElementId("sid-5EEB495F-ACAC-4C04-99E1-691D906B3A30")]!!.serviceTask!!.map { it.id.id }.shouldContain("nestedServiceTaskInterlacedOther") } @Test @@ -91,9 +91,9 @@ internal class FlowableParserDumbTest { processObject = FlowableParser().parse("nested-interlaced.bpmn20.xml".asResource()!!) processObject.shouldNotBeNull() - processObject.process.body!!.serviceTask!!.map { it.id.id }.shouldContainAll(arrayOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask")) - processObject.process.children!![BpmnElementId("sid-1BB4FA80-C87F-4A05-95DF-753D06EE7424")]!!.serviceTask!!.shouldHaveSize(2) - processObject.process.children!![BpmnElementId("sid-1BB4FA80-C87F-4A05-95DF-753D06EE7424")]!!.serviceTask!!.map { it.id.id }.shouldContain("nestedServiceTaskInterlacedYetOther") + processObject.processes[0].body!!.serviceTask!!.map { it.id.id }.shouldContainAll(arrayOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask")) + processObject.processes[0].children!![BpmnElementId("sid-1BB4FA80-C87F-4A05-95DF-753D06EE7424")]!!.serviceTask!!.shouldHaveSize(2) + processObject.processes[0].children!![BpmnElementId("sid-1BB4FA80-C87F-4A05-95DF-753D06EE7424")]!!.serviceTask!!.map { it.id.id }.shouldContain("nestedServiceTaskInterlacedYetOther") } @Test @@ -223,7 +223,7 @@ internal class FlowableParserDumbTest { updated.shouldNotBeNull() val updatedProcess = FlowableParser().parse(updated) - updatedProcess.process.children!![BpmnElementId("sid-3AD3FAD5-389C-4066-8CB0-C4090CA91F6D")]!!.sequenceFlow!!.map { it.id }.shouldContain(newId) + updatedProcess.processes[0].children!![BpmnElementId("sid-3AD3FAD5-389C-4066-8CB0-C4090CA91F6D")]!!.sequenceFlow!!.map { it.id }.shouldContain(newId) } @Test @@ -258,7 +258,7 @@ internal class FlowableParserDumbTest { updated.shouldNotBeNull() val processObject = FlowableParser().parse(updated) - processObject.process.body!!.transaction!!.map { it.id.id }.shouldContain("sid-C4389D7E-1083-47D2-BECC-99479E63D18B") + processObject.processes[0].body!!.transaction!!.map { it.id.id }.shouldContain("sid-C4389D7E-1083-47D2-BECC-99479E63D18B") } @Test @@ -280,7 +280,7 @@ internal class FlowableParserDumbTest { updated.shouldNotBeNull() val updatedProcess = FlowableParser().parse(updated) - val sequenceFlow = updatedProcess.process.body!!.sequenceFlow!!.filter { it.id.id == "onGatewayOk"}.shouldHaveSingleItem() + val sequenceFlow = updatedProcess.processes[0].body!!.sequenceFlow!!.filter { it.id.id == "onGatewayOk"}.shouldHaveSingleItem() sequenceFlow.conditionExpression!!.text.shouldBeNull() } @@ -293,7 +293,7 @@ internal class FlowableParserDumbTest { updated.shouldNotBeNull() val updatedProcess = FlowableParser().parse(updated) - val sequenceFlow = updatedProcess.process.body!!.sequenceFlow!!.filter { it.id.id == "onGatewayNokId"}.shouldHaveSingleItem() + val sequenceFlow = updatedProcess.processes[0].body!!.sequenceFlow!!.filter { it.id.id == "onGatewayNokId"}.shouldHaveSingleItem() sequenceFlow.conditionExpression!!.text.shouldBeNull() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/WindowsEncodingAndCrLfTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/WindowsEncodingAndCrLfTest.kt index 58365cdfa..8fdf4919e 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/WindowsEncodingAndCrLfTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/WindowsEncodingAndCrLfTest.kt @@ -19,7 +19,7 @@ class WindowsEncodingAndCrLfTest { val updateNameTo = "提交请假" val flowableParser = FlowableParser() val updated = flowableParser.update(initial, listOf(StringValueUpdatedEvent(BpmnElementId("empty-process-name"), PropertyType.NAME, updateNameTo))) - flowableParser.parse(updated).process.name.shouldBeEqualTo(updateNameTo) + flowableParser.parse(updated).processes[0].name.shouldBeEqualTo(updateNameTo) } private fun setKoi8DefaultEncoding() { diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlUpdateEventApplyTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlUpdateEventApplyTest.kt index 10ed57b31..8deb657c5 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlUpdateEventApplyTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlUpdateEventApplyTest.kt @@ -34,7 +34,7 @@ internal class XmlUpdateEventApplyTest { val newValue = "Start task name" val updatedProcess = readAndUpdateProcess(parser, StringValueUpdatedEvent(startEventId, PropertyType.NAME, newValue)) - updatedProcess.process.body!!.startEvent!!.filter { it.id == startEventId }.shouldHaveSingleItem().name.shouldBeEqualTo(newValue) + updatedProcess.processes[0].body!!.startEvent!!.filter { it.id == startEventId }.shouldHaveSingleItem().name.shouldBeEqualTo(newValue) } @Test @@ -42,7 +42,7 @@ internal class XmlUpdateEventApplyTest { val newValue = "Nested service task name" val updatedProcess = readAndUpdateProcess(parser, StringValueUpdatedEvent(nestedServiceTaskFirstId, PropertyType.NAME, newValue)) - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem().name.shouldBeEqualTo(newValue) + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem().name.shouldBeEqualTo(newValue) } @Test @@ -50,8 +50,8 @@ internal class XmlUpdateEventApplyTest { val newValue = "newAwesomeStartEventId" val updatedProcess = readAndUpdateProcess(parser, StringValueUpdatedEvent(startEventId, PropertyType.ID, newValue)) - updatedProcess.process.body!!.startEvent!!.filter { it.id == BpmnElementId(newValue) }.shouldHaveSingleItem() - updatedProcess.process.body!!.startEvent!!.filter { it.id == startEventId }.shouldBeEmpty() + updatedProcess.processes[0].body!!.startEvent!!.filter { it.id == BpmnElementId(newValue) }.shouldHaveSingleItem() + updatedProcess.processes[0].body!!.startEvent!!.filter { it.id == startEventId }.shouldBeEmpty() } @Test @@ -59,8 +59,8 @@ internal class XmlUpdateEventApplyTest { val newValue = "newAwesomeNestedServiceId" val updatedProcess = readAndUpdateProcess(parser, StringValueUpdatedEvent(nestedServiceTaskFirstId, PropertyType.ID, newValue)) - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == BpmnElementId(newValue) }.shouldHaveSingleItem() - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == BpmnElementId(newValue) }.shouldHaveSingleItem() + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() } @Test @@ -68,7 +68,7 @@ internal class XmlUpdateEventApplyTest { val newValue = "Some new docs" val updatedProcess = readAndUpdateProcess(parser, StringValueUpdatedEvent(startEventId, PropertyType.DOCUMENTATION, newValue)) - updatedProcess.process.body!!.startEvent!!.filter { it.id == startEventId }.shouldHaveSingleItem().documentation.shouldBeEqualTo(newValue) + updatedProcess.processes[0].body!!.startEvent!!.filter { it.id == startEventId }.shouldHaveSingleItem().documentation.shouldBeEqualTo(newValue) } @Test @@ -76,31 +76,31 @@ internal class XmlUpdateEventApplyTest { val newValue = "Some new docs" val updatedProcess = readAndUpdateProcess(parser, StringValueUpdatedEvent(nestedServiceTaskFirstId, PropertyType.DOCUMENTATION, newValue)) - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem().documentation.shouldBeEqualTo(newValue) + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem().documentation.shouldBeEqualTo(newValue) } @Test fun `Boolean value update event on flat element works (attribute)`() { val updatedProcess = readAndUpdateProcess(parser, BooleanValueUpdatedEvent(flatServiceTaskId, PropertyType.ASYNC, true)) - updatedProcess.process.body!!.serviceTask!!.filter { it.id == flatServiceTaskId }.shouldHaveSingleItem().async.shouldBeEqualTo(true) + updatedProcess.processes[0].body!!.serviceTask!!.filter { it.id == flatServiceTaskId }.shouldHaveSingleItem().async.shouldBeEqualTo(true) } @Test fun `Boolean value update event on nested element works (attribute)`() { val updatedProcess = readAndUpdateProcess(parser, BooleanValueUpdatedEvent(nestedServiceTaskFirstId, PropertyType.ASYNC, true)) - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem().async.shouldBeEqualTo(true) + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem().async.shouldBeEqualTo(true) } @Test fun `Element type pdate event on flat element works (attribute)`() { val updatedProcess = readAndUpdateProcess(parser, BooleanValueUpdatedEvent(subProcessId, PropertyType.IS_TRANSACTIONAL_SUBPROCESS, true)) - updatedProcess.process.body!!.transaction!!.filter { it.id == subProcessId }.shouldHaveSingleItem() - updatedProcess.process.body!!.subProcess.shouldBeNull() - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.shouldHaveSize(2) - updatedProcess.process.children!![subProcessId]!!.sequenceFlow!!.shouldHaveSize(1) + updatedProcess.processes[0].body!!.transaction!!.filter { it.id == subProcessId }.shouldHaveSingleItem() + updatedProcess.processes[0].body!!.subProcess.shouldBeNull() + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.shouldHaveSize(2) + updatedProcess.processes[0].children!![subProcessId]!!.sequenceFlow!!.shouldHaveSize(1) } @@ -177,14 +177,14 @@ internal class XmlUpdateEventApplyTest { fun `BPMN element removed event on flat element works`() { val updatedProcess = readAndUpdateProcess(parser, BpmnElementRemovedEvent(flatServiceTaskId)) - updatedProcess.process.body!!.serviceTask.shouldBeNull() + updatedProcess.processes[0].body!!.serviceTask.shouldBeNull() } @Test fun `BPMN element removed event on nested element works`() { val updatedProcess = readAndUpdateProcess(parser, BpmnElementRemovedEvent(nestedServiceTaskFirstId)) - updatedProcess.process.body!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() + updatedProcess.processes[0].body!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() } // BPMN Object added is tested in XmlUpdateEventBpmnObjectAdded @@ -208,7 +208,7 @@ internal class XmlUpdateEventApplyTest { PropertyTable(mutableMapOf(Pair(PropertyType.ID, mutableListOf(Property(id.id))), Pair(PropertyType.NAME, mutableListOf(Property(nameOnProp))))) )) - updatedProcess.process.body!!.sequenceFlow!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.sequenceFlow!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test @@ -230,7 +230,7 @@ internal class XmlUpdateEventApplyTest { PropertyTable(mutableMapOf(Pair(PropertyType.ID, mutableListOf(Property(id.id))), Pair(PropertyType.NAME, mutableListOf(Property(nameOnProp))))) )) - updatedProcess.process.children!![subProcessId]!!.sequenceFlow!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].children!![subProcessId]!!.sequenceFlow!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) val addedEdge = updatedProcess.diagram.filter { it.id == parentDiagramElementId }.shouldHaveSingleItem().bpmnPlane.bpmnEdge!!.filter { it.id == diagramId }.shouldHaveSingleItem() addedEdge.waypoint!![0].x.shouldBeNear(100.0f, EPSILON) addedEdge.waypoint!![0].y.shouldBeNear(100.0f, EPSILON) @@ -258,9 +258,9 @@ internal class XmlUpdateEventApplyTest { fun `BPMN parent changed event on flat element works`() { val updatedProcess = readAndUpdateProcess(parser, BpmnParentChangedEvent(flatServiceTaskId, subProcessId)) - updatedProcess.process.body!!.serviceTask.shouldBeNull() - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == flatServiceTaskId }.shouldHaveSingleItem() - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.map { it.id }.shouldContainSame( + updatedProcess.processes[0].body!!.serviceTask.shouldBeNull() + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == flatServiceTaskId }.shouldHaveSingleItem() + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.map { it.id }.shouldContainSame( listOf(flatServiceTaskId, nestedServiceTaskFirstId, nestedServiceTaskSecondId) ) } @@ -269,9 +269,9 @@ internal class XmlUpdateEventApplyTest { fun `BPMN parent changed event on nested element works`() { val updatedProcess = readAndUpdateProcess(parser, BpmnParentChangedEvent(nestedServiceTaskFirstId, processId)) - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() - updatedProcess.process.body!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem() - updatedProcess.process.body!!.serviceTask!!.map { it.id }.shouldContainSame( + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() + updatedProcess.processes[0].body!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem() + updatedProcess.processes[0].body!!.serviceTask!!.map { it.id }.shouldContainSame( listOf(flatServiceTaskId, nestedServiceTaskFirstId) ) } @@ -280,8 +280,8 @@ internal class XmlUpdateEventApplyTest { fun `BPMN parent changed event without propagation flag on nested element works`() { val updatedProcess = readAndUpdateProcess(parser, BpmnParentChangedEvent(nestedServiceTaskFirstId, processId, false)) - updatedProcess.process.children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem() - updatedProcess.process.body!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() - updatedProcess.process.body!!.serviceTask!!.filter { it.id == flatServiceTaskId }.shouldHaveSingleItem() + updatedProcess.processes[0].children!![subProcessId]!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldHaveSingleItem() + updatedProcess.processes[0].body!!.serviceTask!!.filter { it.id == nestedServiceTaskFirstId }.shouldBeEmpty() + updatedProcess.processes[0].body!!.serviceTask!!.filter { it.id == flatServiceTaskId }.shouldHaveSingleItem() } } \ No newline at end of file diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlUpdateEventBpmnObjectAddedTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlUpdateEventBpmnObjectAddedTest.kt index df4f43c0c..0d1029c07 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlUpdateEventBpmnObjectAddedTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlUpdateEventBpmnObjectAddedTest.kt @@ -53,322 +53,322 @@ internal class XmlUpdateEventBpmnObjectAddedTest { fun `Added start event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartEvent::class)) - updatedProcess.process.body!!.startEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.startEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added start timer event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartTimerEvent::class)) - updatedProcess.process.body!!.timerStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.timerStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added start signal event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartSignalEvent::class)) - updatedProcess.process.body!!.signalStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.signalStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added start message event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartMessageEvent::class)) - updatedProcess.process.body!!.messageStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.messageStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added start error event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartErrorEvent::class)) - updatedProcess.process.body!!.errorStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.errorStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added start conditional event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartConditionalEvent::class)) - updatedProcess.process.body!!.conditionalStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.conditionalStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added start escalation event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnStartEscalationEvent::class)) - updatedProcess.process.body!!.escalationStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.escalationStartEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added end event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEndEvent::class)) - updatedProcess.process.body!!.endEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.endEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added end termination event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEndTerminateEvent::class)) - updatedProcess.process.body!!.terminateEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.terminateEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added end escalation event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEndEscalationEvent::class)) - updatedProcess.process.body!!.escalationEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.escalationEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added end cancel event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEndCancelEvent::class)) - updatedProcess.process.body!!.cancelEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.cancelEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added end error event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEndErrorEvent::class)) - updatedProcess.process.body!!.errorEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.errorEndEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary cancel event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryCancelEvent::class)) - updatedProcess.process.body!!.boundaryCancelEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryCancelEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary compensation event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryCompensationEvent::class)) - updatedProcess.process.body!!.boundaryCompensationEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryCompensationEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary condtional event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryConditionalEvent::class)) - updatedProcess.process.body!!.boundaryConditionalEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryConditionalEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary error event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryErrorEvent::class)) - updatedProcess.process.body!!.boundaryErrorEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryErrorEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary escalation event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryEscalationEvent::class)) - updatedProcess.process.body!!.boundaryEscalationEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryEscalationEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary message event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryMessageEvent::class)) - updatedProcess.process.body!!.boundaryMessageEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryMessageEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary signal event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundarySignalEvent::class)) - updatedProcess.process.body!!.boundarySignalEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundarySignalEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added boundary timer event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBoundaryTimerEvent::class)) - updatedProcess.process.body!!.boundaryTimerEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.boundaryTimerEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate timer catching event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateTimerCatchingEvent::class)) - updatedProcess.process.body!!.intermediateTimerCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateTimerCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate message catching event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateMessageCatchingEvent::class)) - updatedProcess.process.body!!.intermediateMessageCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateMessageCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate signal catching event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateSignalCatchingEvent::class)) - updatedProcess.process.body!!.intermediateSignalCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateSignalCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate conditional catching event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateConditionalCatchingEvent::class)) - updatedProcess.process.body!!.intermediateConditionalCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateConditionalCatchingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate none throwing event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateNoneThrowingEvent::class)) - updatedProcess.process.body!!.intermediateNoneThrowingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateNoneThrowingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate signal throwing event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateSignalThrowingEvent::class)) - updatedProcess.process.body!!.intermediateSignalThrowingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateSignalThrowingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added intermediate escalation throwing event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnIntermediateEscalationThrowingEvent::class)) - updatedProcess.process.body!!.intermediateEscalationThrowingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.intermediateEscalationThrowingEvent!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added user task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnUserTask::class)) - updatedProcess.process.body!!.userTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.userTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added script task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnScriptTask::class)) - updatedProcess.process.body!!.scriptTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.scriptTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added service task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnServiceTask::class)) - updatedProcess.process.body!!.serviceTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.serviceTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added business rule task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnBusinessRuleTask::class)) - updatedProcess.process.body!!.businessRuleTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.businessRuleTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added receive task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnReceiveTask::class)) - updatedProcess.process.body!!.receiveTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.receiveTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added camel task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnCamelTask::class)) - updatedProcess.process.body!!.camelTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.camelTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added http task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnHttpTask::class)) - updatedProcess.process.body!!.httpTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.httpTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added mule task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnMuleTask::class)) - updatedProcess.process.body!!.muleTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.muleTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added decision task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnDecisionTask::class)) - updatedProcess.process.body!!.decisionTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.decisionTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added shell task event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnShellTask::class)) - updatedProcess.process.body!!.shellTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.shellTask!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added call activity event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnCallActivity::class)) - updatedProcess.process.body!!.callActivity!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.callActivity!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added sub process event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnSubProcess::class)) - updatedProcess.process.body!!.subProcess!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.subProcess!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added event sub process event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEventSubprocess::class)) - updatedProcess.process.body!!.eventSubProcess!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.eventSubProcess!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added adhoc sub process event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnAdHocSubProcess::class)) - updatedProcess.process.body!!.adHocSubProcess!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.adHocSubProcess!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added transactional sub process event works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnTransactionalSubProcess::class)) - updatedProcess.process.body!!.transaction!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.transaction!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added exclusive gateway works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnExclusiveGateway::class)) - updatedProcess.process.body!!.exclusiveGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.exclusiveGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added parallel gateway works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnParallelGateway::class)) - updatedProcess.process.body!!.parallelGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.parallelGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added inclusive gateway works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnInclusiveGateway::class)) - updatedProcess.process.body!!.inclusiveGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.inclusiveGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } @Test fun `Added event gateway works`() { val updatedProcess = readAndUpdateProcess(generateUpdateEvent(BpmnEventGateway::class)) - updatedProcess.process.body!!.eventBasedGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) + updatedProcess.processes[0].body!!.eventBasedGateway!!.filter { it.id == id }.shouldHaveSingleItem().name.shouldBeEqualTo(nameOnProp) } private fun generateUpdateEvent(clazz: KClass): EventPropagatableToXml { diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlUpdateEventDocumentationFormatTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlUpdateEventDocumentationFormatTest.kt index 1fd5ad0b9..74001b09f 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlUpdateEventDocumentationFormatTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlUpdateEventDocumentationFormatTest.kt @@ -68,8 +68,8 @@ class XmlUpdateEventDocumentationFormatTest { fun `Removing element does not break 'documentation' element formatting`() { val originalProcess = readProcess() val updatedProcess = readAndUpdateProcess(BpmnElementRemovedEvent(BpmnElementId(startEventId))) - updatedProcess.process.body!!.scriptTask!![0].documentation - .shouldBeEqualTo(originalProcess.process.body!!.scriptTask!![0].documentation) + updatedProcess.processes[0].body!!.scriptTask!![0].documentation!! + .shouldBeEqualTo(originalProcess.processes[0].body!!.scriptTask!![0].documentation) } private fun readProcess(): BpmnFileObject { diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlWithNestedStructureParserTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlWithNestedStructureParserTest.kt index bae7d9d25..757a0d1f4 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlWithNestedStructureParserTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/XmlWithNestedStructureParserTest.kt @@ -19,15 +19,15 @@ internal class XmlWithNestedStructureParserTest { // Assert the process structure processObject.shouldNotBeNull() - processObject.process.id.shouldBeEqualTo(BpmnElementId("nested-test")) - processObject.process.body.shouldNotBeNull() - processObject.process.body!!.startEvent!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("startGlobal") - processObject.process.body!!.endEvent!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("endGlobal") - processObject.process.body!!.serviceTask!!.map { it.id.id }.shouldContainSame( + processObject.processes[0].id.shouldBeEqualTo(BpmnElementId("nested-test")) + processObject.processes[0].body.shouldNotBeNull() + processObject.processes[0].body!!.startEvent!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("startGlobal") + processObject.processes[0].body!!.endEvent!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("endGlobal") + processObject.processes[0].body!!.serviceTask!!.map { it.id.id }.shouldContainSame( listOf("parentInterlaceBeginServiceTask", "parentInterlaceEndServiceTask") ) - processObject.process.body!!.exclusiveGateway!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("basicGateway") - processObject.process.body!!.sequenceFlow!!.map { it.id.id }.shouldContainSame( + processObject.processes[0].body!!.exclusiveGateway!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("basicGateway") + processObject.processes[0].body!!.sequenceFlow!!.map { it.id.id }.shouldContainSame( listOf( "sid-E256FA9F-E663-49B5-B15A-6C1BA641C61A", "sid-4F47ED8C-967A-4774-AC42-0DD33A0F5FA7", @@ -38,10 +38,10 @@ internal class XmlWithNestedStructureParserTest { ) ) - processObject.process.body!!.subProcess!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("sid-C4389D7E-1083-47D2-BECC-99479E63D18B") - processObject.process.body!!.adHocSubProcess!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("sid-5EEB495F-ACAC-4C04-99E1-691D906B3A30") - processObject.process.body!!.transaction!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("sid-1BB4FA80-C87F-4A05-95DF-753D06EE7424") - processObject.process.children!!.keys.map { it.id }.shouldContainSame( + processObject.processes[0].body!!.subProcess!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("sid-C4389D7E-1083-47D2-BECC-99479E63D18B") + processObject.processes[0].body!!.adHocSubProcess!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("sid-5EEB495F-ACAC-4C04-99E1-691D906B3A30") + processObject.processes[0].body!!.transaction!!.shouldHaveSingleItem().id.id.shouldBeEqualTo("sid-1BB4FA80-C87F-4A05-95DF-753D06EE7424") + processObject.processes[0].children!!.keys.map { it.id }.shouldContainSame( listOf( "sid-C4389D7E-1083-47D2-BECC-99479E63D18B", "sid-5EEB495F-ACAC-4C04-99E1-691D906B3A30", @@ -51,13 +51,13 @@ internal class XmlWithNestedStructureParserTest { ) ) - validateDirectChildSubProcess(processObject.process.children!![BpmnElementId("sid-C4389D7E-1083-47D2-BECC-99479E63D18B")]!!) - validateInSubProcessNestedChildSubProcess(processObject.process.children!![BpmnElementId("sid-775FFB07-8CFB-4F82-A6EA-AB0E9BBB79A6")]!!) - validateDirectAdhocSubProcess(processObject.process.children!![BpmnElementId("sid-5EEB495F-ACAC-4C04-99E1-691D906B3A30")]!!) - validateInAdHocNestedChildSubProcess(processObject.process.children!![BpmnElementId("sid-3AD3FAD5-389C-4066-8CB0-C4090CA91F6D")]!!) - validateDirectTransactionSubProcess(processObject.process.children!![BpmnElementId("sid-1BB4FA80-C87F-4A05-95DF-753D06EE7424")]!!) + validateDirectChildSubProcess(processObject.processes[0].children!![BpmnElementId("sid-C4389D7E-1083-47D2-BECC-99479E63D18B")]!!) + validateInSubProcessNestedChildSubProcess(processObject.processes[0].children!![BpmnElementId("sid-775FFB07-8CFB-4F82-A6EA-AB0E9BBB79A6")]!!) + validateDirectAdhocSubProcess(processObject.processes[0].children!![BpmnElementId("sid-5EEB495F-ACAC-4C04-99E1-691D906B3A30")]!!) + validateInAdHocNestedChildSubProcess(processObject.processes[0].children!![BpmnElementId("sid-3AD3FAD5-389C-4066-8CB0-C4090CA91F6D")]!!) + validateDirectTransactionSubProcess(processObject.processes[0].children!![BpmnElementId("sid-1BB4FA80-C87F-4A05-95DF-753D06EE7424")]!!) - othersAreEmpty(processObject.process.body!!) + othersAreEmpty(processObject.processes[0].body!!) } private fun validateDirectChildSubProcess(subProcess: BpmnProcessBody) { diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/bugfix/CondExpressionWithoutTypeParseable.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/bugfix/CondExpressionWithoutTypeParseable.kt index 08a8a990e..94ecb0f9e 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/bugfix/CondExpressionWithoutTypeParseable.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/bugfix/CondExpressionWithoutTypeParseable.kt @@ -22,11 +22,11 @@ internal class CondExpressionWithoutTypeParseable { fun `Sequence flow with empty conditional flow element parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val sequenceFlow = processObject.process.body!!.sequenceFlow!![2] + val sequenceFlow = processObject.processes[0].body!!.sequenceFlow!![2] sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "\${evection.num<3} ")) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("\${evection.num<3} ") diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/bugfix/EmptyCondExpressionParseable.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/bugfix/EmptyCondExpressionParseable.kt index b513be06c..904bf0d8b 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/bugfix/EmptyCondExpressionParseable.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/bugfix/EmptyCondExpressionParseable.kt @@ -22,11 +22,11 @@ internal class EmptyCondExpressionParseable { fun `Sequence flow with empty conditional flow element parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val sequenceFlow = processObject.process.body!!.sequenceFlow!![0] + val sequenceFlow = processObject.processes[0].body!!.sequenceFlow!![0] sequenceFlow.id.shouldBeEqualTo(sequenceFlowElem) sequenceFlow.conditionExpression.shouldBeEqualTo(ConditionExpression(null, "")) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[sequenceFlow.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[sequenceFlow.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(sequenceFlowElem.id) props[PropertyType.CONDITION_EXPR_TYPE]!!.value.shouldBeNull() props[PropertyType.CONDITION_EXPR_VALUE]!!.value.shouldBeEqualTo("") diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customevents/FlowableStartEventWithNestedExtensionTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customevents/FlowableStartEventWithNestedExtensionTest.kt index b9518bb29..9fdc03d1f 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customevents/FlowableStartEventWithNestedExtensionTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customevents/FlowableStartEventWithNestedExtensionTest.kt @@ -30,7 +30,7 @@ internal class FlowableUsereventWithNestedExtensionTest { val event = readStartEventWithExtensions(processObject) event.id.shouldBeEqualTo(elementId) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[event.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[event.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(event.id.id) props.getAll(PropertyType.FORM_PROPERTY_ID).shouldContainSame(arrayOf( @@ -82,6 +82,6 @@ internal class FlowableUsereventWithNestedExtensionTest { } private fun readStartEventWithExtensions(processObject: BpmnFileObject): BpmnStartEvent { - return processObject.process.body!!.startEvent!!.shouldHaveSize(1)[0] + return processObject.processes[0].body!!.startEvent!!.shouldHaveSize(1)[0] } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableBusinessRuleTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableBusinessRuleTaskTest.kt index b30b77cf8..b8c33aa5e 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableBusinessRuleTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableBusinessRuleTaskTest.kt @@ -36,7 +36,7 @@ internal class FlowableBusinessRuleTaskTest { task.resultVariable.shouldBeEqualTo("RESULT_VAR") task.exclude!!.shouldBeTrue() - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -83,6 +83,6 @@ internal class FlowableBusinessRuleTaskTest { } private fun readBusinessRuleTask(processObject: BpmnFileObject): BpmnBusinessRuleTask { - return processObject.process.body!!.businessRuleTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.businessRuleTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableCamelTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableCamelTaskTest.kt index d26838bf6..e33b1ce20 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableCamelTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableCamelTaskTest.kt @@ -36,7 +36,7 @@ internal class FlowableCamelTaskTest { task.isForCompensation!!.shouldBeTrue() task.camelContext.shouldBeEqualTo("CAMEL_CTX") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -94,6 +94,6 @@ internal class FlowableCamelTaskTest { } private fun readCamelTask(processObject: BpmnFileObject): BpmnCamelTask { - return processObject.process.body!!.camelTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.camelTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableDecisionTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableDecisionTaskTest.kt index f6d676480..f3f581cf3 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableDecisionTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableDecisionTaskTest.kt @@ -38,7 +38,7 @@ internal class FlowableDecisionTaskTest { task.decisionTaskThrowErrorOnNoHits.shouldBeEqualTo(true) task.fallbackToDefaultTenantCdata.shouldBeEqualTo(true) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -81,6 +81,6 @@ internal class FlowableDecisionTaskTest { } private fun readDecisionTask(processObject: BpmnFileObject): BpmnDecisionTask { - return processObject.process.body!!.decisionTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.decisionTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableExternalTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableExternalTaskTest.kt index 2f211c452..6f80cf9d8 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableExternalTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableExternalTaskTest.kt @@ -1,9 +1,8 @@ package com.valb3r.bpmn.intellij.plugin.flowable.parser.customservicetasks -import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnProcessObject +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnFileObject import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnExternalTask -import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.tasks.BpmnHttpTask import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType import com.valb3r.bpmn.intellij.plugin.flowable.parser.FlowableObjectFactory import com.valb3r.bpmn.intellij.plugin.flowable.parser.FlowableParser @@ -36,7 +35,7 @@ class FlowableExternalTaskTest { // TODO 'exclusive' ? task.isForCompensation!!.shouldBeTrue() - val props = BpmnProcessObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -74,7 +73,7 @@ class FlowableExternalTaskTest { return readExternalTask(readAndUpdateProcess(parser, FILE, BooleanValueUpdatedEvent(elementId, property, newValue))) } - private fun readExternalTask(processObject: BpmnProcessObject): BpmnExternalTask { - return processObject.process.body!!.externalTask!!.shouldHaveSingleItem() + private fun readExternalTask(processObject: BpmnFileObject): BpmnExternalTask { + return processObject.processes[0].body!!.externalTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableHttpTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableHttpTaskTest.kt index c7c2cfe70..f835cdddb 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableHttpTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableHttpTaskTest.kt @@ -56,7 +56,7 @@ internal class FlowableHttpTaskTest { task.saveResponseParametersTransient.shouldBeEqualTo("TRANSIENT_RESPONSE") task.saveResponseVariableAsJson.shouldBeEqualTo("AS_JSON") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -141,6 +141,6 @@ internal class FlowableHttpTaskTest { } private fun readHttpTask(processObject: BpmnFileObject): BpmnHttpTask { - return processObject.process.body!!.httpTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.httpTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableMailTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableMailTaskTest.kt index 66adc6378..d5802491f 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableMailTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableMailTaskTest.kt @@ -44,7 +44,7 @@ internal class FlowableMailTaskTest { task.html.shouldBeEqualTo("Hello") task.charset.shouldBeEqualTo("UTF-8") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -107,6 +107,6 @@ internal class FlowableMailTaskTest { } private fun readMailTask(processObject: BpmnFileObject): BpmnMailTask { - return processObject.process.body!!.mailTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.mailTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableManualTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableManualTaskTest.kt index 6a628818a..f0517fb92 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableManualTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableManualTaskTest.kt @@ -35,7 +35,7 @@ internal class FlowableManualTaskTest { // TODO 'exclusive' ? task.isForCompensation!!.shouldBeTrue() - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -71,6 +71,6 @@ internal class FlowableManualTaskTest { } private fun readManualTask(processObject: BpmnFileObject): BpmnManualTask { - return processObject.process.body!!.manualTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.manualTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableMuleTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableMuleTaskTest.kt index 0db6a6e5b..9f5542a0e 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableMuleTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableMuleTaskTest.kt @@ -39,7 +39,7 @@ internal class FlowableMuleTaskTest { task.payloadExpression.shouldBeEqualTo("\${foo.bar}") task.resultVariableCdata.shouldBeEqualTo("RESULT") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -87,6 +87,6 @@ internal class FlowableMuleTaskTest { } private fun readMuleTask(processObject: BpmnFileObject): BpmnMuleTask { - return processObject.process.body!!.muleTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.muleTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableReceiveTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableReceiveTaskTest.kt index 277c000e7..8ca9e3744 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableReceiveTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableReceiveTaskTest.kt @@ -35,7 +35,7 @@ internal class FlowableReceiveTaskTest { // TODO 'exclusive' ? task.isForCompensation!!.shouldBeTrue() - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -71,6 +71,6 @@ internal class FlowableReceiveTaskTest { } private fun readReceiveTask(processObject: BpmnFileObject): BpmnReceiveTask { - return processObject.process.body!!.receiveTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.receiveTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableScriptTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableScriptTaskTest.kt index 7769e60b0..3db07d1a0 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableScriptTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableScriptTaskTest.kt @@ -38,7 +38,7 @@ internal class FlowableScriptTaskTest { task.autoStoreVariables.shouldBeEqualTo(true) task.scriptBody.shouldBeEqualTo("echo \"Foo Bar!\" > /tmp/foo.txt") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -82,6 +82,6 @@ internal class FlowableScriptTaskTest { } private fun readScriptTask(processObject: BpmnFileObject): BpmnScriptTask { - return processObject.process.body!!.scriptTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.scriptTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskTest.kt index 4086301c4..d01693fa1 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskTest.kt @@ -43,7 +43,7 @@ internal class FlowableServiceTaskTest { task.useLocalScopeForResultVariable!!.shouldBeTrue() // TODO handle deep extension elements - field - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -98,6 +98,6 @@ internal class FlowableServiceTaskTest { } private fun readServiceTask(processObject: BpmnFileObject): BpmnServiceTask { - return processObject.process.body!!.serviceTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.serviceTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithExtensionElementsTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithExtensionElementsTest.kt index da5f07e1b..ef8903fdb 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithExtensionElementsTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithExtensionElementsTest.kt @@ -23,12 +23,12 @@ internal class FlowableServiceTaskWithExtensionElementsTest { @Test fun `Service task with failedJobRetryTimeCycle is parseable`() { val processObject = parser.parse(FILE.asResource()!!) - val task = processObject.process.body!!.serviceTask!![0] + val task = processObject.processes[0].body!!.serviceTask!![0] task.id.shouldBeEqualTo(elementId) task.failedJobRetryTimeCycle.shouldBeEqualTo("R10/PT5M") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.FAILED_JOB_RETRY_CYCLE]!!.value.shouldBeEqualTo(task.failedJobRetryTimeCycle) } @@ -42,6 +42,6 @@ internal class FlowableServiceTaskWithExtensionElementsTest { } private fun readServiceTask(processObject: BpmnFileObject): BpmnServiceTask { - return processObject.process.body!!.serviceTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.serviceTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithNestedExtensionTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithNestedExtensionTest.kt index e0543cd72..c6f777aff 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithNestedExtensionTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableServiceTaskWithNestedExtensionTest.kt @@ -29,7 +29,7 @@ internal class FlowableServiceTaskWithNestedExtensionTest { task.documentation.shouldBeNull() task.failedJobRetryTimeCycle?.shouldBeEqualTo("R10/PT5M") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -67,8 +67,8 @@ internal class FlowableServiceTaskWithNestedExtensionTest { @Test fun `Add nested extension element`() { val process = readAndUpdateProcess(parser, FILE, StringValueUpdatedEvent(emptyElementId, PropertyType.FIELD_NAME, "new name", propertyIndex = listOf(""))) - val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnFileObject(process.process, process.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val emptyTask = process.processes[0].body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() + val props = BpmnFileObject(process.processes, process.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]!!.shouldBeEqualTo(Property("new name", listOf("new name"))) } @@ -82,8 +82,8 @@ internal class FlowableServiceTaskWithNestedExtensionTest { StringValueUpdatedEvent(emptyElementId, PropertyType.FIELD_NAME, "", propertyIndex = listOf("new name")) ) ) - val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnFileObject(process.process, process.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val emptyTask = process.processes[0].body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() + val props = BpmnFileObject(process.processes, process.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]?.value.shouldBeNull() } @@ -98,8 +98,8 @@ internal class FlowableServiceTaskWithNestedExtensionTest { StringValueUpdatedEvent(emptyElementId, PropertyType.FIELD_NAME, "other new name", propertyIndex = listOf("")), ) ) - val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnFileObject(process.process, process.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val emptyTask = process.processes[0].body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() + val props = BpmnFileObject(process.processes, process.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]!!.shouldBeEqualTo(Property("other new name", listOf("other new name"))) } @@ -113,8 +113,8 @@ internal class FlowableServiceTaskWithNestedExtensionTest { StringValueUpdatedEvent(emptyElementId, PropertyType.FIELD_NAME, "new name", propertyIndex = listOf("")), ) ) - val emptyTask = process.process.body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() - val props = BpmnFileObject(process.process, process.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[emptyTask.id]!! + val emptyTask = process.processes[0].body!!.serviceTask!!.firstOrNull {it.id == emptyElementId}.shouldNotBeNull() + val props = BpmnFileObject(process.processes, process.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[emptyTask.id]!! props[PropertyType.FIELD_NAME]!!.shouldBeEqualTo(Property("new name", listOf("new name"))) props[PropertyType.FIELD_EXPRESSION]!!.shouldBeEqualTo(Property("expression 1", listOf("new name"))) } @@ -131,6 +131,6 @@ internal class FlowableServiceTaskWithNestedExtensionTest { } private fun readServiceTaskWithExtensions(processObject: BpmnFileObject): BpmnServiceTask { - return processObject.process.body!!.serviceTask!!.shouldHaveSize(2)[0] + return processObject.processes[0].body!!.serviceTask!!.shouldHaveSize(2)[0] } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableShellTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableShellTaskTest.kt index 204326dce..6f0bd5c46 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableShellTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableShellTaskTest.kt @@ -46,7 +46,7 @@ internal class FlowableShellTaskTest { task.outputVariable.shouldBeEqualTo("OUTPUT_VAR") task.directory.shouldBeEqualTo("/tmp") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -115,6 +115,6 @@ internal class FlowableShellTaskTest { } private fun readShellTask(processObject: BpmnFileObject): BpmnShellTask { - return processObject.process.body!!.shellTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.shellTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskTest.kt index 1d9c540d7..726d57ddd 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskTest.kt @@ -44,7 +44,7 @@ internal class FlowableUserTaskTest { task.priority.shouldBeEqualTo("1") task.skipExpression.shouldBeEqualTo("#{do.skip}") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -106,6 +106,6 @@ internal class FlowableUserTaskTest { } private fun readUserTask(processObject: BpmnFileObject): BpmnUserTask { - return processObject.process.body!!.userTask!!.shouldHaveSingleItem() + return processObject.processes[0].body!!.userTask!!.shouldHaveSingleItem() } } diff --git a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskWithNestedExtensionTest.kt b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskWithNestedExtensionTest.kt index 833a42c1a..1078e5524 100644 --- a/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskWithNestedExtensionTest.kt +++ b/flowable-xml-parser/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/flowable/parser/customservicetasks/FlowableUserTaskWithNestedExtensionTest.kt @@ -32,7 +32,7 @@ internal class FlowableUserTaskWithNestedExtensionTest { task.name.shouldBeEqualTo("A user task") task.documentation.shouldBeEqualTo("A user task to do") - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props[PropertyType.ID]!!.value.shouldBeEqualTo(task.id.id) props[PropertyType.NAME]!!.value.shouldBeEqualTo(task.name) props[PropertyType.DOCUMENTATION]!!.value.shouldBeEqualTo(task.documentation) @@ -98,7 +98,7 @@ internal class FlowableUserTaskWithNestedExtensionTest { val task = readEmptyUserTaskWithExtensions(processObject) task.id.shouldBeEqualTo(BpmnElementId("emptyUserTaskId")) - val props = BpmnFileObject(processObject.process, processObject.diagram).toView(FlowableObjectFactory()).elemPropertiesByElementId[task.id]!! + val props = BpmnFileObject(processObject.processes, processObject.diagram).toView(FlowableObjectFactory()).processes[0].processElemPropertiesByElementId[task.id]!! props.getAll(PropertyType.FORM_PROPERTY_ID).shouldHaveSize(1) } @@ -107,10 +107,10 @@ internal class FlowableUserTaskWithNestedExtensionTest { } private fun readUserTaskWithExtensions(processObject: BpmnFileObject): BpmnUserTask { - return processObject.process.body!!.userTask!!.shouldHaveSize(3)[0] + return processObject.processes[0].body!!.userTask!!.shouldHaveSize(3)[0] } private fun readEmptyUserTaskWithExtensions(processObject: BpmnFileObject): BpmnUserTask { - return processObject.process.body!!.userTask!!.shouldHaveSize(3)[2] + return processObject.processes[0].body!!.userTask!!.shouldHaveSize(3)[2] } } diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index 9d06e8da0..927c361f0 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -16,6 +16,8 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType // TODO - move to some implementation module data class BpmnFileObject(val processes: List, val collaborations: List, val diagram: List) { + constructor(processes: List, diagram: List) : this(processes, listOf(), diagram) + fun toView(factory: BpmnObjectFactory) : BpmnFileView { val mappedCollaborations = mapCollaborations(factory) val rootProcessOrCollaborationId = mappedCollaborations.firstOrNull()?.collaborationId ?: BpmnElementId("") From 922638f760403177598c39185fe91ec054d3decd Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 26 Jun 2022 10:14:46 +0300 Subject: [PATCH 36/41] Fixed compilation issues --- .../plugin/BoundaryEventAttachTest.kt | 4 +-- .../intellij/plugin/UiEditorLightE2ETest.kt | 36 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/BoundaryEventAttachTest.kt b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/BoundaryEventAttachTest.kt index c10053597..ed89eb9b3 100644 --- a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/BoundaryEventAttachTest.kt +++ b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/BoundaryEventAttachTest.kt @@ -293,7 +293,7 @@ internal class BoundaryEventAttachTest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, *propUpdate)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(optionalBoundaryErrorEventBpmnId.id) sequence.targetRef.shouldBe("") @@ -323,7 +323,7 @@ internal class BoundaryEventAttachTest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, *propUpdate)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(optionalBoundaryErrorEventBpmnId.id) sequence.targetRef.shouldBe("") diff --git a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt index 5a0f5e288..39dbb56bb 100644 --- a/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt +++ b/bpmn-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/UiEditorLightE2ETest.kt @@ -103,10 +103,10 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, shapeBpmn, draggedTo, *propUpdate)) shapeBpmn.bpmnObject.element.shouldBeInstanceOf() - shapeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + shapeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -145,7 +145,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, draggedTo, *propUpdate)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -182,7 +182,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, draggedTo, *propUpdate)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -224,7 +224,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, draggedToMid, draggedToTarget, *propUpdate)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -234,7 +234,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { intermediateTargetChangeToParentPropUpd.bpmnElementId.shouldBe(edgeBpmn.bpmnObject.id) intermediateTargetChangeToParentPropUpd.property.shouldBe(PropertyType.TARGET_REF) - intermediateTargetChangeToParentPropUpd.newValue.shouldBe(basicProcess.process.id.id) + intermediateTargetChangeToParentPropUpd.newValue.shouldBe(basicProcess.processes[0].id.id) draggedToTarget.diagramElementId.shouldBeEqualTo(lastEndpointId) draggedToTarget.dx.shouldBeNear(endElemX - point.x - draggedToMid.dx, 0.1f) @@ -267,7 +267,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, *propUpdate, newWaypoint)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -322,7 +322,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, newMidWaypoint, newQuarterWaypoint, *propUpdate)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -393,7 +393,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, dragTask, dragEdge, *propUpdate)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -426,7 +426,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, *propUpdate)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -473,7 +473,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, *propUpdate, dragTask, dragEdge)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -484,7 +484,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { cascadeIdUpdate.first().bpmnElementId.id.shouldBeEqualTo(newId) cascadeIdUpdate.first().property.shouldBeEqualTo(PropertyType.SOURCE_REF) - cascadeIdUpdate.first().newValue.shouldBeEqualTo(basicProcess.process.id.id) + cascadeIdUpdate.first().newValue.shouldBeEqualTo(basicProcess.processes[0].id.id) cascadeIdUpdate.last().bpmnElementId.id.shouldBeEqualTo(newId) cascadeIdUpdate.last().property.shouldBeEqualTo(PropertyType.SOURCE_REF) @@ -523,7 +523,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, *propUpdate, dragTask, dragEdge)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -623,7 +623,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, dragStart, dragEdge, *propUpdate)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -709,7 +709,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, removeEdgeDiagram, removeEdgeBpmn, *propUpdate)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -752,7 +752,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, newWaypoint, removeWaypoint, *propUpdate)) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -803,7 +803,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn) + diagramRemoved + bpmnRemoved + propUpdate) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() - edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + edgeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) sequence.sourceRef.shouldBe(serviceTaskStartBpmnId.id) sequence.targetRef.shouldBe("") @@ -877,7 +877,7 @@ internal class UiEditorLightE2ETest: BaseUiTest() { lastValue.shouldContainSame(listOf(edgeBpmn, shapeBpmn, draggedTo, *propUpdate)) shapeBpmn.bpmnObject.element.shouldBeInstanceOf() - shapeBpmn.bpmnObject.parent.shouldBe(basicProcess.process.id) + shapeBpmn.bpmnObject.parent.shouldBe(basicProcess.processes[0].id) val sequence = edgeBpmn.bpmnObject.element.shouldBeInstanceOf() edgeBpmn.bpmnObject.parent.shouldBe(subprocessBpmnId) From bd4273ca57d00dd2011cdb2041b46e9f3a306706 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 26 Jun 2022 10:31:36 +0300 Subject: [PATCH 37/41] Improve cycle found message --- .../com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt index 61f53c577..cc6e77040 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/DevHelper.kt @@ -41,7 +41,7 @@ private fun dumpTree(elementsById: Map, elemsByParent.keys.forEach { possibleRoot -> elemsByParent.forEach { (k, v) -> if (v.contains(possibleRoot)) { - println("Possible root $possibleRoot is child of $k") + println("Possible root '$possibleRoot' is child of '$k'") } } } From 454eeb0081360df1ba23568fe1fffd0d3e35fdea Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 12 Mar 2023 13:50:45 +0200 Subject: [PATCH 38/41] Remove runIde section --- activiti-intellij-plugin/build.gradle | 5 ----- camunda-intellij-plugin/build.gradle | 5 ----- flowable-intellij-plugin/build.gradle | 5 ----- 3 files changed, 15 deletions(-) diff --git a/activiti-intellij-plugin/build.gradle b/activiti-intellij-plugin/build.gradle index 747ae152b..55cc4f5b8 100644 --- a/activiti-intellij-plugin/build.gradle +++ b/activiti-intellij-plugin/build.gradle @@ -46,11 +46,6 @@ runPluginVerifier { ideVersions = ["IU-2021.3"] } -runIde { - jbrVersion = jbrJdkVersion - jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition", "-Xmx2G") -} - verifyPlugin { ignoreWarnings = true } diff --git a/camunda-intellij-plugin/build.gradle b/camunda-intellij-plugin/build.gradle index 29d12fff7..de6652831 100644 --- a/camunda-intellij-plugin/build.gradle +++ b/camunda-intellij-plugin/build.gradle @@ -46,11 +46,6 @@ runPluginVerifier { ideVersions = ["IU-2021.3"] } -runIde { - jbrVersion = jbrJdkVersion - jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition", "-Xmx2G") -} - verifyPlugin { ignoreWarnings = true } diff --git a/flowable-intellij-plugin/build.gradle b/flowable-intellij-plugin/build.gradle index 77c941e7b..33bd5aece 100644 --- a/flowable-intellij-plugin/build.gradle +++ b/flowable-intellij-plugin/build.gradle @@ -46,11 +46,6 @@ runPluginVerifier { ideVersions = ["IU-2021.3"] } -runIde { - jbrVersion = jbrJdkVersion - jvmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition", "-Xmx2G") -} - verifyPlugin { ignoreWarnings = true } From f9afefc25baaf4369a6b6ab40bf9a3b37bfb0549 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 12 Mar 2023 20:53:48 +0200 Subject: [PATCH 39/41] Fixed compilation issues --- .../intellij/plugin/core/tests/BaseUiTest.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt b/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt index 616bd8db8..ab1fa31ef 100644 --- a/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt +++ b/bpmn-intellij-plugin-common-tests/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/tests/BaseUiTest.kt @@ -565,12 +565,12 @@ abstract class BaseUiTest { protected fun prepareSendEventTask(){ val process = basicProcess.copy( - basicProcess.process.copy( + listOf(basicProcess.processes[0].copy( body = basicProcessBody.copy(sendEventTask = listOf(bpmnSendEventTask)) - ), - listOf(DiagramElement( + )), + diagram = listOf(DiagramElement( diagramMainElementId, - PlaneElement(diagramMainPlaneElementId, basicProcess.process.id, listOf(diagramSendEventTask), listOf())) + PlaneElement(diagramMainPlaneElementId, basicProcess.processes[0].id, listOf(diagramSendEventTask), listOf())) ) ) whenever(parser.parse("")).thenReturn(process) @@ -599,12 +599,12 @@ abstract class BaseUiTest { protected fun prepareUserTask(task: BpmnUserTask) { val process = basicProcess.copy( - basicProcess.process.copy( + listOf(basicProcess.processes[0].copy( body = basicProcessBody.copy(userTask = listOf(task)) - ), - listOf(DiagramElement( + )), + diagram = listOf(DiagramElement( diagramMainElementId, - PlaneElement(diagramMainPlaneElementId, basicProcess.process.id, listOf(diagramUserTask), listOf())) + PlaneElement(diagramMainPlaneElementId, basicProcess.processes[0].id, listOf(diagramUserTask), listOf())) ) ) whenever(parser.parse("")).thenReturn(process) From 43f00798f93caacd6ad15dd2374cedb250cb5540 Mon Sep 17 00:00:00 2001 From: valb3r Date: Sun, 26 Mar 2023 11:37:39 +0300 Subject: [PATCH 40/41] Fixed problem when rendering non-collaboration files --- .../core/popupmenu/CommonCanvasPopupMenuProvider.kt | 11 +++++++++-- .../core/render/elements/BaseBpmnRenderElement.kt | 10 ++++++++++ .../bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt | 6 ++++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/popupmenu/CommonCanvasPopupMenuProvider.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/popupmenu/CommonCanvasPopupMenuProvider.kt index b2fd817f3..852c15065 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/popupmenu/CommonCanvasPopupMenuProvider.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/popupmenu/CommonCanvasPopupMenuProvider.kt @@ -9,6 +9,8 @@ import com.valb3r.bpmn.intellij.plugin.core.events.BpmnElementTypeChangeEvent import com.valb3r.bpmn.intellij.plugin.core.events.BpmnShapeObjectAddedEvent import com.valb3r.bpmn.intellij.plugin.core.events.updateEventsRegistry import com.valb3r.bpmn.intellij.plugin.core.newelements.newElementsFactory +import com.valb3r.bpmn.intellij.plugin.core.render.elements.BaseBpmnRenderElement +import com.valb3r.bpmn.intellij.plugin.core.render.lastRenderedState import com.valb3r.bpmn.intellij.plugin.core.render.snapToGridIfNecessary import com.valb3r.bpmn.intellij.plugin.core.state.currentStateProvider import java.awt.event.ActionEvent @@ -36,9 +38,14 @@ class ShapeCreator (private val project: Project, private val cl override fun actionPerformed(e: ActionEvent?) { val newObject = newElementsFactory(project).newBpmnObject(clazz) val shape = newShapeElement(project, sceneLocation, newObject) + val probablyParentElement = lastRenderedState(project)!!.elementsById[parent]!! + if (probablyParentElement !is BaseBpmnRenderElement) { + // TODO - error here? + return + } - updateEventsRegistry(project).addObjectEvent( - BpmnShapeObjectAddedEvent(WithParentId(parent, newObject), shape, newElementsFactory(project).propertiesOf(newObject)) + updateEventsRegistry(project).addEvents( + probablyParentElement.onElementCreatedOnTopThis(newObject, shape, newElementsFactory(project).propertiesOf(newObject)) ) } } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseBpmnRenderElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseBpmnRenderElement.kt index ce66129ac..bd06dc59b 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseBpmnRenderElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseBpmnRenderElement.kt @@ -1,8 +1,14 @@ package com.valb3r.bpmn.intellij.plugin.core.render.elements +import com.valb3r.bpmn.intellij.plugin.bpmn.api.PropertyTable import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithParentId import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.ShapeElement +import com.valb3r.bpmn.intellij.plugin.bpmn.api.events.Event import com.valb3r.bpmn.intellij.plugin.core.events.BpmnElementRemovedEvent +import com.valb3r.bpmn.intellij.plugin.core.events.BpmnShapeObjectAddedEvent abstract class BaseBpmnRenderElement( elementId: DiagramElementId, @@ -20,4 +26,8 @@ abstract class BaseBpmnRenderElement( override fun toString(): String { return bpmnElementId.id } + + open fun onElementCreatedOnTopThis(newElement: WithBpmnId, shape: ShapeElement, properties: PropertyTable): MutableList { + return mutableListOf(BpmnShapeObjectAddedEvent(WithParentId(this.bpmnElementId, newElement), shape, properties)) + } } \ No newline at end of file diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt index 33519ac97..6af5957c8 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnFileObject.kt @@ -20,7 +20,7 @@ data class BpmnFileObject(val processes: List, val collaborations: fun toView(factory: BpmnObjectFactory) : BpmnFileView { val mappedCollaborations = mapCollaborations(factory) - val rootProcessOrCollaborationId = mappedCollaborations.firstOrNull()?.collaborationId ?: BpmnElementId("") + val rootProcessOrCollaborationId = mappedCollaborations.firstOrNull()?.collaborationId ?: this.processes[0].id val collaborationProcessRoots = collaborations.flatMap { it.participant ?: emptyList() } .filter { null != it.processRef } .groupBy { it.processRef!! } @@ -214,7 +214,9 @@ data class BpmnFileObject(val processes: List, val collaborations: activity: WithBpmnId, elementById: MutableMap, propertiesByElemType: MutableMap) { - elementById[activity.id] = WithParentId(parentId, activity) + if (activity.id != parentId) { // Handle the case of plain processes (without collaboration) + elementById[activity.id] = WithParentId(parentId, activity) + } propertiesByElemType[activity.id] = factory.propertiesOf(activity) } From f62194714cdba90dd4136362b48d200e99633a4c Mon Sep 17 00:00:00 2001 From: valb3r Date: Mon, 27 Mar 2023 09:37:37 +0300 Subject: [PATCH 41/41] FBP-224. Initial work to handle flowNodeRef properly --- .../bpmn/intellij/plugin/core/events/Events.kt | 3 +++ .../core/events/ProcessModelUpdateEvents.kt | 1 + .../popupmenu/CommonCanvasPopupMenuProvider.kt | 7 ++++--- .../render/elements/BaseBpmnRenderElement.kt | 9 +++++++-- .../render/elements/shapes/ShapeGroupElement.kt | 16 ++++++++++++++++ .../intellij/plugin/core/state/CurrentState.kt | 1 + .../plugin/bpmn/api/BpmnObjectFactory.kt | 4 +++- .../plugin/bpmn/api/events/EventInterfaces.kt | 5 +++++ .../bpmn/parser/core/BaseBpmnObjectFactory.kt | 9 +++++++-- .../plugin/bpmn/parser/core/BaseBpmnParser.kt | 1 + 10 files changed, 48 insertions(+), 8 deletions(-) diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/events/Events.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/events/Events.kt index bccc43fa4..c19f20de8 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/events/Events.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/events/Events.kt @@ -4,6 +4,7 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.PropertyTable import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithParentId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnFlowNodeRef import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.ShapeElement import com.valb3r.bpmn.intellij.plugin.bpmn.api.events.* @@ -36,6 +37,8 @@ data class BpmnElementRemovedEvent(override val bpmnElementId: BpmnElementId): B data class BpmnShapeObjectAddedEvent(override val bpmnObject: WithParentId, override val shape: ShapeElement, override val props: PropertyTable): BpmnShapeObjectAdded +data class BpmnFlowNodeRefAddedEvent(override val bpmnObject: BpmnFlowNodeRef): BpmnFlowNodeRefAdded + data class BpmnEdgeObjectAddedEvent(override val bpmnObject: WithParentId, override val edge: EdgeWithIdentifiableWaypoints, override val props: PropertyTable): BpmnEdgeObjectAdded data class UiOnlyValueAddedEvent(val bpmnElementId: BpmnElementId, val property: PropertyType, val newValue: Any?, val propertyIndex: List? = null): EventUiOnly diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/events/ProcessModelUpdateEvents.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/events/ProcessModelUpdateEvents.kt index 8070f7208..e3fd3d455 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/events/ProcessModelUpdateEvents.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/events/ProcessModelUpdateEvents.kt @@ -170,6 +170,7 @@ class ProcessModelUpdateEvents(private val committer: FileCommitter, private val is BpmnEdgeObjectAddedEvent -> addObjectEdgeEvent(toStore as Order) is BpmnElementRemovedEvent -> removeBpmnElement(event.bpmnElementId , toStore as Order ) is BpmnElementTypeChangeEvent -> changeBpmnElement(event.elementId , toStore as Order, toStore as Order) + is BpmnFlowNodeRefAddedEvent -> { /* Nothing here - purely fictitious event handled by XML parser only */ } else -> throw IllegalArgumentException("Can't bulk add: " + event::class.qualifiedName) } } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/popupmenu/CommonCanvasPopupMenuProvider.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/popupmenu/CommonCanvasPopupMenuProvider.kt index 852c15065..2ffe50172 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/popupmenu/CommonCanvasPopupMenuProvider.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/popupmenu/CommonCanvasPopupMenuProvider.kt @@ -36,8 +36,6 @@ private fun newShapeElement(project: Project, sceneLocation: Poi class ShapeCreator (private val project: Project, private val clazz: KClass, private val sceneLocation: Point2D.Float, private val parent: BpmnElementId): ActionListener { override fun actionPerformed(e: ActionEvent?) { - val newObject = newElementsFactory(project).newBpmnObject(clazz) - val shape = newShapeElement(project, sceneLocation, newObject) val probablyParentElement = lastRenderedState(project)!!.elementsById[parent]!! if (probablyParentElement !is BaseBpmnRenderElement) { // TODO - error here? @@ -45,7 +43,10 @@ class ShapeCreator (private val project: Project, private val cl } updateEventsRegistry(project).addEvents( - probablyParentElement.onElementCreatedOnTopThis(newObject, shape, newElementsFactory(project).propertiesOf(newObject)) + probablyParentElement.onElementCreatedOnTopThis( + clazz, + newElementsFactory(project) + ) { newShapeElement(project, sceneLocation, it) } ) } } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseBpmnRenderElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseBpmnRenderElement.kt index bd06dc59b..9c9f5c95e 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseBpmnRenderElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/BaseBpmnRenderElement.kt @@ -1,5 +1,6 @@ package com.valb3r.bpmn.intellij.plugin.core.render.elements +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnObjectFactory import com.valb3r.bpmn.intellij.plugin.bpmn.api.PropertyTable import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId @@ -9,6 +10,7 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.ShapeElement import com.valb3r.bpmn.intellij.plugin.bpmn.api.events.Event import com.valb3r.bpmn.intellij.plugin.core.events.BpmnElementRemovedEvent import com.valb3r.bpmn.intellij.plugin.core.events.BpmnShapeObjectAddedEvent +import kotlin.reflect.KClass abstract class BaseBpmnRenderElement( elementId: DiagramElementId, @@ -27,7 +29,10 @@ abstract class BaseBpmnRenderElement( return bpmnElementId.id } - open fun onElementCreatedOnTopThis(newElement: WithBpmnId, shape: ShapeElement, properties: PropertyTable): MutableList { - return mutableListOf(BpmnShapeObjectAddedEvent(WithParentId(this.bpmnElementId, newElement), shape, properties)) + open fun onElementCreatedOnTopThis(clazz: KClass, factory: BpmnObjectFactory, newShape: (T) -> ShapeElement): MutableList { + val elem = factory.newBpmnObject(clazz) + val shape = newShape(elem) + val props = factory.propertiesOf(elem) + return mutableListOf(BpmnShapeObjectAddedEvent(WithParentId(this.bpmnElementId, elem), shape, props)) } } \ No newline at end of file diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupElement.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupElement.kt index 203609ea4..07a3c7b6b 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupElement.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/render/elements/shapes/ShapeGroupElement.kt @@ -1,15 +1,23 @@ package com.valb3r.bpmn.intellij.plugin.core.render.elements.shapes +import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnObjectFactory +import com.valb3r.bpmn.intellij.plugin.bpmn.api.PropertyTable import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithParentId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnFlowNodeRef import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.ShapeElement import com.valb3r.bpmn.intellij.plugin.bpmn.api.events.Event import com.valb3r.bpmn.intellij.plugin.core.Colors +import com.valb3r.bpmn.intellij.plugin.core.events.BpmnFlowNodeRefAddedEvent +import com.valb3r.bpmn.intellij.plugin.core.events.BpmnShapeObjectAddedEvent import com.valb3r.bpmn.intellij.plugin.core.render.AreaType import com.valb3r.bpmn.intellij.plugin.core.render.AreaWithZindex import com.valb3r.bpmn.intellij.plugin.core.render.RenderContext import com.valb3r.bpmn.intellij.plugin.core.render.elements.RenderState import java.awt.Stroke +import kotlin.reflect.KClass class ShapeGroupElement( elementId: DiagramElementId, @@ -45,6 +53,14 @@ class ShapeGroupElement( return super.onDragEnd(dx, dy, droppedOn, allDroppedOnAreas) } + override fun onElementCreatedOnTopThis(clazz: KClass, factory: BpmnObjectFactory, newShape: (T) -> ShapeElement + ): MutableList { + val newElems = super.onElementCreatedOnTopThis(clazz, factory, newShape) + val refNode = factory.newFlowRef().copy(ref = (newElems[0] as BpmnShapeObjectAddedEvent).bpmnObject.element.id.id) + newElems += BpmnFlowNodeRefAddedEvent(refNode) + return newElems + } + override fun zIndex(): Int { return (parents.firstOrNull()?.zIndex() ?: -1) + 1 } diff --git a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt index fafe91fae..ed335231f 100644 --- a/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt +++ b/bpmn-intellij-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/state/CurrentState.kt @@ -171,6 +171,7 @@ class CurrentStateProvider(private val project: Project) { is IndexUiOnlyValueUpdatedEvent -> updateIndexProperty(event, updatedElemPropertiesByStaticElementId) is UiOnlyValueAddedEvent -> addUiOnlyProperty(event, updatedElemPropertiesByStaticElementId) is UiOnlyValueRemovedEvent -> removeUiOnlyProperty(event, updatedElemPropertiesByStaticElementId) + is BpmnFlowNodeRefAddedEvent -> { /* Nothing here - purely fictitious event handled by XML parser only */ } else -> throw IllegalStateException("Can't handle event ${event.javaClass}") } } diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnObjectFactory.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnObjectFactory.kt index ede9f87bd..910b11d7d 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnObjectFactory.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/BpmnObjectFactory.kt @@ -2,6 +2,7 @@ package com.valb3r.bpmn.intellij.plugin.bpmn.api import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.BpmnSequenceFlow import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnFlowNodeRef import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.WithDiagramId import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.Property import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType @@ -10,8 +11,9 @@ import kotlin.reflect.KClass interface BpmnObjectFactory { fun newBpmnObject(clazz: KClass): T + fun newFlowRef(): BpmnFlowNodeRef fun newOutgoingSequence(sourceRef: T): BpmnSequenceFlow - fun propertiesOf(obj: T): PropertyTable + fun propertiesOf(obj: T): PropertyTable fun newDiagramObject(clazz: KClass, forBpmnObject: WithBpmnId): T fun propertyTypes(): List } \ No newline at end of file diff --git a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/events/EventInterfaces.kt b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/events/EventInterfaces.kt index 60f199e14..69a910f13 100644 --- a/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/events/EventInterfaces.kt +++ b/xml-parser-api/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/api/events/EventInterfaces.kt @@ -5,6 +5,7 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.PropertyTable import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.BpmnElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithBpmnId import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.WithParentId +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnFlowNodeRef import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.DiagramElementId import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.ShapeElement import com.valb3r.bpmn.intellij.plugin.bpmn.api.diagram.elements.Translatable @@ -60,6 +61,10 @@ interface BpmnShapeObjectAdded: EventPropagatableToXml { val props: PropertyTable } +interface BpmnFlowNodeRefAdded: EventPropagatableToXml { + val bpmnObject: BpmnFlowNodeRef +} + interface BpmnProcessObjectAdded: EventPropagatableToXml { val bpmnObject: WithParentId val props: PropertyTable diff --git a/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnObjectFactory.kt b/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnObjectFactory.kt index 8dbf28a89..44858c401 100644 --- a/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnObjectFactory.kt +++ b/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnObjectFactory.kt @@ -18,6 +18,7 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.Bp import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.BpmnIntermediateNoneThrowingEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.events.throwing.BpmnIntermediateSignalThrowingEvent import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.gateways.* +import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnFlowNodeRef import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLane import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.lanes.BpmnLaneSet import com.valb3r.bpmn.intellij.plugin.bpmn.api.bpmn.elements.subprocess.* @@ -127,7 +128,11 @@ abstract class BaseBpmnObjectFactory : BpmnObjectFactory { } } - override fun propertiesOf(obj: T): PropertyTable { + override fun newFlowRef(): BpmnFlowNodeRef { + return BpmnFlowNodeRef(""); + } + + override fun propertiesOf(obj: T): PropertyTable { val table = when (obj) { is BpmnStartEventAlike, is EndEventAlike, is BpmnBoundaryEventAlike, is BpmnTaskAlike, is BpmnGatewayAlike, is IntermediateCatchingEventAlike, is IntermediateThrowingEventAlike, is BpmnProcess, @@ -136,7 +141,7 @@ abstract class BaseBpmnObjectFactory : BpmnObjectFactory { is BpmnStructuralElementAlike -> fillForCallActivity(obj) is BpmnSequenceFlow -> fillForSequenceFlow(obj) - else -> throw IllegalArgumentException("Can't parse properties of: ${obj.javaClass}") + else -> throw IllegalArgumentException("Can't parse properties of: ${obj!!::class.java}") } return PropertyTable(table) diff --git a/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnParser.kt b/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnParser.kt index 9f8aa341b..192c37d86 100644 --- a/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnParser.kt +++ b/xml-parser-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/bpmn/parser/core/BaseBpmnParser.kt @@ -174,6 +174,7 @@ abstract class BaseBpmnParser: BpmnParser { is BpmnEdgeObjectAdded -> applyBpmnEdgeObjectAdded(doc, event) is PropertyUpdateWithId -> applyPropertyUpdateWithId(doc, event) is BpmnParentChanged -> applyParentChange(doc, event) + is BpmnFlowNodeRefAdded -> TODO() } } }