Class DocumentEngine

  • All Implemented Interfaces:
    DocAction

    public class DocumentEngine
    extends Object
    implements DocAction
    Document Action Engine
    Version:
    $Id: DocumentEngine.java,v 1.2 2006/07/30 00:54:44 jjanke Exp $
    Author:
    Jorg Janke, Karsten Thiemann FR [ 1782412 ], victor.perez@e-evolution.com www.e-evolution.com FR [ 1866214 ] https://sourceforge.net/p/adempiere/feature-requests/298/
    • Field Detail

      • DOCUMENT_POST_IMMEDIATE_AFTER_COMPLETE

        public static final String DOCUMENT_POST_IMMEDIATE_AFTER_COMPLETE
        When client accounting is immediate, set this PO attribute to override the default of immediate posting after complete of document
        See Also:
        Constant Field Values
    • Constructor Detail

      • DocumentEngine

        public DocumentEngine​(DocAction po)
        Doc Engine (Drafted)
        Parameters:
        po - document
      • DocumentEngine

        public DocumentEngine​(DocAction po,
                              String docStatus)
        Doc Engine
        Parameters:
        po - document
        docStatus - initial document status
    • Method Detail

      • getDocStatus

        public String getDocStatus()
        Get Doc Status
        Specified by:
        getDocStatus in interface DocAction
        Returns:
        document status
      • isDrafted

        public boolean isDrafted()
        Document is Drafted
        Returns:
        true if drafted
      • isInvalid

        public boolean isInvalid()
        Document is Invalid
        Returns:
        true if Invalid
      • isInProgress

        public boolean isInProgress()
        Document is In Progress
        Returns:
        true if In Progress
      • isApproved

        public boolean isApproved()
        Document is Approved
        Returns:
        true if Approved
      • isNotApproved

        public boolean isNotApproved()
        Document is Not Approved
        Returns:
        true if Not Approved
      • isWaiting

        public boolean isWaiting()
        Document is Waiting Payment or Confirmation
        Returns:
        true if Waiting Payment
      • isCompleted

        public boolean isCompleted()
        Document is Completed
        Returns:
        true if Completed
      • isReversed

        public boolean isReversed()
        Document is Reversed
        Returns:
        true if Reversed
      • isClosed

        public boolean isClosed()
        Document is Closed
        Returns:
        true if Closed
      • isVoided

        public boolean isVoided()
        Document is Voided
        Returns:
        true if Voided
      • isUnknown

        public boolean isUnknown()
        Document Status is Unknown
        Returns:
        true if unknown
      • processIt

        public boolean processIt​(String processAction,
                                 String docAction)
        Process actual document. Checks if user (document) action is valid and then process action Calls the individual actions which call the document action
        Parameters:
        processAction - document action based on workflow
        docAction - document action based on document
        Returns:
        true if performed
      • processIt

        public boolean processIt​(String action)
        Process actual document - do not call directly. Calls the individual actions which call the document action
        Specified by:
        processIt in interface DocAction
        Parameters:
        action - document action
        Returns:
        true if performed
      • completeIt

        public String completeIt()
        Complete Document. Status is set by process
        Specified by:
        completeIt in interface DocAction
        Returns:
        new document status (Complete, In Progress, Invalid, Waiting ..)
        See Also:
        DocAction.completeIt()
      • postIt

        public boolean postIt()
        Post Document Does not change status
        Returns:
        true if success
      • getActionOptions

        public String[] getActionOptions()
        Get Action Options based on current Status
        Returns:
        array of actions
      • isValidAction

        public boolean isValidAction​(String action)
        Is The Action Valid based on current state
        Parameters:
        action - action
        Returns:
        true if valid
      • getProcessMsg

        public String getProcessMsg()
        Get Process Message
        Specified by:
        getProcessMsg in interface DocAction
        Returns:
        clear text error message
      • setProcessMsg

        public void setProcessMsg​(String msg)
        Get Process Message
        Parameters:
        msg - clear text error message
      • getSummary

        public String getSummary()
        Get Summary
        Specified by:
        getSummary in interface DocAction
        Returns:
        throw exception
      • getDocumentNo

        public String getDocumentNo()
        Get Document No
        Specified by:
        getDocumentNo in interface DocAction
        Returns:
        throw exception
      • getDoc_User_ID

        public int getDoc_User_ID()
        Get Document Owner
        Specified by:
        getDoc_User_ID in interface DocAction
        Returns:
        throw exception
      • getC_Currency_ID

        public int getC_Currency_ID()
        Get Document Currency
        Specified by:
        getC_Currency_ID in interface DocAction
        Returns:
        throw exception
      • getAD_Client_ID

        public int getAD_Client_ID()
        Get Document Client
        Specified by:
        getAD_Client_ID in interface DocAction
        Returns:
        throw exception
      • getAD_Org_ID

        public int getAD_Org_ID()
        Get Document Organization
        Specified by:
        getAD_Org_ID in interface DocAction
        Returns:
        throw exception
      • getDocAction

        public String getDocAction()
        Get Doc Action
        Specified by:
        getDocAction in interface DocAction
        Returns:
        Document Action
      • save

        public boolean save()
        Save Document
        Specified by:
        save in interface DocAction
        Returns:
        throw exception
      • get_ID

        public int get_ID()
        Get ID of record
        Specified by:
        get_ID in interface DocAction
        Returns:
        ID
      • get_Table_ID

        public int get_Table_ID()
        Get AD_Table_ID
        Specified by:
        get_Table_ID in interface DocAction
        Returns:
        AD_Table_ID
      • createPDF

        public File createPDF()
        CreatePDF
        Specified by:
        createPDF in interface DocAction
        Returns:
        null
      • getValidActions

        public static int getValidActions​(String docStatus,
                                          Object processing,
                                          String orderType,
                                          String isSOTrx,
                                          int AD_Table_ID,
                                          String[] docAction,
                                          String[] options,
                                          boolean periodOpen,
                                          PO po)
        Get list of valid document action into the options array parameter. Set default document action into the docAction array parameter.
        Parameters:
        docStatus -
        processing -
        orderType -
        isSOTrx -
        AD_Table_ID -
        docAction -
        options -
        periodOpen - - flag indicating if the period is Open - to avoid including Void and ReverseCorrect options in the list
        Returns:
        Number of valid options
      • readReferenceList

        public static void readReferenceList​(ArrayList<String> v_value,
                                             ArrayList<String> v_name,
                                             ArrayList<String> v_description)
        Fill Vector with DocAction Ref_List(135) values
        Parameters:
        v_value -
        v_name -
        v_description -
      • checkActionAccess

        public static int checkActionAccess​(int clientId,
                                            int roleId,
                                            int docTypeId,
                                            String[] options,
                                            int maxIndex)
        Checks the access rights of the given role/client for the given document actions.
        Parameters:
        clientId -
        roleId -
        docTypeId -
        options -
        maxIndex -
        Returns:
        number of valid actions in the String[] options
      • postImmediate

        public static String postImmediate​(Properties ctx,
                                           int AD_Client_ID,
                                           int AD_Table_ID,
                                           int Record_ID,
                                           boolean force,
                                           String trxName)
        Post Immediate
        Parameters:
        ctx - Client Context
        AD_Client_ID - Client ID of Document
        AD_Table_ID - Table ID of Document
        Record_ID - Record ID of this document
        force - force posting
        trxName - ignore, retained for backward compatibility
        Returns:
        null, if success or error message
      • processIt

        public static boolean processIt​(DocAction doc,
                                        String processAction)
        Process document. This replaces DocAction.processIt().
        Parameters:
        doc -
        processAction -
        Returns:
        true if performed
      • readStatusReferenceList

        public static void readStatusReferenceList​(ArrayList<String> v_value,
                                                   ArrayList<String> v_name,
                                                   ArrayList<String> v_description)
        Fill Vector with DocAction Ref_List(131) values
        Parameters:
        v_value -
        v_name -
        v_description -