Search in sources :

Example 6 with ErrorEventDefinition

use of org.activiti.bpmn.model.ErrorEventDefinition in project Activiti by Activiti.

the class ErrorEventDefinitionParseHandler method executeParse.

protected void executeParse(BpmnParse bpmnParse, ErrorEventDefinition eventDefinition) {
    ErrorEventDefinition modelErrorEvent = (ErrorEventDefinition) eventDefinition;
    if (bpmnParse.getBpmnModel().containsErrorRef(modelErrorEvent.getErrorCode())) {
        String errorCode = bpmnParse.getBpmnModel().getErrors().get(modelErrorEvent.getErrorCode());
        modelErrorEvent.setErrorCode(errorCode);
    }
    ScopeImpl scope = bpmnParse.getCurrentScope();
    ActivityImpl activity = bpmnParse.getCurrentActivity();
    if (bpmnParse.getCurrentFlowElement() instanceof StartEvent) {
        if (scope.getProperty(PROPERTYNAME_INITIAL) == null) {
            scope.setProperty(PROPERTYNAME_INITIAL, activity);
            // the scope of the event subscription is the parent of the event
            // subprocess (subscription must be created when parent is initialized)
            ScopeImpl catchingScope = ((ActivityImpl) scope).getParent();
            createErrorStartEventDefinition(modelErrorEvent, activity, catchingScope);
        }
    } else if (bpmnParse.getCurrentFlowElement() instanceof BoundaryEvent) {
        BoundaryEvent boundaryEvent = (BoundaryEvent) bpmnParse.getCurrentFlowElement();
        // non-interrupting not yet supported
        boolean interrupting = true;
        activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createBoundaryEventActivityBehavior(boundaryEvent, interrupting, activity));
        ActivityImpl parentActivity = scope.findActivity(boundaryEvent.getAttachedToRefId());
        createBoundaryErrorEventDefinition(modelErrorEvent, interrupting, parentActivity, activity);
    }
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) ErrorEventDefinition(org.activiti.bpmn.model.ErrorEventDefinition) StartEvent(org.activiti.bpmn.model.StartEvent) ScopeImpl(org.activiti.engine.impl.pvm.process.ScopeImpl)

Example 7 with ErrorEventDefinition

use of org.activiti.bpmn.model.ErrorEventDefinition in project Activiti by Activiti.

the class ErrorEventDefinitionParseHandler method createBoundaryErrorEventDefinition.

public void createBoundaryErrorEventDefinition(ErrorEventDefinition errorEventDefinition, boolean interrupting, ActivityImpl activity, ActivityImpl nestedErrorEventActivity) {
    nestedErrorEventActivity.setProperty("type", "boundaryError");
    ScopeImpl catchingScope = nestedErrorEventActivity.getParent();
    ((ActivityImpl) catchingScope).setScope(true);
    org.activiti.engine.impl.bpmn.parser.ErrorEventDefinition definition = new org.activiti.engine.impl.bpmn.parser.ErrorEventDefinition(nestedErrorEventActivity.getId());
    definition.setErrorCode(errorEventDefinition.getErrorCode());
    addErrorEventDefinition(definition, catchingScope);
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) ErrorEventDefinition(org.activiti.bpmn.model.ErrorEventDefinition) ScopeImpl(org.activiti.engine.impl.pvm.process.ScopeImpl)

Example 8 with ErrorEventDefinition

use of org.activiti.bpmn.model.ErrorEventDefinition in project Activiti by Activiti.

the class BoundaryEventXMLConverter method convertXMLToElement.

@Override
protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
    BoundaryEvent boundaryEvent = new BoundaryEvent();
    BpmnXMLUtil.addXMLLocation(boundaryEvent, xtr);
    if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_BOUNDARY_CANCELACTIVITY))) {
        String cancelActivity = xtr.getAttributeValue(null, ATTRIBUTE_BOUNDARY_CANCELACTIVITY);
        if (ATTRIBUTE_VALUE_FALSE.equalsIgnoreCase(cancelActivity)) {
            boundaryEvent.setCancelActivity(false);
        }
    }
    boundaryEvent.setAttachedToRefId(xtr.getAttributeValue(null, ATTRIBUTE_BOUNDARY_ATTACHEDTOREF));
    parseChildElements(getXMLElementName(), boundaryEvent, model, xtr);
    // Explicitly set cancel activity to false for error boundary events
    if (boundaryEvent.getEventDefinitions().size() == 1) {
        EventDefinition eventDef = boundaryEvent.getEventDefinitions().get(0);
        if (eventDef instanceof ErrorEventDefinition) {
            boundaryEvent.setCancelActivity(false);
        }
    }
    return boundaryEvent;
}
Also used : BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) ErrorEventDefinition(org.activiti.bpmn.model.ErrorEventDefinition) ErrorEventDefinition(org.activiti.bpmn.model.ErrorEventDefinition) EventDefinition(org.activiti.bpmn.model.EventDefinition)

