Class SvrProcess

    • Field Detail

      • log

        protected CLogger log
        Logger
      • MSG_SaveErrorRowNotFound

        protected static String MSG_SaveErrorRowNotFound
        Common Error Message
      • MSG_InvalidArguments

        protected static String MSG_InvalidArguments
    • Constructor Detail

      • SvrProcess

        public SvrProcess()
        Server Process. Note that the class is initiated by startProcess.
    • Method Detail

      • addBufferLog

        public void addBufferLog​(int id,
                                 Timestamp date,
                                 BigDecimal number,
                                 String msg,
                                 int tableId,
                                 int recordId)
        Add log to buffer, only process total success, flush buffer
        Parameters:
        id -
        date -
        number -
        msg -
        tableId -
        recordId -
      • prepare

        protected abstract void prepare()
        Prepare - e.g., get Parameters.
        
        		ProcessInfoParameter[] para = getParameter();
        		for (int i = 0; i < para.length; i++)
        		{
        			String name = para[i].getParameterName();
        			if (para[i].getParameter() == null)
        				;
        			else if (name.equals("A_Asset_Group_ID"))
        				p_A_Asset_Group_ID = para[i].getParameterAsInt();
        			else if (name.equals("GuaranteeDate"))
        				p_GuaranteeDate = (Timestamp)para[i].getParameter();
        			else if (name.equals("AttachAsset"))
        				p_AttachAsset = "Y".equals(para[i].getParameter());
        			else
        				log.log(Level.SEVERE, "Unknown Parameter: " + name);
        		}
          
      • doIt

        protected abstract String doIt()
                                throws Exception
        Perform process.
        Returns:
        Message (variables are parsed)
        Throws:
        Exception - if not successful e.g. throw new AdempiereUserError ("@FillMandatory@ @C_BankAccount_ID@");
      • postProcess

        protected void postProcess​(boolean success)
        Post process actions (outside trx). Please note that at this point the transaction is committed so you can't rollback. This method is useful if you need to do some custom work when the process complete the work (e.g. open some windows).
        Parameters:
        success - true if the process was success
        Since:
        3.1.4
      • commit

        protected void commit()
        Deprecated.
        suggested to use commitEx instead
        Commit
      • commitEx

        protected void commitEx()
                         throws SQLException
        Commit and throw exception if error
        Throws:
        SQLException - on commit error
      • rollback

        protected void rollback()
        Rollback
      • lockObject

        protected boolean lockObject​(PO po)
        Lock Object. Needs to be explicitly called. Unlock is automatic.
        Parameters:
        po - object
        Returns:
        true if locked
      • isLocked

        protected boolean isLocked()
        Is an object Locked?
        Returns:
        true if object locked
      • unlockObject

        protected boolean unlockObject()
        Unlock Object. Is automatically called at the end of process.
        Returns:
        true if unlocked or if there was nothing to unlock
      • getProcessInfo

        public ProcessInfo getProcessInfo()
        Get Process Info
        Returns:
        Process Info
      • getCtx

        public Properties getCtx()
        Get Properties
        Returns:
        Properties
      • getName

        protected String getName()
        Get Name/Title
        Returns:
        Name
      • getAD_PInstance_ID

        protected int getAD_PInstance_ID()
        Get Process Instance
        Returns:
        Process Instance
      • getTable_ID

        protected int getTable_ID()
        Get Table_ID
        Returns:
        AD_Table_ID
      • getRecord_ID

        protected int getRecord_ID()
        Get Record_ID
        Returns:
        Record_ID
      • getRecord_IDs

        protected List<Integer> getRecord_IDs()
        Get Record_IDs
        Returns:
        Record_IDs
      • getAD_User_ID

        protected int getAD_User_ID()
        Get AD_User_ID
        Returns:
        AD_User_ID of Process owner or -1 if not found
      • getAD_Client_ID

        protected int getAD_Client_ID()
        Get AD_User_ID
        Returns:
        AD_User_ID of Process owner
      • addLog

        public void addLog​(int id,
                           Timestamp date,
                           BigDecimal number,
                           String msg,
                           int tableId,
                           int recordId)
        Add Log Entry with table name
      • addLog

        public void addLog​(int id,
                           Timestamp date,
                           BigDecimal number,
                           String msg)
        Add Log Entry
        Parameters:
        date - date or null
        id - record id or 0
        number - number or null
        msg - message or null
      • addLog

        public void addLog​(String msg)
        Add Log
        Parameters:
        msg - message
      • doIt

        public Object doIt​(String className,
                           String methodName,
                           Object[] args)
        Execute function
        Parameters:
        className - class
        methodName - method
        args - arguments
        Returns:
        result
      • get_TrxName

        public String get_TrxName()
        Return the main transaction of the current process.
        Returns:
        the transaction name
      • statusUpdate

        protected void statusUpdate​(String message)
        publish status update message
        Parameters:
        message -