Search in sources :

Example 1 with DataObjectReference

use of org.eclipse.bpmn2.DataObjectReference in project kie-wb-common by kiegroup.

the class LanePropertyWriter method addChild.

@Override
public void addChild(BasePropertyWriter child) {
    if (child instanceof DataObjectPropertyWriter) {
        final DataObjectReference element = (DataObjectReference) child.getElement();
        FlowNode node = new FlowNodeImpl() {

            @Override
            public Auditing getAuditing() {
                return element.getAuditing();
            }

            @Override
            public Monitoring getMonitoring() {
                return element.getMonitoring();
            }

            @Override
            public List<CategoryValue> getCategoryValueRef() {
                return element.getCategoryValueRef();
            }

            @Override
            public String getName() {
                return element.getName();
            }

            @Override
            public String toString() {
                return element.toString();
            }
        };
        lane.getFlowNodeRefs().add(node);
    } else {
        lane.getFlowNodeRefs().add((FlowNode) child.getElement());
    }
}
Also used : CategoryValue(org.eclipse.bpmn2.CategoryValue) FlowNodeImpl(org.eclipse.bpmn2.impl.FlowNodeImpl) DataObjectReference(org.eclipse.bpmn2.DataObjectReference) FlowNode(org.eclipse.bpmn2.FlowNode)

Example 2 with DataObjectReference

use of org.eclipse.bpmn2.DataObjectReference in project kie-wb-common by kiegroup.

the class FlowElementConverterTest method convertSupported.

@Test
public void convertSupported() {
    StartEvent startEvent = mock(StartEvent.class);
    tested.convertNode(startEvent);
    verify(startEventConverter).convert(startEvent);
    EndEvent endEvent = mock(EndEvent.class);
    tested.convertNode(endEvent);
    verify(endEventConverter).convert(endEvent);
    BoundaryEvent boundaryEvent = mock(BoundaryEvent.class);
    tested.convertNode(boundaryEvent);
    verify(eventConverter).convertBoundaryEvent(boundaryEvent);
    IntermediateCatchEvent intermediateCatchEvent = mock(IntermediateCatchEvent.class);
    tested.convertNode(intermediateCatchEvent);
    verify(eventConverter).convert(intermediateCatchEvent);
    IntermediateThrowEvent intermediateThrowEvent = mock(IntermediateThrowEvent.class);
    tested.convertNode(intermediateThrowEvent);
    verify(throwEventConverter).convert(intermediateThrowEvent);
    Task task = mock(Task.class);
    tested.convertNode(task);
    verify(taskConverter).convert(task);
    Gateway gateway = mock(Gateway.class);
    tested.convertNode(gateway);
    verify(gatewayConverter).convert(gateway);
    SubProcess subProcess = mock(SubProcess.class);
    tested.convertNode(subProcess);
    verify(subProcessConverter).convertSubProcess(subProcess);
    CallActivity callActivity = mock(CallActivity.class);
    tested.convertNode(callActivity);
    verify(callActivityConverter).convert(callActivity);
    TextAnnotation textAnnotation = mock(TextAnnotation.class);
    tested.convertNode(textAnnotation);
    verify(artifactsConverter).convert(textAnnotation);
    DataObjectReference dataObjectReference = mock(DataObjectReference.class);
    tested.convertNode(dataObjectReference);
    verify(artifactsConverter).convert(dataObjectReference);
}
Also used : SubProcess(org.eclipse.bpmn2.SubProcess) Task(org.eclipse.bpmn2.Task) BoundaryEvent(org.eclipse.bpmn2.BoundaryEvent) Gateway(org.eclipse.bpmn2.Gateway) IntermediateCatchEvent(org.eclipse.bpmn2.IntermediateCatchEvent) StartEvent(org.eclipse.bpmn2.StartEvent) EndEvent(org.eclipse.bpmn2.EndEvent) CallActivity(org.eclipse.bpmn2.CallActivity) TextAnnotation(org.eclipse.bpmn2.TextAnnotation) IntermediateThrowEvent(org.eclipse.bpmn2.IntermediateThrowEvent) DataObjectReference(org.eclipse.bpmn2.DataObjectReference) Test(org.junit.Test)

Example 3 with DataObjectReference

use of org.eclipse.bpmn2.DataObjectReference in project kie-wb-common by kiegroup.

the class ProcessPropertyWriterTest method addChildElement.

