Class 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
Extended Workflow Activity Model for AD_WF_Activity.
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:
    • Constructor Details

      • MWFActivity

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

        public MWFActivity(Properties ctx, int AD_WF_Activity_ID, String trxName)
        Standard Constructor
        Parameters:
        ctx - context
        AD_WF_Activity_ID - id
        trxName - transaction
      • MWFActivity

        public MWFActivity(Properties ctx, ResultSet rs, String trxName)
        Load Constructor
        Parameters:
        ctx - context
        rs - result set
        trxName - transaction
      • MWFActivity

        public MWFActivity(MWFProcess process, int AD_WF_Node_ID)
        Parent Constructor
        Parameters:
        process - process
        AD_WF_Node_ID - start node
      • MWFActivity

        public MWFActivity(MWFProcess process, Properties ctx, ResultSet rs, String trxName)
        Process-aware Parent Constructor
        Parameters:
        process - process
        ctx - context
        rs - record to load
        trxName - transaction name
      • MWFActivity

        public MWFActivity(MWFProcess process, int next_ID, PO lastPO)
        Parent Constructor
        Parameters:
        process - process
        next_ID - start node
        lastPO - PO from the previously executed node
    • Method Details

      • get

        public static MWFActivity[] get(Properties ctx, int AD_Table_ID, int Record_ID, boolean activeOnly)
        Get Activities for table/record
        Parameters:
        ctx - context
        AD_Table_ID - table
        Record_ID - record
        activeOnly - if true only not processed records are returned
        Returns:
        activities
      • getActiveInfo

        public static String getActiveInfo(Properties ctx, int AD_Table_ID, int Record_ID)
        Get info of active activities
        Parameters:
        ctx - context
        AD_Table_ID - table
        Record_ID - record
        Returns:
        info of active activities (separated by new line character)
      • 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 call MWFProcess.checkActivities(String, PO)
        Specified by:
        setWFState in interface I_AD_WF_Activity
        Overrides:
        setWFState in class X_AD_WF_Activity
        Parameters:
        WFState - StateEngine.STATE_*
      • isClosed

        public boolean isClosed()
        Is Activity closed
        Returns:
        true if closed
      • getEventAudit

        public MWFEventAudit getEventAudit()
        Get/Create new 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 (AD_Column_ID of MWFNode) 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 state to Not Started.
        Specified by:
        setAD_WF_Node_ID in interface I_AD_WF_Activity
        Overrides:
        setAD_WF_Node_ID in class X_AD_WF_Activity
        Parameters:
        AD_WF_Node_ID - new 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 interface I_AD_WF_Activity
        Overrides:
        setTextMsg in class X_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:
        workflow state text
      • getResponsible

        public MWFResponsible 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 User
        C_Currency_ID - currency
        amount - amount
        AD_Org_ID - document organization
        ownDocument - 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.
        Specified by:
        run in interface Runnable
      • getCurrentWorkflowProcessInfo

        public static ProcessInfo 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 - user
        value - new Value
        displayType - display type
        textMsg - optional Message
        Returns:
        true if set
        Throws:
        Exception - if error
      • forwardTo

        public boolean forwardTo(int AD_User_ID, String textMsg)
        Forward to user, usually for approval
        Parameters:
        AD_User_ID - user
        textMsg - text message
        Returns:
        true if forwarded
      • setUserConfirmation

        public void setUserConfirmation(int AD_User_ID, String textMsg)
        Set User Confirmation
        Parameters:
        AD_User_ID - user
        textMsg - optional message
      • getHistoryHTML

        public String 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 class PO
        Returns:
        true if there is a pdf attachment
      • getPdfAttachment

        public byte[] getPdfAttachment()
        Get PDF Attachment of underlying PO object
        Overrides:
        getPdfAttachment in class PO
        Returns:
        pdf data or null
      • toString

        public String toString()
        String Representation
        Overrides:
        toString in class X_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
      • getWhereUserPendingActivities

        public static String 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
      • getMWFProcess

        public MWFProcess getMWFProcess()
        Get process message
        Returns:
        process message
      • getProcessMsg

        public String getProcessMsg()
      • getWFWhatsAppNotification

        public IWFWhatsAppNotification getWFWhatsAppNotification()