Class BpmnParse

  • All Implemented Interfaces:
    ContentHandler, DTDHandler, EntityResolver, ErrorHandler

    public class BpmnParse
    extends Parse
    Specific parsing of one BPMN 2.0 XML file, created by the BpmnParser. Instances of this class should not be reused and are also not threadsafe.
    Tom Baeyens, Bernd Ruecker, Joram Barrez, Christian Stettler, Frederik Heremans, Falko Menge, Esteban Robles, Daniel Meyer, Saeid Mirzaei, Nico Rehwaldt, Ronny Bräunlich, Christopher Zell, Deivarayan Azhagappan, Ingo Richtsmeier
    • Constructor Detail

    • Method Detail

      • parseRootElement

        protected void parseRootElement()
        Parses the 'definitions' root element
      • collectElementIds

        protected void collectElementIds()
      • parseDefinitionsAttributes

        protected void parseDefinitionsAttributes()
      • resolveName

        protected String resolveName​(String name)
      • parseImports

        protected void parseImports()
        Parses the rootElement importing structures
      • parseMessages

        public void parseMessages()
        Parses the messages of the given definitions file. Messages are not contained within a process element, but they can be referenced from inner process elements.
      • parseSignals

        protected void parseSignals()
        Parses the signals of the given definitions file. Signals are not contained within a process element, but they can be referenced from inner process elements.
      • parseErrors

        public void parseErrors()
      • parseEscalations

        protected void parseEscalations()
      • parseProcessDefinitions

        public void parseProcessDefinitions()
        Parses all the process definitions defined within the 'definitions' root element.
      • parseCollaboration

        public void parseCollaboration()
        Parses the collaboration definition defined within the 'definitions' root element and get all participants to lookup their process references during DI parsing.
      • parseProcess

        public ProcessDefinitionEntity parseProcess​(Element processElement)
        Parses one process (ie anything inside a <process> element).
        processElement - The 'process' element.
        The parsed version of the XML: a ProcessDefinitionImpl object.
      • parseLanes

        protected void parseLanes​(Element laneSetElement,
                                  LaneSet laneSet)
      • parseScope

        public void parseScope​(Element scopeElement,
                               ScopeImpl parentScope)
        Parses a scope: a process, subprocess, etc. Note that a process definition is a scope on itself.
        scopeElement - The XML element defining the scope
        parentScope - The scope that contains the nested scope.
      • parseIntermediateCatchEvents

        protected void parseIntermediateCatchEvents​(Element scopeElement,
                                                    ScopeImpl parentScope,
                                                    Map<String,​Element> intermediateCatchEventElements)
      • parseProcessDefinitionCustomExtensions

        protected void parseProcessDefinitionCustomExtensions​(Element scopeElement,
                                                              ProcessDefinition definition)
      • parseStartAuthorization

        protected void parseStartAuthorization​(Element scopeElement,
                                               ProcessDefinition definition)
      • parsePotentialStarterResourceAssignment

        protected void parsePotentialStarterResourceAssignment​(Element performerElement,
                                                               ProcessDefinitionEntity processDefinition)
      • parseAssociationOfCompensationBoundaryEvent

        protected void parseAssociationOfCompensationBoundaryEvent​(Element associationElement,
                                                                   ActivityImpl sourceActivity,
                                                                   ActivityImpl targetActivity)
      • parseCompensationHandlers

        protected void parseCompensationHandlers​(ScopeImpl parentScope,
                                                 Map<String,​Element> compensationHandlers)
      • parseStartEvents

        public void parseStartEvents​(Element parentElement,
                                     ScopeImpl scope)
        Parses the start events of a certain level in the process (process, subprocess or another scope).
        parentElement - The 'parent' element that contains the start events (process, subprocess).
        scope - The ScopeImpl to which the start events must be added.
      • parseProcessDefinitionStartEvent

        protected void parseProcessDefinitionStartEvent​(ActivityImpl startEventActivity,
                                                        Element startEventElement,
                                                        Element parentElement,
                                                        ScopeImpl scope)
      • parseCompensationEventSubprocess

        protected void parseCompensationEventSubprocess​(ActivityImpl startEventActivity,
                                                        Element startEventElement,
                                                        ActivityImpl scopeActivity,
                                                        Element compensateEventDefinition)
      • parseErrorStartEventDefinition

        protected void parseErrorStartEventDefinition​(Element errorEventDefinition,
                                                      ActivityImpl startEventActivity)
      • setErrorCodeVariableOnErrorEventDefinition

        protected void setErrorCodeVariableOnErrorEventDefinition​(Element errorEventDefinition,
                                                                  ErrorEventDefinition definition)
        Sets the value for "camunda:errorCodeVariable" on the passed definition if it's present.
        errorEventDefinition - the XML errorEventDefinition tag
        definition - the errorEventDefintion that can get the errorCodeVariable value
      • setErrorMessageVariableOnErrorEventDefinition

        protected void setErrorMessageVariableOnErrorEventDefinition​(Element errorEventDefinition,
                                                                     ErrorEventDefinition definition)
        Sets the value for "camunda:errorMessageVariable" on the passed definition if it's present.
        errorEventDefinition - the XML errorEventDefinition tag
        definition - the errorEventDefintion that can get the errorMessageVariable value
      • parseActivities

        public void parseActivities​(List<Element> activityElements,
                                    Element parentElement,
                                    ScopeImpl scopeElement)
        Parses the activities of a certain level in the process (process, subprocess or another scope).
        activityElements - The list of activities to be parsed. This list may be filtered before.
        parentElement - The 'parent' element that contains the activities (process, subprocess).
        scopeElement - The ScopeImpl to which the activities must be added.
      • validateActivities

        public void validateActivities​(List<ActivityImpl> activities)
      • validateActivity

        protected void validateActivity​(ActivityImpl activity)
      • validateOutgoingFlows

        protected void validateOutgoingFlows​(ActivityImpl activity)
      • validateExclusiveGateway

        public void validateExclusiveGateway​(ActivityImpl activity)
      • parseIntermediateLinkEventCatchBehavior

        protected void parseIntermediateLinkEventCatchBehavior​(Element intermediateEventElement,
                                                               ActivityImpl activity,
                                                               Element linkEventDefinitionElement)
      • parseIntermediateMessageEventDefinition

        protected void parseIntermediateMessageEventDefinition​(Element messageEventDefinition,
                                                               ActivityImpl nestedActivity)
      • parseIntermediateThrowEvent

        public ActivityImpl parseIntermediateThrowEvent​(Element intermediateEventElement,
                                                        ScopeImpl scopeElement)
      • validateCatchCompensateEventDefinition

        protected void validateCatchCompensateEventDefinition​(Element compensateEventDefinitionElement,
                                                              String parentElementId)
      • parseBoundaryCompensateEventDefinition

        protected void parseBoundaryCompensateEventDefinition​(Element compensateEventDefinition,
                                                              ActivityImpl activity)
      • parseMultiInstanceLoopCharacteristics

        public ScopeImpl parseMultiInstanceLoopCharacteristics​(Element activityElement,
                                                               ScopeImpl scope)
        Parses loopCharacteristics (standardLoop/Multi-instance) of an activity, if any is defined.
      • getIdForMiBody

        public static String getIdForMiBody​(String id)
      • createActivityOnScope

        public ActivityImpl createActivityOnScope​(Element activityElement,
                                                  ScopeImpl scopeElement)
        Parses the generic information of an activity element (id, name, documentation, etc.), and creates a new ActivityImpl on the given scope element.
      • setActivityAsyncDelegates

        protected void setActivityAsyncDelegates​(ActivityImpl activity)
        Sets the delegates for the activity, which will be called if the attribute asyncAfter or asyncBefore was changed.
        activity - the activity which gets the delegates
      • addMessageJobDeclaration

        protected void addMessageJobDeclaration​(MessageJobDeclaration messageJobDeclaration,
                                                ActivityImpl activity,
                                                boolean exclusive)
        Adds the new message job declaration to existing declarations. There will be executed an existing check before the adding is executed.
        messageJobDeclaration - the new message job declaration
        activity - the corresponding activity
        exclusive - the flag which indicates if the async should be exclusive
      • exists

        protected boolean exists​(MessageJobDeclaration msgJobdecl,
                                 String procDefKey,
                                 String activityId)
        Checks whether the message declaration already exists.
        msgJobdecl - the message job declaration which is searched
        procDefKey - the corresponding process definition key
        activityId - the corresponding activity id
        true if the message job declaration exists, false otherwise
      • removeMessageJobDeclarationWithJobConfiguration

        protected void removeMessageJobDeclarationWithJobConfiguration​(ActivityImpl activity,
                                                                       String jobConfiguration)
        Removes a job declaration which belongs to the given activity and has the given job configuration.
        activity - the activity of the job declaration
        jobConfiguration - the job configuration of the declaration
      • parseDocumentation

        public String parseDocumentation​(Element element)
      • parseDocumentation

        public static String parseDocumentation​(List<String> docStrings)
      • isCompensationHandler

        protected boolean isCompensationHandler​(Element activityElement)
      • parseExclusiveGateway

        public ActivityImpl parseExclusiveGateway​(Element exclusiveGwElement,
                                                  ScopeImpl scope)
        Parses an exclusive gateway declaration.
      • parseInclusiveGateway

        public ActivityImpl parseInclusiveGateway​(Element inclusiveGwElement,
                                                  ScopeImpl scope)
        Parses an inclusive gateway declaration.
      • parseParallelGateway

        public ActivityImpl parseParallelGateway​(Element parallelGwElement,
                                                 ScopeImpl scope)
        Parses a parallel gateway declaration.
      • parseResultVariable

        protected String parseResultVariable​(Element element)
      • parseServiceTask

        public ActivityImpl parseServiceTask​(Element serviceTaskElement,
                                             ScopeImpl scope)
        Parses a serviceTask declaration.
      • parseServiceTaskLike

        public void parseServiceTaskLike​(ActivityImpl activity,
                                         String elementName,
                                         Element serviceTaskElement,
                                         Element camundaPropertiesElement,
                                         ScopeImpl scope)
        elementName -
        serviceTaskElement - the element that contains the camunda service task definition (e.g. camunda:class attributes)
        camundaPropertiesElement - the element that contains the camunda:properties extension elements that apply to this service task. Usually, but not always, this is the same as serviceTaskElement
        scope -
      • validateServiceTaskLike

        protected void validateServiceTaskLike​(ActivityImpl activity,
                                               String elementName,
                                               Element serviceTaskElement)
      • parseBusinessRuleTask

        public ActivityImpl parseBusinessRuleTask​(Element businessRuleTaskElement,
                                                  ScopeImpl scope)
        Parses a businessRuleTask declaration.
      • parseDmnBusinessRuleTask

        protected ActivityImpl parseDmnBusinessRuleTask​(Element businessRuleTaskElement,
                                                        ScopeImpl scope)
        Parse a Business Rule Task which references a decision.
      • parseAsynchronousContinuationForActivity

        protected void parseAsynchronousContinuationForActivity​(Element activityElement,
                                                                ActivityImpl activity)
        Parse async continuation of an activity and create async jobs for the activity.

        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.
      • parseAsynchronousContinuation

        protected void parseAsynchronousContinuation​(Element element,
                                                     ActivityImpl activity)
        Parse async continuation of the given element and create async jobs for the activity.
        element - with async characteristics
        activity -
      • addJobDeclarationToProcessDefinition

        protected void addJobDeclarationToProcessDefinition​(JobDeclaration<?,​?> jobDeclaration,
                                                            ProcessDefinition processDefinition)
      • parseExternalServiceTask

        protected void parseExternalServiceTask​(ActivityImpl activity,
                                                Element serviceTaskElement,
                                                Element camundaPropertiesElement)
      • validateFieldDeclarationsForEmail

        protected void validateFieldDeclarationsForEmail​(Element serviceTaskElement,
                                                         List<FieldDeclaration> fieldDeclarations)
      • validateFieldDeclarationsForShell

        protected void validateFieldDeclarationsForShell​(Element serviceTaskElement,
                                                         List<FieldDeclaration> fieldDeclarations)
      • getStringValueFromAttributeOrElement

        protected String getStringValueFromAttributeOrElement​(String attributeName,
                                                              String elementName,
                                                              Element element,
                                                              String ancestorElementId)
      • parseTask

        public ActivityImpl parseTask​(Element taskElement,
                                      ScopeImpl scope)
        Parses a task with no specific type (behaves as passthrough).
      • parseHumanPerformer

        protected void parseHumanPerformer​(Element taskElement,
                                           TaskDefinition taskDefinition)
      • parsePotentialOwner

        protected void parsePotentialOwner​(Element taskElement,
                                           TaskDefinition taskDefinition)
      • parseHumanPerformerResourceAssignment

        protected void parseHumanPerformerResourceAssignment​(Element performerElement,
                                                             TaskDefinition taskDefinition)
      • parsePotentialOwnerResourceAssignment

        protected void parsePotentialOwnerResourceAssignment​(Element performerElement,
                                                             TaskDefinition taskDefinition)
      • getAssignmentId

        protected String getAssignmentId​(String expression,
                                         String prefix)
      • parseCommaSeparatedList

        protected List<String> parseCommaSeparatedList​(String s)
        Parses the given String as a list of comma separated entries, where an entry can possibly be an expression that has comma's. If somebody is smart enough to write a regex for this, please let us know.
        the entries of the comma separated list, trimmed.
      • parseEndEvents

        public void parseEndEvents​(Element parentElement,
                                   ScopeImpl scope)
        Parses the end events of a certain level in the process (process, subprocess or another scope).
        parentElement - The 'parent' element that contains the end events (process, subprocess).
        scope - The ScopeImpl to which the end events must be added.
      • parseBoundaryEvents

        public void parseBoundaryEvents​(Element parentElement,
                                        ScopeImpl flowScope)
        Parses the boundary events of a certain 'level' (process, subprocess or other scope). Note that the boundary events are not parsed during the parsing of the bpmn activities, since the semantics are different (boundaryEvent needs to be added as nested activity to the reference activity on PVM level).
        parentElement - The 'parent' element that contains the activities (process, subprocess).
        flowScope - The ScopeImpl to which the activities must be added.
      • parseBoundaryTimerEventDefinition

        public void parseBoundaryTimerEventDefinition​(Element timerEventDefinition,
                                                      boolean interrupting,
                                                      ActivityImpl boundaryActivity)
        Parses a boundary timer event. The end-result will be that the given nested activity will get the appropriate ActivityBehavior.
        timerEventDefinition - The XML element corresponding with the timer event details
        interrupting - Indicates whether this timer is interrupting.
        boundaryActivity - The activity which maps to the structure of the timer event on the boundary of another activity. Note that this is NOT the activity onto which the boundary event is attached, but a nested activity inside this activity, specifically created for this event.
      • parseBoundarySignalEventDefinition

        public void parseBoundarySignalEventDefinition​(Element element,
                                                       boolean interrupting,
                                                       ActivityImpl signalActivity)
      • parseBoundaryMessageEventDefinition

        public void parseBoundaryMessageEventDefinition​(Element element,
                                                        boolean interrupting,
                                                        ActivityImpl messageActivity)
      • parseTimerStartEventDefinitionForEventSubprocess

        protected void parseTimerStartEventDefinitionForEventSubprocess​(Element timerEventDefinition,
                                                                        ActivityImpl timerActivity,
                                                                        boolean interrupting)
      • parseIntermediateSignalEventDefinition

        protected void parseIntermediateSignalEventDefinition​(Element element,
                                                              ActivityImpl signalActivity)
      • parseSignalCatchEventDefinition

        protected void parseSignalCatchEventDefinition​(Element element,
                                                       ActivityImpl signalActivity,
                                                       boolean isStartEvent)
      • parseSignalEventDefinition

        protected EventSubscriptionDeclaration parseSignalEventDefinition​(Element signalEventDefinitionElement,
                                                                          boolean isThrowing,
                                                                          String signalElementId)
        Parses the Signal Event Definition XML including payload definition.
        signalEventDefinitionElement - the Signal Event Definition element
        isThrowing - true if a Throwing signal event is being parsed
      • parseIntermediateTimerEventDefinition

        protected void parseIntermediateTimerEventDefinition​(Element timerEventDefinition,
                                                             ActivityImpl timerActivity)
      • parseBoundaryErrorEventDefinition

        public void parseBoundaryErrorEventDefinition​(Element errorEventDefinition,
                                                      ActivityImpl boundaryEventActivity)
      • parseBoundaryEscalationEventDefinition

        protected void parseBoundaryEscalationEventDefinition​(Element escalationEventDefinitionElement,
                                                              boolean cancelActivity,
                                                              ActivityImpl boundaryEventActivity)
      • findEscalationForEscalationEventDefinition

        protected Escalation findEscalationForEscalationEventDefinition​(Element escalationEventDefinition,
                                                                        String escalationElementId)
        Find the referenced escalation of the given escalation event definition. Add errors if the referenced escalation not found.
        referenced escalation or null, if referenced escalation not found
      • createEscalationEventDefinitionForEscalationHandler

        protected EscalationEventDefinition createEscalationEventDefinitionForEscalationHandler​(Element escalationEventDefinitionElement,
                                                                                                ActivityImpl escalationHandler,
                                                                                                boolean cancelActivity,
                                                                                                String parentElementId)
      • parseBoundaryConditionalEventDefinition

        public BoundaryConditionalEventActivityBehavior parseBoundaryConditionalEventDefinition​(Element element,
                                                                                                boolean interrupting,
                                                                                                ActivityImpl conditionalActivity)
        Parses the given element as conditional boundary event.
        element - the XML element which contains the conditional event information
        interrupting - indicates if the event is interrupting or not
        conditionalActivity - the conditional event activity
        the boundary conditional event behavior which contains the condition
      • parseIntermediateConditionalEventDefinition

        public ConditionalEventDefinition parseIntermediateConditionalEventDefinition​(Element element,
                                                                                      ActivityImpl conditionalActivity)
        Parses the given element as intermediate conditional event.
        element - the XML element which contains the conditional event information
        conditionalActivity - the conditional event activity
        returns the conditional activity with the parsed information
      • parseConditionalStartEventForEventSubprocess

        public ConditionalEventDefinition parseConditionalStartEventForEventSubprocess​(Element element,
                                                                                       ActivityImpl conditionalActivity,
                                                                                       boolean interrupting)
        Parses the given element as conditional start event of an event subprocess.
        element - the XML element which contains the conditional event information
        interrupting - indicates if the event is interrupting or not
        conditionalActivity - the conditional event activity
      • parseConditionalEventDefinition

        protected ConditionalEventDefinition parseConditionalEventDefinition​(Element element,
                                                                             ActivityImpl conditionalActivity)
        Parses the given element and returns an ConditionalEventDefinition object.
        element - the XML element which contains the conditional event information
        conditionalActivity - the conditional event activity
        the conditional event definition which was parsed
      • parseSubProcess

        public ActivityImpl parseSubProcess​(Element subProcessElement,
                                            ScopeImpl scope)
        Parses a subprocess (formally known as an embedded subprocess): a subprocess defined within another process definition.
        subProcessElement - The XML element corresponding with the subprocess definition
        scope - The current scope on which the subprocess is defined.
      • parseCallActivity

        public ActivityImpl parseCallActivity​(Element callActivityElement,
                                              ScopeImpl scope,
                                              boolean isMultiInstance)
        Parses a call activity (currently only supporting calling subprocesses).
        callActivityElement - The XML element defining the call activity
        scope - The current scope on which the call activity is defined.
      • parseInputParameter

        protected void parseInputParameter​(Element elementWithParameters,
                                           CallableElement callableElement)
      • attributeValueEquals

        protected boolean attributeValueEquals​(Element element,
                                               String attribute,
                                               String comparisonValue)
      • parseProperties

        public void parseProperties​(Element element,
                                    ActivityImpl activity)
        Parses the properties of an element (if any) that can contain properties (processes, activities, etc.) Returns true if property subelemens are found.
        element - The element that can contain properties.
        activity - The activity where the property declaration is done.
      • parseProperty

        public void parseProperty​(Element propertyElement,
                                  ActivityImpl activity)
        Parses one property definition.
        propertyElement - The 'property' element that defines how a property looks like and is handled.
      • parsePropertyCustomExtensions

        public void parsePropertyCustomExtensions​(ActivityImpl activity,
                                                  Element propertyElement,
                                                  String propertyName,
                                                  String propertyType)
        Parses the custom extensions for properties.
        activity - The activity where the property declaration is done.
        propertyElement - The 'property' element defining the property.
        propertyName - The name of the property.
        propertyType - The type of the property.
      • parseSequenceFlow

        public void parseSequenceFlow​(Element processElement,
                                      ScopeImpl scope,
                                      Map<String,​Element> compensationHandlers)
        Parses all sequence flow of a scope.
        processElement - The 'process' element wherein the sequence flow are defined.
        scope - The scope to which the sequence flow must be added.
        compensationHandlers -
      • parseSequenceFlowConditionExpression

        public void parseSequenceFlowConditionExpression​(Element seqFlowElement,
                                                         TransitionImpl seqFlow)
        Parses a condition expression on a sequence flow.
        seqFlowElement - The 'sequenceFlow' element that can contain a condition.
        seqFlow - The sequenceFlow object representation to which the condition must be added.
      • parseConditionExpression

        protected Condition parseConditionExpression​(Element conditionExprElement,
                                                     String ancestorElementId)
      • parseExecutionListenersOnScope

        public void parseExecutionListenersOnScope​(Element scopeElement,
                                                   ScopeImpl scope)
        Parses all execution-listeners on a scope.
        scopeElement - the XML element containing the scope definition.
        scope - the scope to add the executionListeners to.
      • isValidEventNameForScope

        protected boolean isValidEventNameForScope​(String eventName,
                                                   Element listenerElement,
                                                   String ancestorElementId)
        Check if the given event name is valid. If not, an appropriate error is added.
      • parseExecutionListenersOnTransition

        public void parseExecutionListenersOnTransition​(Element activitiElement,
                                                        TransitionImpl activity)
      • parseExecutionListener

        public ExecutionListener parseExecutionListener​(Element executionListenerElement,
                                                        String ancestorElementId)
        Parses an ExecutionListener implementation for the given executionListener element.
        executionListenerElement - the XML element containing the executionListener definition.
      • parseDiagramInterchangeElements

        public void parseDiagramInterchangeElements()
      • parseBPMNDiagram

        public void parseBPMNDiagram​(Element bpmndiagramElement)
      • parseBPMNPlane

        public void parseBPMNPlane​(Element bpmnPlaneElement)
      • parseBPMNShape

        public void parseBPMNShape​(Element bpmnShapeElement)
      • parseDIBounds

        protected void parseDIBounds​(Element bpmnShapeElement,
                                     HasDIBounds target)
      • parseBPMNEdge

        public void parseBPMNEdge​(Element bpmnEdgeElement)
      • parseBooleanAttribute

        public Boolean parseBooleanAttribute​(String booleanText,
                                             boolean defaultValue)
      • parseBooleanAttribute

        public Boolean parseBooleanAttribute​(String booleanText)
      • parseDoubleAttribute

        public Double parseDoubleAttribute​(Element element,
                                           String attributeName,
                                           String doubleText,
                                           boolean required)
      • isStartable

        protected boolean isStartable​(Element element)
      • isExclusive

        protected boolean isExclusive​(Element element)
      • isAsyncBefore

        protected boolean isAsyncBefore​(Element element)
      • isAsyncAfter

        protected boolean isAsyncAfter​(Element element)
      • isServiceTaskLike

        protected boolean isServiceTaskLike​(Element element)
      • hasConnector

        protected boolean hasConnector​(Element element)
      • getJobDeclarationsByKey

        public List<JobDeclaration<?,​?>> getJobDeclarationsByKey​(String processDefinitionKey)
      • parseActivityInputOutput

        protected void parseActivityInputOutput​(Element activityElement,
                                                ActivityImpl activity)
      • checkActivityInputOutputSupported

        protected boolean checkActivityInputOutputSupported​(Element activityElement,
                                                            ActivityImpl activity,
                                                            IoMapping inputOutput)
      • checkActivityOutputParameterSupported

        protected boolean checkActivityOutputParameterSupported​(Element activityElement,
                                                                ActivityImpl activity)
      • ensureNoIoMappingDefined

        protected void ensureNoIoMappingDefined​(Element element)
      • addTimeCycleWarning

        protected void addTimeCycleWarning​(Element timeCycleElement,
                                           String type,
                                           String timerElementId)
      • ensureNoExpressionInMessageStartEvent

        protected void ensureNoExpressionInMessageStartEvent​(Element element,
                                                             EventSubscriptionDeclaration messageStartEventSubscriptionDeclaration,
                                                             String parentElementId)