Search in sources :

Example 51 with Element

use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.

the class BpmnParse method parseEscalations.

protected void parseEscalations() {
    for (Element element : rootElement.elements("escalation")) {
        String id = element.attribute("id");
        if (id == null) {
            addError("escalation must have an id", element);
        } else {
            Escalation escalation = createEscalation(id, element);
            escalations.put(id, escalation);
        }
    }
}
Also used : Element(org.camunda.bpm.engine.impl.util.xml.Element)

Example 52 with Element

use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.

the class BpmnParse method parseAsynchronousContinuationForActivity.

/**
 * Parse async continuation of an activity and create async jobs for the activity.
 * <br/> <br/>
 * When the activity is marked as multi instance, then async jobs create instead for the multi instance body.
 * When the wrapped activity has async characteristics in 'multiInstanceLoopCharacteristics' element,
 * then async jobs create additionally for the wrapped activity.
 */
protected void parseAsynchronousContinuationForActivity(Element activityElement, ActivityImpl activity) {
    // can't use #getMultiInstanceScope here to determine whether the task is multi-instance,
    // since the property hasn't been set yet (cf parseActivity)
    ActivityImpl parentFlowScopeActivity = activity.getParentFlowScopeActivity();
    if (parentFlowScopeActivity != null && parentFlowScopeActivity.getActivityBehavior() instanceof MultiInstanceActivityBehavior && !activity.isCompensationHandler()) {
        parseAsynchronousContinuation(activityElement, parentFlowScopeActivity);
        Element miLoopCharacteristics = activityElement.element("multiInstanceLoopCharacteristics");
        parseAsynchronousContinuation(miLoopCharacteristics, activity);
    } else {
        parseAsynchronousContinuation(activityElement, activity);
    }
}
Also used : Element(org.camunda.bpm.engine.impl.util.xml.Element)

Example 53 with Element

use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.

the class BpmnParse method parseStartAuthorization.

protected void parseStartAuthorization(Element scopeElement, ProcessDefinition definition) {
    ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) definition;
    // parse activiti:potentialStarters
    Element extentionsElement = scopeElement.element("extensionElements");
    if (extentionsElement != null) {
        List<Element> potentialStarterElements = extentionsElement.elementsNS(CAMUNDA_BPMN_EXTENSIONS_NS, POTENTIAL_STARTER);
        for (Element potentialStarterElement : potentialStarterElements) {
            parsePotentialStarterResourceAssignment(potentialStarterElement, processDefinition);
        }
    }
    // parse activiti:candidateStarterUsers
    String candidateUsersString = scopeElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, CANDIDATE_STARTER_USERS_EXTENSION);
    if (candidateUsersString != null) {
        List<String> candidateUsers = parseCommaSeparatedList(candidateUsersString);
        for (String candidateUser : candidateUsers) {
            processDefinition.addCandidateStarterUserIdExpression(expressionManager.createExpression(candidateUser.trim()));
        }
    }
    // Candidate activiti:candidateStarterGroups
    String candidateGroupsString = scopeElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, CANDIDATE_STARTER_GROUPS_EXTENSION);
    if (candidateGroupsString != null) {
        List<String> candidateGroups = parseCommaSeparatedList(candidateGroupsString);
        for (String candidateGroup : candidateGroups) {
            processDefinition.addCandidateStarterGroupIdExpression(expressionManager.createExpression(candidateGroup.trim()));
        }
    }
}
Also used : Element(org.camunda.bpm.engine.impl.util.xml.Element) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 54 with Element

use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.

the class BpmnParse method parseIntermediateCatchEvent.

