Search in sources :

Example 1 with BaseElement

use of org.camunda.bpm.model.bpmn.instance.BaseElement 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);
}
Also used : BaseElement(org.camunda.bpm.model.bpmn.instance.BaseElement) ServiceTask(org.camunda.bpm.model.bpmn.instance.ServiceTask) IncreaseCurrentTimeServiceTask(org.camunda.bpm.engine.test.bpmn.event.compensate.helper.IncreaseCurrentTimeServiceTask) Association(org.camunda.bpm.model.bpmn.instance.Association) BoundaryEvent(org.camunda.bpm.model.bpmn.instance.BoundaryEvent) IncreaseCurrentTimeServiceTask(org.camunda.bpm.engine.test.bpmn.event.compensate.helper.IncreaseCurrentTimeServiceTask)

Example 2 with BaseElement

use of org.camunda.bpm.model.bpmn.instance.BaseElement 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)

Aggregations

Association (org.camunda.bpm.model.bpmn.instance.Association)2 BaseElement (org.camunda.bpm.model.bpmn.instance.BaseElement)2 BoundaryEvent (org.camunda.bpm.model.bpmn.instance.BoundaryEvent)2 IncreaseCurrentTimeServiceTask (org.camunda.bpm.engine.test.bpmn.event.compensate.helper.IncreaseCurrentTimeServiceTask)1 ServiceTask (org.camunda.bpm.model.bpmn.instance.ServiceTask)1 UserTask (org.camunda.bpm.model.bpmn.instance.UserTask)1