Package org.compiere.process
Class DocumentEngine
java.lang.Object
org.compiere.process.DocumentEngine
- All Implemented Interfaces:
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
Modifier and TypeFieldDescriptionstatic final String
When client accounting is immediate, set this PO attribute to override the default of immediate posting after complete of documentFields 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
ConstructorDescriptionDoc Engine (Drafted)DocumentEngine
(DocAction po, String docStatus) Doc Engine -
Method Summary
Modifier and TypeMethodDescriptionboolean
Approve Document.
Status: Approved.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.
Status: Closed.Complete Document.
Status is set by document action method.CreatePDFint
get_ID()
Get ID of recordGet Loggerint
Get AD_Table_IDGet TransactionString[]
Get available Document Actions based on current Document Status.int
Not applicable, throw exceptionint
Not applicable, throw exceptionNot applicable, throw exceptionint
Not applicable, throw exceptiongetCtx()
Get Contextint
Not applicable, throw exceptionGet Doc ActionGet Doc StatusNot applicable, throw exceptionNot applicable, throw exceptionGet Process MessageNot applicable, throw exceptionstatic 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.boolean
Invalidate Document.
Status: Invalid.boolean
Is current Document Status is Approvedboolean
isClosed()
Is current Document Status is Closedboolean
Is current Document Status is Completedboolean
Is current Document Status is Draftedboolean
Is current Document Status is In Progressboolean
Is current Document Status is Invalidboolean
Is current Document Status is Not Approvedboolean
Is current Document Status is Reversedboolean
Is current Document Status is Unknownboolean
isValidAction
(String action) Is The Action Valid based on current document status.boolean
isVoided()
Is current Document Status is Voidedboolean
Is current Document Status is Waiting Payment or Confirmationstatic String
postImmediate
(Properties ctx, int AD_Client_ID, int AD_Table_ID, int Record_ID, boolean force, String trxName) Perform immediate posting of documentboolean
postIt()
Post Document.
Does not change status.Prepare Document.
Status is set by document action method.boolean
Process document action - internal API, do not call directly.
Calls the individual actions which call the document action.boolean
Process document action.
Checks if user (document) action is valid and then process action.
Calls the individual actions which call the document action.static boolean
Process document action.boolean
Re-activate Document.
Status: In Progress.static void
readReferenceList
(ArrayList<String> v_value, ArrayList<String> v_name, ArrayList<String> v_description) Fill lists with DocAction Ref_List(135) valuesstatic void
readStatusReferenceList
(ArrayList<String> v_value, ArrayList<String> v_name, ArrayList<String> v_description) Fill lists with DocAction Ref_List(131) valuesboolean
rejectIt()
Reject Approval.
Status: Not Approved.boolean
Reverse Accrual Document.
Status: Reversed.boolean
Reverse Correct Document.
Status: Reversed.boolean
save()
Not applicable, throw exceptionvoid
saveEx()
Not applicable, throw exceptionvoid
setDocStatus
(String ignored) Set Doc Status - Ignoredvoid
setProcessMsg
(String msg) Set Process Messageprotected void
Set Document Status to new Statusboolean
unlockIt()
Unlock Document.
Status: Drafted.boolean
voidIt()
Void Document.
Status: Voided.
-
Field Details
-
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
Doc Engine (Drafted)- Parameters:
po
- document
-
DocumentEngine
Doc Engine- Parameters:
po
- documentdocStatus
- initial document status
-
-
Method Details
-
getDocStatus
Get Doc Status- Specified by:
getDocStatus
in interfaceDocAction
- Returns:
- document status
-
setDocStatus
Set Doc Status - Ignored- Specified by:
setDocStatus
in interfaceDocAction
- Parameters:
ignored
- Status is not set directly- See Also:
-
isDrafted
public boolean isDrafted()Is current Document Status is Drafted- Returns:
- true if current status is drafted
-
isInvalid
public boolean isInvalid()Is current Document Status is Invalid- Returns:
- true if current status is Invalid
-
isInProgress
public boolean isInProgress()Is current Document Status is In Progress- Returns:
- true if current status is In Progress
-
isApproved
public boolean isApproved()Is current Document Status is Approved- Returns:
- true if current status is Approved
-
isNotApproved
public boolean isNotApproved()Is current Document Status is Not Approved- Returns:
- true if current status is Not Approved
-
isWaiting
public boolean isWaiting()Is current Document Status is Waiting Payment or Confirmation- Returns:
- true if current status is Waiting Payment
-
isCompleted
public boolean isCompleted()Is current Document Status is Completed- Returns:
- true if current status is Completed
-
isReversed
public boolean isReversed()Is current Document Status is Reversed- Returns:
- true if current status is Reversed
-
isClosed
public boolean isClosed()Is current Document Status is Closed- Returns:
- true if current status is Closed
-
isVoided
public boolean isVoided()Is current Document Status is Voided- Returns:
- true if current status is Voided
-
isUnknown
public boolean isUnknown()Is current Document Status is Unknown- Returns:
- true if current status is unknown
-
processIt
Process document action.
Checks if user (document) action is valid and then process action.
Calls the individual actions which call the document action.- Parameters:
processAction
- document action value from workflowdocAction
- document action value from document (PO)- Returns:
- true if performed
-
processIt
Process document action - internal API, do not call directly.
Calls the individual actions which call the document action. -
unlockIt
public boolean unlockIt()Unlock Document.
Status: Drafted. -
invalidateIt
public boolean invalidateIt()Invalidate Document.
Status: Invalid.- Specified by:
invalidateIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
-
prepareIt
Prepare Document.
Status is set by document action method. -
approveIt
public boolean approveIt()Approve Document.
Status: Approved. -
rejectIt
public boolean rejectIt()Reject Approval.
Status: Not Approved. -
completeIt
Complete Document.
Status is set by document action method.- Specified by:
completeIt
in interfaceDocAction
- 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. -
closeIt
public boolean closeIt()Close Document.
Status: Closed. -
reverseCorrectIt
public boolean reverseCorrectIt()Reverse Correct Document.
Status: Reversed.- Specified by:
reverseCorrectIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
-
reverseAccrualIt
public boolean reverseAccrualIt()Reverse Accrual Document.
Status: Reversed.- Specified by:
reverseAccrualIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
-
reActivateIt
public boolean reActivateIt()Re-activate Document.
Status: In Progress.- Specified by:
reActivateIt
in interfaceDocAction
- Returns:
- true if success
- See Also:
-
setStatus
Set Document Status to new Status- Parameters:
newStatus
- new status
-
getActionOptions
Get available Document Actions based on current Document Status.- Returns:
- array of actions
-
isValidAction
Is The Action Valid based on current document status.- Parameters:
action
- action- Returns:
- true if valid
-
getProcessMsg
Get Process Message- Specified by:
getProcessMsg
in interfaceDocAction
- Returns:
- clear text error message
-
setProcessMsg
Set Process Message- Parameters:
msg
- clear text error message
-
getSummary
Not applicable, throw exception- Specified by:
getSummary
in interfaceDocAction
- Returns:
- Summary of Document
-
getDocumentNo
Not applicable, throw exception- Specified by:
getDocumentNo
in interfaceDocAction
- Returns:
- Document No
-
getDocumentInfo
Not applicable, throw exception- Specified by:
getDocumentInfo
in interfaceDocAction
- Returns:
- Type and Document No
-
getDoc_User_ID
public int getDoc_User_ID()Not applicable, throw exception- Specified by:
getDoc_User_ID
in interfaceDocAction
- Returns:
- AD_User_ID
-
getC_Currency_ID
public int getC_Currency_ID()Not applicable, throw exception- Specified by:
getC_Currency_ID
in interfaceDocAction
- Returns:
- C_Currency_ID
-
getApprovalAmt
Not applicable, throw exception- Specified by:
getApprovalAmt
in interfaceDocAction
- Returns:
- amount
-
getAD_Client_ID
public int getAD_Client_ID()Not applicable, throw exception- Specified by:
getAD_Client_ID
in interfaceDocAction
- Returns:
- AD_Client_ID
-
getAD_Org_ID
public int getAD_Org_ID()Not applicable, throw exception- Specified by:
getAD_Org_ID
in interfaceDocAction
- Returns:
- AD_Org_ID
-
getDocAction
Get Doc Action- Specified by:
getDocAction
in interfaceDocAction
- Returns:
- Document Action
-
save
public boolean save()Not applicable, throw exception -
saveEx
Not applicable, throw exception- Specified by:
saveEx
in interfaceDocAction
- Throws:
AdempiereException
- if save fail- See Also:
-
getCtx
Get Context -
get_ID
public int get_ID()Get ID of record -
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
Get Logger- Specified by:
get_Logger
in interfaceDocAction
- Returns:
- logger
-
get_TrxName
Get Transaction- Specified by:
get_TrxName
in interfaceDocAction
- Returns:
- trx name
-
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:
- End index of valid options[] (exclusive)
-
readReferenceList
public static void readReferenceList(ArrayList<String> v_value, ArrayList<String> v_name, ArrayList<String> v_description) Fill lists 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:
- End index of valid options[] (exclusive)
-
postImmediate
public static String postImmediate(Properties ctx, int AD_Client_ID, int AD_Table_ID, int Record_ID, boolean force, String trxName) Perform immediate posting of document- 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
Process document action. 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 lists with DocAction Ref_List(131) values- Parameters:
v_value
-v_name
-v_description
-
-