}       //	getParameter

        /**************************************************************************
         *  Process SQL Procedures w/o parameter
         *	@param Record_ID record
         *	@return Process Instance
         */
        public MPInstance ProcessIt(int Record_ID)
        {
            MPInstance pInstance = new MPInstance(this, Record_ID);

            //	Lock
            pInstance.SetIsProcessing(true);
            //pInstance.save();

            bool ok = true;

            //	PL/SQL Procedure
            String ProcedureName = GetProcedureName();

            //	String Classname = getClassname();
            if (ProcedureName != null && ProcedureName.Length > 0)
            {
                ok = StartProcess(ProcedureName, pInstance);
            }
            //	else if (Classname != null && Classname.length() > 0)
            //		ok = startClass(Classname, pi, trx);


            //	Unlock
            pInstance.SetResult(ok ? MPInstance.RESULT_OK : MPInstance.RESULT_ERROR);
            pInstance.SetIsProcessing(false);
            //pInstance.save();
            //
            //pInstance.log();
            return(pInstance);
        }       //	process
        }       //	process

        /**
         *  Process It (sync)
         *	@param pi Process Info
         *	@param trx transaction
         *	@return true if OK
         */
        public bool ProcessIt(ProcessInfo pi, Trx trx)
        {
            if (pi.GetAD_PInstance_ID() == 0)
            {
                MPInstance pInstance = new MPInstance(this, pi.GetRecord_ID());
                //	Lock
                pInstance.SetIsProcessing(true);
                pInstance.Save();
            }

            bool ok = false;

            //	 Class
            String Classname = GetClassname();

            if (Classname != null && Classname.Length > 0)
            {
                ok = StartClass(Classname, pi, trx);
            }
            // checked if procedure is linked with Process
            // then execute procedure
            else if (GetProcedureName() != null && GetProcedureName().Trim().Length > 0)
            {
                ProcessCtl pc = new ProcessCtl(GetCtx(), null, pi, trx);
                ok = pc.StartDBProcess(GetProcedureName());
            }
            else
            {
                if (!IsReport())
                {
                    String msg = "No Classname for " + GetName();
                    pi.SetSummary(msg, ok);
                }
                else
                {
                    String msg = Msg.GetMsg(GetCtx(), "Success") + " " + GetValue();
                    pi.SetSummary(msg, ok);
                }
                //log.warning(msg);
            }

            return(ok);
        }
Esempio n. 3
0
        }       //	process

        /**
         *  Process It (sync)
         *	@param pi Process Info
         *	@param trx transaction
         *	@return true if OK
         */
        public bool ProcessIt(ProcessInfo pi, Trx trx)
        {
            if (pi.GetAD_PInstance_ID() == 0)
            {
                MPInstance pInstance = new MPInstance(this, pi.GetRecord_ID());
                //	Lock
                pInstance.SetIsProcessing(true);
                pInstance.Save();
            }

            bool ok = false;

            //	Java Class
            String Classname = GetClassname();

            if (Classname != null && Classname.Length > 0)
            {
                ok = StartClass(Classname, pi, trx);
            }
            else
            {
                if (!IsReport())
                {
                    String msg = "No Classname for " + GetName();
                    pi.SetSummary(msg, ok);
                }
                else
                {
                    String msg = Msg.GetMsg(GetCtx(), "Success") + " " + GetValue();
                    pi.SetSummary(msg, ok);
                }
                //log.warning(msg);
            }

            return(ok);
        }