/// <summary>
        /// Activity Constructor
        /// </summary>
        /// <param name="activity">activity</param>
        public MWFEventAudit(MWFActivity activity)
            : base(activity.GetCtx(), 0, activity.Get_TrxName())
        {
            SetAD_WF_Process_ID(activity.GetAD_WF_Process_ID());
            SetAD_WF_Node_ID(activity.GetAD_WF_Node_ID());
            SetAD_Table_ID(activity.GetAD_Table_ID());
            SetRecord_ID(activity.GetRecord_ID());
            SetAD_WF_Responsible_ID(activity.GetAD_WF_Responsible_ID());
            SetAD_User_ID(activity.GetAD_User_ID());
            SetWFState(activity.GetWFState());
            SetEventType(EVENTTYPE_ProcessCreated);
            SetElapsedTimeMS(Utility.Env.ZERO);
            MWFNode node = activity.GetNode();

            if (node != null && node.Get_ID() != 0)
            {
                String action = node.GetAction();
                if (MWFNode.ACTION_SetVariable.Equals(action) ||
                    MWFNode.ACTION_UserChoice.Equals(action))
                {
                    SetAttributeName(node.GetAttributeName());
                    //SetOldValue(String.valueOf(activity.getAttributeValue()));
                    SetOldValue(Util.GetValueOfString(activity.GetAttributeValue()));
                    if (MWFNode.ACTION_SetVariable.Equals(action))
                    {
                        SetNewValue(node.GetAttributeValue());
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Get the next nodes
        /// </summary>
        /// <param name="AD_WF_Node_ID">ID</param>
        /// <param name="AD_Client_ID">for client</param>
        /// <returns>array of next nodes or null</returns>
        public MWFNode[] GetNextNodes(int AD_WF_Node_ID, int AD_Client_ID)
        {
            MWFNode node = GetNode(AD_WF_Node_ID);

            if (node == null || node.GetNextNodeCount() == 0)
            {
                return(null);
            }
            MWFNodeNext[]  nexts = node.GetTransitions(AD_Client_ID);
            List <MWFNode> list  = new List <MWFNode>();

            for (int i = 0; i < nexts.Length; i++)
            {
                MWFNode next = GetNode(nexts[i].GetAD_WF_Next_ID());
                if (next != null)
                {
                    list.Add(next);
                }
            }
            //	Return Nodes
            MWFNode[] retValue = new MWFNode[list.Count];
            //list.toArray(retValue);
            retValue = list.ToArray();
            return(retValue);
        }
Exemple #3
0
 /// <summary>
 /// Parent Constructor
 /// </summary>
 /// <param name="parent">parent</param>
 /// <param name="AD_WF_Next_ID">next id</param>
 public MWFNodeNext(MWFNode parent, int AD_WF_Next_ID)
     : this(parent.GetCtx(), 0, parent.Get_TrxName())
 {
     SetClientOrg(parent);
     SetAD_WF_Node_ID(parent.GetAD_WF_Node_ID());
     SetAD_WF_Next_ID(AD_WF_Next_ID);
 }
        /// <summary>
        /// Get Node Name
        /// </summary>
        /// <returns>node name</returns>
        public String GetNodeName()
        {
            MWFNode node = MWFNode.Get(GetCtx(), GetAD_WF_Node_ID());

            if (node.Get_ID() == 0)
            {
                return("?");
            }
            return(node.GetName(true));
        }
Exemple #5
0
 /// <summary>
 /// Get Node with ID in Workflow
 /// </summary>
 /// <param name="AD_WF_Node_ID">ID</param>
 /// <returns>node or null</returns>
 protected MWFNode GetNode(int AD_WF_Node_ID)
 {
     for (int i = 0; i < _nodes.Count; i++)
     {
         MWFNode node = (MWFNode)_nodes[i];
         if (node.GetAD_WF_Node_ID() == AD_WF_Node_ID)
         {
             return(node);
         }
     }
     return(null);
 }
Exemple #6
0
 /// <summary>
 /// Join Element is AND
 /// </summary>
 /// <returns>Returns the to Join And.</returns>
 public bool IsToJoinAnd()
 {
     if (_toJoinAnd == null && GetAD_WF_Next_ID() != 0)
     {
         MWFNode next = MWFNode.Get(GetCtx(), GetAD_WF_Next_ID());
         SetToJoinAnd(MWFNode.JOINELEMENT_AND.Equals(next.GetJoinElement()));
     }
     if (_toJoinAnd != null)
     {
         return((bool)_toJoinAnd);
     }
     return(false);
 }
Exemple #7
0
        /// <summary>
        /// Get WF Node from Cache
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="AD_WF_Node_ID">id</param>
        /// <returns>MWFNode</returns>
        public static MWFNode Get(Ctx ctx, int AD_WF_Node_ID)
        {
            int     key      = AD_WF_Node_ID;
            MWFNode retValue = _cache[key];

            if (retValue != null)
            {
                return(retValue);
            }
            retValue = new MWFNode(ctx, AD_WF_Node_ID, null);
            if (retValue.Get_ID() != 0)
            {
                _cache.Add(key, retValue);
            }
            return(retValue);
        }
Exemple #8
0
        /// <summary>
        ///	Add Nodes recursively (depth first) to Ordered List
        /// </summary>
        /// <param name="list">list to add to</param>
        /// <param name="AD_WF_Node_ID">start node id</param>
        /// <param name="AD_Client_ID">for client</param>
        private void AddNodesDF(List <MWFNode> list, int AD_WF_Node_ID, int AD_Client_ID)
        {
            MWFNode node = GetNode(AD_WF_Node_ID);

            if (node != null && !list.Contains(node))
            {
                list.Add(node);
                //	Get Dependent
                MWFNodeNext[] nexts = node.GetTransitions(AD_Client_ID);
                for (int i = 0; i < nexts.Length; i++)
                {
                    if (nexts[i].IsActive())
                    {
                        AddNodesDF(list, nexts[i].GetAD_WF_Next_ID(), AD_Client_ID);
                    }
                }
            }
        }
Exemple #9
0
        /// <summary>
        /// Get The Nodes in Sequence Order
        /// </summary>
        /// <param name="AD_Client_ID">client</param>
        /// <returns>Nodes in sequence</returns>
        private MWFNode[] GetNodesInOrder(int AD_Client_ID)
        {
            List <MWFNode> list = new List <MWFNode>();

            AddNodesSF(list, GetAD_WF_Node_ID(), AD_Client_ID); //	start with first
            //	Remaining Nodes
            if (_nodes.Count != list.Count)
            {
                //	Add Stand alone
                for (int n = 0; n < _nodes.Count; n++)
                {
                    MWFNode node = (MWFNode)_nodes[n];
                    if (!node.IsActive())
                    {
                        continue;
                    }
                    if (node.GetAD_Client_ID() == 0 || node.GetAD_Client_ID() == AD_Client_ID)
                    {
                        bool found = false;
                        for (int i = 0; i < list.Count; i++)
                        {
                            MWFNode existing = (MWFNode)list[i];
                            if (existing.GetAD_WF_Node_ID() == node.GetAD_WF_Node_ID())
                            {
                                found = true;
                                break;
                            }
                        }
                        if (!found)
                        {
                            log.Log(Level.WARNING, "Added Node w/o transition: " + node);
                            list.Add(node);
                        }
                    }
                }
            }
            //
            MWFNode[] nodeArray = new MWFNode[list.Count];
            nodeArray = list.ToArray();
            return(nodeArray);
        }
Exemple #10
0
        /// <summary>
        /// Add Nodes recursively (sibling first) to Ordered List
        /// </summary>
        /// <param name="list">list to add to</param>
        /// <param name="AD_WF_Node_ID">start node id</param>
        /// <param name="AD_Client_ID">for client</param>
        private void AddNodesSF(List <MWFNode> list, int AD_WF_Node_ID, int AD_Client_ID)
        {
            MWFNode node = GetNode(AD_WF_Node_ID);

            if (node != null &&
                (node.GetAD_Client_ID() == 0 || node.GetAD_Client_ID() == AD_Client_ID))
            {
                if (!list.Contains(node))
                {
                    list.Add(node);
                }
                MWFNodeNext[] nexts = node.GetTransitions(AD_Client_ID);
                for (int i = 0; i < nexts.Length; i++)
                {
                    MWFNode child = GetNode(nexts[i].GetAD_WF_Next_ID());
                    if (!child.IsActive())
                    {
                        continue;
                    }
                    if (child.GetAD_Client_ID() == 0 ||
                        child.GetAD_Client_ID() == AD_Client_ID)
                    {
                        if (!list.Contains(child))
                        {
                            list.Add(child);
                        }
                    }
                }
                //	Remainder Nodes not connected
                for (int i = 0; i < nexts.Length; i++)
                {
                    if (nexts[i].IsActive())
                    {
                        AddNodesSF(list, nexts[i].GetAD_WF_Next_ID(), AD_Client_ID);
                    }
                }
            }
        }
Exemple #11
0
        /// <summary>
        /// Get the active nodes
        /// </summary>
        /// <param name="ordered">ordered ordered array</param>
        /// <param name="AD_Client_ID">for client</param>
        /// <returns>array of nodes</returns>
        public MWFNode[] GetNodes(bool ordered, int AD_Client_ID)
        {
            if (ordered)
            {
                return(GetNodesInOrder(AD_Client_ID));
            }
            List <MWFNode> list = new List <MWFNode>();

            for (int i = 0; i < _nodes.Count; i++)
            {
                MWFNode node = _nodes[i];
                if (!node.IsActive())
                {
                    continue;
                }
                if (node.GetAD_Client_ID() == 0 || node.GetAD_Client_ID() == AD_Client_ID)
                {
                    list.Add(node);
                }
            }
            MWFNode[] retValue = new MWFNode[list.Count];
            retValue = list.ToArray();
            return(retValue);
        }