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();
}
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();
}
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);
}
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);
}
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);
}
Aggregations