Class MPInstance

All Implemented Interfaces:
Serializable, Cloneable, Comparator<Object>, I_AD_PInstance, I_Persistent, Evaluatee

public class MPInstance extends X_AD_PInstance
Process Instance Model
Version:
$Id: MPInstance.java,v 1.3 2006/07/30 00:58:36 jjanke Exp $
Author:
Jorg Janke, Teo Sarca, www.arhipac.ro
  • FR [ 2818478 ] Introduce MPInstance.createParameter helper method https://sourceforge.net/p/adempiere/feature-requests/756/
  • See Also:
    • Field Details

    • Constructor Details

      • MPInstance

        public MPInstance(Properties ctx, String AD_PInstance_UU, String trxName)
        UUID based Constructor
        Parameters:
        ctx - Context
        AD_PInstance_UU - UUID key
        trxName - Transaction
      • MPInstance

        public MPInstance(Properties ctx, int AD_PInstance_ID, String ignored)
        Standard Constructor
        Parameters:
        ctx - context
        AD_PInstance_ID - instance or 0
        ignored - no transaction support
      • MPInstance

        public MPInstance(Properties ctx, ResultSet rs, String ignored)
        Load Constructor
        Parameters:
        ctx - context
        rs - result set
        ignored - no transaction support
      • MPInstance

        @Deprecated public MPInstance(MProcess process, int Record_ID)
        Create Process Instance from Process and create parameters
        Parameters:
        process - process
        Record_ID - Record
      • MPInstance

        public MPInstance(MProcess process, int Table_ID, int Record_ID, String Record_UU)
        Create and save new Process Instance from Process and record parameters
        Parameters:
        process - process
        Table_ID -
        Record_ID - Record id
        Record_UU - Record uuid
      • MPInstance

        @Deprecated public MPInstance(Properties ctx, int AD_Process_ID, int Record_ID)
        New Constructor
        Parameters:
        ctx - context
        AD_Process_ID - Process ID
        Record_ID - record
      • MPInstance

        public MPInstance(Properties ctx, int AD_Process_ID, int Table_ID, int Record_ID, String Record_UU)
        New Constructor
        Parameters:
        ctx - context
        AD_Process_ID - Process ID
        Table_ID -
        Record_ID - record id
        Record_UU - record uuid
    • Method Details

      • getParameters

        public MPInstancePara[] getParameters()
        Get Instance Parameters
        Returns:
        instance parameter array
      • getProcessParameters

        public MProcessPara[] getProcessParameters()
        Get Process Parameters
        Returns:
        process parameters array
      • equalParameters

        public boolean equalParameters(MPInstancePara[] params)
        Check whether a set of process instance parameters are equal to the current instance parameters.
        Parameters:
        params - array of instance parameters to compare
        Returns:
        true if the process instance parameters equals to this instance's instance parameters
      • getLog

        public MPInstanceLog[] getLog()
        Get Instance Logs
        Returns:
        array of instance logs
      • addLog

        public MPInstanceLog addLog(Timestamp P_Date, int P_ID, BigDecimal P_Number, String P_Msg)
        Add instance log
        Parameters:
        P_Date - date
        P_ID - id
        P_Number - number
        P_Msg - msg
        Returns:
        added instance log
      • addLog

        public MPInstanceLog addLog(Timestamp P_Date, int P_ID, BigDecimal P_Number, String P_Msg, int AD_Table_ID, int Record_ID)
        Add instance log
        Parameters:
        P_Date - date
        P_ID - id
        P_Number - number
        P_Msg - msg
        AD_Table_ID - tableID
        Record_ID - recordID
        Returns:
        added instance log
      • setAD_Process_ID

        public void setAD_Process_ID(int AD_Process_ID)
        Set AD_Process_ID. Throw exception if current role has no permission to run the process.
        Specified by:
        setAD_Process_ID in interface I_AD_PInstance
        Overrides:
        setAD_Process_ID in class X_AD_PInstance
        Parameters:
        AD_Process_ID - process
      • setRecord_ID

        public void setRecord_ID(int Record_ID)
        Set Record ID.
        Specified by:
        setRecord_ID in interface I_AD_PInstance
        Overrides:
        setRecord_ID in class X_AD_PInstance
        Parameters:
        Record_ID - record
      • toString

        public String toString()
        String Representation
        Overrides:
        toString in class X_AD_PInstance
        Returns:
        info
        See Also:
      • log

        public void log()
        Dump Instance Logs to server log
      • isOK

        public boolean isOK()
        Is it OK
        Returns:
        true if Result == OK
      • setResult

        public void setResult(boolean ok)
        Set Result
        Parameters:
        ok -
      • afterSave

        protected boolean afterSave(boolean newRecord, boolean success)
        Description copied from class: PO
        Called after Save for Post-Save Operation.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        afterSave in class PO
        Parameters:
        newRecord - true if it is a new record
        success - true if save operation was success
        Returns:
        if save was a success
      • createParameter

        public MPInstancePara createParameter(int seqNo, String parameterName, Object value)
        Create Process Instance Parameter and save to database
        Parameters:
        seqNo - parameter sequence#
        parameterName - parameter name
        value - parameter value
        Returns:
        instance parameter
      • getAD_Process

        public I_AD_Process getAD_Process() throws RuntimeException
        Specified by:
        getAD_Process in interface I_AD_PInstance
        Overrides:
        getAD_Process in class X_AD_PInstance
        Throws:
        RuntimeException
      • publishChangedEvent

        public static void publishChangedEvent(int AD_User_ID)
        Publish ON_RUNNING_JOB_CHANGED_TOPIC message to message service.
        If message service is not available, post as OSGi event instead.
        Parameters:
        AD_User_ID -
      • postOnChangedEvent

        public static void postOnChangedEvent(int AD_User_ID)
        Post ON_RUNNING_JOB_CHANGED_TOPIC OSGi event.
        Parameters:
        AD_User_ID -
      • get

        public static List<MPInstance> get(Properties ctx, int AD_Process_ID, int AD_User_ID)
        Get list of process instance via AD_Process_ID and AD_User_ID
        Parameters:
        ctx -
        AD_Process_ID -
        AD_User_ID -
        Returns:
        process instance list
      • getPInstanceInfo

        public static MPInstance.PInstanceInfo getPInstanceInfo(int AD_PInstance_ID) throws SQLException
        Get instance info
        Parameters:
        AD_PInstance_ID -
        Returns:
        MPInstance.PInstanceInfo
        Throws:
        SQLException
      • beforeSave

        protected boolean beforeSave(boolean newRecord)
        Description copied from class: PO
        Called before Save for Pre-Save Operation.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        beforeSave in class PO
        Parameters:
        newRecord - true if it is a new record
        Returns:
        true if record can be saved
      • updatePrintFormatAndLanguageIfEmpty

        public void updatePrintFormatAndLanguageIfEmpty(MPrintFormat format)
        Set AD_PrintFormat_ID if empty, AD_Language_ID if empty and save the record.
        Parameters:
        format -