use of org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess in project kie-wb-common by kiegroup.
the class SubProcessConverter method convertEmbeddedSubprocessNode.
private BpmnNode convertEmbeddedSubprocessNode(SubProcess subProcess) {
Node<View<EmbeddedSubprocess>, Edge> node = factoryManager.newNode(subProcess.getId(), EmbeddedSubprocess.class);
EmbeddedSubprocess definition = node.getContent().getDefinition();
SubProcessPropertyReader p = propertyReaderFactory.of(subProcess);
definition.setGeneral(new BPMNGeneralSet(new Name(subProcess.getName()), new Documentation(p.getDocumentation())));
definition.getOnEntryAction().setValue(p.getOnEntryAction());
definition.getOnExitAction().setValue(p.getOnExitAction());
definition.getIsAsync().setValue(p.isAsync());
definition.setProcessData(new ProcessData(new ProcessVariables(p.getProcessVariables())));
definition.setSimulationSet(p.getSimulationSet());
node.getContent().setBounds(p.getBounds());
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.EmbeddedSubprocess in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallEmbeddedSubprocess.
@Test
public void testUnmarshallEmbeddedSubprocess() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EMBEDDED_SUBPROCESS);
EmbeddedSubprocess subprocess = 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 EmbeddedSubprocess) {
subprocess = (EmbeddedSubprocess) oDefinition;
break;
}
}
}
assertNotNull(subprocess);
}
use of org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallEmbeddedSubprocess.
@Test
public void testUnmarshallEmbeddedSubprocess() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EMBEDDED_SUBPROCESS);
EmbeddedSubprocess subprocess = 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 EmbeddedSubprocess) {
subprocess = (EmbeddedSubprocess) oDefinition;
break;
}
}
}
assertNotNull(subprocess);
}
use of org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess in project kie-wb-common by kiegroup.
the class ConditionalComboBoxFieldRendererTest method init.
@Test
public void init() throws Exception {
resetMocks();
EmbeddedSubprocess embeddedSubprocess = new EmbeddedSubprocess.EmbeddedSubprocessBuilder().build();
OnEntryAction onEntryAction = embeddedSubprocess.getOnEntryAction();
OnExitAction onExitAction = embeddedSubprocess.getOnExitAction();
// static mock
PowerMockito.mockStatic(ClientBindingUtils.class);
BDDMockito.given(ClientBindingUtils.getProxiedValue(embeddedSubprocess, "onEntryAction")).willReturn(onEntryAction);
BDDMockito.given(ClientBindingUtils.getProxiedValue(embeddedSubprocess, "onExitAction")).willReturn(onExitAction);
// instances mock
when(conditionalComboBoxFieldDefinition.getRelatedField()).thenReturn("onEntryAction;onExitAction");
when(renderingContext.getModel()).thenReturn(embeddedSubprocess);
when(adapterManager.forProperty()).thenReturn(Mockito.mock(PropertyAdapter.class));
when(adapterManager.forProperty().getValue(onEntryAction)).thenReturn("value");
when(adapterManager.forProperty().getValue(onExitAction)).thenReturn("");
conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition);
verify(conditionalComboBoxFieldRenderer, never()).setReadOnly(true);
when(adapterManager.forProperty().getValue(onEntryAction)).thenReturn(null);
when(adapterManager.forProperty().getValue(onExitAction)).thenReturn("");
conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition);
verify(conditionalComboBoxFieldRenderer, times(1)).setReadOnly(false);
}
use of org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess in project kie-wb-common by kiegroup.
the class SubProcessConverter method convertEmbeddedSubprocessNode.
private SubProcessPropertyWriter convertEmbeddedSubprocessNode(Node<View<EmbeddedSubprocess>, ?> n) {
SubProcess process = bpmn2.createSubProcess();
process.setId(n.getUUID());
SubProcessPropertyWriter p = propertyWriterFactory.of(process);
EmbeddedSubprocess definition = n.getContent().getDefinition();
BPMNGeneralSet general = definition.getGeneral();
p.setName(general.getName().getValue());
p.setDocumentation(general.getDocumentation().getValue());
p.setOnEntryAction(definition.getOnEntryAction());
p.setOnExitAction(definition.getOnExitAction());
p.setAsync(definition.getIsAsync().getValue());
ProcessData processData = definition.getProcessData();
p.setProcessVariables(processData.getProcessVariables());
p.setSimulationSet(definition.getSimulationSet());
p.setBounds(n.getContent().getBounds());
return p;
}
Aggregations