idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
10,100 | public void continueIfExecutionDoesNotAffectNextOperation ( Callback < PvmExecutionImpl , Void > dispatching , Callback < PvmExecutionImpl , Void > continuation , PvmExecutionImpl execution ) { String lastActivityId = execution . getActivityId ( ) ; String lastActivityInstanceId = getActivityInstanceId ( execution ) ; dispatching . callback ( execution ) ; execution = execution . getReplacedBy ( ) != null ? execution . getReplacedBy ( ) : execution ; String currentActivityInstanceId = getActivityInstanceId ( execution ) ; String currentActivityId = execution . getActivityId ( ) ; if ( ! execution . isCanceled ( ) && isOnSameActivity ( lastActivityInstanceId , lastActivityId , currentActivityInstanceId , currentActivityId ) ) { continuation . callback ( execution ) ; } } | Executes the given depending operations with the given execution . The execution state will be checked with the help of the activity instance id and activity id of the execution before and after the dispatching callback call . If the id s are not changed the continuation callback is called . |
10,101 | protected void dispatchScopeEvents ( PvmExecutionImpl execution ) { PvmExecutionImpl scopeExecution = execution . isScope ( ) ? execution : execution . getParent ( ) ; List < DelayedVariableEvent > delayedEvents = new ArrayList < > ( scopeExecution . getDelayedEvents ( ) ) ; scopeExecution . clearDelayedEvents ( ) ; Map < PvmExecutionImpl , String > activityInstanceIds = new HashMap < > ( ) ; Map < PvmExecutionImpl , String > activityIds = new HashMap < > ( ) ; initActivityIds ( delayedEvents , activityInstanceIds , activityIds ) ; for ( DelayedVariableEvent event : delayedEvents ) { PvmExecutionImpl targetScope = event . getTargetScope ( ) ; PvmExecutionImpl replaced = targetScope . getReplacedBy ( ) != null ? targetScope . getReplacedBy ( ) : targetScope ; dispatchOnSameActivity ( targetScope , replaced , activityIds , activityInstanceIds , event ) ; } } | Dispatches the current delayed variable events on the scope of the given execution . |
10,102 | protected void initActivityIds ( List < DelayedVariableEvent > delayedEvents , Map < PvmExecutionImpl , String > activityInstanceIds , Map < PvmExecutionImpl , String > activityIds ) { for ( DelayedVariableEvent event : delayedEvents ) { PvmExecutionImpl targetScope = event . getTargetScope ( ) ; String targetScopeActivityInstanceId = getActivityInstanceId ( targetScope ) ; activityInstanceIds . put ( targetScope , targetScopeActivityInstanceId ) ; activityIds . put ( targetScope , targetScope . getActivityId ( ) ) ; } } | Initializes the given maps with the target scopes and current activity id s and activity instance id s . |
10,103 | private boolean isOnDispatchableState ( PvmExecutionImpl targetScope ) { ActivityImpl targetActivity = targetScope . getActivity ( ) ; return targetScope . getActivityId ( ) == null || ! targetActivity . isScope ( ) || ( targetScope . isInState ( ActivityInstanceState . DEFAULT ) ) ; } | Checks if the given execution is on a dispatchable state . That means if the current activity is not a leaf in the activity tree OR it is a leaf but not a scope OR it is a leaf a scope and the execution is in state DEFAULT which means not in state Starting Execute or Ending . For this states it is prohibited to trigger conditional events otherwise unexpected behavior can appear . |
10,104 | private boolean isOnSameActivity ( String lastActivityInstanceId , String lastActivityId , String currentActivityInstanceId , String currentActivityId ) { return ( ( lastActivityInstanceId == null && lastActivityInstanceId == currentActivityInstanceId && lastActivityId . equals ( currentActivityId ) ) || ( lastActivityInstanceId != null && lastActivityInstanceId . equals ( currentActivityInstanceId ) && ( lastActivityId == null || lastActivityId . equals ( currentActivityId ) ) ) ) ; } | Compares the given activity instance id s and activity id s to check if the execution is on the same activity as before an operation was executed . The activity instance id s can be null on transitions . In this case the activity Id s have to be equal otherwise the execution changed . |
10,105 | private String getActivityInstanceId ( PvmExecutionImpl targetScope ) { if ( targetScope . isConcurrent ( ) ) { return targetScope . getActivityInstanceId ( ) ; } else { ActivityImpl targetActivity = targetScope . getActivity ( ) ; if ( ( targetActivity != null && targetActivity . getActivities ( ) . isEmpty ( ) ) ) { return targetScope . getActivityInstanceId ( ) ; } else { return targetScope . getParentActivityInstanceId ( ) ; } } } | Returns the activity instance id for the given execution . |
10,106 | public void resolveIncident ( final String incidentId ) { IncidentEntity incident = ( IncidentEntity ) Context . getCommandContext ( ) . getIncidentManager ( ) . findIncidentById ( incidentId ) ; IncidentHandler incidentHandler = findIncidentHandler ( incident . getIncidentType ( ) ) ; if ( incidentHandler == null ) { incidentHandler = new DefaultIncidentHandler ( incident . getIncidentType ( ) ) ; } IncidentContext incidentContext = new IncidentContext ( incident ) ; incidentHandler . resolveIncident ( incidentContext ) ; } | Resolves an incident with given id . |
10,107 | protected < T extends HistoryEvent > T findInCache ( Class < T > type , String id ) { return Context . getCommandContext ( ) . getDbEntityManager ( ) . getCachedEntity ( type , id ) ; } | find a cached entity by primary key |
10,108 | public static PvmExecutionImpl getScopeExecution ( ScopeImpl scope , Map < ScopeImpl , PvmExecutionImpl > activityExecutionMapping ) { ScopeImpl flowScope = scope . getFlowScope ( ) ; return activityExecutionMapping . get ( flowScope ) ; } | In case the process instance was migrated from a previous version activities which are now parsed as scopes do not have scope executions . Use the flow scopes of these activities in order to find their execution . - For an event subprocess this is the scope execution of the scope in which the event subprocess is embeded in - For a multi instance sequential subprocess this is the multi instace scope body . |
10,109 | public static Map < ScopeImpl , PvmExecutionImpl > createActivityExecutionMapping ( List < PvmExecutionImpl > scopeExecutions , List < ScopeImpl > scopes ) { PvmExecutionImpl deepestExecution = scopeExecutions . get ( 0 ) ; if ( isLegacyAsyncAtMultiInstance ( deepestExecution ) ) { scopes . remove ( 0 ) ; } int numOfMissingExecutions = scopes . size ( ) - scopeExecutions . size ( ) ; Collections . reverse ( scopeExecutions ) ; Collections . reverse ( scopes ) ; Map < ScopeImpl , PvmExecutionImpl > mapping = new HashMap < ScopeImpl , PvmExecutionImpl > ( ) ; mapping . put ( scopes . get ( 0 ) , scopeExecutions . get ( 0 ) ) ; int executionCounter = 0 ; for ( int i = 1 ; i < scopes . size ( ) ; i ++ ) { ActivityImpl scope = ( ActivityImpl ) scopes . get ( i ) ; PvmExecutionImpl scopeExecutionCandidate = null ; if ( executionCounter + 1 < scopeExecutions . size ( ) ) { scopeExecutionCandidate = scopeExecutions . get ( executionCounter + 1 ) ; } if ( numOfMissingExecutions > 0 && wasNoScope ( scope , scopeExecutionCandidate ) ) { numOfMissingExecutions -- ; } else { executionCounter ++ ; } if ( executionCounter >= scopeExecutions . size ( ) ) { throw new ProcessEngineException ( "Cannot construct activity-execution mapping: there are " + "more scope executions missing than explained by the flow scope hierarchy." ) ; } PvmExecutionImpl execution = scopeExecutions . get ( executionCounter ) ; mapping . put ( scope , execution ) ; } return mapping ; } | Creates an activity execution mapping when the scope hierarchy and the execution hierarchy are out of sync . |
10,110 | protected static boolean wasNoScope ( ActivityImpl activity , PvmExecutionImpl scopeExecutionCandidate ) { return wasNoScope72 ( activity ) || wasNoScope73 ( activity , scopeExecutionCandidate ) ; } | Determines whether the given scope was a scope in previous versions |
10,111 | protected static boolean isLegacyAsyncAtMultiInstance ( PvmExecutionImpl execution ) { ActivityImpl activity = execution . getActivity ( ) ; if ( activity != null ) { boolean isAsync = execution . getActivityInstanceId ( ) == null ; boolean isAtMultiInstance = activity . getParentFlowScopeActivity ( ) != null && activity . getParentFlowScopeActivity ( ) . getActivityBehavior ( ) instanceof MultiInstanceActivityBehavior ; return isAsync && isAtMultiInstance ; } else { return false ; } } | This returns true only if the provided execution has reached its wait state in a legacy engine version because only in that case it can be async and waiting at the inner activity wrapped by the miBody . In versions > = 7 . 3 the execution would reference the multi - instance body instead . |
10,112 | public static PvmExecutionImpl determinePropagatingExecutionOnEnd ( PvmExecutionImpl propagatingExecution , Map < ScopeImpl , PvmExecutionImpl > activityExecutionMapping ) { if ( ! propagatingExecution . isScope ( ) ) { return propagatingExecution ; } else { if ( activityExecutionMapping . values ( ) . contains ( propagatingExecution ) ) { return propagatingExecution ; } else { propagatingExecution . remove ( ) ; PvmExecutionImpl parent = propagatingExecution . getParent ( ) ; parent . setActivity ( propagatingExecution . getActivity ( ) ) ; return propagatingExecution . getParent ( ) ; } } } | Tolerates the broken execution trees fixed with CAM - 3727 where there may be more ancestor scope executions than ancestor flow scopes ; |
10,113 | protected static boolean areEqualEventSubscriptions ( EventSubscriptionEntity subscription1 , EventSubscriptionEntity subscription2 ) { return valuesEqual ( subscription1 . getEventType ( ) , subscription2 . getEventType ( ) ) && valuesEqual ( subscription1 . getEventName ( ) , subscription2 . getEventName ( ) ) && valuesEqual ( subscription1 . getActivityId ( ) , subscription2 . getActivityId ( ) ) ; } | Checks if the parameters are the same apart from the execution id |
10,114 | public static void removeLegacyNonScopesFromMapping ( Map < ScopeImpl , PvmExecutionImpl > mapping ) { Map < PvmExecutionImpl , List < ScopeImpl > > scopesForExecutions = new HashMap < PvmExecutionImpl , List < ScopeImpl > > ( ) ; for ( Map . Entry < ScopeImpl , PvmExecutionImpl > mappingEntry : mapping . entrySet ( ) ) { List < ScopeImpl > scopesForExecution = scopesForExecutions . get ( mappingEntry . getValue ( ) ) ; if ( scopesForExecution == null ) { scopesForExecution = new ArrayList < ScopeImpl > ( ) ; scopesForExecutions . put ( mappingEntry . getValue ( ) , scopesForExecution ) ; } scopesForExecution . add ( mappingEntry . getKey ( ) ) ; } for ( Map . Entry < PvmExecutionImpl , List < ScopeImpl > > scopesForExecution : scopesForExecutions . entrySet ( ) ) { List < ScopeImpl > scopes = scopesForExecution . getValue ( ) ; if ( scopes . size ( ) > 1 ) { ScopeImpl topMostScope = getTopMostScope ( scopes ) ; for ( ScopeImpl scope : scopes ) { if ( scope != scope . getProcessDefinition ( ) && scope != topMostScope ) { mapping . remove ( scope ) ; } } } } } | Remove all entries for legacy non - scopes given that the assigned scope execution is also responsible for another scope |
10,115 | public static void migrateMultiInstanceJobDefinitions ( ProcessDefinitionEntity processDefinition , List < JobDefinitionEntity > jobDefinitions ) { for ( JobDefinitionEntity jobDefinition : jobDefinitions ) { String activityId = jobDefinition . getActivityId ( ) ; if ( activityId != null ) { ActivityImpl activity = processDefinition . findActivity ( jobDefinition . getActivityId ( ) ) ; if ( ! isAsync ( activity ) && isActivityWrappedInMultiInstanceBody ( activity ) && isAsyncJobDefinition ( jobDefinition ) ) { jobDefinition . setActivityId ( activity . getFlowScope ( ) . getId ( ) ) ; } } } } | When deploying an async job definition for an activity wrapped in an miBody set the activity id to the miBody except the wrapped activity is marked as async . |
10,116 | public static void repairMultiInstanceAsyncJob ( ExecutionEntity execution ) { ActivityImpl activity = execution . getActivity ( ) ; if ( ! isAsync ( activity ) && isActivityWrappedInMultiInstanceBody ( activity ) ) { execution . setActivity ( ( ActivityImpl ) activity . getFlowScope ( ) ) ; } } | When executing an async job for an activity wrapped in an miBody set the execution to the miBody except the wrapped activity is marked as async . |
10,117 | public static boolean isCompensationThrowing ( PvmExecutionImpl execution , Map < ScopeImpl , PvmExecutionImpl > activityExecutionMapping ) { if ( CompensationBehavior . isCompensationThrowing ( execution ) ) { ScopeImpl compensationThrowingActivity = execution . getActivity ( ) ; if ( compensationThrowingActivity . isScope ( ) ) { return activityExecutionMapping . get ( compensationThrowingActivity ) == activityExecutionMapping . get ( compensationThrowingActivity . getFlowScope ( ) ) ; } else { return compensationThrowingActivity . getActivityBehavior ( ) instanceof CancelBoundaryEventActivityBehavior ; } } else { return false ; } } | Returns true if the given execution is in a compensation - throwing activity but there is no dedicated scope execution in the given mapping . |
10,118 | public void collectIds ( List < String > ids ) { ids . add ( attribute ( "id" ) ) ; for ( Element child : elements ) { child . collectIds ( ids ) ; } } | allows to recursively collect the ids of all elements in the tree . |
10,119 | public Iterator < FeatureDescriptor > getFeatureDescriptors ( final ELContext context , final Object base ) { return new Iterator < FeatureDescriptor > ( ) { Iterator < FeatureDescriptor > empty = Collections . < FeatureDescriptor > emptyList ( ) . iterator ( ) ; Iterator < ELResolver > resolvers = CompositeELResolver . this . resolvers . iterator ( ) ; Iterator < FeatureDescriptor > features = empty ; Iterator < FeatureDescriptor > features ( ) { while ( ! features . hasNext ( ) && resolvers . hasNext ( ) ) { features = resolvers . next ( ) . getFeatureDescriptors ( context , base ) ; if ( features == null ) { features = empty ; } } return features ; } public boolean hasNext ( ) { return features ( ) . hasNext ( ) ; } public FeatureDescriptor next ( ) { return features ( ) . next ( ) ; } public void remove ( ) { features ( ) . remove ( ) ; } } ; } | Returns information about the set of variables or properties that can be resolved for the given base object . One use for this method is to assist tools in auto - completion . The results are collected from all component resolvers . The propertyResolved property of the ELContext is not relevant to this method . The results of all ELResolvers are concatenated . The Iterator returned is an iterator over the collection of FeatureDescriptor objects returned by the iterators returned by each component resolver s getFeatureDescriptors method . If null is returned by a resolver it is skipped . |
10,120 | public static < T > boolean elementIsNotContainedInList ( T element , Collection < T > values ) { if ( element != null && values != null ) { return ! values . contains ( element ) ; } else { return false ; } } | Checks if the element is not contained within the list of values . If the element or the list are null then true is returned . |
10,121 | public static < T > boolean elementIsNotContainedInArray ( T element , T ... values ) { if ( element != null && values != null ) { return elementIsNotContainedInList ( element , Arrays . asList ( values ) ) ; } else { return false ; } } | Checks if the element is contained within the list of values . If the element or the list are null then true is returned . |
10,122 | public Class < ? > getType ( ELContext context ) throws ELException { return node . getType ( bindings , context ) ; } | Evaluates the expression as an lvalue and answers the result type . |
10,123 | public Object getValue ( ELContext context ) throws ELException { return node . getValue ( bindings , context , type ) ; } | Evaluates the expression as an rvalue and answers the result . |
10,124 | public void setValue ( ELContext context , Object value ) throws ELException { node . setValue ( bindings , context , value ) ; } | Evaluates the expression as an lvalue and assigns the given value . |
10,125 | public Set < MigratingProcessElementInstance > getChildren ( ) { Set < MigratingProcessElementInstance > childInstances = new HashSet < MigratingProcessElementInstance > ( ) ; childInstances . addAll ( childActivityInstances ) ; childInstances . addAll ( childTransitionInstances ) ; childInstances . addAll ( childCompensationInstances ) ; childInstances . addAll ( childCompensationSubscriptionInstances ) ; return childInstances ; } | Returns a copy of all children modifying the returned set does not have any further effect . |
10,126 | public MethodInfo getMethodInfo ( ELContext context ) throws ELException { return node . getMethodInfo ( bindings , context , type , types ) ; } | Evaluates the expression and answers information about the method |
10,127 | public Object invoke ( ELContext context , Object [ ] paramValues ) throws ELException { return node . invoke ( bindings , context , type , types , paramValues ) ; } | Evaluates the expression and invokes the method . |
10,128 | private boolean containsIncompatibleResourceType ( ) { if ( queryByResourceType && queryByPermission ) { Resource [ ] resources = resourcesIntersection . toArray ( new Resource [ resourcesIntersection . size ( ) ] ) ; return ! ResourceTypeUtil . resourceIsContainedInArray ( resourceType , resources ) ; } return false ; } | check whether the permissions resources are compatible to the filtered resource parameter |
10,129 | public void updateModifiableFieldsFromEntity ( CaseDefinitionEntity updatingCaseDefinition ) { if ( this . key . equals ( updatingCaseDefinition . key ) && this . deploymentId . equals ( updatingCaseDefinition . deploymentId ) ) { this . revision = updatingCaseDefinition . revision ; this . historyTimeToLive = updatingCaseDefinition . historyTimeToLive ; } else { LOG . logUpdateUnrelatedCaseDefinitionEntity ( this . key , updatingCaseDefinition . key , this . deploymentId , updatingCaseDefinition . deploymentId ) ; } } | Updates all modifiable fields from another case definition entity . |
10,130 | public static boolean isWithinBatchWindow ( Date date , ProcessEngineConfigurationImpl configuration ) { if ( configuration . getBatchWindowManager ( ) . isBatchWindowConfigured ( configuration ) ) { BatchWindow batchWindow = configuration . getBatchWindowManager ( ) . getCurrentOrNextBatchWindow ( date , configuration ) ; if ( batchWindow == null ) { return false ; } return batchWindow . isWithin ( date ) ; } else { return false ; } } | Checks if given date is within a batch window . Batch window start time is checked inclusively . |
10,131 | public static List < EventSubscriptionEntity > collectCompensateEventSubscriptionsForScope ( ActivityExecution execution ) { final Map < ScopeImpl , PvmExecutionImpl > scopeExecutionMapping = execution . createActivityExecutionMapping ( ) ; ScopeImpl activity = ( ScopeImpl ) execution . getActivity ( ) ; final Set < EventSubscriptionEntity > subscriptions = new HashSet < EventSubscriptionEntity > ( ) ; TreeVisitor < ScopeImpl > eventSubscriptionCollector = new TreeVisitor < ScopeImpl > ( ) { public void visit ( ScopeImpl obj ) { PvmExecutionImpl execution = scopeExecutionMapping . get ( obj ) ; subscriptions . addAll ( ( ( ExecutionEntity ) execution ) . getCompensateEventSubscriptions ( ) ) ; } } ; new FlowScopeWalker ( activity ) . addPostVisitor ( eventSubscriptionCollector ) . walkUntil ( new ReferenceWalker . WalkCondition < ScopeImpl > ( ) { public boolean isFulfilled ( ScopeImpl element ) { Boolean consumesCompensationProperty = ( Boolean ) element . getProperty ( BpmnParse . PROPERTYNAME_CONSUMES_COMPENSATION ) ; return consumesCompensationProperty == null || consumesCompensationProperty == Boolean . TRUE ; } } ) ; return new ArrayList < EventSubscriptionEntity > ( subscriptions ) ; } | Collect all compensate event subscriptions for scope of given execution . |
10,132 | public static List < EventSubscriptionEntity > collectCompensateEventSubscriptionsForActivity ( ActivityExecution execution , String activityRef ) { final List < EventSubscriptionEntity > eventSubscriptions = collectCompensateEventSubscriptionsForScope ( execution ) ; final String subscriptionActivityId = getSubscriptionActivityId ( execution , activityRef ) ; List < EventSubscriptionEntity > eventSubscriptionsForActivity = new ArrayList < EventSubscriptionEntity > ( ) ; for ( EventSubscriptionEntity subscription : eventSubscriptions ) { if ( subscriptionActivityId . equals ( subscription . getActivityId ( ) ) ) { eventSubscriptionsForActivity . add ( subscription ) ; } } return eventSubscriptionsForActivity ; } | Collect all compensate event subscriptions for activity on the scope of given execution . |
10,133 | private static String generateExceptionMessage ( String userId , List < MissingAuthorization > missingAuthorizations ) { StringBuilder sBuilder = new StringBuilder ( ) ; sBuilder . append ( "The user with id '" ) ; sBuilder . append ( userId ) ; sBuilder . append ( "' does not have one of the following permissions: " ) ; boolean first = true ; for ( MissingAuthorization missingAuthorization : missingAuthorizations ) { if ( ! first ) { sBuilder . append ( " or " ) ; } else { first = false ; } sBuilder . append ( generateMissingAuthorizationMessage ( missingAuthorization ) ) ; } return sBuilder . toString ( ) ; } | Generate exception message from the missing authorizations . |
10,134 | private static String generateMissingAuthorizationMessage ( MissingAuthorization exceptionInfo ) { StringBuilder builder = new StringBuilder ( ) ; String permissionName = exceptionInfo . getViolatedPermissionName ( ) ; String resourceType = exceptionInfo . getResourceType ( ) ; String resourceId = exceptionInfo . getResourceId ( ) ; builder . append ( "'" ) ; builder . append ( permissionName ) ; builder . append ( "' permission on resource '" ) ; builder . append ( ( resourceId != null ? ( resourceId + "' of type '" ) : "" ) ) ; builder . append ( resourceType ) ; builder . append ( "'" ) ; return builder . toString ( ) ; } | Generated exception message for the missing authorization . |
10,135 | public static ProcessEngine getProcessEngine ( String processEngineName , boolean forceCreate ) { if ( ! isInitialized ) { init ( forceCreate ) ; } return processEngines . get ( processEngineName ) ; } | obtain a process engine by name . |
10,136 | protected Number parseInteger ( String string ) throws ParseException { try { return Long . valueOf ( string ) ; } catch ( NumberFormatException e ) { fail ( INTEGER ) ; return null ; } } | Parse an integer literal . |
10,137 | protected Number parseFloat ( String string ) throws ParseException { try { return Double . valueOf ( string ) ; } catch ( NumberFormatException e ) { fail ( FLOAT ) ; return null ; } } | Parse a floating point literal . |
10,138 | protected final Token lookahead ( int index ) throws ScanException , ParseException { if ( lookahead . isEmpty ( ) ) { lookahead = new LinkedList < LookaheadToken > ( ) ; } while ( index >= lookahead . size ( ) ) { lookahead . add ( new LookaheadToken ( scanner . next ( ) , scanner . getPosition ( ) ) ) ; } return lookahead . get ( index ) . token ; } | get lookahead symbol . |
10,139 | private static ExpressionFactory newInstance ( Properties properties , String className , ClassLoader classLoader ) { Class < ? > clazz = null ; try { clazz = classLoader . loadClass ( className . trim ( ) ) ; if ( ! ExpressionFactory . class . isAssignableFrom ( clazz ) ) { throw new ELException ( "Invalid expression factory class: " + clazz . getName ( ) ) ; } } catch ( ClassNotFoundException e ) { throw new ELException ( "Could not find expression factory class" , e ) ; } try { if ( properties != null ) { Constructor < ? > constructor = null ; try { constructor = clazz . getConstructor ( Properties . class ) ; } catch ( Exception e ) { } if ( constructor != null ) { return ( ExpressionFactory ) constructor . newInstance ( properties ) ; } } return ( ExpressionFactory ) clazz . newInstance ( ) ; } catch ( Exception e ) { throw new ELException ( "Could not create expression factory instance" , e ) ; } } | Create an ExpressionFactory instance . |
10,140 | 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 ) ; } } } | Parses the rootElement importing structures |
10,141 | public void parseMessages ( ) { for ( Element messageElement : rootElement . elements ( "message" ) ) { String id = messageElement . attribute ( "id" ) ; String messageName = messageElement . attribute ( "name" ) ; Expression messageExpression = null ; if ( messageName != null ) { messageExpression = expressionManager . createExpression ( messageName ) ; } MessageDefinition messageDefinition = new MessageDefinition ( this . targetNamespace + ":" + id , messageExpression ) ; this . messages . put ( messageDefinition . getId ( ) , messageDefinition ) ; } } | 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 . |
10,142 | protected void parseSignals ( ) { for ( Element signalElement : rootElement . elements ( "signal" ) ) { String id = signalElement . attribute ( "id" ) ; String signalName = signalElement . attribute ( "name" ) ; for ( SignalDefinition signalDefinition : signals . values ( ) ) { if ( signalDefinition . getName ( ) . equals ( signalName ) ) { addError ( "duplicate signal name '" + signalName + "'." , signalElement ) ; } } if ( id == null ) { addError ( "signal must have an id" , signalElement ) ; } else if ( signalName == null ) { addError ( "signal with id '" + id + "' has no name" , signalElement ) ; } else { Expression signalExpression = expressionManager . createExpression ( signalName ) ; SignalDefinition signal = new SignalDefinition ( ) ; signal . setId ( this . targetNamespace + ":" + id ) ; signal . setExpression ( signalExpression ) ; this . signals . put ( signal . getId ( ) , signal ) ; } } } | 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 . |
10,143 | public void parseProcessDefinitions ( ) { for ( Element processElement : rootElement . elements ( "process" ) ) { boolean isExecutable = ! deployment . isNew ( ) ; String isExecutableStr = processElement . attribute ( "isExecutable" ) ; if ( isExecutableStr != null ) { isExecutable = Boolean . parseBoolean ( isExecutableStr ) ; if ( ! isExecutable ) { LOG . ignoringNonExecutableProcess ( processElement . attribute ( "id" ) ) ; } } else { LOG . missingIsExecutableAttribute ( processElement . attribute ( "id" ) ) ; } if ( isExecutable ) { processDefinitions . add ( parseProcess ( processElement ) ) ; } } } | Parses all the process definitions defined within the definitions root element . |
10,144 | public void parseCollaboration ( ) { Element collaboration = rootElement . element ( "collaboration" ) ; if ( collaboration != null ) { for ( Element participant : collaboration . elements ( "participant" ) ) { String processRef = participant . attribute ( "processRef" ) ; if ( processRef != null ) { ProcessDefinitionImpl procDef = getProcessDefinition ( processRef ) ; if ( procDef != null ) { ParticipantProcess participantProcess = new ParticipantProcess ( ) ; participantProcess . setId ( participant . attribute ( "id" ) ) ; participantProcess . setName ( participant . attribute ( "name" ) ) ; procDef . setParticipantProcess ( participantProcess ) ; participantProcesses . put ( participantProcess . getId ( ) , processRef ) ; } } } } } | Parses the collaboration definition defined within the definitions root element and get all participants to lookup their process references during DI parsing . |
10,145 | protected void setActivityAsyncDelegates ( final ActivityImpl activity ) { activity . setDelegateAsyncAfterUpdate ( new ActivityImpl . AsyncAfterUpdate ( ) { public void updateAsyncAfter ( boolean asyncAfter , boolean exclusive ) { if ( asyncAfter ) { addMessageJobDeclaration ( new AsyncAfterMessageJobDeclaration ( ) , activity , exclusive ) ; } else { removeMessageJobDeclarationWithJobConfiguration ( activity , MessageJobDeclaration . ASYNC_AFTER ) ; } } } ) ; activity . setDelegateAsyncBeforeUpdate ( new ActivityImpl . AsyncBeforeUpdate ( ) { public void updateAsyncBefore ( boolean asyncBefore , boolean exclusive ) { if ( asyncBefore ) { addMessageJobDeclaration ( new AsyncBeforeMessageJobDeclaration ( ) , activity , exclusive ) ; } else { removeMessageJobDeclarationWithJobConfiguration ( activity , MessageJobDeclaration . ASYNC_BEFORE ) ; } } } ) ; } | Sets the delegates for the activity which will be called if the attribute asyncAfter or asyncBefore was changed . |
10,146 | protected void addMessageJobDeclaration ( MessageJobDeclaration messageJobDeclaration , ActivityImpl activity , boolean exclusive ) { ProcessDefinition procDef = ( ProcessDefinition ) activity . getProcessDefinition ( ) ; if ( ! exists ( messageJobDeclaration , procDef . getKey ( ) , activity . getActivityId ( ) ) ) { messageJobDeclaration . setExclusive ( exclusive ) ; messageJobDeclaration . setActivity ( activity ) ; messageJobDeclaration . setJobPriorityProvider ( ( ParameterValueProvider ) activity . getProperty ( PROPERTYNAME_JOB_PRIORITY ) ) ; addMessageJobDeclarationToActivity ( messageJobDeclaration , activity ) ; addJobDeclarationToProcessDefinition ( messageJobDeclaration , procDef ) ; } } | Adds the new message job declaration to existing declarations . There will be executed an existing check before the adding is executed . |
10,147 | protected boolean exists ( MessageJobDeclaration msgJobdecl , String procDefKey , String activityId ) { boolean exist = false ; List < JobDeclaration < ? , ? > > declarations = jobDeclarations . get ( procDefKey ) ; if ( declarations != null ) { for ( int i = 0 ; i < declarations . size ( ) && ! exist ; i ++ ) { JobDeclaration < ? , ? > decl = declarations . get ( i ) ; if ( decl . getActivityId ( ) . equals ( activityId ) && decl . getJobConfiguration ( ) . equalsIgnoreCase ( msgJobdecl . getJobConfiguration ( ) ) ) { exist = true ; } } } return exist ; } | Checks whether the message declaration already exists . |
10,148 | protected void removeMessageJobDeclarationWithJobConfiguration ( ActivityImpl activity , String jobConfiguration ) { List < MessageJobDeclaration > messageJobDeclarations = ( List < MessageJobDeclaration > ) activity . getProperty ( PROPERTYNAME_MESSAGE_JOB_DECLARATION ) ; if ( messageJobDeclarations != null ) { Iterator < MessageJobDeclaration > iter = messageJobDeclarations . iterator ( ) ; while ( iter . hasNext ( ) ) { MessageJobDeclaration msgDecl = iter . next ( ) ; if ( msgDecl . getJobConfiguration ( ) . equalsIgnoreCase ( jobConfiguration ) && msgDecl . getActivityId ( ) . equalsIgnoreCase ( activity . getActivityId ( ) ) ) { iter . remove ( ) ; } } } ProcessDefinition procDef = ( ProcessDefinition ) activity . getProcessDefinition ( ) ; List < JobDeclaration < ? , ? > > declarations = jobDeclarations . get ( procDef . getKey ( ) ) ; if ( declarations != null ) { Iterator < JobDeclaration < ? , ? > > iter = declarations . iterator ( ) ; while ( iter . hasNext ( ) ) { JobDeclaration < ? , ? > jobDcl = iter . next ( ) ; if ( jobDcl . getJobConfiguration ( ) . equalsIgnoreCase ( jobConfiguration ) && jobDcl . getActivityId ( ) . equalsIgnoreCase ( activity . getActivityId ( ) ) ) { iter . remove ( ) ; } } } } | Removes a job declaration which belongs to the given activity and has the given job configuration . |
10,149 | public ActivityImpl parseExclusiveGateway ( Element exclusiveGwElement , ScopeImpl scope ) { ActivityImpl activity = createActivityOnScope ( exclusiveGwElement , scope ) ; activity . setActivityBehavior ( new ExclusiveGatewayActivityBehavior ( ) ) ; parseAsynchronousContinuationForActivity ( exclusiveGwElement , activity ) ; parseExecutionListenersOnScope ( exclusiveGwElement , activity ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseExclusiveGateway ( exclusiveGwElement , scope , activity ) ; } return activity ; } | Parses an exclusive gateway declaration . |
10,150 | public ActivityImpl parseInclusiveGateway ( Element inclusiveGwElement , ScopeImpl scope ) { ActivityImpl activity = createActivityOnScope ( inclusiveGwElement , scope ) ; activity . setActivityBehavior ( new InclusiveGatewayActivityBehavior ( ) ) ; parseAsynchronousContinuationForActivity ( inclusiveGwElement , activity ) ; parseExecutionListenersOnScope ( inclusiveGwElement , activity ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseInclusiveGateway ( inclusiveGwElement , scope , activity ) ; } return activity ; } | Parses an inclusive gateway declaration . |
10,151 | public ActivityImpl parseParallelGateway ( Element parallelGwElement , ScopeImpl scope ) { ActivityImpl activity = createActivityOnScope ( parallelGwElement , scope ) ; activity . setActivityBehavior ( new ParallelGatewayActivityBehavior ( ) ) ; parseAsynchronousContinuationForActivity ( parallelGwElement , activity ) ; parseExecutionListenersOnScope ( parallelGwElement , activity ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseParallelGateway ( parallelGwElement , scope , activity ) ; } return activity ; } | Parses a parallel gateway declaration . |
10,152 | public ActivityImpl parseScriptTask ( Element scriptTaskElement , ScopeImpl scope ) { ActivityImpl activity = createActivityOnScope ( scriptTaskElement , scope ) ; ScriptTaskActivityBehavior activityBehavior = parseScriptTaskElement ( scriptTaskElement ) ; if ( activityBehavior != null ) { parseAsynchronousContinuationForActivity ( scriptTaskElement , activity ) ; activity . setActivityBehavior ( activityBehavior ) ; parseExecutionListenersOnScope ( scriptTaskElement , activity ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseScriptTask ( scriptTaskElement , scope , activity ) ; } } return activity ; } | Parses a scriptTask declaration . |
10,153 | public ActivityImpl parseBusinessRuleTask ( Element businessRuleTaskElement , ScopeImpl scope ) { String decisionRef = businessRuleTaskElement . attributeNS ( CAMUNDA_BPMN_EXTENSIONS_NS , "decisionRef" ) ; if ( decisionRef != null ) { return parseDmnBusinessRuleTask ( businessRuleTaskElement , scope ) ; } else { return parseServiceTaskLike ( "businessRuleTask" , businessRuleTaskElement , scope ) ; } } | Parses a businessRuleTask declaration . |
10,154 | protected ActivityImpl parseDmnBusinessRuleTask ( Element businessRuleTaskElement , ScopeImpl scope ) { ActivityImpl activity = createActivityOnScope ( businessRuleTaskElement , scope ) ; activity . setScope ( true ) ; parseAsynchronousContinuationForActivity ( businessRuleTaskElement , activity ) ; String decisionRef = businessRuleTaskElement . attributeNS ( CAMUNDA_BPMN_EXTENSIONS_NS , "decisionRef" ) ; BaseCallableElement callableElement = new BaseCallableElement ( ) ; callableElement . setDeploymentId ( deployment . getId ( ) ) ; ParameterValueProvider definitionKeyProvider = createParameterValueProvider ( decisionRef , expressionManager ) ; callableElement . setDefinitionKeyValueProvider ( definitionKeyProvider ) ; parseBinding ( businessRuleTaskElement , activity , callableElement , "decisionRefBinding" ) ; parseVersion ( businessRuleTaskElement , activity , callableElement , "decisionRefBinding" , "decisionRefVersion" ) ; parseVersionTag ( businessRuleTaskElement , activity , callableElement , "decisionRefBinding" , "decisionRefVersionTag" ) ; parseTenantId ( businessRuleTaskElement , activity , callableElement , "decisionRefTenantId" ) ; String resultVariable = parseResultVariable ( businessRuleTaskElement ) ; DecisionResultMapper decisionResultMapper = parseDecisionResultMapper ( businessRuleTaskElement ) ; DmnBusinessRuleTaskActivityBehavior behavior = new DmnBusinessRuleTaskActivityBehavior ( callableElement , resultVariable , decisionResultMapper ) ; activity . setActivityBehavior ( behavior ) ; parseExecutionListenersOnScope ( businessRuleTaskElement , activity ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseBusinessRuleTask ( businessRuleTaskElement , scope , activity ) ; } return activity ; } | Parse a Business Rule Task which references a decision . |
10,155 | protected void parseAsynchronousContinuation ( Element element , ActivityImpl activity ) { boolean isAsyncBefore = isAsyncBefore ( element ) ; boolean isAsyncAfter = isAsyncAfter ( element ) ; boolean exclusive = isExclusive ( element ) ; activity . setAsyncBefore ( isAsyncBefore , exclusive ) ; activity . setAsyncAfter ( isAsyncAfter , exclusive ) ; } | Parse async continuation of the given element and create async jobs for the activity . |
10,156 | public ActivityImpl parseSendTask ( Element sendTaskElement , ScopeImpl scope ) { if ( isServiceTaskLike ( sendTaskElement ) ) { return parseServiceTaskLike ( "sendTask" , sendTaskElement , scope ) ; } else { ActivityImpl activity = createActivityOnScope ( sendTaskElement , scope ) ; parseAsynchronousContinuationForActivity ( sendTaskElement , activity ) ; parseExecutionListenersOnScope ( sendTaskElement , activity ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseSendTask ( sendTaskElement , scope , activity ) ; } if ( activity . getActivityBehavior ( ) == null ) { addError ( "One of the attributes 'class', 'delegateExpression', 'type', or 'expression' is mandatory on sendTask." , sendTaskElement ) ; } return activity ; } } | Parses a sendTask declaration . |
10,157 | public ActivityImpl parseManualTask ( Element manualTaskElement , ScopeImpl scope ) { ActivityImpl activity = createActivityOnScope ( manualTaskElement , scope ) ; activity . setActivityBehavior ( new ManualTaskActivityBehavior ( ) ) ; parseAsynchronousContinuationForActivity ( manualTaskElement , activity ) ; parseExecutionListenersOnScope ( manualTaskElement , activity ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseManualTask ( manualTaskElement , scope , activity ) ; } return activity ; } | Parses a manual task . |
10,158 | public ActivityImpl parseReceiveTask ( Element receiveTaskElement , ScopeImpl scope ) { ActivityImpl activity = createActivityOnScope ( receiveTaskElement , scope ) ; activity . setActivityBehavior ( new ReceiveTaskActivityBehavior ( ) ) ; parseAsynchronousContinuationForActivity ( receiveTaskElement , activity ) ; parseExecutionListenersOnScope ( receiveTaskElement , activity ) ; if ( receiveTaskElement . attribute ( "messageRef" ) != null ) { activity . setScope ( true ) ; activity . setEventScope ( activity ) ; EventSubscriptionDeclaration declaration = parseMessageEventDefinition ( receiveTaskElement ) ; declaration . setActivityId ( activity . getActivityId ( ) ) ; declaration . setEventScopeActivityId ( activity . getActivityId ( ) ) ; addEventSubscriptionDeclaration ( declaration , activity , receiveTaskElement ) ; } for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseReceiveTask ( receiveTaskElement , scope , activity ) ; } return activity ; } | Parses a receive task . |
10,159 | public ActivityImpl parseUserTask ( Element userTaskElement , ScopeImpl scope ) { ActivityImpl activity = createActivityOnScope ( userTaskElement , scope ) ; parseAsynchronousContinuationForActivity ( userTaskElement , activity ) ; TaskDefinition taskDefinition = parseTaskDefinition ( userTaskElement , activity . getId ( ) , ( ProcessDefinitionEntity ) scope . getProcessDefinition ( ) ) ; TaskDecorator taskDecorator = new TaskDecorator ( taskDefinition , expressionManager ) ; UserTaskActivityBehavior userTaskActivity = new UserTaskActivityBehavior ( taskDecorator ) ; activity . setActivityBehavior ( userTaskActivity ) ; parseProperties ( userTaskElement , activity ) ; parseExecutionListenersOnScope ( userTaskElement , activity ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseUserTask ( userTaskElement , scope , activity ) ; } return activity ; } | Parses a userTask declaration . |
10,160 | protected List < String > parseCommaSeparatedList ( String s ) { List < String > result = new ArrayList < String > ( ) ; if ( s != null && ! "" . equals ( s ) ) { StringCharacterIterator iterator = new StringCharacterIterator ( s ) ; char c = iterator . first ( ) ; StringBuilder strb = new StringBuilder ( ) ; boolean insideExpression = false ; while ( c != StringCharacterIterator . DONE ) { if ( c == '{' || c == '$' ) { insideExpression = true ; } else if ( c == '}' ) { insideExpression = false ; } else if ( c == ',' && ! insideExpression ) { result . add ( strb . toString ( ) . trim ( ) ) ; strb . delete ( 0 , strb . length ( ) ) ; } if ( c != ',' || ( insideExpression ) ) { strb . append ( c ) ; } c = iterator . next ( ) ; } if ( strb . length ( ) > 0 ) { result . add ( strb . toString ( ) . trim ( ) ) ; } } return result ; } | Parses the given String as a list of comma separated entries where an entry can possibly be an expression that has comma s . |
10,161 | protected EventSubscriptionDeclaration parseSignalEventDefinition ( Element signalEventDefinitionElement , boolean isThrowing ) { String signalRef = signalEventDefinitionElement . attribute ( "signalRef" ) ; if ( signalRef == null ) { addError ( "signalEventDefinition does not have required property 'signalRef'" , signalEventDefinitionElement ) ; return null ; } else { SignalDefinition signalDefinition = signals . get ( resolveName ( signalRef ) ) ; if ( signalDefinition == null ) { addError ( "Could not find signal with id '" + signalRef + "'" , signalEventDefinitionElement ) ; } EventSubscriptionDeclaration signalEventDefinition ; if ( isThrowing ) { CallableElement payload = new CallableElement ( ) ; parseInputParameter ( signalEventDefinitionElement , payload ) ; signalEventDefinition = new EventSubscriptionDeclaration ( signalDefinition . getExpression ( ) , EventType . SIGNAL , payload ) ; } else { signalEventDefinition = new EventSubscriptionDeclaration ( signalDefinition . getExpression ( ) , EventType . SIGNAL ) ; } boolean throwingAsync = TRUE . equals ( signalEventDefinitionElement . attributeNS ( CAMUNDA_BPMN_EXTENSIONS_NS , "async" , "false" ) ) ; signalEventDefinition . setAsync ( throwingAsync ) ; return signalEventDefinition ; } } | Parses the Signal Event Definition XML including payload definition . |
10,162 | protected Escalation findEscalationForEscalationEventDefinition ( Element escalationEventDefinition ) { String escalationRef = escalationEventDefinition . attribute ( "escalationRef" ) ; if ( escalationRef == null ) { addError ( "escalationEventDefinition does not have required attribute 'escalationRef'" , escalationEventDefinition ) ; } else if ( ! escalations . containsKey ( escalationRef ) ) { addError ( "could not find escalation with id '" + escalationRef + "'" , escalationEventDefinition ) ; } else { return escalations . get ( escalationRef ) ; } return null ; } | Find the referenced escalation of the given escalation event definition . Add errors if the referenced escalation not found . |
10,163 | public BoundaryConditionalEventActivityBehavior parseBoundaryConditionalEventDefinition ( Element element , boolean interrupting , ActivityImpl conditionalActivity ) { conditionalActivity . getProperties ( ) . set ( BpmnProperties . TYPE , ActivityTypes . BOUNDARY_CONDITIONAL ) ; ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition ( element , conditionalActivity ) ; conditionalEventDefinition . setInterrupting ( interrupting ) ; addEventSubscriptionDeclaration ( conditionalEventDefinition , conditionalActivity . getEventScope ( ) , element ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseBoundaryConditionalEventDefinition ( element , interrupting , conditionalActivity ) ; } return new BoundaryConditionalEventActivityBehavior ( conditionalEventDefinition ) ; } | Parses the given element as conditional boundary event . |
10,164 | public ConditionalEventDefinition parseIntermediateConditionalEventDefinition ( Element element , ActivityImpl conditionalActivity ) { conditionalActivity . getProperties ( ) . set ( BpmnProperties . TYPE , ActivityTypes . INTERMEDIATE_EVENT_CONDITIONAL ) ; ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition ( element , conditionalActivity ) ; addEventSubscriptionDeclaration ( conditionalEventDefinition , conditionalActivity . getEventScope ( ) , element ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseIntermediateConditionalEventDefinition ( element , conditionalActivity ) ; } return conditionalEventDefinition ; } | Parses the given element as intermediate conditional event . |
10,165 | public ConditionalEventDefinition parseConditionalStartEventForEventSubprocess ( Element element , ActivityImpl conditionalActivity , boolean interrupting ) { conditionalActivity . getProperties ( ) . set ( BpmnProperties . TYPE , ActivityTypes . START_EVENT_CONDITIONAL ) ; ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition ( element , conditionalActivity ) ; conditionalEventDefinition . setInterrupting ( interrupting ) ; addEventSubscriptionDeclaration ( conditionalEventDefinition , conditionalActivity . getEventScope ( ) , element ) ; for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseConditionalStartEventForEventSubprocess ( element , conditionalActivity , interrupting ) ; } return conditionalEventDefinition ; } | Parses the given element as conditional start event of an event subprocess . |
10,166 | protected ConditionalEventDefinition parseConditionalEventDefinition ( Element element , ActivityImpl conditionalActivity ) { ConditionalEventDefinition conditionalEventDefinition = null ; Element conditionExprElement = element . element ( CONDITION ) ; if ( conditionExprElement != null ) { Condition condition = parseConditionExpression ( conditionExprElement ) ; conditionalEventDefinition = new ConditionalEventDefinition ( condition , conditionalActivity ) ; String expression = conditionExprElement . getText ( ) . trim ( ) ; conditionalEventDefinition . setConditionAsString ( expression ) ; conditionalActivity . getProcessDefinition ( ) . getProperties ( ) . set ( BpmnProperties . HAS_CONDITIONAL_EVENTS , true ) ; final String variableName = element . attributeNS ( CAMUNDA_BPMN_EXTENSIONS_NS , "variableName" ) ; conditionalEventDefinition . setVariableName ( variableName ) ; final String variableEvents = element . attributeNS ( CAMUNDA_BPMN_EXTENSIONS_NS , "variableEvents" ) ; final List < String > variableEventsList = parseCommaSeparatedList ( variableEvents ) ; conditionalEventDefinition . setVariableEvents ( new HashSet < String > ( variableEventsList ) ) ; for ( String variableEvent : variableEventsList ) { if ( ! VARIABLE_EVENTS . contains ( variableEvent ) ) { addWarning ( "Variable event: " + variableEvent + " is not valid. Possible variable change events are: " + Arrays . toString ( VARIABLE_EVENTS . toArray ( ) ) , element ) ; } } } else { addError ( "Conditional event must contain an expression for evaluation." , element ) ; } return conditionalEventDefinition ; } | Parses the given element and returns an ConditionalEventDefinition object . |
10,167 | public void parseProperty ( Element propertyElement , ActivityImpl activity ) { String id = propertyElement . attribute ( "id" ) ; String name = propertyElement . attribute ( "name" ) ; if ( name == null ) { if ( id == null ) { addError ( "Invalid property usage on line " + propertyElement . getLine ( ) + ": no id or name specified." , propertyElement ) ; } else { name = id ; } } String type = null ; parsePropertyCustomExtensions ( activity , propertyElement , name , type ) ; } | Parses one property definition . |
10,168 | public void parsePropertyCustomExtensions ( ActivityImpl activity , Element propertyElement , String propertyName , String propertyType ) { if ( propertyType == null ) { String type = propertyElement . attributeNS ( CAMUNDA_BPMN_EXTENSIONS_NS , TYPE ) ; propertyType = type != null ? type : "string" ; } VariableDeclaration variableDeclaration = new VariableDeclaration ( propertyName , propertyType ) ; addVariableDeclaration ( activity , variableDeclaration ) ; activity . setScope ( true ) ; String src = propertyElement . attributeNS ( CAMUNDA_BPMN_EXTENSIONS_NS , "src" ) ; if ( src != null ) { variableDeclaration . setSourceVariableName ( src ) ; } String srcExpr = propertyElement . attributeNS ( CAMUNDA_BPMN_EXTENSIONS_NS , "srcExpr" ) ; if ( srcExpr != null ) { Expression sourceExpression = expressionManager . createExpression ( srcExpr ) ; variableDeclaration . setSourceExpression ( sourceExpression ) ; } String dst = propertyElement . attributeNS ( CAMUNDA_BPMN_EXTENSIONS_NS , "dst" ) ; if ( dst != null ) { variableDeclaration . setDestinationVariableName ( dst ) ; } String destExpr = propertyElement . attributeNS ( CAMUNDA_BPMN_EXTENSIONS_NS , "dstExpr" ) ; if ( destExpr != null ) { Expression destinationExpression = expressionManager . createExpression ( destExpr ) ; variableDeclaration . setDestinationExpression ( destinationExpression ) ; } String link = propertyElement . attributeNS ( CAMUNDA_BPMN_EXTENSIONS_NS , "link" ) ; if ( link != null ) { variableDeclaration . setLink ( link ) ; } String linkExpr = propertyElement . attributeNS ( CAMUNDA_BPMN_EXTENSIONS_NS , "linkExpr" ) ; if ( linkExpr != null ) { Expression linkExpression = expressionManager . createExpression ( linkExpr ) ; variableDeclaration . setLinkExpression ( linkExpression ) ; } for ( BpmnParseListener parseListener : parseListeners ) { parseListener . parseProperty ( propertyElement , variableDeclaration , activity ) ; } } | Parses the custom extensions for properties . |
10,169 | public void parseSequenceFlowConditionExpression ( Element seqFlowElement , TransitionImpl seqFlow ) { Element conditionExprElement = seqFlowElement . element ( CONDITION_EXPRESSION ) ; if ( conditionExprElement != null ) { Condition condition = parseConditionExpression ( conditionExprElement ) ; seqFlow . setProperty ( PROPERTYNAME_CONDITION_TEXT , conditionExprElement . getText ( ) . trim ( ) ) ; seqFlow . setProperty ( PROPERTYNAME_CONDITION , condition ) ; } } | Parses a condition expression on a sequence flow . |
10,170 | public void parseExecutionListenersOnScope ( Element scopeElement , ScopeImpl scope ) { Element extentionsElement = scopeElement . element ( "extensionElements" ) ; if ( extentionsElement != null ) { List < Element > listenerElements = extentionsElement . elementsNS ( CAMUNDA_BPMN_EXTENSIONS_NS , "executionListener" ) ; for ( Element listenerElement : listenerElements ) { String eventName = listenerElement . attribute ( "event" ) ; if ( isValidEventNameForScope ( eventName , listenerElement ) ) { ExecutionListener listener = parseExecutionListener ( listenerElement ) ; if ( listener != null ) { scope . addExecutionListener ( eventName , listener ) ; } } } } } | Parses all execution - listeners on a scope . |
10,171 | protected boolean isValidEventNameForScope ( String eventName , Element listenerElement ) { if ( eventName != null && eventName . trim ( ) . length ( ) > 0 ) { if ( "start" . equals ( eventName ) || "end" . equals ( eventName ) ) { return true ; } else { addError ( "Attribute 'event' must be one of {start|end}" , listenerElement ) ; } } else { addError ( "Attribute 'event' is mandatory on listener" , listenerElement ) ; } return false ; } | Check if the given event name is valid . If not an appropriate error is added . |
10,172 | public Object execute ( ExecutableScript script , VariableScope scope ) { ScriptEngine scriptEngine = scriptingEngines . getScriptEngineForLanguage ( script . getLanguage ( ) ) ; Bindings bindings = scriptingEngines . createBindings ( scriptEngine , scope ) ; return execute ( script , scope , bindings , scriptEngine ) ; } | execute a given script in the environment |
10,173 | protected List < ExecutableScript > getEnvScripts ( String scriptLanguage ) { Map < String , List < ExecutableScript > > environment = getEnv ( scriptLanguage ) ; List < ExecutableScript > envScripts = environment . get ( scriptLanguage ) ; if ( envScripts == null ) { synchronized ( this ) { envScripts = environment . get ( scriptLanguage ) ; if ( envScripts == null ) { envScripts = initEnvForLanguage ( scriptLanguage ) ; environment . put ( scriptLanguage , envScripts ) ; } } } return envScripts ; } | Returns the env scripts for the given language . Performs lazy initialization of the env scripts . |
10,174 | protected List < ExecutableScript > initEnvForLanguage ( String language ) { List < ExecutableScript > scripts = new ArrayList < ExecutableScript > ( ) ; for ( ScriptEnvResolver resolver : envResolvers ) { String [ ] resolvedScripts = resolver . resolve ( language ) ; if ( resolvedScripts != null ) { for ( String resolvedScript : resolvedScripts ) { scripts . add ( scriptFactory . createScriptFromSource ( language , resolvedScript ) ) ; } } } return scripts ; } | Initializes the env scripts for a given language . |
10,175 | @ SuppressWarnings ( "unchecked" ) public < S > S getService ( ObjectName name ) { return ( S ) servicesByName . get ( name ) ; } | get a specific service by name or null if no such Service exists . |
10,176 | public static boolean isPartOfProcessApplication ( DeploymentUnit unit ) { if ( isProcessApplication ( unit ) ) { return true ; } if ( unit . getParent ( ) != null && unit . getParent ( ) != unit ) { return unit . getParent ( ) . hasAttachment ( PART_OF_MARKER ) ; } return false ; } | return true if the deployment unit is either itself a process application or part of a process application . |
10,177 | public Object getValue ( ELContext context , Object base , Object property ) { if ( context == null ) { throw new NullPointerException ( "context is null" ) ; } Object result = null ; if ( isResolvable ( base ) ) { int index = toIndex ( null , property ) ; List < ? > list = ( List < ? > ) base ; result = index < 0 || index >= list . size ( ) ? null : list . get ( index ) ; context . setPropertyResolved ( true ) ; } return result ; } | If the base object is a list returns the value at the given index . The index is specified by the property argument and coerced into an integer . If the coercion could not be performed an IllegalArgumentException is thrown . If the index is out of bounds null is returned . If the base is a List the propertyResolved property of the ELContext object must be set to true by this resolver before returning . If this property is not true after this method is called the caller should ignore the return value . |
10,178 | public static boolean executesNonScopeCompensationHandler ( PvmExecutionImpl execution ) { ActivityImpl activity = execution . getActivity ( ) ; return execution . isScope ( ) && activity != null && activity . isCompensationHandler ( ) && ! activity . isScope ( ) ; } | With compensation we have a dedicated scope execution for every handler even if the handler is not a scope activity ; this must be respected when invoking end listeners etc . |
10,179 | public static boolean executesDefaultCompensationHandler ( PvmExecutionImpl scopeExecution ) { ActivityImpl currentActivity = scopeExecution . getActivity ( ) ; if ( currentActivity != null ) { return scopeExecution . isScope ( ) && currentActivity . isScope ( ) && ! scopeExecution . getNonEventScopeExecutions ( ) . isEmpty ( ) && ! isCompensationThrowing ( scopeExecution ) ; } else { return false ; } } | Determines whether an execution is responsible for default compensation handling . |
10,180 | public DefaultDmnEngineConfiguration build ( ) { List < DmnDecisionEvaluationListener > decisionEvaluationListeners = createCustomPostDecisionEvaluationListeners ( ) ; dmnEngineConfiguration . setCustomPostDecisionEvaluationListeners ( decisionEvaluationListeners ) ; DmnTransformer dmnTransformer = dmnEngineConfiguration . getTransformer ( ) ; dmnTransformer . getElementTransformHandlerRegistry ( ) . addHandler ( Definitions . class , new DecisionRequirementsDefinitionTransformHandler ( ) ) ; dmnTransformer . getElementTransformHandlerRegistry ( ) . addHandler ( Decision . class , new DecisionDefinitionHandler ( ) ) ; if ( dmnEngineConfiguration . getScriptEngineResolver ( ) == null ) { ensureNotNull ( "scriptEngineResolver" , scriptEngineResolver ) ; dmnEngineConfiguration . setScriptEngineResolver ( scriptEngineResolver ) ; } if ( dmnEngineConfiguration . getElProvider ( ) == null ) { ensureNotNull ( "expressionManager" , expressionManager ) ; ProcessEngineElProvider elProvider = new ProcessEngineElProvider ( expressionManager ) ; dmnEngineConfiguration . setElProvider ( elProvider ) ; } return dmnEngineConfiguration ; } | Modify the given DMN engine configuration and return it . |
10,181 | public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; if ( ! ProcessApplicationAttachments . isProcessApplication ( deploymentUnit ) ) { return ; } final Module module = deploymentUnit . getAttachment ( MODULE ) ; String [ ] deploymentDescriptors = getDeploymentDescriptors ( deploymentUnit ) ; List < URL > deploymentDescriptorURLs = getDeploymentDescriptorUrls ( module , deploymentDescriptors ) ; for ( URL processesXmlResource : deploymentDescriptorURLs ) { VirtualFile processesXmlFile = getFile ( processesXmlResource ) ; ProcessesXml processesXml = null ; if ( isEmptyFile ( processesXmlResource ) ) { processesXml = ProcessesXml . EMPTY_PROCESSES_XML ; } else { processesXml = parseProcessesXml ( processesXmlResource ) ; } ProcessApplicationAttachments . addProcessesXml ( deploymentUnit , new ProcessesXmlWrapper ( processesXml , processesXmlFile ) ) ; } } | this can happen ASAP in the POST_MODULE Phase |
10,182 | public ScriptEngine getScriptEngine ( String language , boolean resolveFromCache ) { ScriptEngine scriptEngine = null ; if ( resolveFromCache ) { scriptEngine = cachedEngines . get ( language ) ; if ( scriptEngine == null ) { scriptEngine = scriptEngineManager . getEngineByName ( language ) ; if ( scriptEngine != null ) { if ( ScriptingEngines . GROOVY_SCRIPTING_LANGUAGE . equals ( language ) ) { configureGroovyScriptEngine ( scriptEngine ) ; } if ( isCachable ( scriptEngine ) ) { cachedEngines . put ( language , scriptEngine ) ; } } } } else { scriptEngine = scriptEngineManager . getEngineByName ( language ) ; } return scriptEngine ; } | Returns a cached script engine or creates a new script engine if no such engine is currently cached . |
10,183 | protected boolean isCachable ( ScriptEngine scriptEngine ) { Object threadingParameter = scriptEngine . getFactory ( ) . getParameter ( "THREADING" ) ; return threadingParameter != null ; } | Allows checking whether the script engine can be cached . |
10,184 | public static TaskEntity createAndInsert ( VariableScope execution ) { TaskEntity task = create ( ) ; if ( execution instanceof ExecutionEntity ) { ExecutionEntity executionEntity = ( ExecutionEntity ) execution ; task . setExecution ( executionEntity ) ; task . skipCustomListeners = executionEntity . isSkipCustomListeners ( ) ; task . insert ( executionEntity ) ; return task ; } else if ( execution instanceof CaseExecutionEntity ) { task . setCaseExecution ( ( DelegateCaseExecution ) execution ) ; } task . insert ( null ) ; return task ; } | creates and initializes a new persistent task . |
10,185 | protected void propertyChanged ( String propertyName , Object orgValue , Object newValue ) { if ( propertyChanges . containsKey ( propertyName ) ) { Object oldOrgValue = propertyChanges . get ( propertyName ) . getOrgValue ( ) ; if ( ( oldOrgValue == null && newValue == null ) || ( oldOrgValue != null && oldOrgValue . equals ( newValue ) ) ) { propertyChanges . remove ( propertyName ) ; } else { propertyChanges . get ( propertyName ) . setNewValue ( newValue ) ; } } else { if ( ( orgValue == null && newValue != null ) || ( orgValue != null && newValue == null ) || ( orgValue != null && ! orgValue . equals ( newValue ) ) ) propertyChanges . put ( propertyName , new PropertyChange ( propertyName , orgValue , newValue ) ) ; } } | Tracks a property change . Therefore the original and new value are stored in a map . It tracks multiple changes and if a property finally is changed back to the original value then the change is removed . |
10,186 | public void setDelegationStateString ( String delegationState ) { if ( delegationState == null ) { setDelegationStateWithoutCascade ( null ) ; } else { setDelegationStateWithoutCascade ( DelegationState . valueOf ( delegationState ) ) ; } } | Setter for mybatis mapper . |
10,187 | public static < T > List < T > asArrayList ( T [ ] values ) { ArrayList < T > result = new ArrayList < T > ( ) ; Collections . addAll ( result , values ) ; return result ; } | Arrays . asList cannot be reliably used for SQL parameters on MyBatis < 3 . 3 . 0 |
10,188 | public static < T > List < List < T > > partition ( List < T > list , final int partitionSize ) { List < List < T > > parts = new ArrayList < List < T > > ( ) ; final int listSize = list . size ( ) ; for ( int i = 0 ; i < listSize ; i += partitionSize ) { parts . add ( new ArrayList < T > ( list . subList ( i , Math . min ( listSize , i + partitionSize ) ) ) ) ; } return parts ; } | Chops a list into non - view sublists of length partitionSize . |
10,189 | public static Date offset ( Long offsetInMillis ) { DateTimeUtils . setCurrentMillisOffset ( offsetInMillis ) ; return new Date ( DateTimeUtils . currentTimeMillis ( ) ) ; } | Moves the clock by the given offset and keeps it running from that point on . |
10,190 | protected void updateAuthorizationBasedOnCacheEntries ( AuthorizationEntity authorization , String userId , String groupId , Resource resource , String resourceId ) { DbEntityManager dbManager = Context . getCommandContext ( ) . getDbEntityManager ( ) ; List < AuthorizationEntity > list = dbManager . getCachedEntitiesByType ( AuthorizationEntity . class ) ; for ( AuthorizationEntity authEntity : list ) { boolean hasSameAuthRights = hasEntitySameAuthorizationRights ( authEntity , userId , groupId , resource , resourceId ) ; if ( hasSameAuthRights ) { int previousPermissions = authEntity . getPermissions ( ) ; authorization . setPermissions ( previousPermissions ) ; dbManager . getDbEntityCache ( ) . remove ( authEntity ) ; return ; } } } | Searches through the cache if there is already an authorization with same rights . If that s the case update the given authorization with the permissions and remove the old one from the cache . |
10,191 | protected void insertOrUpdate ( HistoryEvent historyEvent ) { final DbEntityManager dbEntityManager = getDbEntityManager ( ) ; if ( isInitialEvent ( historyEvent ) ) { dbEntityManager . insert ( historyEvent ) ; } else { if ( dbEntityManager . getCachedEntity ( historyEvent . getClass ( ) , historyEvent . getId ( ) ) == null ) { if ( historyEvent instanceof HistoricScopeInstanceEvent ) { HistoricScopeInstanceEvent existingEvent = ( HistoricScopeInstanceEvent ) dbEntityManager . selectById ( historyEvent . getClass ( ) , historyEvent . getId ( ) ) ; if ( existingEvent != null ) { HistoricScopeInstanceEvent historicScopeInstanceEvent = ( HistoricScopeInstanceEvent ) historyEvent ; historicScopeInstanceEvent . setStartTime ( existingEvent . getStartTime ( ) ) ; } } if ( historyEvent . getId ( ) == null ) { } else { dbEntityManager . merge ( historyEvent ) ; } } } } | general history event insert behavior |
10,192 | protected void insertHistoricVariableUpdateEntity ( HistoricVariableUpdateEventEntity historyEvent ) { DbEntityManager dbEntityManager = getDbEntityManager ( ) ; if ( shouldWriteHistoricDetail ( historyEvent ) ) { byte [ ] byteValue = historyEvent . getByteValue ( ) ; if ( byteValue != null ) { ByteArrayEntity byteArrayEntity = new ByteArrayEntity ( historyEvent . getVariableName ( ) , byteValue , ResourceTypes . HISTORY ) ; byteArrayEntity . setRootProcessInstanceId ( historyEvent . getRootProcessInstanceId ( ) ) ; byteArrayEntity . setRemovalTime ( historyEvent . getRemovalTime ( ) ) ; Context . getCommandContext ( ) . getByteArrayManager ( ) . insertByteArray ( byteArrayEntity ) ; historyEvent . setByteArrayId ( byteArrayEntity . getId ( ) ) ; } dbEntityManager . insert ( historyEvent ) ; } if ( historyEvent . isEventOfType ( HistoryEventTypes . VARIABLE_INSTANCE_CREATE ) ) { HistoricVariableInstanceEntity persistentObject = new HistoricVariableInstanceEntity ( historyEvent ) ; dbEntityManager . insert ( persistentObject ) ; } else if ( historyEvent . isEventOfType ( HistoryEventTypes . VARIABLE_INSTANCE_UPDATE ) || historyEvent . isEventOfType ( HistoryEventTypes . VARIABLE_INSTANCE_MIGRATE ) ) { HistoricVariableInstanceEntity historicVariableInstanceEntity = dbEntityManager . selectById ( HistoricVariableInstanceEntity . class , historyEvent . getVariableInstanceId ( ) ) ; if ( historicVariableInstanceEntity != null ) { historicVariableInstanceEntity . updateFromEvent ( historyEvent ) ; historicVariableInstanceEntity . setState ( HistoricVariableInstance . STATE_CREATED ) ; } else { HistoricVariableInstanceEntity persistentObject = new HistoricVariableInstanceEntity ( historyEvent ) ; dbEntityManager . insert ( persistentObject ) ; } } else if ( historyEvent . isEventOfType ( HistoryEventTypes . VARIABLE_INSTANCE_DELETE ) ) { HistoricVariableInstanceEntity historicVariableInstanceEntity = dbEntityManager . selectById ( HistoricVariableInstanceEntity . class , historyEvent . getVariableInstanceId ( ) ) ; if ( historicVariableInstanceEntity != null ) { historicVariableInstanceEntity . setState ( HistoricVariableInstance . STATE_DELETED ) ; } } } | customized insert behavior for HistoricVariableUpdateEventEntity |
10,193 | protected Token nextEval ( ) throws ScanException { char c1 = input . charAt ( position ) ; char c2 = position < input . length ( ) - 1 ? input . charAt ( position + 1 ) : ( char ) 0 ; switch ( c1 ) { case '*' : return fixed ( Symbol . MUL ) ; case '/' : return fixed ( Symbol . DIV ) ; case '%' : return fixed ( Symbol . MOD ) ; case '+' : return fixed ( Symbol . PLUS ) ; case '-' : return fixed ( Symbol . MINUS ) ; case '?' : return fixed ( Symbol . QUESTION ) ; case ':' : return fixed ( Symbol . COLON ) ; case '[' : return fixed ( Symbol . LBRACK ) ; case ']' : return fixed ( Symbol . RBRACK ) ; case '(' : return fixed ( Symbol . LPAREN ) ; case ')' : return fixed ( Symbol . RPAREN ) ; case ',' : return fixed ( Symbol . COMMA ) ; case '.' : if ( ! isDigit ( c2 ) ) { return fixed ( Symbol . DOT ) ; } break ; case '=' : if ( c2 == '=' ) { return fixed ( Symbol . EQ ) ; } break ; case '&' : if ( c2 == '&' ) { return fixed ( Symbol . AND ) ; } break ; case '|' : if ( c2 == '|' ) { return fixed ( Symbol . OR ) ; } break ; case '!' : if ( c2 == '=' ) { return fixed ( Symbol . NE ) ; } return fixed ( Symbol . NOT ) ; case '<' : if ( c2 == '=' ) { return fixed ( Symbol . LE ) ; } return fixed ( Symbol . LT ) ; case '>' : if ( c2 == '=' ) { return fixed ( Symbol . GE ) ; } return fixed ( Symbol . GT ) ; case '"' : case '\'' : return nextString ( ) ; } if ( isDigit ( c1 ) || c1 == '.' ) { return nextNumber ( ) ; } if ( Character . isJavaIdentifierStart ( c1 ) ) { int i = position + 1 ; int l = input . length ( ) ; while ( i < l && Character . isJavaIdentifierPart ( input . charAt ( i ) ) ) { i ++ ; } String name = input . substring ( position , i ) ; Token keyword = keyword ( name ) ; return keyword == null ? token ( Symbol . IDENTIFIER , name , i - position ) : keyword ; } throw new ScanException ( position , "invalid character '" + c1 + "'" , "expression token" ) ; } | token inside an eval expression |
10,194 | public static void main ( String [ ] args ) { if ( args . length != 1 ) { System . err . println ( "usage: java " + Builder . class . getName ( ) + " <expression string>" ) ; System . exit ( 1 ) ; } PrintWriter out = new PrintWriter ( System . out ) ; Tree tree = null ; try { tree = new Builder ( Feature . METHOD_INVOCATIONS ) . build ( args [ 0 ] ) ; } catch ( TreeBuilderException e ) { System . out . println ( e . getMessage ( ) ) ; System . exit ( 0 ) ; } NodePrinter . dump ( out , tree . getRoot ( ) ) ; if ( ! tree . getFunctionNodes ( ) . iterator ( ) . hasNext ( ) && ! tree . getIdentifierNodes ( ) . iterator ( ) . hasNext ( ) ) { ELContext context = new ELContext ( ) { public VariableMapper getVariableMapper ( ) { return null ; } public FunctionMapper getFunctionMapper ( ) { return null ; } public ELResolver getELResolver ( ) { return null ; } } ; out . print ( ">> " ) ; try { out . println ( tree . getRoot ( ) . getValue ( new Bindings ( null , null ) , context , null ) ) ; } catch ( ELException e ) { out . println ( e . getMessage ( ) ) ; } } out . flush ( ) ; } | Dump out abstract syntax tree for a given expression |
10,195 | private void checkConfiguration ( JobExecutorXml jobExecutorXml ) { Map < String , String > properties = jobExecutorXml . getProperties ( ) ; for ( Entry < String , String > entry : properties . entrySet ( ) ) { LOGGER . warning ( "Property " + entry . getKey ( ) + " with value " + entry . getValue ( ) + " from bpm-platform.xml will be ignored for JobExecutor." ) ; } } | Checks the validation to see if properties are present which will be ignored in this environment so we can log a warning . |
10,196 | private void stopProcessEngine ( String serviceName , PlatformServiceContainer serviceContainer ) { try { serviceContainer . stopService ( serviceName ) ; } catch ( Exception e ) { LOG . exceptionWhileStopping ( "Process Engine" , serviceName , e ) ; } } | Stops a process engine failures are logged but no exceptions are thrown . |
10,197 | public static DelegateExecution getCurrentDelegationExecution ( ) { BpmnExecutionContext bpmnExecutionContext = Context . getBpmnExecutionContext ( ) ; ExecutionEntity executionEntity = null ; if ( bpmnExecutionContext != null ) { executionEntity = bpmnExecutionContext . getExecution ( ) ; } return executionEntity ; } | Returns the current delegation execution or null if the execution is not available . |
10,198 | public void addStep ( DeploymentOperationStep step ) { if ( currentStep != null ) { steps . add ( steps . indexOf ( currentStep ) + 1 , step ) ; } else { steps . add ( step ) ; } } | Add a new atomic step to the composite operation . If the operation is currently executing a step the step is added after the current step . |
10,199 | public EventSubscriptionEntity createSubscriptionForExecution ( ExecutionEntity execution ) { EventSubscriptionEntity eventSubscriptionEntity = new EventSubscriptionEntity ( execution , eventType ) ; String eventName = resolveExpressionOfEventName ( execution ) ; eventSubscriptionEntity . setEventName ( eventName ) ; if ( activityId != null ) { ActivityImpl activity = execution . getProcessDefinition ( ) . findActivity ( activityId ) ; eventSubscriptionEntity . setActivity ( activity ) ; } eventSubscriptionEntity . insert ( ) ; LegacyBehavior . removeLegacySubscriptionOnParent ( execution , eventSubscriptionEntity ) ; return eventSubscriptionEntity ; } | Creates and inserts a subscription entity depending on the message type of this declaration . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.