Search in sources :

Example 1 with ActivityRef

use of org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.ActivityRef in project kie-wb-common by kiegroup.

the class HashCodeAndEqualityTest method testIntermediateCompensationThrowingEventEqualsAndHashCode.

@Test
public void testIntermediateCompensationThrowingEventEqualsAndHashCode() {
    String ACTIVITY_REF = "ACTIVITY_REF";
    String ACTIVITY_REF_1 = "ACTIVITY_REF_1";
    TestCaseBuilder.newTestCase().addTrueCase(new IntermediateCompensationEventThrowing(), new IntermediateCompensationEventThrowing()).addTrueCase(new IntermediateCompensationEventThrowing(new BPMNGeneralSet(), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet()), new IntermediateCompensationEventThrowing(new BPMNGeneralSet(), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet())).addFalseCase(new IntermediateCompensationEventThrowing(), null).addTrueCase(new IntermediateCompensationEventThrowing(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet()), new IntermediateCompensationEventThrowing(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet())).addTrueCase(new IntermediateCompensationEventThrowing(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF))), new IntermediateCompensationEventThrowing(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF)))).addFalseCase(new IntermediateCompensationEventThrowing(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF))), new IntermediateCompensationEventThrowing(new BPMNGeneralSet("name1", "doc1"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF)))).addFalseCase(new IntermediateCompensationEventThrowing(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF))), new IntermediateCompensationEventThrowing(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF_1)))).addFalseCase(new IntermediateCompensationEventThrowing(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF))), new IntermediateCompensationEventThrowing(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet(null))).addFalseCase(new IntermediateCompensationEventThrowing(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF))), new IntermediateCompensationEventThrowing(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new DataIOSet(), new AdvancedData(), null)).test();
}
Also used : DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) FontSet(org.kie.workbench.common.stunner.bpmn.definition.property.font.FontSet) AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) BackgroundSet(org.kie.workbench.common.stunner.bpmn.definition.property.background.BackgroundSet) CircleDimensionSet(org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.CircleDimensionSet) ActivityRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.ActivityRef) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) CompensationEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.CompensationEventExecutionSet) Test(org.junit.Test)

Example 2 with ActivityRef

use of org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.ActivityRef in project kie-wb-common by kiegroup.

the class HashCodeAndEqualityTest method testEndCompensationEventEqualsAndHashCode.

@Test
public void testEndCompensationEventEqualsAndHashCode() {
    String ACTIVITY_REF = "ACTIVITY_REF";
    String ACTIVITY_REF_1 = "ACTIVITY_REF_1";
    TestCaseBuilder.newTestCase().addTrueCase(new EndCompensationEvent(), new EndCompensationEvent()).addTrueCase(new EndCompensationEvent(new BPMNGeneralSet(), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet()), new EndCompensationEvent(new BPMNGeneralSet(), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet())).addFalseCase(new EndCompensationEvent(), null).addTrueCase(new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet()), new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet())).addTrueCase(new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF))), new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF)))).addFalseCase(new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF))), new EndCompensationEvent(new BPMNGeneralSet("name1", "doc1"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF)))).addFalseCase(new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF))), new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF_1)))).addFalseCase(new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF))), new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF_1)))).addFalseCase(new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF))), new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet(null))).addFalseCase(new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), new CompensationEventExecutionSet(new ActivityRef(ACTIVITY_REF))), new EndCompensationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new AdvancedData(), null)).test();
}
Also used : FontSet(org.kie.workbench.common.stunner.bpmn.definition.property.font.FontSet) AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) BackgroundSet(org.kie.workbench.common.stunner.bpmn.definition.property.background.BackgroundSet) CircleDimensionSet(org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.CircleDimensionSet) ActivityRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.ActivityRef) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) CompensationEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.CompensationEventExecutionSet) Test(org.junit.Test)

Example 3 with ActivityRef

use of org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.ActivityRef in project kie-wb-common by kiegroup.

