Package org.compiere.wf
Class MWFActivity
java.lang.Object
org.compiere.model.PO
org.compiere.model.X_AD_WF_Activity
org.compiere.wf.MWFActivity
- All Implemented Interfaces:
Serializable
,Cloneable
,Runnable
,Comparator<Object>
,I_AD_WF_Activity
,I_Persistent
,Evaluatee
Extended Workflow Activity Model for AD_WF_Activity.
Controlled by WF Process: set Node - startWork
Controlled by WF Process: set Node - startWork
- Version:
- $Id: MWFActivity.java,v 1.4 2006/07/30 00:51:05 jjanke Exp $
- Author:
- Jorg Janke, Silvano Trinchero, www.freepath.it
- IDEMPIERE-3209 added process-aware resultset-based constructor
- See Also:
-
Field Summary
Fields inherited from class org.compiere.model.X_AD_WF_Activity
WFSTATE_Aborted, WFSTATE_AD_Reference_ID, WFSTATE_Completed, WFSTATE_NotStarted, WFSTATE_Running, WFSTATE_Suspended, WFSTATE_Terminated
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_WF_Activity
accessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Message_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AD_Table_ID, COLUMNNAME_AD_User_ID, COLUMNNAME_AD_WF_Activity_ID, COLUMNNAME_AD_WF_Activity_UU, COLUMNNAME_AD_WF_Node_ID, COLUMNNAME_AD_WF_Process_ID, COLUMNNAME_AD_WF_Responsible_ID, COLUMNNAME_AD_Workflow_ID, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_DateLastAlert, COLUMNNAME_DynPriorityStart, COLUMNNAME_EndWaitTime, COLUMNNAME_IsActive, COLUMNNAME_Priority, COLUMNNAME_Processed, COLUMNNAME_Processing, COLUMNNAME_Record_ID, COLUMNNAME_TextMsg, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_WFState, Model, Table_ID, Table_Name
-
Constructor Summary
ConstructorDescriptionMWFActivity
(Properties ctx, int AD_WF_Activity_ID, String trxName) Standard ConstructorMWFActivity
(Properties ctx, String AD_WF_Activity_UU, String trxName) UUID based ConstructorMWFActivity
(Properties ctx, ResultSet rs, String trxName) Load ConstructorMWFActivity
(MWFProcess process, int AD_WF_Node_ID) Parent ConstructorMWFActivity
(MWFProcess process, int next_ID, PO lastPO) Parent ConstructorMWFActivity
(MWFProcess process, Properties ctx, ResultSet rs, String trxName) Process-aware Parent Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTextMsg
(Object obj) Add to Text Msgboolean
Forward to user, usually for approvalstatic MWFActivity[]
get
(Properties ctx, int AD_Table_ID, int Record_ID, boolean activeOnly) Get Activities for table/recordstatic String
getActiveInfo
(Properties ctx, int AD_Table_ID, int Record_ID) Get info of active activitiesint
getApprovalUser
(int AD_User_ID, int C_Currency_ID, BigDecimal amount, int AD_Org_ID, boolean ownDocument) Get Approval User.
If the returned user is the same, the document is approved.Get Attribute Value (AD_Column_ID ofMWFNode
) of POstatic ProcessInfo
Get ProcessInfo instance of current workflow processGet/Create new Event AuditGet Process Activity (Event) HistorygetNode()
Get WF NodeGet Node DescriptionGet Node HelpGet WF Node Namebyte[]
Get PDF Attachment of underlying PO objectgetPO()
Get Persistent ObjectGet Persistent Object in Transactionint
Get PO AD_Client_IDGet process messageGet workflow ResponsiblegetState()
Get StateGet Document SummaryGet WF State textstatic String
Get where clause to get the pending activities related to a User (unprocessed and suspended).
The where clause return requires the AD_User_ID parameter 5 times, and then AD_Client_ID.boolean
isClosed()
Is Activity closedboolean
Is Invoker (no user and no role)boolean
Does the underlying PO object has a PDF Attachmentboolean
isSOTrx()
Is SO Trxboolean
Is this an user Approval step?boolean
Is this a user choice step?boolean
Is this a Manual user step?void
run()
Run activity.void
setAD_WF_Node_ID
(int AD_WF_Node_ID) Set AD_WF_Node_ID.void
setTextMsg
(String TextMsg) Set Text Msg (add after existing)void
setTextMsgBefore
(String TextMsg) Set Text Msg (add before existing)boolean
setUserChoice
(int AD_User_ID, String value, int displayType, String textMsg) Set User Choicevoid
setUserConfirmation
(int AD_User_ID, String textMsg) Set User Confirmationvoid
setWFState
(String WFState) Set Activity State.
It also validates the new state and if is valid, then create event audit and callMWFProcess.checkActivities(String, PO)
toString()
String RepresentationUser String Representation.Methods inherited from class org.compiere.model.X_AD_WF_Activity
get_AccessLevel, getAD_Message, getAD_Message_ID, getAD_Table, getAD_Table_ID, getAD_User, getAD_User_ID, getAD_WF_Activity_ID, getAD_WF_Activity_UU, getAD_WF_Node, getAD_WF_Node_ID, getAD_WF_Process, getAD_WF_Process_ID, getAD_WF_Responsible, getAD_WF_Responsible_ID, getAD_Workflow, getAD_Workflow_ID, getDateLastAlert, getDynPriorityStart, getEndWaitTime, getKeyNamePair, getPriority, getRecord_ID, getTextMsg, getWFState, initPO, isProcessed, isProcessing, setAD_Message_ID, setAD_Table_ID, setAD_User_ID, setAD_WF_Activity_ID, setAD_WF_Activity_UU, setAD_WF_Process_ID, setAD_WF_Responsible_ID, setAD_Workflow_ID, setDateLastAlert, setDynPriorityStart, setEndWaitTime, setPriority, setProcessed, setProcessing, setRecord_ID
Methods inherited from class org.compiere.model.PO
afterDelete, afterSave, beforeDelete, beforeSave, 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, 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, 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_WF_Activity
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
-
Constructor Details
-
MWFActivity
UUID based Constructor- Parameters:
ctx
- ContextAD_WF_Activity_UU
- UUID keytrxName
- Transaction
-
MWFActivity
Standard Constructor- Parameters:
ctx
- contextAD_WF_Activity_ID
- idtrxName
- transaction
-
MWFActivity
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MWFActivity
Parent Constructor- Parameters:
process
- processAD_WF_Node_ID
- start node
-
MWFActivity
Process-aware Parent Constructor- Parameters:
process
- processctx
- contextrs
- record to loadtrxName
- transaction name
-
MWFActivity
Parent Constructor- Parameters:
process
- processnext_ID
- start nodelastPO
- PO from the previously executed node
-
-
Method Details
-
get
Get Activities for table/record- Parameters:
ctx
- contextAD_Table_ID
- tableRecord_ID
- recordactiveOnly
- if true only not processed records are returned- Returns:
- activities
-
getActiveInfo
Get info of active activities- Parameters:
ctx
- contextAD_Table_ID
- tableRecord_ID
- record- Returns:
- info of active activities (separated by new line character)
-
getState
Get State- Returns:
- state
-
setWFState
Set Activity State.
It also validates the new state and if is valid, then create event audit and callMWFProcess.checkActivities(String, PO)
- Specified by:
setWFState
in interfaceI_AD_WF_Activity
- Overrides:
setWFState
in classX_AD_WF_Activity
- Parameters:
WFState
- StateEngine.STATE_*
-
isClosed
public boolean isClosed()Is Activity closed- Returns:
- true if closed
-
getEventAudit
Get/Create new Event Audit- Returns:
- event
-
getPO
Get Persistent Object in Transaction- Parameters:
trx
- transaction- Returns:
- po
-
getPO
Get Persistent Object- Returns:
- po
-
getPO_AD_Client_ID
public int getPO_AD_Client_ID()Get PO AD_Client_ID- Returns:
- client of PO
-
getAttributeValue
Get Attribute Value (AD_Column_ID ofMWFNode
) of PO- Returns:
- Attribute Value or null
-
isSOTrx
public boolean isSOTrx()Is SO Trx- Returns:
- SO Trx or if not found true
-
setAD_WF_Node_ID
public void setAD_WF_Node_ID(int AD_WF_Node_ID) Set AD_WF_Node_ID. (Re)Set state to Not Started.- Specified by:
setAD_WF_Node_ID
in interfaceI_AD_WF_Activity
- Overrides:
setAD_WF_Node_ID
in classX_AD_WF_Activity
- Parameters:
AD_WF_Node_ID
- new node
-
getNode
Get WF Node- Returns:
- node
-
getNodeName
Get WF Node Name- Returns:
- translated node name
-
getNodeDescription
Get Node Description- Returns:
- translated node description
-
getNodeHelp
Get Node Help- Returns:
- translated node help
-
isUserApproval
public boolean isUserApproval()Is this an user Approval step?- Returns:
- true if User Approval
-
isUserManual
public boolean isUserManual()Is this a Manual user step?- Returns:
- true if Window/Form/..
-
isUserChoice
public boolean isUserChoice()Is this a user choice step?- Returns:
- true if User Choice
-
setTextMsg
Set Text Msg (add after existing)- Specified by:
setTextMsg
in interfaceI_AD_WF_Activity
- Overrides:
setTextMsg
in classX_AD_WF_Activity
- Parameters:
TextMsg
-
-
setTextMsgBefore
Set Text Msg (add before existing)- Parameters:
TextMsg
-
-
addTextMsg
Add to Text Msg- Parameters:
obj
- some object
-
getWFStateText
Get WF State text- Returns:
- workflow state text
-
getResponsible
Get workflow Responsible- Returns:
- workflow responsible
-
isInvoker
public boolean isInvoker()Is Invoker (no user and no role)- Returns:
- true if invoker
-
getApprovalUser
public int getApprovalUser(int AD_User_ID, int C_Currency_ID, BigDecimal amount, int AD_Org_ID, boolean ownDocument) Get Approval User.
If the returned user is the same, the document is approved.- Parameters:
AD_User_ID
- starting UserC_Currency_ID
- currencyamount
- amountAD_Org_ID
- document organizationownDocument
- the document is owned by AD_User_ID- Returns:
- AD_User_ID - if -1 no Approver
-
run
public void run()Run activity.
Called from MWFProcess.startNext.
Feedback to Process via setWFState -> checkActivities. -
getCurrentWorkflowProcessInfo
Get ProcessInfo instance of current workflow process- Returns:
ProcessInfo
-
setUserChoice
public boolean setUserChoice(int AD_User_ID, String value, int displayType, String textMsg) throws Exception Set User Choice- Parameters:
AD_User_ID
- uservalue
- new ValuedisplayType
- display typetextMsg
- optional Message- Returns:
- true if set
- Throws:
Exception
- if error
-
forwardTo
Forward to user, usually for approval- Parameters:
AD_User_ID
- usertextMsg
- text message- Returns:
- true if forwarded
-
setUserConfirmation
Set User Confirmation- Parameters:
AD_User_ID
- usertextMsg
- optional message
-
getHistoryHTML
Get Process Activity (Event) History- Returns:
- history in html format
-
isPdfAttachment
public boolean isPdfAttachment()Does the underlying PO object has a PDF Attachment- Overrides:
isPdfAttachment
in classPO
- Returns:
- true if there is a pdf attachment
-
getPdfAttachment
public byte[] getPdfAttachment()Get PDF Attachment of underlying PO object- Overrides:
getPdfAttachment
in classPO
- Returns:
- pdf data or null
-
toString
String Representation- Overrides:
toString
in classX_AD_WF_Activity
- Returns:
- info
-
toStringX
User String Representation. Suspended: Approve it (Joe)- Returns:
- info
-
getSummary
Get Document Summary- Returns:
- PO Summary
-
getWhereUserPendingActivities
Get where clause to get the pending activities related to a User (unprocessed and suspended).
The where clause return requires the AD_User_ID parameter 5 times, and then AD_Client_ID.- Returns:
- Where Clause
-
getProcessMsg
Get process message- Returns:
- process message
-