use of org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess in project kie-wb-common by kiegroup.
the class CallActivityConverter method convert.
public BpmnNode convert(CallActivity activity) {
Node<View<ReusableSubprocess>, Edge> node = factoryManager.newNode(activity.getId(), ReusableSubprocess.class);
ReusableSubprocess definition = node.getContent().getDefinition();
ActivityPropertyReader p = propertyReaderFactory.of(activity);
definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
definition.setExecutionSet(new ReusableSubprocessTaskExecutionSet(new CalledElement(activity.getCalledElement()), new Independent(p.isIndependent()), new WaitForCompletion(p.isWaitForCompletion()), new IsAsync(p.isAsync())));
definition.setDataIOSet(new DataIOSet(p.getAssignmentsInfo()));
node.getContent().setBounds(p.getBounds());
definition.setSimulationSet(p.getSimulationSet());
definition.setDimensionsSet(p.getRectangleDimensionsSet());
definition.setFontSet(p.getFontSet());
definition.setBackgroundSet(p.getBackgroundSet());
return BpmnNode.of(node);
}
use of org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallReusableSubprocess.
@Test
public void testUnmarshallReusableSubprocess() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_REUSABLE_SUBPROCESS);
ReusableSubprocess reusableSubprocess = null;
Iterator<Element> it = nodesIterator(diagram);
while (it.hasNext()) {
Element element = it.next();
if (element.getContent() instanceof View) {
Object oDefinition = ((View) element.getContent()).getDefinition();
if (oDefinition instanceof ReusableSubprocess) {
reusableSubprocess = (ReusableSubprocess) oDefinition;
break;
}
}
}
assertNotNull(reusableSubprocess);
assertNotNull(reusableSubprocess.getExecutionSet());
assertNotNull(reusableSubprocess.getExecutionSet().getCalledElement());
assertNotNull(reusableSubprocess.getGeneral());
BPMNGeneralSet generalSet = reusableSubprocess.getGeneral();
ReusableSubprocessTaskExecutionSet executionSet = reusableSubprocess.getExecutionSet();
assertNotNull(generalSet);
assertNotNull(executionSet);
assertEquals("my subprocess", generalSet.getName().getValue());
assertEquals("my-called-element", executionSet.getCalledElement().getValue());
assertEquals(false, executionSet.getIndependent().getValue());
assertEquals(false, executionSet.getWaitForCompletion().getValue());
String assignmentsInfo = reusableSubprocess.getDataIOSet().getAssignmentsinfo().getValue();
assertEquals("|input1:String,input2:Float||output1:String,output2:Float|[din]pv1->input1,[din]pv2->input2,[dout]output1->pv1,[dout]output2->pv2", assignmentsInfo);
assertEquals("true", reusableSubprocess.getExecutionSet().getIsAsync().getValue().toString());
}
use of org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallReusableSubprocess.
@Test
public void testUnmarshallReusableSubprocess() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_REUSABLE_SUBPROCESS);
ReusableSubprocess reusableSubprocess = null;
Iterator<Element> it = nodesIterator(diagram);
while (it.hasNext()) {
Element element = it.next();
if (element.getContent() instanceof View) {
Object oDefinition = ((View) element.getContent()).getDefinition();
if (oDefinition instanceof ReusableSubprocess) {
reusableSubprocess = (ReusableSubprocess) oDefinition;
break;
}
}
}
assertNotNull(reusableSubprocess);
assertNotNull(reusableSubprocess.getExecutionSet());
assertNotNull(reusableSubprocess.getExecutionSet().getCalledElement());
assertNotNull(reusableSubprocess.getGeneral());
BPMNGeneralSet generalSet = reusableSubprocess.getGeneral();
ReusableSubprocessTaskExecutionSet executionSet = reusableSubprocess.getExecutionSet();
assertNotNull(generalSet);
assertNotNull(executionSet);
assertEquals("my subprocess", generalSet.getName().getValue());
assertEquals("my-called-element", executionSet.getCalledElement().getValue());
assertEquals(false, executionSet.getIndependent().getValue());
assertEquals(false, executionSet.getWaitForCompletion().getValue());
String assignmentsInfo = reusableSubprocess.getDataIOSet().getAssignmentsinfo().getValue();
assertEquals("|input1:String,input2:Float||output1:String,output2:Float|[din]pv1->input1,[din]pv2->input2,[dout]output1->pv1,[dout]output2->pv2", assignmentsInfo);
assertEquals("true", reusableSubprocess.getExecutionSet().getIsAsync().getValue().toString());
}
use of org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess in project kie-wb-common by kiegroup.
the class ReusableSubprocessConverter method toFlowElement.
public PropertyWriter toFlowElement(Node<View<ReusableSubprocess>, ?> n) {
CallActivity activity = bpmn2.createCallActivity();
activity.setId(n.getUUID());
CallActivityPropertyWriter p = propertyWriterFactory.of(activity);
ReusableSubprocess definition = n.getContent().getDefinition();
BPMNGeneralSet general = definition.getGeneral();
p.setName(general.getName().getValue());
p.setDocumentation(general.getDocumentation().getValue());
ReusableSubprocessTaskExecutionSet executionSet = definition.getExecutionSet();
p.setCalledElement(executionSet.getCalledElement().getValue());
p.setAsync(executionSet.getIsAsync().getValue());
p.setIndependent(executionSet.getIndependent().getValue());
p.setWaitForCompletion(executionSet.getIndependent().getValue());
p.setAssignmentsInfo(definition.getDataIOSet().getAssignmentsinfo());
p.setSimulationSet(definition.getSimulationSet());
p.setBounds(n.getContent().getBounds());
return p;
}
Aggregations