Example 9 with ErrorEventDefinition

use of org.activiti.bpmn.model.ErrorEventDefinition in project Activiti by Activiti.

the class BaseBpmnJsonConverter method convertJsonToErrorDefinition.

protected void convertJsonToErrorDefinition(JsonNode objectNode, Event event) {
    String errorRef = getPropertyValueAsString(PROPERTY_ERRORREF, objectNode);
    ErrorEventDefinition eventDefinition = new ErrorEventDefinition();
    eventDefinition.setErrorCode(errorRef);
    event.getEventDefinitions().add(eventDefinition);
}
Also used : ErrorEventDefinition(org.activiti.bpmn.model.ErrorEventDefinition)

Example 10 with ErrorEventDefinition

use of org.activiti.bpmn.model.ErrorEventDefinition in project Activiti by Activiti.

the class EndEventJsonConverter method getStencilId.

protected String getStencilId(BaseElement baseElement) {
    EndEvent endEvent = (EndEvent) baseElement;
    List<EventDefinition> eventDefinitions = endEvent.getEventDefinitions();
    if (eventDefinitions.size() != 1) {
        return STENCIL_EVENT_END_NONE;
    }
    EventDefinition eventDefinition = eventDefinitions.get(0);
    if (eventDefinition instanceof ErrorEventDefinition) {
        return STENCIL_EVENT_END_ERROR;
    } else if (eventDefinition instanceof CancelEventDefinition) {
        return STENCIL_EVENT_END_CANCEL;
    } else if (eventDefinition instanceof TerminateEventDefinition) {
        return STENCIL_EVENT_END_TERMINATE;
    } else {
        return STENCIL_EVENT_END_NONE;
    }
}
Also used : ErrorEventDefinition(org.activiti.bpmn.model.ErrorEventDefinition) EndEvent(org.activiti.bpmn.model.EndEvent) CancelEventDefinition(org.activiti.bpmn.model.CancelEventDefinition) TerminateEventDefinition(org.activiti.bpmn.model.TerminateEventDefinition) TerminateEventDefinition(org.activiti.bpmn.model.TerminateEventDefinition) ErrorEventDefinition(org.activiti.bpmn.model.ErrorEventDefinition) CancelEventDefinition(org.activiti.bpmn.model.CancelEventDefinition) EventDefinition(org.activiti.bpmn.model.EventDefinition)

Aggregations

ErrorEventDefinition (org.activiti.bpmn.model.ErrorEventDefinition)10 BoundaryEvent (org.activiti.bpmn.model.BoundaryEvent)5 EventDefinition (org.activiti.bpmn.model.EventDefinition)5 MessageEventDefinition (org.activiti.bpmn.model.MessageEventDefinition)4 SignalEventDefinition (org.activiti.bpmn.model.SignalEventDefinition)4 CancelEventDefinition (org.activiti.bpmn.model.CancelEventDefinition)3 TimerEventDefinition (org.activiti.bpmn.model.TimerEventDefinition)3 CompensateEventDefinition (org.activiti.bpmn.model.CompensateEventDefinition)2 TerminateEventDefinition (org.activiti.bpmn.model.TerminateEventDefinition)2 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)2 ScopeImpl (org.activiti.engine.impl.pvm.process.ScopeImpl)2 HashMap (java.util.HashMap)1 EndEvent (org.activiti.bpmn.model.EndEvent)1 Event (org.activiti.bpmn.model.Event)1 FlowElement (org.activiti.bpmn.model.FlowElement)1 StartEvent (org.activiti.bpmn.model.StartEvent)1 Transaction (org.activiti.bpmn.model.Transaction)1