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());
}
}
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);
}
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());
}
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());
}
Aggregations