the class IntermediateThrowEventConverter method compensationEvent.

protected BpmnNode compensationEvent(IntermediateThrowEvent event, CompensateEventDefinition eventDefinition) {
    Node<View<IntermediateCompensationEventThrowing>, Edge> node = factoryManager.newNode(event.getId(), IntermediateCompensationEventThrowing.class);
    IntermediateCompensationEventThrowing definition = node.getContent().getDefinition();
    EventPropertyReader p = propertyReaderFactory.of(event);
    node.getContent().setBounds(p.getBounds());
    definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
    definition.setDimensionsSet(p.getCircleDimensionSet());
    definition.setFontSet(p.getFontSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    definition.setDataIOSet(new DataIOSet(p.getAssignmentsInfo()));
    definition.setExecutionSet(new CompensationEventExecutionSet(new ActivityRef(EventDefinitionReader.activityRefOf(eventDefinition))));
    return BpmnNode.of(node, p);
}
Also used : DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) IntermediateCompensationEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEventThrowing) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) ActivityRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.ActivityRef) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) CompensationEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.CompensationEventExecutionSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) EventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader) ThrowEventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)

Example 4 with ActivityRef

use of org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.ActivityRef in project kie-wb-common by kiegroup.

the class EndEventConverter method compensationEventDefinition.

private BpmnNode compensationEventDefinition(EndEvent event, CompensateEventDefinition eventDefinition) {
    Node<View<EndCompensationEvent>, Edge> node = factoryManager.newNode(event.getId(), EndCompensationEvent.class);
    EndCompensationEvent definition = node.getContent().getDefinition();
    EventPropertyReader p = propertyReaderFactory.of(event);
    definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
    definition.setExecutionSet(new CompensationEventExecutionSet(new ActivityRef(EventDefinitionReader.activityRefOf(eventDefinition))));
    node.getContent().setBounds(p.getBounds());
    definition.setDimensionsSet(p.getCircleDimensionSet());
    definition.setFontSet(p.getFontSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    return BpmnNode.of(node, p);
}
Also used : AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) ActivityRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.ActivityRef) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) CompensationEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.CompensationEventExecutionSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) EndCompensationEvent(org.kie.workbench.common.stunner.bpmn.definition.EndCompensationEvent) EventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader) ThrowEventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)

Example 5 with ActivityRef

use of org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.ActivityRef in project kie-wb-common by kiegroup.

the class ProcessCompensationRefProvider method getSelectorData.

