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);
}
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();
}
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);
}
Aggregations