コード例 #1
0
        private void Wakeup()
        {
            String sql = "SELECT * "
                         + "FROM AD_WF_Activity a "
                         + "WHERE Processed='N' AND WFState='OS'" //	suspended
                         + " AND EndWaitTime > SysDate"
                         + " AND AD_Client_ID=@AD_Client_ID"
                         + " AND EXISTS (SELECT * FROM AD_Workflow wf "
                         + " INNER JOIN AD_WF_Node wfn ON (wf.AD_Workflow_ID=wfn.AD_Workflow_ID) "
                         + "WHERE a.AD_WF_Node_ID=wfn.AD_WF_Node_ID"
                         + " AND wfn.Action='Z'"        //	sleeping
                         + " AND wf.AD_WorkflowProcessor_ID IS NULL OR wf.AD_WorkflowProcessor_ID=@AD_WorkflowProcessor_ID)";

            int count = 0;

            try
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@AD_Client_ID", m_model.GetAD_Client_ID());
                param[1] = new SqlParameter("@AD_WorkflowProcessor_ID", m_model.GetAD_WorkflowProcessor_ID());
                DataSet ds = DB.ExecuteDataset(sql, param);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    MWFActivity activity = new MWFActivity(GetCtx(), dr, null);
                    activity.SetWFState(StateEngine.STATE_COMPLETED);
                    // saves and calls MWFProcess.checkActivities();
                    count++;
                }
            }
            catch (Exception e)
            {
                log.Log(Level.SEVERE, "wakeup", e);
            }
            m_summary.Append("Wakeup #").Append(count).Append(" - ");
        }       //	wakeup
コード例 #2
0
        /// <summary>
        ///Perform Process.
        /// </summary>
        /// <returns>Message (variables are parsed)</returns>
        protected override String DoIt()
        {
            string      msg      = null;
            MWFActivity activity = new MWFActivity(GetCtx(), p_AD_WF_Activity_ID, Get_Trx());

            log.Info("" + activity);

            MUser user = MUser.Get(GetCtx(), GetAD_User_ID());

            //	Abort
            if (p_IsAbort)
            {
                msg = user.GetName() + ": Abort";
                activity.SetTextMsg(msg);
                activity.SetAD_User_ID(GetAD_User_ID());
                activity.SetWFState(StateEngine.STATE_ABORTED);
                //JID_0278 : To mark processing checkbox false.
                // Mohit
                // Date : 22 May 2019
                MTable table = new MTable(GetCtx(), activity.GetAD_Table_ID(), null);
                PO     po    = MTable.GetPO(GetCtx(), table.GetTableName(), activity.GetRecord_ID(), Get_Trx());
                if (po != null && po.Get_ColumnIndex("Processing") >= 0)
                {
                    po.Set_Value("Processing", false);
                    po.Save();
                }
                return(msg);
            }

            //	Change User
            if (p_AD_User_ID != 0 && activity.GetAD_User_ID() != p_AD_User_ID)
            {
                MUser from = MUser.Get(GetCtx(), activity.GetAD_User_ID());
                MUser to   = MUser.Get(GetCtx(), p_AD_User_ID);
                msg = user.GetName() + ": " + from.GetName() + " -> " + to.GetName();
                activity.SetTextMsg(msg);
                activity.SetAD_User_ID(p_AD_User_ID);
            }
            //	Change Responsible
            if (p_AD_WF_Responsible_ID != 0 && activity.GetAD_WF_Responsible_ID() != p_AD_WF_Responsible_ID)
            {
                MWFResponsible from = MWFResponsible.Get(GetCtx(), activity.GetAD_WF_Responsible_ID());
                MWFResponsible to   = MWFResponsible.Get(GetCtx(), p_AD_WF_Responsible_ID);
                String         msg1 = user.GetName() + ": " + from.GetName() + " -> " + to.GetName();
                activity.SetTextMsg(msg1);
                activity.SetAD_WF_Responsible_ID(p_AD_WF_Responsible_ID);
                if (msg == null)
                {
                    msg = msg1;
                }
                else
                {
                    msg += " - " + msg1;
                }
            }
            activity.Save();
            return(msg);
        }
コード例 #3
0
        /// <summary>
        ///Perform Process.
        /// </summary>
        /// <returns>Message (variables are parsed)</returns>
        protected override String DoIt()
        {
            string      msg      = null;
            MWFActivity activity = new MWFActivity(GetCtx(), p_AD_WF_Activity_ID, Get_Trx());

            log.Info("" + activity);

            MUser user = MUser.Get(GetCtx(), GetAD_User_ID());

            //	Abort
            if (p_IsAbort)
            {
                msg = user.GetName() + ": Abort";
                activity.SetTextMsg(msg);
                activity.SetAD_User_ID(GetAD_User_ID());
                activity.SetWFState(StateEngine.STATE_ABORTED);
                return(msg);
            }

            //	Change User
            if (p_AD_User_ID != 0 && activity.GetAD_User_ID() != p_AD_User_ID)
            {
                MUser from = MUser.Get(GetCtx(), activity.GetAD_User_ID());
                MUser to   = MUser.Get(GetCtx(), p_AD_User_ID);
                msg = user.GetName() + ": " + from.GetName() + " -> " + to.GetName();
                activity.SetTextMsg(msg);
                activity.SetAD_User_ID(p_AD_User_ID);
            }
            //	Change Responsible
            if (p_AD_WF_Responsible_ID != 0 && activity.GetAD_WF_Responsible_ID() != p_AD_WF_Responsible_ID)
            {
                MWFResponsible from = MWFResponsible.Get(GetCtx(), activity.GetAD_WF_Responsible_ID());
                MWFResponsible to   = MWFResponsible.Get(GetCtx(), p_AD_WF_Responsible_ID);
                String         msg1 = user.GetName() + ": " + from.GetName() + " -> " + to.GetName();
                activity.SetTextMsg(msg1);
                activity.SetAD_WF_Responsible_ID(p_AD_WF_Responsible_ID);
                if (msg == null)
                {
                    msg = msg1;
                }
                else
                {
                    msg += " - " + msg1;
                }
            }
            activity.Save();
            return(msg);
        }