@Test
public void addChildElement() {
    Process process = p.getProcess();
    BoundaryEventPropertyWriter boundaryEventPropertyWriter = new BoundaryEventPropertyWriter(bpmn2.createBoundaryEvent(), variableScope, new HashSet<>());
    UserTaskPropertyWriter userTaskPropertyWriter = new UserTaskPropertyWriter(bpmn2.createUserTask(), variableScope, new HashSet<>());
    SubProcessPropertyWriter subProcessPropertyWriter = new SubProcessPropertyWriter(bpmn2.createSubProcess(), variableScope, new HashSet<>());
    final DataObjectReference dataObjectReference = bpmn2.createDataObjectReference();
    DataObjectPropertyWriter dataObjectPropertyWriter = new DataObjectPropertyWriter(dataObjectReference, variableScope, new HashSet<>());
    final DataObject dataObject = dataObjectPropertyWriter.getElement().getDataObjectRef();
    dataObject.getItemSubjectRef();
    ItemDefinition itemDefinition = mock(ItemDefinition.class);
    dataObject.setItemSubjectRef(itemDefinition);
    dataObject.getItemSubjectRef();
    subProcessPropertyWriter.addChildElement(dataObjectPropertyWriter);
    p.addChildElement(subProcessPropertyWriter);
    p.addChildElement(boundaryEventPropertyWriter);
    p.addChildElement(userTaskPropertyWriter);
    // boundary event should always occur after other nodes (compat with old marshallers)
    assertThat(process.getFlowElements().get(0)).isEqualTo(userTaskPropertyWriter.getFlowElement());
    assertThat(process.getFlowElements().get(1)).isEqualTo(subProcessPropertyWriter.getFlowElement());
    assertThat(process.getFlowElements().get(2)).isEqualTo(boundaryEventPropertyWriter.getFlowElement());
}
Also used : DataObject(org.eclipse.bpmn2.DataObject) ItemDefinition(org.eclipse.bpmn2.ItemDefinition) Process(org.eclipse.bpmn2.Process) DataObjectReference(org.eclipse.bpmn2.DataObjectReference) Test(org.junit.Test)

Example 4 with DataObjectReference

use of org.eclipse.bpmn2.DataObjectReference in project kie-wb-common by kiegroup.

the class ArtifactsConverterTest method convertDataObject.

@Test
public void convertDataObject() {
    DataObjectReference element = Bpmn2Factory.eINSTANCE.createDataObjectReference();
    when(typedFactoryManager.newNode(any(), eq(org.kie.workbench.common.stunner.bpmn.definition.DataObject.class))).thenReturn(nodeDataObject);
    when(nodeDataObject.getContent()).thenReturn(contentDataObject);
    when(contentDataObject.getDefinition()).thenReturn(defDataObject);
    when(propertyReaderFactory.of(element)).thenReturn(readerDataObject);
    final Result<BpmnNode> node = tested.convert(element);
    final Node<? extends View<? extends BPMNViewDefinition>, ?> value = node.value().value();
    assertEquals(contentDataObject, value.getContent());
    assertEquals(defDataObject, value.getContent().getDefinition());
}
Also used : BpmnNode(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode) DataObjectReference(org.eclipse.bpmn2.DataObjectReference) Test(org.junit.Test)

Aggregations

DataObjectReference (org.eclipse.bpmn2.DataObjectReference)4 Test (org.junit.Test)3 BoundaryEvent (org.eclipse.bpmn2.BoundaryEvent)1 CallActivity (org.eclipse.bpmn2.CallActivity)1 CategoryValue (org.eclipse.bpmn2.CategoryValue)1 DataObject (org.eclipse.bpmn2.DataObject)1 EndEvent (org.eclipse.bpmn2.EndEvent)1 FlowNode (org.eclipse.bpmn2.FlowNode)1 Gateway (org.eclipse.bpmn2.Gateway)1 IntermediateCatchEvent (org.eclipse.bpmn2.IntermediateCatchEvent)1 IntermediateThrowEvent (org.eclipse.bpmn2.IntermediateThrowEvent)1 ItemDefinition (org.eclipse.bpmn2.ItemDefinition)1 Process (org.eclipse.bpmn2.Process)1 StartEvent (org.eclipse.bpmn2.StartEvent)1 SubProcess (org.eclipse.bpmn2.SubProcess)1 Task (org.eclipse.bpmn2.Task)1 TextAnnotation (org.eclipse.bpmn2.TextAnnotation)1 FlowNodeImpl (org.eclipse.bpmn2.impl.FlowNodeImpl)1 BpmnNode (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode)1