Example #1
0
        public virtual CaseDefinitionBuilder createActivity(string id)
        {
            CmmnActivity activity = activityStack.Peek().createActivity(id);

            activityStack.Push(activity);
            processElement = activity;

            return(this);
        }
Example #2
0
        // create a new activity ///////////////////////////////////////

        public override CmmnActivity createActivity(string activityId)
        {
            CmmnActivity activity = new CmmnActivity(activityId, caseDefinition);

            if (!string.ReferenceEquals(activityId, null))
            {
                namedActivities[activityId] = activity;
            }
            activity.Parent = this;
            activities.Add(activity);
            return(activity);
        }
Example #3
0
        public virtual void addOnPart(CmmnOnPartDeclaration onPart)
        {
            CmmnActivity source = onPart.Source;

            if (source == null)
            {
                // do nothing: ignore onPart
                return;
            }

            string sourceId = source.Id;

            IList <CmmnOnPartDeclaration> onPartDeclarations = onPartMap[sourceId];

            if (onPartDeclarations == null)
            {
                onPartDeclarations  = new List <CmmnOnPartDeclaration>();
                onPartMap[sourceId] = onPartDeclarations;
            }

            foreach (CmmnOnPartDeclaration onPartDeclaration in onPartDeclarations)
            {
                if (onPart.StandardEvent.Equals(onPartDeclaration.StandardEvent))
                {
                    // if there already exists an onPartDeclaration which has the
                    // same defined standardEvent then ignore this onPartDeclaration.

                    if (onPartDeclaration.Sentry == onPart.Sentry)
                    {
                        return;
                    }

                    // but merge the sentryRef into the already existing onPartDeclaration
                    if (onPartDeclaration.Sentry == null && onPart.Sentry != null)
                    {
                        // According to the specification, when "sentryRef" is specified,
                        // "standardEvent" must have value "exit" (page 39, Table 23).
                        // But there is no further check necessary.
                        onPartDeclaration.Sentry = onPart.Sentry;
                        return;
                    }
                }
            }

            onPartDeclarations.Add(onPart);
            onParts.Add(onPart);
        }
Example #4
0
        public virtual CmmnCaseInstance createCaseInstance(string businessKey)
        {
            // create a new case instance
            CmmnExecution caseInstance = newCaseInstance();

            // set the definition...
            caseInstance.CaseDefinition = this;
            // ... and the case instance (identity)
            caseInstance.CaseInstance = caseInstance;

            // set the business key
            caseInstance.BusinessKey = businessKey;

            // get the case plan model as "initial" activity
            CmmnActivity casePlanModel = Activities[0];

            // set the case plan model activity
            caseInstance.Activity = casePlanModel;

            return(caseInstance);
        }
Example #5
0
        // variable listeners

        /// <summary>
        /// Returns a map of all variable listeners defined on this activity or any of
        /// its parents activities. The map's key is the id of the respective activity
        /// the listener is defined on.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: public java.util.Map<String, java.util.List<org.camunda.bpm.engine.delegate.VariableListener<?>>> getVariableListeners(String eventName, boolean includeCustomListeners)
        public virtual IDictionary <string, IList <VariableListener <object> > > getVariableListeners(string eventName, bool includeCustomListeners)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<String, java.util.Map<String, java.util.List<org.camunda.bpm.engine.delegate.VariableListener<?>>>> listenerCache;
            IDictionary <string, IDictionary <string, IList <VariableListener <object> > > > listenerCache;

            if (includeCustomListeners)
            {
                if (resolvedVariableListeners == null)
                {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: resolvedVariableListeners = new java.util.HashMap<String, java.util.Map<String,java.util.List<org.camunda.bpm.engine.delegate.VariableListener<?>>>>();
                    resolvedVariableListeners = new Dictionary <string, IDictionary <string, IList <VariableListener <object> > > >();
                }

                listenerCache = resolvedVariableListeners;
            }
            else
            {
                if (resolvedBuiltInVariableListeners == null)
                {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: resolvedBuiltInVariableListeners = new java.util.HashMap<String, java.util.Map<String,java.util.List<org.camunda.bpm.engine.delegate.VariableListener<?>>>>();
                    resolvedBuiltInVariableListeners = new Dictionary <string, IDictionary <string, IList <VariableListener <object> > > >();
                }
                listenerCache = resolvedBuiltInVariableListeners;
            }

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<String, java.util.List<org.camunda.bpm.engine.delegate.VariableListener<?>>> resolvedListenersForEvent = listenerCache.get(eventName);
            IDictionary <string, IList <VariableListener <object> > > resolvedListenersForEvent = listenerCache[eventName];

            if (resolvedListenersForEvent == null)
            {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: resolvedListenersForEvent = new java.util.HashMap<String, java.util.List<org.camunda.bpm.engine.delegate.VariableListener<?>>>();
                resolvedListenersForEvent = new Dictionary <string, IList <VariableListener <object> > >();
                listenerCache[eventName]  = resolvedListenersForEvent;

                CmmnActivity currentActivity = this;

                while (currentActivity != null)
                {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<org.camunda.bpm.engine.delegate.VariableListener<?>> localListeners = null;
                    IList <VariableListener <object> > localListeners = null;
                    if (includeCustomListeners)
                    {
                        localListeners = currentActivity.getVariableListenersLocal(eventName);
                    }
                    else
                    {
                        localListeners = currentActivity.getBuiltInVariableListenersLocal(eventName);
                    }

                    if (localListeners != null && localListeners.Count > 0)
                    {
                        resolvedListenersForEvent[currentActivity.Id] = localListeners;
                    }

                    currentActivity = currentActivity.Parent;
                }
            }

            return(resolvedListenersForEvent);
        }