use of org.kie.workbench.common.stunner.bpmn.workitem.CustomTask in project kie-wb-common by kiegroup.
the class BaseTaskConverter method jbpmServiceTask.
private BpmnNode jbpmServiceTask(org.eclipse.bpmn2.Task task) {
final ServiceTaskPropertyReader serviceTaskPropertyReader = propertyReaderFactory.ofCustom(task);
final Node<View<CustomTask>, Edge> node = factoryManager.newNode(task.getId(), CustomTask.class);
final CustomTask definition = node.getContent().getDefinition();
definition.setName(serviceTaskPropertyReader.getServiceTaskName());
definition.getTaskType().setRawType(serviceTaskPropertyReader.getServiceTaskName());
definition.setDescription(serviceTaskPropertyReader.getServiceTaskDescription());
definition.setCategory(serviceTaskPropertyReader.getServiceTaskCategory());
definition.setDefaultHandler(serviceTaskPropertyReader.getServiceTaskDefaultHandler());
definition.setGeneral(new TaskGeneralSet(new Name(serviceTaskPropertyReader.getName()), new Documentation(serviceTaskPropertyReader.getDocumentation())));
definition.setDataIOSet(new DataIOSet(serviceTaskPropertyReader.getAssignmentsInfo()));
definition.setExecutionSet(new CustomTaskExecutionSet(new TaskName(serviceTaskPropertyReader.getTaskName()), new IsAsync(serviceTaskPropertyReader.isAsync()), new AdHocAutostart(serviceTaskPropertyReader.isAdHocAutoStart()), new OnEntryAction(serviceTaskPropertyReader.getOnEntryAction()), new OnExitAction(serviceTaskPropertyReader.getOnExitAction()), new SLADueDate(serviceTaskPropertyReader.getSlaDueDate())));
definition.setSimulationSet(serviceTaskPropertyReader.getSimulationSet());
definition.setAdvancedData(new AdvancedData(serviceTaskPropertyReader.getMetaDataAttributes()));
node.getContent().setBounds(serviceTaskPropertyReader.getBounds());
definition.setDimensionsSet(serviceTaskPropertyReader.getRectangleDimensionsSet());
definition.setBackgroundSet(serviceTaskPropertyReader.getBackgroundSet());
definition.setFontSet(serviceTaskPropertyReader.getFontSet());
return BpmnNode.of(node, serviceTaskPropertyReader);
}
use of org.kie.workbench.common.stunner.bpmn.workitem.CustomTask in project kie-wb-common by kiegroup.
the class BPMNPaletteDefinitionBuilderTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
when(definitionUtils.getDefinitionManager()).thenReturn(definitionManager);
when(definitionManager.adapters()).thenReturn(adapterManager);
when(adapterManager.registry()).thenReturn(adapterRegistry);
when(adapterRegistry.getDefinitionAdapter(any(Class.class))).thenReturn(widAdapter);
when(widAdapter.getId(eq(customTask))).thenReturn(DefinitionId.build(WID_NAME));
when(widAdapter.getCategory(eq(customTask))).thenReturn(WID_CAT);
when(widAdapter.getTitle(eq(customTask))).thenReturn(WID_DISPLAY_NAME);
when(widAdapter.getDescription(eq(customTask))).thenReturn(WID_DESC);
ExpandedPaletteDefinitionBuilder paletteDefinitionBuilder = spy(new ExpandedPaletteDefinitionBuilder(definitionUtils, profileManager, definitionsRegistry, translationService));
doAnswer(invocationOnMock -> {
Consumer<DefaultPaletteDefinition> definitionConsumer = (Consumer<DefaultPaletteDefinition>) invocationOnMock.getArguments()[1];
definitionConsumer.accept(PALETTE_DEFINITION);
return null;
}).when(paletteDefinitionBuilder).build(eq(canvasHandler), any(Consumer.class));
Function<WorkItemDefinition, CustomTask> serviceTaskBuilder = wid -> WID.equals(wid) ? customTask : null;
tested = new BPMNPaletteDefinitionBuilder(definitionManager, paletteDefinitionBuilder, translationService, () -> workItemDefinitionRegistry, serviceTaskBuilder, definitionUtils, new BPMNCategoryDefinitionProvider());
tested.init();
}
use of org.kie.workbench.common.stunner.bpmn.workitem.CustomTask in project kie-wb-common by kiegroup.
the class BaseTaskConverterTest method convertServiceTask.
@Test
public void convertServiceTask() {
org.eclipse.bpmn2.ServiceTask task = mock(org.eclipse.bpmn2.ServiceTask.class);
ServiceTaskPropertyReader serviceTaskPropertyReader = mock(ServiceTaskPropertyReader.class);
CustomTask definition = new CustomTask();
FeatureMap attributes = mock(FeatureMap.class);
FeatureMap.Entry ruleAttr = mock(FeatureMap.Entry.class);
EStructuralFeature ruleFeature = mock(EStructuralFeature.class);
when(factoryManager.newNode(any(), eq(CustomTask.class))).thenReturn(serviceTaskNode);
when(serviceTaskNode.getContent()).thenReturn(serviceTaskContent);
when(serviceTaskContent.getDefinition()).thenReturn(definition);
when(propertyReaderFactory.ofCustom(task)).thenReturn(serviceTaskPropertyReader);
when(task.getAnyAttribute()).thenReturn(attributes);
when(attributes.stream()).thenReturn(Stream.of(ruleAttr));
when(ruleAttr.getEStructuralFeature()).thenReturn(ruleFeature);
when(ruleAttr.getValue()).thenReturn("");
when(ruleFeature.getName()).thenReturn(CustomAttribute.serviceImplementation.name());
final BpmnNode converted = (BpmnNode) tested.convert(task).value();
assertNotEquals(converted.value(), noneTaskNode);
assertEquals(converted.value(), serviceTaskNode);
}
use of org.kie.workbench.common.stunner.bpmn.workitem.CustomTask 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.workitem.CustomTask in project kie-wb-common by kiegroup.
the class HashCodeAndEqualityTest method testServiceTaskHashCode.
@Test
public void testServiceTaskHashCode() {
CustomTask a = new CustomTask();
CustomTask b = new CustomTask();
assertEquals(a.hashCode(), b.hashCode());
}
Aggregations