public ActivityImpl parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scopeElement, ActivityImpl eventBasedGateway) {
    ActivityImpl nestedActivity = createActivityOnScope(intermediateEventElement, scopeElement);
    Element timerEventDefinition = intermediateEventElement.element(TIMER_EVENT_DEFINITION);
    Element signalEventDefinition = intermediateEventElement.element(SIGNAL_EVENT_DEFINITION);
    Element messageEventDefinition = intermediateEventElement.element(MESSAGE_EVENT_DEFINITION);
    Element linkEventDefinitionElement = intermediateEventElement.element(LINK_EVENT_DEFINITION);
    Element conditionalEventDefinitionElement = intermediateEventElement.element(CONDITIONAL_EVENT_DEFINITION);
    // shared by all events except for link event
    IntermediateCatchEventActivityBehavior defaultCatchBehaviour = new IntermediateCatchEventActivityBehavior(eventBasedGateway != null);
    parseAsynchronousContinuationForActivity(intermediateEventElement, nestedActivity);
    boolean isEventBaseGatewayPresent = eventBasedGateway != null;
    if (isEventBaseGatewayPresent) {
        nestedActivity.setEventScope(eventBasedGateway);
        nestedActivity.setActivityStartBehavior(ActivityStartBehavior.CANCEL_EVENT_SCOPE);
    } else {
        nestedActivity.setEventScope(nestedActivity);
        nestedActivity.setScope(true);
    }
    nestedActivity.setActivityBehavior(defaultCatchBehaviour);
    if (timerEventDefinition != null) {
        parseIntermediateTimerEventDefinition(timerEventDefinition, nestedActivity);
    } else if (signalEventDefinition != null) {
        parseIntermediateSignalEventDefinition(signalEventDefinition, nestedActivity);
    } else if (messageEventDefinition != null) {
        parseIntermediateMessageEventDefinition(messageEventDefinition, nestedActivity);
    } else if (linkEventDefinitionElement != null) {
        if (isEventBaseGatewayPresent) {
            addError("IntermediateCatchLinkEvent is not allowed after an EventBasedGateway.", intermediateEventElement);
        }
        nestedActivity.setActivityBehavior(new IntermediateCatchLinkEventActivityBehavior());
        parseIntermediateLinkEventCatchBehavior(intermediateEventElement, nestedActivity, linkEventDefinitionElement);
    } else if (conditionalEventDefinitionElement != null) {
        ConditionalEventDefinition conditionalEvent = parseIntermediateConditionalEventDefinition(conditionalEventDefinitionElement, nestedActivity);
        nestedActivity.setActivityBehavior(new IntermediateConditionalEventBehavior(conditionalEvent, isEventBaseGatewayPresent));
    } else {
        addError("Unsupported intermediate catch event type", intermediateEventElement);
    }
    for (BpmnParseListener parseListener : parseListeners) {
        parseListener.parseIntermediateCatchEvent(intermediateEventElement, scopeElement, nestedActivity);
    }
    parseExecutionListenersOnScope(intermediateEventElement, nestedActivity);
    return nestedActivity;
}
Also used : Element(org.camunda.bpm.engine.impl.util.xml.Element)

Example 55 with Element

use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.

the class BpmnParse method parseStartEvents.

/**
 * Parses the start events of a certain level in the process (process,
 * subprocess or another scope).
 *
 * @param parentElement
 *          The 'parent' element that contains the start events (process,
 *          subprocess).
 * @param scope
 *          The {@link ScopeImpl} to which the start events must be added.
 */
public void parseStartEvents(Element parentElement, ScopeImpl scope) {
    List<Element> startEventElements = parentElement.elements("startEvent");
    List<ActivityImpl> startEventActivities = new ArrayList<ActivityImpl>();
    for (Element startEventElement : startEventElements) {
        ActivityImpl startEventActivity = createActivityOnScope(startEventElement, scope);
        parseAsynchronousContinuationForActivity(startEventElement, startEventActivity);
        if (scope instanceof ProcessDefinitionEntity) {
            parseProcessDefinitionStartEvent(startEventActivity, startEventElement, parentElement, scope);
            startEventActivities.add(startEventActivity);
        } else {
            parseScopeStartEvent(startEventActivity, startEventElement, parentElement, (ActivityImpl) scope);
        }
        ensureNoIoMappingDefined(startEventElement);
        for (BpmnParseListener parseListener : parseListeners) {
            parseListener.parseStartEvent(startEventElement, scope, startEventActivity);
        }
        parseExecutionListenersOnScope(startEventElement, startEventActivity);
    }
    if (scope instanceof ProcessDefinitionEntity) {
        selectInitial(startEventActivities, (ProcessDefinitionEntity) scope, parentElement);
        parseStartFormHandlers(startEventElements, (ProcessDefinitionEntity) scope);
    }
}
Also used : Element(org.camunda.bpm.engine.impl.util.xml.Element) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Aggregations

Element (org.camunda.bpm.engine.impl.util.xml.Element)60 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)5 BpmnParseException (org.camunda.bpm.engine.BpmnParseException)4 ExecutableScript (org.camunda.bpm.engine.impl.scripting.ExecutableScript)4 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)3 ProcessEngineXml (org.camunda.bpm.container.impl.metadata.spi.ProcessEngineXml)2 TaskListener (org.camunda.bpm.engine.delegate.TaskListener)2 Condition (org.camunda.bpm.engine.impl.Condition)2 IoMapping (org.camunda.bpm.engine.impl.core.variable.mapping.IoMapping)2 ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)2 ActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)2 ScriptCondition (org.camunda.bpm.engine.impl.scripting.ScriptCondition)2 ClassDelegateTaskListener (org.camunda.bpm.engine.impl.task.listener.ClassDelegateTaskListener)2 DelegateExpressionTaskListener (org.camunda.bpm.engine.impl.task.listener.DelegateExpressionTaskListener)2 ExpressionTaskListener (org.camunda.bpm.engine.impl.task.listener.ExpressionTaskListener)2 ScriptTaskListener (org.camunda.bpm.engine.impl.task.listener.ScriptTaskListener)2 LinkedHashMap (java.util.LinkedHashMap)1 TreeMap (java.util.TreeMap)1 ProcessArchiveXml (org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml)1