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.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.Complete Document.CreatePDFint
get_ID()
Get ID of recordGet Loggerint
Get AD_Table_IDGet TransactionString[]
Get Action Options based on current Statusint
Get Document Clientint
Get Document OrganizationGet Document Approval Amountint
Get Document CurrencygetCtx()
Get Contextint
Get Document OwnerGet Doc ActionGet Doc StatusGet Document InfoGet Document NoGet Process MessageGet 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
Invalidate Document.boolean
Document is Approvedboolean
isClosed()
Document is Closedboolean
Document is Completedboolean
Document is Draftedboolean
Document is In Progressboolean
Document is Invalidboolean
Document is Not Approvedboolean
Document is Reversedboolean
Document Status is Unknownboolean
isValidAction
(String action) Is The Action Valid based on current stateboolean
isVoided()
Document is Voidedboolean
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 statusProcess Document.boolean
Process actual document - do not call directly.boolean
Process actual document.static boolean
Process document.boolean
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
Reverse Accrual Document.boolean
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 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()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
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
Process actual document - 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
Process Document. Status is set by process -
approveIt
public boolean approveIt()Approve Document. Status: Approved -
rejectIt
public boolean rejectIt()Reject Approval. Status: Not Approved -
completeIt
Complete Document. Status is set by process- 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:
-
getActionOptions
Get Action Options based on current Status- Returns:
- array of actions
-
isValidAction
Is The Action Valid based on current state- Parameters:
action
- action- Returns:
- true if valid
-
getProcessMsg
Get Process Message- Specified by:
getProcessMsg
in interfaceDocAction
- Returns:
- clear text error message
-
setProcessMsg
Get Process Message- Parameters:
msg
- clear text error message
-
getSummary
Get Summary- Specified by:
getSummary
in interfaceDocAction
- Returns:
- throw exception
-
getDocumentNo
Get Document No- Specified by:
getDocumentNo
in interfaceDocAction
- Returns:
- throw exception
-
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
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
Get Doc Action- Specified by:
getDocAction
in interfaceDocAction
- Returns:
- Document Action
-
save
public boolean save()Save Document -
saveEx
Save Document- Specified by:
saveEx
in interfaceDocAction
- Throws:
AdempiereException
- 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 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
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
-
-