Class DocumentEngine

java.lang.Object
org.compiere.process.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 Details

    • 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:
  • Constructor Details

    • 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 Details

    • getDocStatus

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

      public void setDocStatus(String ignored)
      Set Doc Status - Ignored
      Specified by:
      setDocStatus in interface DocAction
      Parameters:
      ignored - Status is not set directly
      See Also:
    • 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
    • unlockIt

      public boolean unlockIt()
      Unlock Document. Status: Drafted
      Specified by:
      unlockIt in interface DocAction
      Returns:
      true if success
      See Also:
    • invalidateIt

      public boolean invalidateIt()
      Invalidate Document. Status: Invalid
      Specified by:
      invalidateIt in interface DocAction
      Returns:
      true if success
      See Also:
    • prepareIt

      public String prepareIt()
      Process Document. Status is set by process
      Specified by:
      prepareIt in interface DocAction
      Returns:
      new status (In Progress or Invalid)
      See Also:
    • approveIt

      public boolean approveIt()
      Approve Document. Status: Approved
      Specified by:
      approveIt in interface DocAction
      Returns:
      true if success
      See Also:
    • rejectIt

      public boolean rejectIt()
      Reject Approval. Status: Not Approved
      Specified by:
      rejectIt in interface DocAction
      Returns:
      true if success
      See Also:
    • 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:
    • postIt

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

      public boolean voidIt()
      Void Document. Status: Voided
      Specified by:
      voidIt in interface DocAction
      Returns:
      true if success
      See Also:
    • closeIt

      public boolean closeIt()
      Close Document. Status: Closed
      Specified by:
      closeIt in interface DocAction
      Returns:
      true if success
      See Also:
    • reverseCorrectIt

      public boolean reverseCorrectIt()
      Reverse Correct Document. Status: Reversed
      Specified by:
      reverseCorrectIt in interface DocAction
      Returns:
      true if success
      See Also:
    • reverseAccrualIt

      public boolean reverseAccrualIt()
      Reverse Accrual Document. Status: Reversed
      Specified by:
      reverseAccrualIt in interface DocAction
      Returns:
      true if success
      See Also:
    • reActivateIt

      public boolean reActivateIt()
      Re-activate Document. Status: In Progress
      Specified by:
      reActivateIt in interface DocAction
      Returns:
      true if success
      See Also:
    • 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
    • getDocumentInfo

      public String getDocumentInfo()
      Get Document Info
      Specified by:
      getDocumentInfo 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
    • getApprovalAmt

      public BigDecimal getApprovalAmt()
      Get Document Approval Amount
      Specified by:
      getApprovalAmt 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
    • saveEx

      public void saveEx() throws AdempiereException
      Save Document
      Specified by:
      saveEx in interface DocAction
      Throws:
      AdempiereException
      See Also:
    • getCtx

      public Properties getCtx()
      Get Context
      Specified by:
      getCtx in interface DocAction
      Returns:
      context
    • 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
    • get_Logger

      public CLogger get_Logger()
      Get Logger
      Specified by:
      get_Logger in interface DocAction
      Returns:
      logger
    • get_TrxName

      public String get_TrxName()
      Get Transaction
      Specified by:
      get_TrxName in interface DocAction
      Returns:
      trx name
    • 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:
      End index of valid options[] (exclusive)
    • 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 -