Search in sources :

Example 11 with IntermediateCompensationEvent

use of org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEvent in project kie-wb-common by kiegroup.

the class IntermediateCatchEventConverterTest method verifyCompensationEventConvert.

private void verifyCompensationEventConvert() {
    IntermediateCompensationEvent definition = mock(IntermediateCompensationEvent.class);
    CompensateEventDefinition eventDefinition = mock(CompensateEventDefinition.class);
    IntermediateCatchEvent intermediateCatchEvent = mockIntermediateCatchEvent(definition);
    eventDefinitions.clear();
    eventDefinitions.add(eventDefinition);
    tested.convert(intermediateCatchEvent);
    verify(tested).compensationEvent(intermediateCatchEvent);
}
Also used : IntermediateCatchEvent(org.eclipse.bpmn2.IntermediateCatchEvent) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) IntermediateCompensationEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEvent)

Example 12 with IntermediateCompensationEvent

use of org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEvent in project kie-wb-common by kiegroup.

the class IntermediateCatchEventConverter method compensationEvent.

protected Result<BpmnNode> compensationEvent(CatchEvent event) {
    String nodeId = event.getId();
    Node<View<IntermediateCompensationEvent>, Edge> node = factoryManager.newNode(nodeId, IntermediateCompensationEvent.class);
    IntermediateCompensationEvent definition = node.getContent().getDefinition();
    CatchEventPropertyReader p = propertyReaderFactory.of(event);
    node.getContent().setBounds(p.getBounds());
    definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    definition.setBackgroundSet(p.getBackgroundSet());
    definition.setFontSet(p.getFontSet());
    definition.setDimensionsSet(p.getCircleDimensionSet());
    definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
    definition.setDataIOSet(new DataIOSet(p.getAssignmentsInfo()));
    CancelActivity cancelActivity = new CancelActivity(false);
    SLADueDate slaDueDate = new SLADueDate(p.getSlaDueDate());
    BaseCancellingEventExecutionSet executionSet = new BaseCancellingEventExecutionSet(cancelActivity, slaDueDate);
    definition.setExecutionSet(executionSet);
    return Result.success(BpmnNode.of(node, p));
}
Also used : Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) BaseCancellingEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.BaseCancellingEventExecutionSet) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) IntermediateCompensationEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEvent) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) SLADueDate(org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate) AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) CatchEventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.CatchEventPropertyReader) Edge(org.kie.workbench.common.stunner.core.graph.Edge) CancelActivity(org.kie.workbench.common.stunner.bpmn.definition.property.event.CancelActivity)

Example 13 with IntermediateCompensationEvent

use of org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEvent in project kie-wb-common by kiegroup.

the class BPMNDirectDiagramMarshallerTest method testUnmarshallIntermediateCompensationEvents.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallIntermediateCompensationEvents() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_COMPENSATION_EVENTS);
    assertDiagram(diagram, 3);
    assertEquals("IntermediateCompensationEvents", diagram.getMetadata().getTitle());
    Node<? extends Definition, ?> catchingEventNode = diagram.getGraph().getNode("_8CE8AB54-7E8B-4032-B340-2DBEBAB5080F");
    assertNotNull(catchingEventNode);
    IntermediateCompensationEvent intermediateCompensationEvent = (IntermediateCompensationEvent) catchingEventNode.getContent().getDefinition();
    assertNotNull(intermediateCompensationEvent.getGeneral());
    assertEquals("IntermediateCompensationEventName", intermediateCompensationEvent.getGeneral().getName().getValue());
    assertEquals("IntermediateCompensationEventDocumentation", intermediateCompensationEvent.getGeneral().getDocumentation().getValue());
    assertEquals("IntermediateCompensationEventDocumentation", intermediateCompensationEvent.getGeneral().getDocumentation().getValue());
    assertEquals("12/25/1983", intermediateCompensationEvent.getExecutionSet().getSlaDueDate().getValue());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) IntermediateCompensationEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEvent) Test(org.junit.Test)

Example 14 with IntermediateCompensationEvent

use of org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEvent in project kie-wb-common by kiegroup.

the class BoundaryCatchingIntermediateCompensationEventTest method testUnmarshallTopLevelEventWithEdgesEmptyProperties.

@Test
@Override
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() {
    Diagram<Graph, Metadata> diagram = getDiagram();
    assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
    IntermediateCompensationEvent emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_EDGES_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, TWO_OUTGOING_EDGES);
    assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE);
    assertCompensationEventExecutionSet(emptyEvent.getExecutionSet(), NON_CANCELLING, EMPTY_VALUE);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) IntermediateCompensationEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEvent) Test(org.junit.Test)

Example 15 with IntermediateCompensationEvent

use of org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEvent in project kie-wb-common by kiegroup.

the class BoundaryCatchingIntermediateCompensationEventTest method testUnmarshallSubprocessLevelEventWithEdgesEmptyProperties.

@Test
@Override
public void testUnmarshallSubprocessLevelEventWithEdgesEmptyProperties() {
    Diagram<Graph, Metadata> diagram = getDiagram();
    assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
    IntermediateCompensationEvent emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_EDGES_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, TWO_OUTGOING_EDGES);
    assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE);
    assertCompensationEventExecutionSet(emptySubprocessEvent.getExecutionSet(), NON_CANCELLING, EMPTY_VALUE);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) IntermediateCompensationEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEvent) Test(org.junit.Test)

Aggregations

IntermediateCompensationEvent (org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEvent)18 Test (org.junit.Test)13 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)10 Graph (org.kie.workbench.common.stunner.core.graph.Graph)10 CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)3 IntermediateConditionalEvent (org.kie.workbench.common.stunner.bpmn.definition.IntermediateConditionalEvent)3 BaseCancellingEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.BaseCancellingEventExecutionSet)3 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)3 IntermediateCatchEvent (org.eclipse.bpmn2.IntermediateCatchEvent)2 EndNoneEvent (org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent)2 StartNoneEvent (org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent)2 Node (org.kie.workbench.common.stunner.core.graph.Node)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 Matcher (java.util.regex.Matcher)1