Class MWorkflow

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

public class MWorkflow extends X_AD_Workflow implements ImmutablePOSupport
Extended WorkFlow Model for AD_Workflow
Version:
$Id: MWorkflow.java,v 1.4 2006/07/30 00:51:05 jjanke Exp $
Author:
Jorg Janke, Teo Sarca, www.arhipac.ro
  • FR [ 2214883 ] Remove SQL code and Replace for Query
  • BF [ 2665963 ] Copy Workflow name in Activity name, Silvano Trinchero, www.freepath.it
  • IDEMPIERE-3209 changed functions to public to improve integration support
  • See Also:
    • Constructor Details

      • MWorkflow

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

        public MWorkflow(Properties ctx, int AD_Workflow_ID, String trxName)
        Create/Load Workflow
        Parameters:
        ctx - Context
        AD_Workflow_ID - ID
        trxName - transaction
      • MWorkflow

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

        public MWorkflow(MWorkflow copy)
        Copy constructor
        Parameters:
        copy -
      • MWorkflow

        public MWorkflow(Properties ctx, MWorkflow copy)
        Copy constructor
        Parameters:
        ctx -
        copy -
      • MWorkflow

        public MWorkflow(Properties ctx, MWorkflow copy, String trxName)
        Copy constructor
        Parameters:
        ctx -
        copy -
        trxName -
    • Method Details

      • get

        public static MWorkflow get(int AD_Workflow_ID)
        Get Workflow from Cache (immutable)
        Parameters:
        AD_Workflow_ID - id
        Returns:
        workflow
      • get

        public static MWorkflow get(Properties ctx, int AD_Workflow_ID)
        Get Workflow from Cache (immutable)
        Parameters:
        ctx - context
        AD_Workflow_ID - id
        Returns:
        workflow
      • getCopy

        public static MWorkflow getCopy(Properties ctx, int AD_Workflow_ID, String trxName)
        Get updateable copy of MWorkflow from cache
        Parameters:
        ctx -
        AD_Workflow_ID -
        trxName -
        Returns:
        MWorkflow
      • getDocValue

        public static MWorkflow[] getDocValue(Properties ctx, int AD_Client_ID, int AD_Table_ID, String trxName)
        Get Doc Value Workflows
        Parameters:
        ctx - context
        AD_Client_ID - client
        AD_Table_ID - table
        trxName -
        Returns:
        document value workflow array or null
      • getNodeCount

        public int getNodeCount()
        Get Number of Nodes
        Returns:
        number of nodes
      • getNodes

        public MWFNode[] getNodes(boolean ordered, int AD_Client_ID)
        Get the nodes
        Parameters:
        ordered - ordered array
        AD_Client_ID - for client
        Returns:
        array of nodes
      • reloadNodes

        public void reloadNodes()
        Reload all nodes
      • getFirstNode

        public MWFNode getFirstNode()
        Get the first node
        Returns:
        first workflow node
      • getNode

        protected MWFNode getNode(int AD_WF_Node_ID)
        Get Node with ID in Workflow
        Parameters:
        AD_WF_Node_ID - ID
        Returns:
        node or null
      • getNextNodes

        public MWFNode[] getNextNodes(int AD_WF_Node_ID, int AD_Client_ID)
        Get the next nodes
        Parameters:
        AD_WF_Node_ID - ID
        AD_Client_ID - for client
        Returns:
        array of next nodes or null
      • getNodesInOrder

        public MWFNode[] getNodesInOrder(int AD_Client_ID)
        Get The Nodes in Sequence Order
        Parameters:
        AD_Client_ID - client
        Returns:
        Nodes in sequence
      • getNext

        public int getNext(int AD_WF_Node_ID, int AD_Client_ID)
        Get first transition (Next Node) node id
        Parameters:
        AD_WF_Node_ID - from node id
        AD_Client_ID -
        Returns:
        next AD_WF_Node_ID or 0
      • getNodeNexts

        public MWFNodeNext[] getNodeNexts(int AD_WF_Node_ID, int AD_Client_ID)
        Get Transitions (NodeNext) node id
        Parameters:
        AD_WF_Node_ID - from node id
        AD_Client_ID -
        Returns:
        array of next nodes
      • getPrevious

        public int getPrevious(int AD_WF_Node_ID, int AD_Client_ID)
        Get (first) Previous Node ID
        Parameters:
        AD_WF_Node_ID - from node id
        AD_Client_ID -
        Returns:
        next AD_WF_Node_ID or 0
      • getLast

        public int getLast(int AD_WF_Node_ID, int AD_Client_ID)
        Get Last Node id
        Parameters:
        AD_WF_Node_ID - ignored
        AD_Client_ID -
        Returns:
        last AD_WF_Node_ID or 0
      • isFirst

        public boolean isFirst(int AD_WF_Node_ID, int AD_Client_ID)
        Is this the first Node
        Parameters:
        AD_WF_Node_ID - node id
        AD_Client_ID -
        Returns:
        true if node id is first node
      • isLast

        public boolean isLast(int AD_WF_Node_ID, int AD_Client_ID)
        Is this the last Node
        Parameters:
        AD_WF_Node_ID - node id
        AD_Client_ID -
        Returns:
        true if node id is last node
      • getName

        public String getName(boolean translated)
        Get Name
        Parameters:
        translated - translated
        Returns:
        Name
      • getDescription

        public String getDescription(boolean translated)
        Get Description
        Parameters:
        translated - translated
        Returns:
        Description
      • getHelp

        public String getHelp(boolean translated)
        Get Help
        Parameters:
        translated - translated
        Returns:
        Name
      • toString

        public String toString()
        String Representation
        Overrides:
        toString in class X_AD_Workflow
        Returns:
        info
      • beforeSave

        protected boolean beforeSave(boolean newRecord)
        Before Save
        Overrides:
        beforeSave in class PO
        Parameters:
        newRecord - new
        Returns:
        true
      • afterSave

        protected boolean afterSave(boolean newRecord, boolean success)
        After Save.
        Overrides:
        afterSave in class PO
        Parameters:
        newRecord - new record
        success - success
        Returns:
        true if save complete (if not overwritten true)
      • start

        public MWFProcess start(ProcessInfo pi)
        Deprecated.
        Start Workflow.
        Parameters:
        pi - Process Info (Record_ID)
        Returns:
        process
      • start

        public MWFProcess start(ProcessInfo pi, String trxName)
        Start Workflow.
        Parameters:
        pi - Process Info
        trxName -
        Returns:
        process
      • startWait

        @Deprecated public MWFProcess startWait(ProcessInfo pi)
        Deprecated.
        workflow process run in the same thread, this is meaningless
        Start Workflow and Wait for completion.
        Parameters:
        pi - process info with Record_ID record for the workflow
        Returns:
        process
      • getDurationBaseSec

        public long getDurationBaseSec()
        Get Duration Base in Seconds
        Returns:
        duration unit in seconds
      • getDurationCalendarField

        public int getDurationCalendarField()
        Get Duration Calendar Field
        Returns:
        Calendar field (Calendar.MINUTE, etc)
      • validate

        public String validate()
        Validate workflow. Sets Valid flag.
        Returns:
        errors or ""
      • getWorkflowSearchKey

        public static int getWorkflowSearchKey(MProduct product)
        Get AD_Workflow_ID for given M_Product_ID
        Parameters:
        product -
        Returns:
        AD_Workflow_ID
      • isValidFromTo

        public boolean isValidFromTo(Timestamp date)
        Check if this workflow is valid for given date
        Parameters:
        date -
        Returns:
        true if valid for given date
      • markImmutable

        public MWorkflow markImmutable()
        Description copied from interface: ImmutablePOSupport
        mark PO as immutable
        Specified by:
        markImmutable in interface ImmutablePOSupport
        Returns:
        PO
      • runDocumentActionWorkflow

        public static ProcessInfo runDocumentActionWorkflow(PO po, String docAction)
        Run document action workflow
        Parameters:
        po -
        docAction - DocAction.ACTION_*
        Returns:
        ProcessInfo