Package org.compiere.model
Class MPInstance
java.lang.Object
org.compiere.model.PO
org.compiere.model.X_AD_PInstance
org.compiere.model.MPInstance
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_AD_PInstance
,I_Persistent
,Evaluatee
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Instance info record class with fields from AD_PInstance+AD_Process -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final int
Result FALSE = 0static final int
Result OK = 1Fields inherited from class org.compiere.model.X_AD_PInstance
NOTIFICATIONTYPE_AD_Reference_ID, NOTIFICATIONTYPE_EMail, NOTIFICATIONTYPE_EMailPlusNotice, NOTIFICATIONTYPE_None, NOTIFICATIONTYPE_Notice
Fields inherited from class org.compiere.model.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, LOCAL_TRX_PREFIX, log, p_ctx, p_info, UUID_NEW_RECORD, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
Fields inherited from interface org.compiere.model.I_AD_PInstance
accessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Language_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AD_PInstance_ID, COLUMNNAME_AD_PInstance_UU, COLUMNNAME_AD_PrintFormat_ID, COLUMNNAME_AD_Process_ID, COLUMNNAME_AD_Session_ID, COLUMNNAME_AD_Table_ID, COLUMNNAME_AD_User_ID, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_ErrorMsg, COLUMNNAME_IsActive, COLUMNNAME_IsProcessing, COLUMNNAME_IsRunAsJob, COLUMNNAME_IsSummary, COLUMNNAME_JsonData, COLUMNNAME_Name, COLUMNNAME_NotificationType, COLUMNNAME_Record_ID, COLUMNNAME_Record_UU, COLUMNNAME_ReportType, COLUMNNAME_Result, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, Model, Table_ID, Table_Name
-
Constructor Summary
ConstructorDescriptionMPInstance
(Properties ctx, int AD_Process_ID, int Record_ID) Deprecated.MPInstance
(Properties ctx, int AD_Process_ID, int Table_ID, int Record_ID, String Record_UU) New ConstructorMPInstance
(Properties ctx, int AD_PInstance_ID, String ignored) Standard ConstructorMPInstance
(Properties ctx, String AD_PInstance_UU, String trxName) UUID based ConstructorMPInstance
(Properties ctx, ResultSet rs, String ignored) Load ConstructorMPInstance
(MProcess process, int Record_ID) Deprecated.Please useMPInstance(MProcess, int, int, String)
MPInstance
(MProcess process, int Table_ID, int Record_ID, String Record_UU) Create and save new Process Instance from Process and record parameters -
Method Summary
Modifier and TypeMethodDescriptionaddLog
(Timestamp P_Date, int P_ID, BigDecimal P_Number, String P_Msg) Add instance logaddLog
(Timestamp P_Date, int P_ID, BigDecimal P_Number, String P_Msg, int AD_Table_ID, int Record_ID) Add instance logprotected boolean
afterSave
(boolean newRecord, boolean success) After Saveprotected boolean
beforeSave
(boolean newRecord) Before SavecreateParameter
(int seqNo, String parameterName, Object value) Create Process Instance Parameter and save to databaseboolean
equalParameters
(MPInstancePara[] params) Check whether a set of process instance parameters are equal to the current instance parameters.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_IDgetLog()
Get Instance LogsGet Instance Parametersstatic MPInstance.PInstanceInfo
getPInstanceInfo
(int AD_PInstance_ID) Get instance infoGet Process Parametersboolean
isOK()
Is it OKvoid
log()
Dump Instance Logs to server logstatic void
postOnChangedEvent
(int AD_User_ID) Post ON_RUNNING_JOB_CHANGED_TOPIC OSGi event.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.void
setAD_Process_ID
(int AD_Process_ID) Set AD_Process_ID.void
setRecord_ID
(int Record_ID) Set Record ID.void
setResult
(boolean ok) Set ResulttoString()
String Representationvoid
Set AD_PrintFormat_ID if empty, AD_Language_ID if empty and save the record.Methods inherited from class org.compiere.model.X_AD_PInstance
get_AccessLevel, getAD_Language, getAD_Language_ID, getAD_PInstance_ID, getAD_PInstance_UU, getAD_PrintFormat, getAD_PrintFormat_ID, getAD_Process_ID, getAD_Session, getAD_Session_ID, getAD_Table, getAD_Table_ID, getAD_User, getAD_User_ID, getErrorMsg, getJsonData, getKeyNamePair, getName, getNotificationType, getRecord_ID, getRecord_UU, getReportType, getResult, initPO, isProcessing, isRunAsJob, isSummary, setAD_Language_ID, setAD_PInstance_ID, setAD_PInstance_UU, setAD_PrintFormat_ID, setAD_Session_ID, setAD_Table_ID, setAD_User_ID, setErrorMsg, setIsProcessing, setIsRunAsJob, setIsSummary, setJsonData, setName, setNotificationType, setRecord_UU, setReportType, setResult
Methods inherited from class org.compiere.model.PO
afterDelete, beforeDelete, buildInsertSQL, checkImmutable, clearCrossTenantSafe, clone, columnExists, columnExists, compare, copyPO, copyValues, copyValues, createAttachment, delete, delete, delete_Accounting, delete_Tree, deleteEx, deleteEx, dump, dump, equals, get_Attribute, get_Attributes, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_OptimisticLockingColumns, get_Table_ID, get_TableName, get_Translation, get_Translation, get_Translation, get_Translation, get_Translation, get_TrxName, get_UUID, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getUUIDColumnName, getUUIDColumnName, hashCode, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_Immutable, is_new, is_UseOptimisticLocking, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, loadByUU, loadComplete, loadDefaults, loadPO, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveCrossTenantSafe, saveCrossTenantSafeEx, saveCrossTenantSafeEx, saveEx, saveEx, saveNew_afterSetID, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_Attribute, set_ColumnUpdateable, set_CustomColumn, set_CustomColumnReturningBoolean, set_OptimisticLockingColumns, set_TrxName, set_TrxName, set_UseOptimisticLocking, set_Value, set_Value, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, set_ValueOfColumnReturningBoolean, set_ValueOfColumnReturningBoolean, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setCrossTenantSafe, setDoc, setDocWorkflowMgr, setIsActive, setProcessedOn, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, toInsertSQL, unlock, update_Tree, validForeignKeys
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface org.compiere.model.I_AD_PInstance
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActive
Methods inherited from interface org.compiere.model.I_Persistent
save
-
Field Details
-
ON_RUNNING_JOB_CHANGED_TOPIC
- See Also:
-
RESULT_OK
public static final int RESULT_OKResult OK = 1- See Also:
-
RESULT_ERROR
public static final int RESULT_ERRORResult FALSE = 0- See Also:
-
-
Constructor Details
-
MPInstance
UUID based Constructor- Parameters:
ctx
- ContextAD_PInstance_UU
- UUID keytrxName
- Transaction
-
MPInstance
Standard Constructor- Parameters:
ctx
- contextAD_PInstance_ID
- instance or 0ignored
- no transaction support
-
MPInstance
Load Constructor- Parameters:
ctx
- contextrs
- result setignored
- no transaction support
-
MPInstance
Deprecated.Please useMPInstance(MProcess, int, int, String)
Create Process Instance from Process and create parameters- Parameters:
process
- processRecord_ID
- Record
-
MPInstance
Create and save new Process Instance from Process and record parameters- Parameters:
process
- processTable_ID
-Record_ID
- Record idRecord_UU
- Record uuid
-
MPInstance
Deprecated.New Constructor- Parameters:
ctx
- contextAD_Process_ID
- Process IDRecord_ID
- record
-
MPInstance
New Constructor- Parameters:
ctx
- contextAD_Process_ID
- Process IDTable_ID
-Record_ID
- record idRecord_UU
- record uuid
-
-
Method Details
-
getParameters
Get Instance Parameters- Returns:
- instance parameter array
-
getProcessParameters
Get Process Parameters- Returns:
- process parameters array
-
equalParameters
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
Get Instance Logs- Returns:
- array of instance logs
-
addLog
Add instance log- Parameters:
P_Date
- dateP_ID
- idP_Number
- numberP_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
- dateP_ID
- idP_Number
- numberP_Msg
- msgAD_Table_ID
- tableIDRecord_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 interfaceI_AD_PInstance
- Overrides:
setAD_Process_ID
in classX_AD_PInstance
- Parameters:
AD_Process_ID
- process
-
setRecord_ID
public void setRecord_ID(int Record_ID) Set Record ID.- Specified by:
setRecord_ID
in interfaceI_AD_PInstance
- Overrides:
setRecord_ID
in classX_AD_PInstance
- Parameters:
Record_ID
- record
-
toString
String Representation- Overrides:
toString
in classX_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) After Save -
createParameter
Create Process Instance Parameter and save to database- Parameters:
seqNo
- parameter sequence#parameterName
- parameter namevalue
- parameter value- Returns:
- instance parameter
-
getAD_Process
- Specified by:
getAD_Process
in interfaceI_AD_PInstance
- Overrides:
getAD_Process
in classX_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
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
Get instance info- Parameters:
AD_PInstance_ID
-- Returns:
MPInstance.PInstanceInfo
- Throws:
SQLException
-
beforeSave
protected boolean beforeSave(boolean newRecord) Before Save- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- new- Returns:
- true
-
updatePrintFormatAndLanguageIfEmpty
Set AD_PrintFormat_ID if empty, AD_Language_ID if empty and save the record.- Parameters:
format
-
-
MPInstance(Properties, int, int, int, String)