Search in sources :

Example 1 with ConditionExpression

use of org.kie.workbench.common.stunner.bpmn.definition.property.connectors.ConditionExpression in project kie-wb-common by kiegroup.

the class SequenceFlowConverter method convertEdge.

public BpmnEdge convertEdge(org.eclipse.bpmn2.SequenceFlow seq, Map<String, BpmnNode> nodes) {
    Edge<View<SequenceFlow>, Node> edge = factoryManager.newEdge(seq.getId(), SequenceFlow.class);
    SequenceFlow definition = edge.getContent().getDefinition();
    SequenceFlowPropertyReader p = propertyReaderFactory.of(seq);
    definition.setGeneral(new BPMNGeneralSet(new Name(seq.getName()), new Documentation(p.getDocumentation())));
    definition.setExecutionSet(new SequenceFlowExecutionSet(new Priority(p.getPriority()), new ConditionExpression(p.getConditionExpression())));
    return BpmnEdge.of(edge, nodes.get(p.getSourceId()), p.getSourceConnection(), nodes.get(p.getTargetId()), p.getTargetConnection());
}
Also used : SequenceFlow(org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow) Priority(org.kie.workbench.common.stunner.bpmn.definition.property.connectors.Priority) ConditionExpression(org.kie.workbench.common.stunner.bpmn.definition.property.connectors.ConditionExpression) BpmnNode(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode) Node(org.kie.workbench.common.stunner.core.graph.Node) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) SequenceFlowExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.connectors.SequenceFlowExecutionSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) SequenceFlowPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.SequenceFlowPropertyReader) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)

Example 2 with ConditionExpression

use of org.kie.workbench.common.stunner.bpmn.definition.property.connectors.ConditionExpression in project kie-wb-common by kiegroup.

the class ConditionalComboBoxFieldRendererTest method initWithDefinitionSet.

@Test
public void initWithDefinitionSet() throws Exception {
    resetMocks();
    SequenceFlow sequenceFlow = new SequenceFlow.SequenceFlowBuilder().build();
    SequenceFlowExecutionSet sequenceFlowExecutionSet = sequenceFlow.getExecutionSet();
    ConditionExpression conditionExpression = sequenceFlowExecutionSet.getConditionExpression();
    // static mock
    PowerMockito.mockStatic(ClientBindingUtils.class);
    BDDMockito.given(ClientBindingUtils.getProxiedValue(sequenceFlow, "executionSet")).willReturn(sequenceFlowExecutionSet);
    BDDMockito.given(ClientBindingUtils.getProxiedValue(sequenceFlowExecutionSet, "conditionExpression")).willReturn(conditionExpression);
    // instances mock
    when(conditionalComboBoxFieldDefinition.getRelatedField()).thenReturn("executionSet.conditionExpression");
    when(renderingContext.getModel()).thenReturn(null);
    when(renderingContext.getParentContext()).thenReturn(renderingContextParent);
    when(renderingContextParent.getModel()).thenReturn(sequenceFlow);
    when(adapterManager.forProperty()).thenReturn(Mockito.mock(PropertyAdapter.class));
    when(adapterManager.forProperty().getValue(conditionExpression)).thenReturn("value");
    conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition);
    verify(conditionalComboBoxFieldRenderer, never()).setReadOnly(true);
    verify(conditionalComboBoxFieldRenderer, times(1)).setReadOnly(false);
    when(adapterManager.forProperty().getValue(conditionExpression)).thenReturn("");
    conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition);
    verify(conditionalComboBoxFieldRenderer, times(1)).setReadOnly(true);
    when(adapterManager.forProperty().getValue(conditionExpression)).thenReturn(null);
    conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition);
    verify(conditionalComboBoxFieldRenderer, atLeastOnce()).setReadOnly(true);
}
Also used : SequenceFlow(org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow) ConditionExpression(org.kie.workbench.common.stunner.bpmn.definition.property.connectors.ConditionExpression) PropertyAdapter(org.kie.workbench.common.stunner.core.definition.adapter.PropertyAdapter) SequenceFlowExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.connectors.SequenceFlowExecutionSet) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

SequenceFlow (org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow)2 ConditionExpression (org.kie.workbench.common.stunner.bpmn.definition.property.connectors.ConditionExpression)2 SequenceFlowExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.connectors.SequenceFlowExecutionSet)2 Test (org.junit.Test)1 BpmnNode (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode)1 SequenceFlowPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.SequenceFlowPropertyReader)1 Priority (org.kie.workbench.common.stunner.bpmn.definition.property.connectors.Priority)1 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)1 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)1 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)1 PropertyAdapter (org.kie.workbench.common.stunner.core.definition.adapter.PropertyAdapter)1 Node (org.kie.workbench.common.stunner.core.graph.Node)1 View (org.kie.workbench.common.stunner.core.graph.content.view.View)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1