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
public class MWFActivity extends X_AD_WF_Activity implements Runnable
Workflow Activity Model. 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:
- Serialized Form
-
-
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, 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
Constructors Constructor Description MWFActivity(Properties ctx, int AD_WF_Activity_ID, String trxName)
Standard ConstructorMWFActivity(Properties ctx, ResultSet rs, String trxName)
Load ConstructorMWFActivity(MWFProcess process, int AD_WF_Node_ID)
Parent ContructorMWFActivity(MWFProcess process, int next_ID, PO lastPO)
Parent ConstructorMWFActivity(MWFProcess process, Properties ctx, ResultSet rs, String trxName)
Process-aware Parent Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTextMsg(Object obj)
Add to Text Msgboolean
forwardTo(int AD_User_ID, String textMsg)
Forward Tostatic 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 Active Infoint
getApprovalUser(int AD_User_ID, int C_Currency_ID, BigDecimal amount, int AD_Org_ID, boolean ownDocument)
Get Approval User.Object
getAttributeValue()
Get Attribute Value (based on Node) of POMWFEventAudit
getEventAudit()
Get/Create Event AuditString
getHistoryHTML()
Get Process Activity (Event) HistoryMWFNode
getNode()
Get WF NodeString
getNodeDescription()
Get Node DescriptionString
getNodeHelp()
Get Node HelpString
getNodeName()
Get WF Node Namebyte[]
getPdfAttachment()
Get PDF Attachment of underlying PO (!)PO
getPO()
Get Persistent ObjectPO
getPO(Trx trx)
Get Persistent Object in Transactionint
getPO_AD_Client_ID()
Get PO AD_Client_IDMWFResponsible
getResponsible()
Get ResponsibleStateEngine
getState()
Get StateString
getSummary()
Get Document SummaryString
getWFStateText()
Get WF State textboolean
isClosed()
Is Activity closedboolean
isInvoker()
Is Invoker (no user and no role)boolean
isPdfAttachment()
Does the underlying PO (!)boolean
isSOTrx()
Is SO Trxboolean
isUserApproval()
Is this an user Approval step?boolean
isUserChoice()
Is this a user choice step?boolean
isUserManual()
Is this a Manual user step?void
run()
Execute Work.void
setAD_WF_Node_ID(int AD_WF_Node_ID)
Set AD_WF_Node_ID.void
setTextMsg(String TextMsg)
Set Text Msg (add to 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.String
toString()
String RepresentationString
toStringX()
User 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, 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_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, 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, load, loadByUU, loadComplete, loadDefaults, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, 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, 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 Detail
-
MWFActivity
public MWFActivity(Properties ctx, int AD_WF_Activity_ID, String trxName)
Standard Constructor- Parameters:
ctx
- contextAD_WF_Activity_ID
- idtrxName
- transaction
-
MWFActivity
public MWFActivity(Properties ctx, ResultSet rs, String trxName)
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MWFActivity
public MWFActivity(MWFProcess process, int AD_WF_Node_ID)
Parent Contructor- Parameters:
process
- processAD_WF_Node_ID
- start node
-
MWFActivity
public MWFActivity(MWFProcess process, Properties ctx, ResultSet rs, String trxName)
Process-aware Parent Constructor- Parameters:
process
- processctx
- contextrs
- record to loadtrxName
- transaction name
-
MWFActivity
public MWFActivity(MWFProcess process, int next_ID, PO lastPO)
Parent Constructor- Parameters:
process
- processnext_ID
- start nodelastPO
- PO from the previously executed node
-
-
Method Detail
-
get
public static MWFActivity[] get(Properties ctx, int AD_Table_ID, int Record_ID, boolean activeOnly)
Get Activities for table/record- Parameters:
ctx
- contextAD_Table_ID
- tableRecord_ID
- recordactiveOnly
- if true only not processed records are returned- Returns:
- activity
-
getActiveInfo
public static String getActiveInfo(Properties ctx, int AD_Table_ID, int Record_ID)
Get Active Info- Parameters:
ctx
- contextAD_Table_ID
- tableRecord_ID
- record- Returns:
- activity summary
-
getState
public StateEngine getState()
Get State- Returns:
- state
-
setWFState
public void 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)
- Specified by:
setWFState
in interfaceI_AD_WF_Activity
- Overrides:
setWFState
in classX_AD_WF_Activity
- Parameters:
WFState
-
-
isClosed
public boolean isClosed()
Is Activity closed- Returns:
- true if closed
-
getEventAudit
public MWFEventAudit getEventAudit()
Get/Create Event Audit- Returns:
- event
-
getPO
public PO getPO(Trx trx)
Get Persistent Object in Transaction- Parameters:
trx
- transaction- Returns:
- po
-
getPO
public 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
public Object getAttributeValue()
Get Attribute Value (based on Node) of PO- Returns:
- Attribute Value or null
-
isSOTrx
public boolean isSOTrx()
Is SO Trx- Returns:
- SO Trx or of 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 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
- now node
-
getNode
public MWFNode getNode()
Get WF Node- Returns:
- node
-
getNodeName
public String getNodeName()
Get WF Node Name- Returns:
- translated node name
-
getNodeDescription
public String getNodeDescription()
Get Node Description- Returns:
- translated node description
-
getNodeHelp
public String 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
public void setTextMsg(String TextMsg)
Set Text Msg (add to existing)- Specified by:
setTextMsg
in interfaceI_AD_WF_Activity
- Overrides:
setTextMsg
in classX_AD_WF_Activity
- Parameters:
TextMsg
-
-
addTextMsg
public void addTextMsg(Object obj)
Add to Text Msg- Parameters:
obj
- some object
-
getWFStateText
public String getWFStateText()
Get WF State text- Returns:
- state text
-
getResponsible
public MWFResponsible getResponsible()
Get Responsible- Returns:
- 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()
Execute Work. Called from MWFProcess.startNext Feedback to Process via setWFState -> checkActivities
-
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
public boolean forwardTo(int AD_User_ID, String textMsg)
Forward To- Parameters:
AD_User_ID
- usertextMsg
- text message- Returns:
- true if forwarded
-
setUserConfirmation
public void setUserConfirmation(int AD_User_ID, String textMsg)
Set User Confirmation- Parameters:
AD_User_ID
- usertextMsg
- optional message
-
getHistoryHTML
public String getHistoryHTML()
Get Process Activity (Event) History- Returns:
- history
-
isPdfAttachment
public boolean isPdfAttachment()
Does the underlying PO (!) object have 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
public String toString()
String Representation- Overrides:
toString
in classX_AD_WF_Activity
- Returns:
- info
-
toStringX
public String toStringX()
User String Representation. Suspended: Approve it (Joe)- Returns:
- info
-
getSummary
public String getSummary()
Get Document Summary- Returns:
- PO Summary
-
-