use of org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallFlightBooking.
@Test
public void testUnmarshallFlightBooking() throws Exception {
final Diagram<Graph, Metadata> diagram = unmarshall(BPMN_FLIGHT_BOOKING);
// User Task 1
Node<? extends View, ?> serviceTask1Node = diagram.getGraph().getNode("ServiceTask_1");
GenericServiceTask serviceTask1 = (GenericServiceTask) serviceTask1Node.getContent().getDefinition();
// Assert properties from Generic Service Task
GenericServiceTaskValue serviceTaskValue = serviceTask1.getExecutionSet().getGenericServiceTaskInfo().getValue();
assertEquals("Java", serviceTaskValue.getServiceImplementation());
assertEquals("org.acme.travels.service.FlightBookingService", serviceTaskValue.getServiceInterface());
assertEquals("bookFlight", serviceTaskValue.getServiceOperation());
assertEquals("org.acme.travels.Trip", serviceTaskValue.getInMessageStructure());
assertEquals("org.acme.travels.Flight", serviceTaskValue.getOutMessagetructure());
String marshalled = tested.marshall(diagram);
assertTrue(marshalled.contains("<bpmn2:itemDefinition id=\"ServiceTask_1_InMessageType\" structureRef=\"org.acme.travels.Trip\"/>"));
assertTrue(marshalled.contains("<bpmn2:itemDefinition id=\"ServiceTask_1_OutMessageType\" structureRef=\"org.acme.travels.Flight\"/>"));
}
use of org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask in project kie-wb-common by kiegroup.
the class AbstractDataTypeCache method extractFromItem.
public void extractFromItem(View view) {
Object definition = view.getDefinition();
if (definition instanceof DataObject) {
DataObject dataObject = (DataObject) definition;
allDataTypes.add(dataObject.getType().getValue().getType());
} else if (definition instanceof AdHocSubprocess) {
AdHocSubprocess adhoc = (AdHocSubprocess) definition;
allDataTypes.addAll(getDataTypes(adhoc.getProcessData().getProcessVariables().getValue()));
} else if (definition instanceof BPMNDiagramImpl) {
BPMNDiagramImpl diagram = (BPMNDiagramImpl) definition;
allDataTypes.addAll(getDataTypes(diagram.getProcessData().getProcessVariables().getValue()));
} else if (definition instanceof EmbeddedSubprocess) {
EmbeddedSubprocess embeddedSubprocess = (EmbeddedSubprocess) definition;
allDataTypes.addAll(getDataTypes(embeddedSubprocess.getProcessData().getProcessVariables().getValue()));
} else if (definition instanceof EventSubprocess) {
EventSubprocess eventSubprocess = (EventSubprocess) definition;
allDataTypes.addAll(getDataTypes(eventSubprocess.getProcessData().getProcessVariables().getValue()));
} else if (definition instanceof MultipleInstanceSubprocess) {
MultipleInstanceSubprocess multipleInstanceSubprocess = (MultipleInstanceSubprocess) definition;
allDataTypes.addAll(getDataTypes(multipleInstanceSubprocess.getProcessData().getProcessVariables().getValue()));
allDataTypes.addAll(getDataTypes(multipleInstanceSubprocess.getExecutionSet().getMultipleInstanceDataInput().getValue()));
allDataTypes.addAll(getDataTypes(multipleInstanceSubprocess.getExecutionSet().getMultipleInstanceDataOutput().getValue()));
} else if (definition instanceof UserTask) {
UserTask userTask = (UserTask) definition;
allDataTypes.addAll(processAssignments(userTask.getExecutionSet().getAssignmentsinfo()));
} else if (definition instanceof GenericServiceTask) {
GenericServiceTask genericServiceTask = (GenericServiceTask) definition;
allDataTypes.addAll(processAssignments(genericServiceTask.getExecutionSet().getAssignmentsinfo()));
} else if (definition instanceof BusinessRuleTask) {
BusinessRuleTask businessRuleTask = (BusinessRuleTask) definition;
allDataTypes.addAll(processAssignments(businessRuleTask.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof EndErrorEvent) {
EndErrorEvent endErrorEvent = (EndErrorEvent) definition;
allDataTypes.addAll(processAssignments(endErrorEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof EndEscalationEvent) {
EndEscalationEvent endEscalationEvent = (EndEscalationEvent) definition;
allDataTypes.addAll(processAssignments(endEscalationEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof EndMessageEvent) {
EndMessageEvent endMessageEvent = (EndMessageEvent) definition;
allDataTypes.addAll(processAssignments(endMessageEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof EndSignalEvent) {
EndSignalEvent endSignalEvent = (EndSignalEvent) definition;
allDataTypes.addAll(processAssignments(endSignalEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateLinkEventCatching) {
IntermediateLinkEventCatching intermediateLinkEventCatching = (IntermediateLinkEventCatching) definition;
allDataTypes.addAll(processAssignments(intermediateLinkEventCatching.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateLinkEventThrowing) {
IntermediateLinkEventThrowing intermediateLinkEventThrowing = (IntermediateLinkEventThrowing) definition;
allDataTypes.addAll(processAssignments(intermediateLinkEventThrowing.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateErrorEventCatching) {
IntermediateErrorEventCatching intermediateErrorEventCatching = (IntermediateErrorEventCatching) definition;
allDataTypes.addAll(processAssignments(intermediateErrorEventCatching.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateEscalationEvent) {
IntermediateEscalationEvent intermediateEscalationEvent = (IntermediateEscalationEvent) definition;
allDataTypes.addAll(processAssignments(intermediateEscalationEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateEscalationEventThrowing) {
IntermediateEscalationEventThrowing intermediateEscalationEventThrowing = (IntermediateEscalationEventThrowing) definition;
allDataTypes.addAll(processAssignments(intermediateEscalationEventThrowing.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateMessageEventCatching) {
IntermediateMessageEventCatching intermediateMessageEventCatching = (IntermediateMessageEventCatching) definition;
allDataTypes.addAll(processAssignments(intermediateMessageEventCatching.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateMessageEventThrowing) {
IntermediateMessageEventThrowing intermediateMessageEventThrowing = (IntermediateMessageEventThrowing) definition;
allDataTypes.addAll(processAssignments(intermediateMessageEventThrowing.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateSignalEventCatching) {
IntermediateSignalEventCatching intermediateSignalEventCatching = (IntermediateSignalEventCatching) definition;
allDataTypes.addAll(processAssignments(intermediateSignalEventCatching.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof IntermediateSignalEventThrowing) {
IntermediateSignalEventThrowing intermediateSignalEventThrowing = (IntermediateSignalEventThrowing) definition;
allDataTypes.addAll(processAssignments(intermediateSignalEventThrowing.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof ReusableSubprocess) {
ReusableSubprocess reusableSubprocess = (ReusableSubprocess) definition;
allDataTypes.addAll(processAssignments(reusableSubprocess.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof StartErrorEvent) {
StartErrorEvent startErrorEvent = (StartErrorEvent) definition;
allDataTypes.addAll(processAssignments(startErrorEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof StartEscalationEvent) {
StartEscalationEvent startEscalationEvent = (StartEscalationEvent) definition;
allDataTypes.addAll(processAssignments(startEscalationEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof StartMessageEvent) {
StartMessageEvent startMessageEvent = (StartMessageEvent) definition;
allDataTypes.addAll(processAssignments(startMessageEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof StartSignalEvent) {
StartSignalEvent startSignalEvent = (StartSignalEvent) definition;
allDataTypes.addAll(processAssignments(startSignalEvent.getDataIOSet().getAssignmentsinfo()));
} else if (definition instanceof CustomTask) {
CustomTask customTask = (CustomTask) definition;
allDataTypes.addAll(processAssignments(customTask.getDataIOSet().getAssignmentsinfo()));
}
}
use of org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask in project kie-wb-common by kiegroup.
the class BaseTaskConverter method bpmnServiceTask.
BpmnNode bpmnServiceTask(org.eclipse.bpmn2.ServiceTask task) {
Node<View<GenericServiceTask>, Edge> node = factoryManager.newNode(task.getId(), GenericServiceTask.class);
GenericServiceTask definition = node.getContent().getDefinition();
GenericServiceTaskPropertyReader p = propertyReaderFactory.of(task);
if (p == null) {
throw new NullPointerException(task.getClass().getCanonicalName());
}
definition.setGeneral(new TaskGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
definition.setExecutionSet(new GenericServiceTaskExecutionSet(new GenericServiceTaskInfo(p.getGenericServiceTask()), p.getAssignmentsInfo(), new AdHocAutostart(p.isAdHocAutostart()), new IsAsync(p.isAsync()), new IsMultipleInstance(p.isMultipleInstance()), new MultipleInstanceExecutionMode(p.isSequential()), new MultipleInstanceCollectionInput(p.getCollectionInput()), new MultipleInstanceDataInput(p.getDataInput()), new MultipleInstanceCollectionOutput(p.getCollectionOutput()), new MultipleInstanceDataOutput(p.getDataOutput()), new MultipleInstanceCompletionCondition(p.getCompletionCondition()), new OnEntryAction(p.getOnEntryAction()), new OnExitAction(p.getOnExitAction()), new SLADueDate(p.getSLADueDate())));
node.getContent().setBounds(p.getBounds());
definition.setDimensionsSet(p.getRectangleDimensionsSet());
definition.setBackgroundSet(p.getBackgroundSet());
definition.setFontSet(p.getFontSet());
definition.setSimulationSet(p.getSimulationSet());
definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
return BpmnNode.of(node, p);
}
Aggregations