Java Code Examples for org.activiti.engine.impl.bpmn.parser.BpmnParse#setCurrentActivity()

The following examples show how to use org.activiti.engine.impl.bpmn.parser.BpmnParse#setCurrentActivity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractBpmnParseHandler.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
public ActivityImpl createActivityOnScope(BpmnParse bpmnParse, FlowElement flowElement, String xmlLocalName, ScopeImpl scopeElement) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Parsing activity {}", flowElement.getId());
    }

    ActivityImpl activity = scopeElement.createActivity(flowElement.getId());
    bpmnParse.setCurrentActivity(activity);

    activity.setProperty("name", flowElement.getName());
    activity.setProperty("documentation", flowElement.getDocumentation());
    if (flowElement instanceof Activity) {
        Activity modelActivity = (Activity) flowElement;
        activity.setProperty("default", modelActivity.getDefaultFlow());
        if (modelActivity.isForCompensation()) {
            activity.setProperty(PROPERTYNAME_IS_FOR_COMPENSATION, true);
        }
    } else if (flowElement instanceof Gateway) {
        activity.setProperty("default", ((Gateway) flowElement).getDefaultFlow());
    }
    activity.setProperty("type", xmlLocalName);

    return activity;
}
 
Example 2
Source File: BoundaryEventParseHandler.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
protected void executeParse(BpmnParse bpmnParse, BoundaryEvent boundaryEvent) {

    ActivityImpl parentActivity = findActivity(bpmnParse, boundaryEvent.getAttachedToRefId());
    if (parentActivity == null) {
        LOGGER.warn("Invalid reference in boundary event. Make sure that the referenced activity is defined in the same scope as the boundary event {}", boundaryEvent.getId());
        return;
    }

    ActivityImpl nestedActivity = createActivityOnScope(bpmnParse, boundaryEvent, BpmnXMLConstants.ELEMENT_EVENT_BOUNDARY, parentActivity);
    bpmnParse.setCurrentActivity(nestedActivity);

    EventDefinition eventDefinition = null;
    if (!boundaryEvent.getEventDefinitions().isEmpty()) {
        eventDefinition = boundaryEvent.getEventDefinitions().get(0);
    }

    if (eventDefinition instanceof TimerEventDefinition
            || eventDefinition instanceof org.flowable.bpmn.model.ErrorEventDefinition
            || eventDefinition instanceof SignalEventDefinition
            || eventDefinition instanceof CancelEventDefinition
            || eventDefinition instanceof MessageEventDefinition
            || eventDefinition instanceof org.flowable.bpmn.model.CompensateEventDefinition) {

        bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);

    } else {
        LOGGER.warn("Unsupported boundary event type for boundary event {}", boundaryEvent.getId());
    }
}