Package org.compiere.process
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 Summary
Fields Modifier and Type Field Description static 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-
Fields inherited from interface org.compiere.process.DocAction
ACTION_Approve, ACTION_Close, ACTION_Complete, ACTION_Invalidate, ACTION_None, ACTION_Post, ACTION_Prepare, ACTION_ReActivate, ACTION_Reject, ACTION_Reverse_Accrual, ACTION_Reverse_Correct, ACTION_Unlock, ACTION_Void, ACTION_WaitComplete, AD_REFERENCE_ID, DOC_COLUMNNAME_AD_User_ID, DOC_COLUMNNAME_C_Currency_ID, DOC_COLUMNNAME_C_DocType_ID, DOC_COLUMNNAME_C_DocTypeTarget_ID, DOC_COLUMNNAME_DateAcct, DOC_COLUMNNAME_DateTrx, DOC_COLUMNNAME_Description, DOC_COLUMNNAME_DocAction, DOC_COLUMNNAME_DocStatus, DOC_COLUMNNAME_DocumentNo, DOC_COLUMNNAME_IsApproved, DOC_COLUMNNAME_Processed, DOC_COLUMNNAME_Processing, DOC_COLUMNNAME_SalesRep_ID, STATUS_Approved, STATUS_Closed, STATUS_Completed, STATUS_Drafted, STATUS_InProgress, STATUS_Invalid, STATUS_NotApproved, STATUS_Reversed, STATUS_Unknown, STATUS_Voided, STATUS_WaitingConfirmation, STATUS_WaitingPayment
-
-
Constructor Summary
Constructors Constructor Description DocumentEngine(DocAction po)
Doc Engine (Drafted)DocumentEngine(DocAction po, String docStatus)
Doc Engine
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
approveIt()
Approve Document.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.boolean
closeIt()
Close Document.String
completeIt()
Complete Document.File
createPDF()
CreatePDFint
get_ID()
Get ID of recordCLogger
get_Logger()
Get Loggerint
get_Table_ID()
Get AD_Table_IDString
get_TrxName()
Get TransactionString[]
getActionOptions()
Get Action Options based on current Statusint
getAD_Client_ID()
Get Document Clientint
getAD_Org_ID()
Get Document OrganizationBigDecimal
getApprovalAmt()
Get Document Approval Amountint
getC_Currency_ID()
Get Document CurrencyProperties
getCtx()
Get Contextint
getDoc_User_ID()
Get Document OwnerString
getDocAction()
Get Doc ActionString
getDocStatus()
Get Doc StatusString
getDocumentInfo()
Get Document InfoString
getDocumentNo()
Get Document NoString
getProcessMsg()
Get Process MessageString
getSummary()
Get Summarystatic 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.boolean
invalidateIt()
Invalidate Document.boolean
isApproved()
Document is Approvedboolean
isClosed()
Document is Closedboolean
isCompleted()
Document is Completedboolean
isDrafted()
Document is Draftedboolean
isInProgress()
Document is In Progressboolean
isInvalid()
Document is Invalidboolean
isNotApproved()
Document is Not Approvedboolean
isReversed()
Document is Reversedboolean
isUnknown()
Document Status is Unknownboolean
isValidAction(String action)
Is The Action Valid based on current stateboolean
isVoided()
Document is Voidedboolean
isWaiting()
Document is Waiting Payment or Confirmationstatic String
postImmediate(Properties ctx, int AD_Client_ID, int AD_Table_ID, int Record_ID, boolean force, String trxName)
Post Immediateboolean
postIt()
Post Document Does not change statusString
prepareIt()
Process Document.boolean
processIt(String action)
Process actual document - do not call directly.boolean
processIt(String processAction, String docAction)
Process actual document.static boolean
processIt(DocAction doc, String processAction)
Process document.boolean
reActivateIt()
Re-activate Document.static void
readReferenceList(ArrayList<String> v_value, ArrayList<String> v_name, ArrayList<String> v_description)
Fill Vector with DocAction Ref_List(135) valuesstatic void
readStatusReferenceList(ArrayList<String> v_value, ArrayList<String> v_name, ArrayList<String> v_description)
Fill Vector with DocAction Ref_List(131) valuesboolean
rejectIt()
Reject Approval.boolean
reverseAccrualIt()
Reverse Accrual Document.boolean
reverseCorrectIt()
Reverse Correct Document.boolean
save()
Save Documentvoid
saveEx()
Save Documentvoid
setDocStatus(String ignored)
Set Doc Status - Ignoredvoid
setProcessMsg(String msg)
Get Process Messageboolean
unlockIt()
Unlock Document.boolean
voidIt()
Void Document.
-
-
-
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
-
-
Method Detail
-
getDocStatus
public String getDocStatus()
Get Doc Status- Specified by:
getDocStatus
in interfaceDocAction
- Returns:
- document status
-
setDocStatus
public void setDocStatus(String ignored)
Set Doc Status - Ignored- Specified by:
setDocStatus
in interfaceDocAction
- Parameters:
ignored
- Status is not set directly- See Also:
DocAction.setDocStatus(String)
-
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 workflowdocAction
- 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
-
unlockIt
public boolean unlockIt()
Unlock Document. Status: Drafted- Specified by:
unlockIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
DocAction.unlockIt()
-
invalidateIt
public boolean invalidateIt()
Invalidate Document. Status: Invalid- Specified by:
invalidateIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
DocAction.invalidateIt()
-
prepareIt
public String prepareIt()
Process Document. Status is set by process- Specified by:
prepareIt
in interfaceDocAction
- Returns:
- new status (In Progress or Invalid)
- See Also:
DocAction.prepareIt()
-
approveIt
public boolean approveIt()
Approve Document. Status: Approved- Specified by:
approveIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
DocAction.approveIt()
-
rejectIt
public boolean rejectIt()
Reject Approval. Status: Not Approved- Specified by:
rejectIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
DocAction.rejectIt()
-
completeIt
public String completeIt()
Complete Document. Status is set by process- Specified by:
completeIt
in interfaceDocAction
- 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
-
voidIt
public boolean voidIt()
Void Document. Status: Voided- Specified by:
voidIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
DocAction.voidIt()
-
closeIt
public boolean closeIt()
Close Document. Status: Closed- Specified by:
closeIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
DocAction.closeIt()
-
reverseCorrectIt
public boolean reverseCorrectIt()
Reverse Correct Document. Status: Reversed- Specified by:
reverseCorrectIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
DocAction.reverseCorrectIt()
-
reverseAccrualIt
public boolean reverseAccrualIt()
Reverse Accrual Document. Status: Reversed- Specified by:
reverseAccrualIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
DocAction.reverseAccrualIt()
-
reActivateIt
public boolean reActivateIt()
Re-activate Document. Status: In Progress- Specified by:
reActivateIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
DocAction.reActivateIt()
-
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 interfaceDocAction
- 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 interfaceDocAction
- Returns:
- throw exception
-
getDocumentNo
public String getDocumentNo()
Get Document No- Specified by:
getDocumentNo
in interfaceDocAction
- Returns:
- throw exception
-
getDocumentInfo
public String getDocumentInfo()
Get Document Info- Specified by:
getDocumentInfo
in interfaceDocAction
- Returns:
- throw exception
-
getDoc_User_ID
public int getDoc_User_ID()
Get Document Owner- Specified by:
getDoc_User_ID
in interfaceDocAction
- Returns:
- throw exception
-
getC_Currency_ID
public int getC_Currency_ID()
Get Document Currency- Specified by:
getC_Currency_ID
in interfaceDocAction
- Returns:
- throw exception
-
getApprovalAmt
public BigDecimal getApprovalAmt()
Get Document Approval Amount- Specified by:
getApprovalAmt
in interfaceDocAction
- Returns:
- throw exception
-
getAD_Client_ID
public int getAD_Client_ID()
Get Document Client- Specified by:
getAD_Client_ID
in interfaceDocAction
- Returns:
- throw exception
-
getAD_Org_ID
public int getAD_Org_ID()
Get Document Organization- Specified by:
getAD_Org_ID
in interfaceDocAction
- Returns:
- throw exception
-
getDocAction
public String getDocAction()
Get Doc Action- Specified by:
getDocAction
in interfaceDocAction
- Returns:
- Document Action
-
save
public boolean save()
Save Document
-
saveEx
public void saveEx() throws AdempiereException
Save Document- Specified by:
saveEx
in interfaceDocAction
- Throws:
AdempiereException
- See Also:
DocAction.save()
-
getCtx
public Properties getCtx()
Get Context
-
get_Table_ID
public int get_Table_ID()
Get AD_Table_ID- Specified by:
get_Table_ID
in interfaceDocAction
- Returns:
- AD_Table_ID
-
get_Logger
public CLogger get_Logger()
Get Logger- Specified by:
get_Logger
in interfaceDocAction
- Returns:
- logger
-
get_TrxName
public String get_TrxName()
Get Transaction- Specified by:
get_TrxName
in interfaceDocAction
- Returns:
- trx name
-
createPDF
public File createPDF()
CreatePDF
-
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 ContextAD_Client_ID
- Client ID of DocumentAD_Table_ID
- Table ID of DocumentRecord_ID
- Record ID of this documentforce
- force postingtrxName
- 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
-
-