Search in sources :

Example 1 with Association

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

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

the class AssociationImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Association.class, BPMN_ELEMENT_ASSOCIATION).namespaceUri(BPMN20_NS).extendsType(Artifact.class).instanceProvider(new ModelTypeInstanceProvider<Association>() {

        public Association newInstance(ModelTypeInstanceContext instanceContext) {
            return new AssociationImpl(instanceContext);
        }
    });
    sourceRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_SOURCE_REF).required().qNameAttributeReference(BaseElement.class).build();
    targetRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_TARGET_REF).required().qNameAttributeReference(BaseElement.class).build();
    associationDirectionAttribute = typeBuilder.enumAttribute(BPMN_ATTRIBUTE_ASSOCIATION_DIRECTION, AssociationDirection.class).defaultValue(AssociationDirection.None).build();
    typeBuilder.build();
}
Also used : Association(org.camunda.bpm.model.bpmn.instance.Association) AssociationDirection(org.camunda.bpm.model.bpmn.AssociationDirection) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext) Artifact(org.camunda.bpm.model.bpmn.instance.Artifact)

Example 3 with Association

use of org.camunda.bpm.model.bpmn.instance.Association 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)3 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 AssociationDirection (org.camunda.bpm.model.bpmn.AssociationDirection)1 Artifact (org.camunda.bpm.model.bpmn.instance.Artifact)1 ServiceTask (org.camunda.bpm.model.bpmn.instance.ServiceTask)1 UserTask (org.camunda.bpm.model.bpmn.instance.UserTask)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1