@Override
@SuppressWarnings("unchecked")
public SelectorData getSelectorData(FormRenderingContext context) {
    final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram();
    final String rootUUID = diagram.getMetadata().getCanvasRootUUID();
    final Node<?, ? extends Edge> selectedNode = getSelectedNode(diagram, sessionManager.getCurrentSession());
    final Map<Object, String> values = new TreeMap<>(SafeComparator.TO_STRING_COMPARATOR);
    if (selectedNode != null) {
        Node<?, ? extends Edge> currentNode = selectedNode;
        final List<Node> compensableNodes = new ArrayList<>();
        Node<?, ? extends Edge> parentNode;
        int levels = 0;
        do {
            parentNode = GraphUtils.getParent(currentNode).asNode();
            compensableNodes.addAll(getCompensableNodes(parentNode));
            if (rootUUID.equals(parentNode.getUUID())) {
                levels = 2;
            } else if (isSubProcess(parentNode)) {
                currentNode = parentNode;
                levels++;
            } else if (isLane(parentNode)) {
                currentNode = parentNode;
            }
        } while (levels < 2);
        compensableNodes.stream().map(node -> buildPair(node.getUUID(), (BPMNDefinition) (((View) node.getContent()).getDefinition()))).forEach(pair -> values.put(pair.getK1(), pair.getK2()));
        ActivityRef currentActivityRef = null;
        if (isEndCompensationEvent(selectedNode)) {
            currentActivityRef = ((EndCompensationEvent) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef();
        } else if (isIntermediateCompensationEventThrowing(selectedNode)) {
            currentActivityRef = ((IntermediateCompensationEventThrowing) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef();
        }
        if (currentActivityRef != null && !isEmpty(currentActivityRef.getValue()) && !values.containsKey(currentActivityRef.getValue())) {
            Node configured = diagram.getGraph().getNode(currentActivityRef.getValue());
            if (configured != null) {
                Pair<Object, String> pair = buildPair(configured.getUUID(), (BPMNDefinition) ((View) configured.getContent()).getDefinition());
                values.put(pair.getK1(), pair.getK2());
            }
        }
    }
    return new SelectorData(values, null);
}
Also used : IntermediateCompensationEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEventThrowing) Edge(org.kie.workbench.common.stunner.core.graph.Edge) SelectorDataProvider(org.kie.workbench.common.forms.dynamic.model.config.SelectorDataProvider) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ArrayList(java.util.ArrayList) IntermediateCompensationEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEvent) GraphUtils(org.kie.workbench.common.stunner.core.graph.util.GraphUtils) Inject(javax.inject.Inject) Map(java.util.Map) Lane(org.kie.workbench.common.stunner.bpmn.definition.Lane) EndCompensationEvent(org.kie.workbench.common.stunner.bpmn.definition.EndCompensationEvent) SessionManager(org.kie.workbench.common.stunner.core.client.api.SessionManager) Pair(org.uberfire.commons.data.Pair) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) SelectorData(org.kie.workbench.common.forms.dynamic.model.config.SelectorData) FormRenderingContext(org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext) StringUtils.isEmpty(org.kie.workbench.common.stunner.core.util.StringUtils.isEmpty) BPMNDefinition(org.kie.workbench.common.stunner.bpmn.definition.BPMNDefinition) Collectors(java.util.stream.Collectors) BaseSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseSubprocess) List(java.util.List) TreeMap(java.util.TreeMap) BaseTask(org.kie.workbench.common.stunner.bpmn.definition.BaseTask) ClientUtils.getSelectedNode(org.kie.workbench.common.stunner.core.client.util.ClientUtils.getSelectedNode) ActivityRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.ActivityRef) SafeComparator(org.kie.workbench.common.stunner.core.util.SafeComparator) Node(org.kie.workbench.common.stunner.core.graph.Node) ClientUtils.getSelectedNode(org.kie.workbench.common.stunner.core.client.util.ClientUtils.getSelectedNode) Node(org.kie.workbench.common.stunner.core.graph.Node) ArrayList(java.util.ArrayList) TreeMap(java.util.TreeMap) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) SelectorData(org.kie.workbench.common.forms.dynamic.model.config.SelectorData) ActivityRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.ActivityRef) EndCompensationEvent(org.kie.workbench.common.stunner.bpmn.definition.EndCompensationEvent)

Aggregations

ActivityRef (org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.ActivityRef)5 CompensationEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.compensation.CompensationEventExecutionSet)4 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)4 AdvancedData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData)4 Edge (org.kie.workbench.common.stunner.core.graph.Edge)3 View (org.kie.workbench.common.stunner.core.graph.content.view.View)3 Test (org.junit.Test)2 EventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader)2 ThrowEventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader)2 EndCompensationEvent (org.kie.workbench.common.stunner.bpmn.definition.EndCompensationEvent)2 IntermediateCompensationEventThrowing (org.kie.workbench.common.stunner.bpmn.definition.IntermediateCompensationEventThrowing)2 BackgroundSet (org.kie.workbench.common.stunner.bpmn.definition.property.background.BackgroundSet)2 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)2 CircleDimensionSet (org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.CircleDimensionSet)2 FontSet (org.kie.workbench.common.stunner.bpmn.definition.property.font.FontSet)2 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)2 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1