Search in sources :

Example 56 with Element

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

the class BpmnParse method parseEventBasedGateway.

public ActivityImpl parseEventBasedGateway(Element eventBasedGwElement, Element parentElement, ScopeImpl scope) {
    ActivityImpl activity = createActivityOnScope(eventBasedGwElement, scope);
    activity.setActivityBehavior(new EventBasedGatewayActivityBehavior());
    activity.setScope(true);
    parseAsynchronousContinuationForActivity(eventBasedGwElement, activity);
    if (activity.isAsyncAfter()) {
        addError("'asyncAfter' not supported for " + eventBasedGwElement.getTagName() + " elements.", eventBasedGwElement);
    }
    parseExecutionListenersOnScope(eventBasedGwElement, activity);
    for (BpmnParseListener parseListener : parseListeners) {
        parseListener.parseEventBasedGateway(eventBasedGwElement, scope, activity);
    }
    // find all outgoing sequence flows:
    List<Element> sequenceFlows = parentElement.elements("sequenceFlow");
    // collect all siblings in a map
    Map<String, Element> siblingsMap = new HashMap<String, Element>();
    List<Element> siblings = parentElement.elements();
    for (Element sibling : siblings) {
        siblingsMap.put(sibling.attribute("id"), sibling);
    }
    for (Element sequenceFlow : sequenceFlows) {
        String sourceRef = sequenceFlow.attribute("sourceRef");
        String targetRef = sequenceFlow.attribute("targetRef");
        if (activity.getId().equals(sourceRef)) {
            Element sibling = siblingsMap.get(targetRef);
            if (sibling != null) {
                if (sibling.getTagName().equals(ActivityTypes.INTERMEDIATE_EVENT_CATCH)) {
                    parseIntermediateCatchEvent(sibling, scope, activity);
                } else {
                    addError("Event based gateway can only be connected to elements of type intermediateCatchEvent", sibling);
                }
            }
        }
    }
    return activity;
}
Also used : Element(org.camunda.bpm.engine.impl.util.xml.Element)

Example 57 with Element

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

the class BpmnParse method parseProcessDefinitionStartEvent.

protected void parseProcessDefinitionStartEvent(ActivityImpl startEventActivity, Element startEventElement, Element parentElement, ScopeImpl scope) {
    ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) scope;
    String initiatorVariableName = startEventElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "initiator");
    if (initiatorVariableName != null) {
        processDefinition.setProperty(PROPERTYNAME_INITIATOR_VARIABLE_NAME, initiatorVariableName);
    }
    // all start events share the same behavior:
    startEventActivity.setActivityBehavior(new NoneStartEventActivityBehavior());
    Element timerEventDefinition = startEventElement.element(TIMER_EVENT_DEFINITION);
    Element messageEventDefinition = startEventElement.element(MESSAGE_EVENT_DEFINITION);
    Element signalEventDefinition = startEventElement.element(SIGNAL_EVENT_DEFINITION);
    Element conditionEventDefinition = startEventElement.element(CONDITIONAL_EVENT_DEFINITION);
    if (timerEventDefinition != null) {
        parseTimerStartEventDefinition(timerEventDefinition, startEventActivity, processDefinition);
    } else if (messageEventDefinition != null) {
        startEventActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.START_EVENT_MESSAGE);
        EventSubscriptionDeclaration messageStartEventSubscriptionDeclaration = parseMessageEventDefinition(messageEventDefinition);
        messageStartEventSubscriptionDeclaration.setActivityId(startEventActivity.getId());
        messageStartEventSubscriptionDeclaration.setStartEvent(true);
        ensureNoExpressionInMessageStartEvent(messageEventDefinition, messageStartEventSubscriptionDeclaration);
        addEventSubscriptionDeclaration(messageStartEventSubscriptionDeclaration, processDefinition, startEventElement);
    } else if (signalEventDefinition != null) {
        startEventActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.START_EVENT_SIGNAL);
        startEventActivity.setEventScope(scope);
        parseSignalCatchEventDefinition(signalEventDefinition, startEventActivity, true);
    } else if (conditionEventDefinition != null) {
        startEventActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.START_EVENT_CONDITIONAL);
        ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition(conditionEventDefinition, startEventActivity);
        conditionalEventDefinition.setStartEvent(true);
        conditionalEventDefinition.setActivityId(startEventActivity.getId());
        startEventActivity.getProperties().set(BpmnProperties.CONDITIONAL_EVENT_DEFINITION, conditionalEventDefinition);
        addEventSubscriptionDeclaration(conditionalEventDefinition, processDefinition, startEventElement);
    }
}
Also used : Element(org.camunda.bpm.engine.impl.util.xml.Element) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 58 with Element

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

the class BpmnParse method parseIntermediateTimerEventDefinition.

protected void parseIntermediateTimerEventDefinition(Element timerEventDefinition, ActivityImpl timerActivity) {
    timerActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.INTERMEDIATE_EVENT_TIMER);
    TimerDeclarationImpl timerDeclaration = parseTimer(timerEventDefinition, timerActivity, TimerCatchIntermediateEventJobHandler.TYPE);
    Element timeCycleElement = timerEventDefinition.element("timeCycle");
    if (timeCycleElement != null) {
        addTimeCycleWarning(timeCycleElement, "intermediate catch");
    }
    addTimerDeclaration(timerActivity.getEventScope(), timerDeclaration);
    for (BpmnParseListener parseListener : parseListeners) {
        parseListener.parseIntermediateTimerEventDefinition(timerEventDefinition, timerActivity);
    }
}
Also used : Element(org.camunda.bpm.engine.impl.util.xml.Element)

Example 59 with Element

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

the class BpmnParse method parseImports.

/**
 * Parses the rootElement importing structures
 */
protected void parseImports() {
    List<Element> imports = rootElement.elements("import");
    for (Element theImport : imports) {
        String importType = theImport.attribute("importType");
        XMLImporter importer = this.getImporter(importType, theImport);
        if (importer == null) {
            addError("Could not import item of type " + importType, theImport);
        } else {
            importer.importFrom(theImport, this);
        }
    }
}
Also used : Element(org.camunda.bpm.engine.impl.util.xml.Element)

Example 60 with Element

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

the class DefaultFailedJobParseListener method parseActivity.

protected void parseActivity(Element element, ActivityImpl activity) {
    if (isMultiInstance(activity)) {
        // in case of multi-instance, the extension elements is set according to the async attributes
        // the extension for multi-instance body is set on the element of the activity
        ActivityImpl miBody = activity.getParentFlowScopeActivity();
        if (isAsync(miBody)) {
            setFailedJobRetryTimeCycleValue(element, miBody);
        }
        // the extension for inner activity is set on the multiInstanceLoopCharacteristics element
        if (isAsync(activity)) {
            Element multiInstanceLoopCharacteristics = element.element(MULTI_INSTANCE_LOOP_CHARACTERISTICS);
            setFailedJobRetryTimeCycleValue(multiInstanceLoopCharacteristics, activity);
        }
    } else if (isAsync(activity)) {
        setFailedJobRetryTimeCycleValue(element, activity);
    }
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) Element(org.camunda.bpm.engine.impl.util.xml.Element)

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