use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.
the class SubProcessConverter method convertAdHocSubprocessNode.
private SubProcessPropertyWriter convertAdHocSubprocessNode(Node<View<AdHocSubprocess>, ?> n) {
org.eclipse.bpmn2.AdHocSubProcess process = bpmn2.createAdHocSubProcess();
process.setId(n.getUUID());
AdHocSubProcessPropertyWriter p = propertyWriterFactory.of(process);
AdHocSubprocess definition = n.getContent().getDefinition();
BPMNGeneralSet general = definition.getGeneral();
p.setName(general.getName().getValue());
p.setDocumentation(general.getDocumentation().getValue());
ProcessData processData = definition.getProcessData();
p.setProcessVariables(processData.getProcessVariables());
AdHocSubprocessTaskExecutionSet executionSet = definition.getExecutionSet();
p.setAdHocCompletionCondition(executionSet.getAdHocCompletionCondition());
p.setAdHocOrdering(executionSet.getAdHocOrdering());
p.setOnEntryAction(executionSet.getOnEntryAction());
p.setOnExitAction(executionSet.getOnExitAction());
p.setSimulationSet(definition.getSimulationSet());
p.setBounds(n.getContent().getBounds());
return p;
}
use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.
the class ProcessConverterDelegateTest method testPostConvertNodes.
@Test
@SuppressWarnings("unchecked")
public void testPostConvertNodes() {
TestingGraphMockHandler graphTestHandler = new TestingGraphMockHandler();
BPMNDiagramImpl bpmnDiagram = new BPMNDiagramImpl();
StartNoneEvent level0StartNode = new StartNoneEvent();
EndNoneEvent level0EndNode = new EndNoneEvent();
UserTask level0Node1 = new UserTask();
UserTask level0Node2 = new UserTask();
EmbeddedSubprocess level1SubProcess1 = new EmbeddedSubprocess();
ScriptTask level1Node1 = new ScriptTask();
IntermediateSignalEventThrowing level1Node2 = new IntermediateSignalEventThrowing();
AdHocSubprocess level2SubProcess1 = new AdHocSubprocess();
BusinessRuleTask level2Node1 = new BusinessRuleTask();
EndCompensationEvent level2Node2 = new EndCompensationEvent();
TestingGraphInstanceBuilder2.Level2Graph level2Graph = TestingGraphInstanceBuilder2.buildLevel2Graph(graphTestHandler, bpmnDiagram, level0StartNode, level0Node1, level0Node2, level0EndNode, level1SubProcess1, level1Node1, level1Node2, level2SubProcess1, level2Node1, level2Node2);
DefinitionsBuildingContext ctx = new DefinitionsBuildingContext(level2Graph.graph);
PropertyWriterFactory writerFactory = new PropertyWriterFactory();
ConverterFactory factory = spy(new ConverterFactory(ctx, writerFactory));
FlowElementPostConverter flowElementPostConverter = mock(FlowElementPostConverter.class);
when(factory.flowElementPostConverter()).thenReturn(flowElementPostConverter);
MyProcessConverter abstractProcessConverter = new MyProcessConverter(factory);
ProcessPropertyWriter processWriter = writerFactory.of(bpmn2.createProcess());
abstractProcessConverter.postConvertChildNodes(processWriter, ctx);
verify(flowElementPostConverter, times(10)).postConvert(anyObject(), anyObject(), nodeCaptor.capture());
Map<String, BPMNViewDefinition> nodes = new HashMap<>();
nodes.put(LEVEL0_START_NODE.uuid(), level0StartNode);
nodes.put(LEVEL0_NODE1.uuid(), level0Node1);
nodes.put(LEVEL0_NODE2.uuid(), level0Node2);
nodes.put(LEVEL0_END_NODE.uuid(), level0EndNode);
nodes.put(LEVEL1_SUB_PROCESS1.uuid(), level1SubProcess1);
nodes.put(LEVEL1_NODE1.uuid(), level1Node1);
nodes.put(LEVEL1_NODE2.uuid(), level1Node2);
nodes.put(LEVEL2_SUB_PROCESS1.uuid(), level2SubProcess1);
nodes.put(LEVEL2_NODE1.uuid(), level2Node1);
nodes.put(LEVEL2_NODE2.uuid(), level2Node2);
assertEquals(nodes.size(), nodeCaptor.getAllValues().size());
nodes.entrySet().forEach(entry -> {
Optional<Node<View<? extends BPMNViewDefinition>, ?>> processed = nodeCaptor.getAllValues().stream().filter(captured -> entry.getKey().equals(captured.getUUID())).findFirst();
assertTrue("Node: " + entry.getKey() + " was not present in result", processed.isPresent());
assertEquals(entry.getValue(), processed.get().getContent().getDefinition());
});
}
use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.
the class AbstractDataTypeCache method extractFromItem.
public void extractFromItem(View view) {
Object definition = view.getDefinition();
if (definition instanceof DataObject) {
DataObject dataObject = (DataObject) definition;
allDataTypes.add(dataObject.getType().getValue().getType());
} else if (definition instanceof AdHocSubprocess) {
AdHocSubprocess adhoc = (AdHocSubprocess) definition;
allDataTypes.addAll(getDataTypes(adhoc.getProcessData().getProcessVariables().getValue()));
} else if (definition instanceof BPMNDiagramImpl) {
BPMNDiagramImpl diagram = (BPMNDiagramImpl) definition;
allDataTypes.addAll(getDataTypes(diagram.getProcessData().getProcessVariables().getValue()));
} else if (definition instanceof EmbeddedSubprocess) {
EmbeddedSubprocess embeddedSubprocess = (EmbeddedSubprocess) definition;
allDataTypes.addAll(getDataTypes(embeddedSubprocess.getProcessData().getProcessVariables().getValue()));
} else if (definition instanceof EventSubprocess) {
EventSubprocess eventSubprocess = (EventSubprocess) definition;
allDataTypes.addAll(getDataTypes(eventSubprocess.getProcessData().getProcessVariables().getValue()));
} else if (definition instanceof MultipleInstanceSubprocess) {
MultipleInstanceSubprocess multipleInstanceSubprocess = (MultipleInstanceSubprocess) definition;
allDataTypes.addAll(getDataTypes(multipleInstanceSubprocess.getProcessData().getProcessVariables().getValue()));
allDataTypes.addAll(getDataTypes(multipleInstanceSubprocess.getExecutionSet().getMultipleInstanceDataInput().getValue()));
allDataTypes.addAll(getDataTypes(multipleInstanceSubprocess.getExecutionSet().getMultipleInstanceDataOutput().getValue()));
} else if (definition instanceof UserTask) {
UserTask userTask = (UserTask) definition;
allDataTypes.addAll(processAssignments(userTask.getExecutionSet().getAssignmentsinfo()));
} else if (definition instanceof GenericServiceTask) {
GenericServiceTask genericServiceTask = (GenericServiceTask) definition;
allDataTypes.addAll(processAssignments(genericServiceTask.getExecutionSet().getAssignmentsinfo()));
} else if (definition instanceof BusinessRuleTask) {
BusinessRuleTask businessRuleTask = (BusinessRuleTask) definition;
allDataTypes.addAll(processAssignments(businessRuleTask.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof EndErrorEvent) {
EndErrorEvent endErrorEvent = (EndErrorEvent) definition;
allDataTypes.addAll(processAssignments(endErrorEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof EndEscalationEvent) {
EndEscalationEvent endEscalationEvent = (EndEscalationEvent) definition;
allDataTypes.addAll(processAssignments(endEscalationEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof EndMessageEvent) {
EndMessageEvent endMessageEvent = (EndMessageEvent) definition;
allDataTypes.addAll(processAssignments(endMessageEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof EndSignalEvent) {
EndSignalEvent endSignalEvent = (EndSignalEvent) definition;
allDataTypes.addAll(processAssignments(endSignalEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateLinkEventCatching) {
IntermediateLinkEventCatching intermediateLinkEventCatching = (IntermediateLinkEventCatching) definition;
allDataTypes.addAll(processAssignments(intermediateLinkEventCatching.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateLinkEventThrowing) {
IntermediateLinkEventThrowing intermediateLinkEventThrowing = (IntermediateLinkEventThrowing) definition;
allDataTypes.addAll(processAssignments(intermediateLinkEventThrowing.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateErrorEventCatching) {
IntermediateErrorEventCatching intermediateErrorEventCatching = (IntermediateErrorEventCatching) definition;
allDataTypes.addAll(processAssignments(intermediateErrorEventCatching.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateEscalationEvent) {
IntermediateEscalationEvent intermediateEscalationEvent = (IntermediateEscalationEvent) definition;
allDataTypes.addAll(processAssignments(intermediateEscalationEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateEscalationEventThrowing) {
IntermediateEscalationEventThrowing intermediateEscalationEventThrowing = (IntermediateEscalationEventThrowing) definition;
allDataTypes.addAll(processAssignments(intermediateEscalationEventThrowing.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateMessageEventCatching) {
IntermediateMessageEventCatching intermediateMessageEventCatching = (IntermediateMessageEventCatching) definition;
allDataTypes.addAll(processAssignments(intermediateMessageEventCatching.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateMessageEventThrowing) {
IntermediateMessageEventThrowing intermediateMessageEventThrowing = (IntermediateMessageEventThrowing) definition;
allDataTypes.addAll(processAssignments(intermediateMessageEventThrowing.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateSignalEventCatching) {
IntermediateSignalEventCatching intermediateSignalEventCatching = (IntermediateSignalEventCatching) definition;
allDataTypes.addAll(processAssignments(intermediateSignalEventCatching.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateSignalEventThrowing) {
IntermediateSignalEventThrowing intermediateSignalEventThrowing = (IntermediateSignalEventThrowing) definition;
allDataTypes.addAll(processAssignments(intermediateSignalEventThrowing.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof ReusableSubprocess) {
ReusableSubprocess reusableSubprocess = (ReusableSubprocess) definition;
allDataTypes.addAll(processAssignments(reusableSubprocess.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof StartErrorEvent) {
StartErrorEvent startErrorEvent = (StartErrorEvent) definition;
allDataTypes.addAll(processAssignments(startErrorEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof StartEscalationEvent) {
StartEscalationEvent startEscalationEvent = (StartEscalationEvent) definition;
allDataTypes.addAll(processAssignments(startEscalationEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof StartMessageEvent) {
StartMessageEvent startMessageEvent = (StartMessageEvent) definition;
allDataTypes.addAll(processAssignments(startMessageEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof StartSignalEvent) {
StartSignalEvent startSignalEvent = (StartSignalEvent) definition;
allDataTypes.addAll(processAssignments(startSignalEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof CustomTask) {
CustomTask customTask = (CustomTask) definition;
allDataTypes.addAll(processAssignments(customTask.getDataIOSet().getAssignmentsinfo()));
}
}
use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.
the class AdHocSubProcessTest method testUnmarshallSubProcessLevelFilledPropertiesSubProcess.
@Test
@Override
public void testUnmarshallSubProcessLevelFilledPropertiesSubProcess() {
final String SUB_PROCESS_NAME_JAVA = "Ad-hoc sub-process04 name ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
final String SUB_PROCESS_DOCUMENTATION_JAVA = "Ad-hoc sub-process04 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
final String SUB_PROCESS_NAME_JAVASCRIPT = "Ad-hoc sub-process05 name ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
final String SUB_PROCESS_DOCUMENTATION_JAVASCRIPT = "Ad-hoc sub-process05 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
final String SUB_PROCESS_NAME_MVEL = "Ad-hoc sub-process06 name ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
final String SUB_PROCESS_DOCUMENTATION_MVEL = "Ad-hoc sub-process06 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
final String SUB_PROCESS_VARIABLES_JAVA = "subVar04:String:[]";
final String SUB_PROCESS_VARIABLES_JAVASCRIPT = "subVar05:String:[]";
final String SUB_PROCESS_VARIABLES_MVEL = "subVarString:String:[],subVarCustom:CustomType:[],subVarBoolean:Boolean:[],subVarFloat:Float:[],subVarInteger:Integer:[],subVarObject:Object:[]";
Diagram<Graph, Metadata> diagram = getDiagram();
assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
AdHocSubprocess subProcessLevelSubProcessJava = getSubProcessNodeById(diagram, SUBPROCESS_LEVEL_FILLED_SUBPROCESS_JAVA_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
assertGeneralSet(subProcessLevelSubProcessJava.getGeneral(), SUB_PROCESS_NAME_JAVA, SUB_PROCESS_DOCUMENTATION_JAVA);
assertAdHocSubProcessExecutionSet(subProcessLevelSubProcessJava.getExecutionSet(), ADHOC_COMPLETION_CONDITION_SCRIPT_DEFAULT, ADHOC_COMPLETION_CONDITION_LANGUAGE_MVEL, ADHOC_ORDERING_SEQUENTIAL, SUBPROCESS_ON_ENTRY_ACTION_JAVA, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, SUBPROCESS_ON_EXIT_ACTION_JAVA, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, IS_ASYNC, SLA_DUE_DATE);
assertSubProcessProcessData(subProcessLevelSubProcessJava.getProcessData(), SUB_PROCESS_VARIABLES_JAVA);
AdHocSubprocess subProcessLevelSubProcessJavascript = getSubProcessNodeById(diagram, SUBPROCESS_LEVEL_FILLED_SUBPROCESS_JAVASCRIPT_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
assertGeneralSet(subProcessLevelSubProcessJavascript.getGeneral(), SUB_PROCESS_NAME_JAVASCRIPT, SUB_PROCESS_DOCUMENTATION_JAVASCRIPT);
assertAdHocSubProcessExecutionSet(subProcessLevelSubProcessJavascript.getExecutionSet(), ADHOC_COMPLETION_CONDITION_SCRIPT, ADHOC_COMPLETION_CONDITION_LANGUAGE_DROOLS, ADHOC_ORDERING_PARALLEL, SUBPROCESS_ON_ENTRY_ACTION_JAVASCRIPT, SUBPROCESS_SCRIPT_JAVASCRIPT_LANGUAGE, SUBPROCESS_ON_EXIT_ACTION_JAVASCRIPT, SUBPROCESS_SCRIPT_JAVASCRIPT_LANGUAGE, IS_ASYNC, SLA_DUE_DATE);
assertSubProcessProcessData(subProcessLevelSubProcessJavascript.getProcessData(), SUB_PROCESS_VARIABLES_JAVASCRIPT);
AdHocSubprocess subProcessLevelSubProcessMVEL = getSubProcessNodeById(diagram, SUBPROCESS_LEVEL_FILLED_SUBPROCESS_MVEL_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
assertGeneralSet(subProcessLevelSubProcessMVEL.getGeneral(), SUB_PROCESS_NAME_MVEL, SUB_PROCESS_DOCUMENTATION_MVEL);
assertAdHocSubProcessExecutionSet(subProcessLevelSubProcessMVEL.getExecutionSet(), ADHOC_COMPLETION_CONDITION_SCRIPT_DEFAULT, ADHOC_COMPLETION_CONDITION_LANGUAGE_MVEL, ADHOC_ORDERING_SEQUENTIAL, SUBPROCESS_ON_ENTRY_ACTION_MVEL, SUBPROCESS_SCRIPT_MVEL_LANGUAGE, SUBPROCESS_ON_EXIT_ACTION_MVEL, SUBPROCESS_SCRIPT_MVEL_LANGUAGE, IS_ASYNC, SLA_DUE_DATE);
assertSubProcessProcessData(subProcessLevelSubProcessMVEL.getProcessData(), SUB_PROCESS_VARIABLES_MVEL);
}
use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.
the class AdHocSubProcessTest method testUnmarshallTopLevelEmptyPropertiesSubProcess.
@Test
@Override
public void testUnmarshallTopLevelEmptyPropertiesSubProcess() {
Diagram<Graph, Metadata> diagram = getDiagram();
assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
AdHocSubprocess topLevelSubProcess = getSubProcessNodeById(diagram, TOP_LEVEL_EMPTY_SUBPROCESS_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
assertGeneralSet(topLevelSubProcess.getGeneral(), DEFAULT_NAME, DEFAULT_DOCUMENTATION);
assertAdHocSubProcessExecutionSet(topLevelSubProcess.getExecutionSet(), EMPTY_VALUE, ADHOC_COMPLETION_CONDITION_LANGUAGE_MVEL, ADHOC_ORDERING_SEQUENTIAL, EMPTY_VALUE, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, EMPTY_VALUE, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, IS_NOT_ASYNC, EMPTY_VALUE);
assertSubProcessProcessData(topLevelSubProcess.getProcessData(), EMPTY_VALUE);
}
Aggregations