use of org.camunda.bpm.model.bpmn.instance.ServiceTask in project camunda-bpm-platform by camunda.
the class CompensateEventOrderTest method addServiceTaskCompensationHandler.
private void addServiceTaskCompensationHandler(BpmnModelInstance modelInstance, String boundaryEventId, String compensationHandlerId) {
BoundaryEvent boundaryEvent = modelInstance.getModelElementById(boundaryEventId);
BaseElement scope = (BaseElement) boundaryEvent.getParentElement();
ServiceTask compensationHandler = modelInstance.newInstance(ServiceTask.class);
compensationHandler.setId(compensationHandlerId);
compensationHandler.setForCompensation(true);
compensationHandler.setCamundaClass(IncreaseCurrentTimeServiceTask.class.getName());
scope.addChildElement(compensationHandler);
Association association = modelInstance.newInstance(Association.class);
association.setAssociationDirection(AssociationDirection.One);
association.setSource(boundaryEvent);
association.setTarget(compensationHandler);
scope.addChildElement(association);
}
use of org.camunda.bpm.model.bpmn.instance.ServiceTask in project camunda-bpmn-model by camunda.
the class ServiceTaskImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ServiceTask.class, BPMN_ELEMENT_SERVICE_TASK).namespaceUri(BPMN20_NS).extendsType(Task.class).instanceProvider(new ModelTypeInstanceProvider<ServiceTask>() {
public ServiceTask newInstance(ModelTypeInstanceContext instanceContext) {
return new ServiceTaskImpl(instanceContext);
}
});
implementationAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_IMPLEMENTATION).defaultValue("##WebService").build();
operationRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_OPERATION_REF).qNameAttributeReference(Operation.class).build();
/**
* camunda extensions
*/
camundaClassAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CLASS).namespace(CAMUNDA_NS).build();
camundaDelegateExpressionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DELEGATE_EXPRESSION).namespace(CAMUNDA_NS).build();
camundaExpressionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_EXPRESSION).namespace(CAMUNDA_NS).build();
camundaResultVariableAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_RESULT_VARIABLE).namespace(CAMUNDA_NS).build();
camundaTopicAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_TOPIC).namespace(CAMUNDA_NS).build();
camundaTypeAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_TYPE).namespace(CAMUNDA_NS).build();
camundaTaskPriorityAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_TASK_PRIORITY).namespace(CAMUNDA_NS).build();
typeBuilder.build();
}
use of org.camunda.bpm.model.bpmn.instance.ServiceTask in project camunda-bpm-platform by camunda.
the class JavaDelegateProcessEngineServicesAccessTest method createModelAccessTask.
protected Task createModelAccessTask(BpmnModelInstance modelInstance, Class<?> delegateClass) {
ServiceTask serviceTask = modelInstance.newInstance(ServiceTask.class);
serviceTask.setId("serviceTask");
serviceTask.setCamundaClass(delegateClass.getName());
return serviceTask;
}
use of org.camunda.bpm.model.bpmn.instance.ServiceTask in project camunda-bpm-platform by camunda.
the class ServiceTaskBpmnModelExecutionContextTest method testJavaDelegateModelExecutionContext.
public void testJavaDelegateModelExecutionContext() {
deploy();
runtimeService.startProcessInstanceByKey(PROCESS_ID);
BpmnModelInstance modelInstance = ModelExecutionContextServiceTask.modelInstance;
assertNotNull(modelInstance);
Model model = modelInstance.getModel();
Collection<ModelElementInstance> events = modelInstance.getModelElementsByType(model.getType(Event.class));
assertEquals(2, events.size());
Collection<ModelElementInstance> tasks = modelInstance.getModelElementsByType(model.getType(Task.class));
assertEquals(1, tasks.size());
Process process = (Process) modelInstance.getDefinitions().getRootElements().iterator().next();
assertEquals(PROCESS_ID, process.getId());
assertTrue(process.isExecutable());
ServiceTask serviceTask = ModelExecutionContextServiceTask.serviceTask;
assertNotNull(serviceTask);
assertEquals(ModelExecutionContextServiceTask.class.getName(), serviceTask.getCamundaClass());
}
Aggregations