Search in sources :

Example 21 with UserTask

use of org.camunda.bpm.model.bpmn.instance.UserTask in project camunda-bpm-platform by camunda.

the class CompensationModels method addUserTaskCompensationHandler.

public static void addUserTaskCompensationHandler(BpmnModelInstance modelInstance, String boundaryEventId, String compensationHandlerId) {
    BoundaryEvent boundaryEvent = modelInstance.getModelElementById(boundaryEventId);
    BaseElement scope = (BaseElement) boundaryEvent.getParentElement();
    UserTask compensationHandler = modelInstance.newInstance(UserTask.class);
    compensationHandler.setId(compensationHandlerId);
    compensationHandler.setForCompensation(true);
    scope.addChildElement(compensationHandler);
    Association association = modelInstance.newInstance(Association.class);
    association.setAssociationDirection(AssociationDirection.One);
    association.setSource(boundaryEvent);
    association.setTarget(compensationHandler);
    scope.addChildElement(association);
}
Also used : BaseElement(org.camunda.bpm.model.bpmn.instance.BaseElement) Association(org.camunda.bpm.model.bpmn.instance.Association) BoundaryEvent(org.camunda.bpm.model.bpmn.instance.BoundaryEvent) UserTask(org.camunda.bpm.model.bpmn.instance.UserTask)

Example 22 with UserTask

use of org.camunda.bpm.model.bpmn.instance.UserTask in project camunda-bpm-platform by camunda.

the class TaskListenerProcessEngineServicesAccessTest method createModelAccessTask.

protected Task createModelAccessTask(BpmnModelInstance modelInstance, Class<?> delegateClass) {
    UserTask task = modelInstance.newInstance(UserTask.class);
    task.setId("userTask");
    CamundaTaskListener executionListener = modelInstance.newInstance(CamundaTaskListener.class);
    executionListener.setCamundaEvent(TaskListener.EVENTNAME_CREATE);
    executionListener.setCamundaClass(delegateClass.getName());
    task.builder().addExtensionElement(executionListener);
    return task;
}
Also used : CamundaTaskListener(org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener) UserTask(org.camunda.bpm.model.bpmn.instance.UserTask)

Aggregations

UserTask (org.camunda.bpm.model.bpmn.instance.UserTask)22 Test (org.junit.Test)18 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)12 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)12 Task (org.camunda.bpm.engine.task.Task)12 DelegateTask (org.camunda.bpm.engine.delegate.DelegateTask)3 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)3 ResourceRole (org.camunda.bpm.model.bpmn.instance.ResourceRole)3 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)2 Definitions (org.camunda.bpm.model.bpmn.instance.Definitions)2 HumanPerformer (org.camunda.bpm.model.bpmn.instance.HumanPerformer)2 Process (org.camunda.bpm.model.bpmn.instance.Process)2 StartEvent (org.camunda.bpm.model.bpmn.instance.StartEvent)2 CamundaTaskListener (org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener)2 ArrayList (java.util.ArrayList)1 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)1 Association (org.camunda.bpm.model.bpmn.instance.Association)1 BaseElement (org.camunda.bpm.model.bpmn.instance.BaseElement)1 BoundaryEvent (org.camunda.bpm.model.bpmn.instance.BoundaryEvent)1 Performer (org.camunda.bpm.model.bpmn.instance.Performer)1