Exemplo n.º 1
0
 public void AddTransition(WfTransitionDefinition transition)
 {
     Debug.Assert(transition != null);
     Debug.Assert(transition.Name != null);
     //--
     transitionsNext.Add(transition.WfadIdFrom + "|" + transition.Name, transition);
 }
Exemplo n.º 2
0
 public void RemoveTransition(WfTransitionDefinition transition)
 {
     Debug.Assert(transition != null);
     Debug.Assert(transition.Name != null);
     //--
     transitionsNext.Remove(transition.WfadIdFrom + "|" + transition.Name);
 }
        public int CountDefaultTransitions(WfWorkflowDefinition wfWorkflowDefinition)
        {
            Debug.Assert(wfWorkflowDefinition != null);
            //--
            long?idActivity = wfWorkflowDefinition.WfadId;

            if (idActivity == null)
            {
                //The workflow don't have a starting activity
                return(0);
            }

            WfTransitionDefinition transitionNext = transitionsNext[idActivity + "|" + WfCodeTransition.Default.ToString()];

            int count = 0;

            while (transitionNext != null)
            {
                WfActivityDefinition wfNextActivityDefinition = inMemoryActivityDefinitionStore[transitionNext.WfadIdTo];
                idActivity     = wfNextActivityDefinition.WfadId;
                transitionNext = transitionsNext[wfNextActivityDefinition.WfadId + "|" + WfCodeTransition.Default.ToString()];
                count++;
            }

            return(count);
        }
        public WfActivityDefinition FindActivityDefinitionByPosition(WfWorkflowDefinition wfWorkflowDefinition, int position)
        {
            int?idActivity = wfWorkflowDefinition.WfadId;

            if (idActivity == null)
            {
                //The workflow don't have a starting activity
                return(null);
            }
            WfTransitionDefinition transitionNext = transitionsNext[idActivity + "|" + WfCodeTransition.Default.ToString()];

            int i = 1;

            while (transitionNext != null && i < position)
            {
                WfActivityDefinition wfNextActivityDefinition = inMemoryActivityDefinitionStore[transitionNext.WfadIdTo];
                idActivity     = wfNextActivityDefinition.WfadId;
                transitionNext = transitionsNext[wfNextActivityDefinition.WfadId + "|" + WfCodeTransition.Default.ToString()];
                i++;
            }

            if (transitionNext == null)
            {
                return(null);
            }

            return(ReadActivityDefinition(transitionNext.WfadIdTo));
        }
Exemplo n.º 5
0
        public WfTransitionDefinition build()
        {
            WfTransitionDefinition wfTransitionDefinition = new WfTransitionDefinition();

            wfTransitionDefinition.Name       = (myName == null ? DEFAULT_VALUE_NAME : myName);
            wfTransitionDefinition.WfadIdFrom = wfadIdFrom;
            wfTransitionDefinition.WfadIdTo   = wfadIdTo;
            return(wfTransitionDefinition);
        }
Exemplo n.º 6
0
        public WfActivityDefinition FindNextActivity(WfActivity activity, string transitionName)
        {
            FilterCriteria filterCriteria = new FilterCriteria();

            filterCriteria.Equals(WfTransitionDefinition.Cols.WFAD_ID_FROM, activity.WfadId);
            filterCriteria.Equals(WfTransitionDefinition.Cols.NAME, transitionName);
            WfTransitionDefinition transition = BrokerManager.GetBroker <WfTransitionDefinition>().GetByCriteria(filterCriteria);

            return(BrokerManager.GetBroker <WfActivityDefinition>().Get(transition.WfadIdTo));
        }
Exemplo n.º 7
0
        public WfTransitionDefinition Build()
        {
            WfTransitionDefinition wfTransitionDefinition = new WfTransitionDefinition();

            wfTransitionDefinition.Name       = (MyName == null ? WfCodeTransition.Default.ToString() : MyName);
            wfTransitionDefinition.WfadIdFrom = WfadIdFrom;
            wfTransitionDefinition.WfadIdTo   = WfadIdTo;
            wfTransitionDefinition.WfwdId     = WfwdId;
            return(wfTransitionDefinition);
        }
Exemplo n.º 8
0
        public bool HasNextActivity(WfActivity activity, string transitionName)
        {
            //TODO: remove this method and use FindNextActivity
            FilterCriteria filterCriteria = new FilterCriteria();

            filterCriteria.Equals(WfTransitionDefinition.Cols.WFAD_ID_FROM, activity.WfadId);
            filterCriteria.Equals(WfTransitionDefinition.Cols.NAME, transitionName);
            WfTransitionDefinition transition = BrokerManager.GetBroker <WfTransitionDefinition>().GetByCriteria(filterCriteria);

            return(transition != null);
        }
        public IList <WfActivityDefinition> FindAllDefaultActivityDefinitions(WfWorkflowDefinition wfWorkflowDefinition)
        {
            Debug.Assert(wfWorkflowDefinition != null);
            //---
            long?idStartActivity = wfWorkflowDefinition.WfadId;
            IList <WfActivityDefinition> retAllDefaultActivities = new List <WfActivityDefinition>();

            WfTransitionDefinition transitionNext = transitionsNext[idStartActivity + "|" + WfCodeTransition.Default.ToString()];

            while (transitionNext != null)
            {
                WfActivityDefinition wfNextActivityDefinition = inMemoryActivityDefinitionStore[transitionNext.WfadIdTo];
                retAllDefaultActivities.Add(wfNextActivityDefinition);
                transitionNext = transitionsNext[wfNextActivityDefinition.WfadId + "|" + WfCodeTransition.Default.ToString()];
            }

            return(retAllDefaultActivities);
        }
Exemplo n.º 10
0
 public void RemoveTransition(WfTransitionDefinition transition)
 {
     BrokerManager.GetBroker <WfTransitionDefinition>().Delete(transition);
 }
Exemplo n.º 11
0
 public void AddTransition(WfTransitionDefinition transition)
 {
     BrokerManager.GetBroker <WfTransitionDefinition>().Save(transition);
 }
Exemplo n.º 12
0
 public void UpdateTransition(WfTransitionDefinition transition)
 {
     transitionsNext[transition.WfadIdFrom + "|" + transition.Name] = transition;
 }
Exemplo n.º 13
0
        public WfActivityDefinition FindNextActivity(int wfadId, string transitionName)
        {
            WfTransitionDefinition transitionNext = transitionsNext[wfadId + "|" + transitionName];

            return(inMemoryActivityDefinitionStore[transitionNext.WfadIdTo]);
        }