Class MWorkflow

    • Constructor Detail

      • 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)
        Parameters:
        copy -
    • Method Detail

      • 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 Workflow
        Parameters:
        ctx - context
        AD_Client_ID - client
        AD_Table_ID - table
        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()
      • getFirstNode

        public MWFNode getFirstNode()
        Get the first node
        Returns:
        array of next nodes
      • 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) of ID
        Parameters:
        AD_WF_Node_ID - id
        AD_Client_ID - for client
        Returns:
        next AD_WF_Node_ID or 0
      • getNodeNexts

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

        public int getPrevious​(int AD_WF_Node_ID,
                               int AD_Client_ID)
        Get (first) Previous Node of ID
        Parameters:
        AD_WF_Node_ID - id
        AD_Client_ID - for client
        Returns:
        next AD_WF_Node_ID or 0
      • getLast

        public int getLast​(int AD_WF_Node_ID,
                           int AD_Client_ID)
        Get very Last Node
        Parameters:
        AD_WF_Node_ID - ignored
        AD_Client_ID - for client
        Returns:
        next 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 - id
        AD_Client_ID - for client
        Returns:
        true if 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 - id
        AD_Client_ID - for client
        Returns:
        true if 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
      • 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 (Record_ID)
        Returns:
        process
      • startWait

        public MWFProcess startWait​(ProcessInfo pi)
        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 CalendarField
        Returns:
        Calendar.MINUTE, etc.
      • validate

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

        public static void main​(String[] args)
        main
        Parameters:
        args -
      • 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 the workflow is valid for given date
        Parameters:
        date -
        Returns:
        true if valid
      • runDocumentActionWorkflow

        public static ProcessInfo runDocumentActionWorkflow​(PO po,
                                                            String docAction)
        Parameters:
        po -
        docAction -
        Returns:
        ProcessInfo