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
FieldsModifier and TypeFieldDescriptionstatic final StringWhen 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
ConstructorsConstructorDescriptionDoc Engine (Drafted)DocumentEngine(DocAction po, String docStatus) Doc Engine -
Method Summary
Modifier and TypeMethodDescriptionbooleanApprove Document.
Status: Approved.static booleancanReactivateThisDocType(int docTypeID) static intcheckActionAccess(int clientId, int roleId, int docTypeId, String[] options, int maxIndex) Checks the access rights of the given role/client for the given document actions.booleancloseIt()Close Document.
Status: Closed.Complete Document.
Status is set by document action method.CreatePDFintget_ID()Get ID of recordGet LoggerintGet AD_Table_IDGet TransactionString[]Get available Document Actions based on current Document Status.intNot applicable, throw exceptionintNot applicable, throw exceptionNot applicable, throw exceptionintNot applicable, throw exceptiongetCtx()Get ContextintNot applicable, throw exceptionGet Doc ActionGet Doc StatusNot applicable, throw exceptionNot applicable, throw exceptionGet Process MessageNot applicable, throw exceptionstatic intgetValidActions(String docStatus, Object processing, String orderType, String isSOTrx, int AD_Table_ID, String[] docAction, String[] options, boolean periodOpen, boolean isBackDateTrxAllowed, PO po) Get list of valid document action into the options array parameter.
Set default document action into the docAction array parameter.static intgetValidActions(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.booleanInvalidate Document.
Status: Invalid.booleanIs current Document Status is ApprovedbooleanisClosed()Is current Document Status is ClosedbooleanIs current Document Status is CompletedbooleanIs current Document Status is DraftedbooleanIs current Document Status is In ProgressbooleanIs current Document Status is InvalidbooleanIs current Document Status is Not ApprovedbooleanIs current Document Status is ReversedbooleanIs current Document Status is UnknownbooleanisValidAction(String action) Is The Action Valid based on current document status.booleanisVoided()Is current Document Status is VoidedbooleanIs current Document Status is Waiting Payment or Confirmationstatic StringpostImmediate(Properties ctx, int AD_Client_ID, int AD_Table_ID, int Record_ID, boolean force, String trxName) Perform immediate posting of documentbooleanpostIt()Post Document.
Does not change status.Prepare Document.
Status is set by document action method.booleanProcess document action - internal API, do not call directly.
Calls the individual actions which call the document action.booleanProcess document action.
Checks if user (document) action is valid and then process action.
Calls the individual actions which call the document action.static booleanProcess document action.booleanRe-activate Document.
Status: In Progress.static voidreadReferenceList(ArrayList<String> v_value, ArrayList<String> v_name, ArrayList<String> v_description) Fill lists with DocAction Ref_List(135) valuesstatic voidreadStatusReferenceList(ArrayList<String> v_value, ArrayList<String> v_name, ArrayList<String> v_description) Fill lists with DocAction Ref_List(131) valuesbooleanrejectIt()Reject Approval.
Status: Not Approved.booleanReverse Accrual Document.
Status: Reversed.booleanReverse Correct Document.
Status: Reversed.booleansave()Not applicable, throw exceptionvoidsaveEx()Not applicable, throw exceptionvoidsetDocStatus(String ignored) Set Doc Status - IgnoredvoidsetProcessMsg(String msg) Set Process Messageprotected voidSet Document Status to new StatusbooleanunlockIt()Unlock Document.
Status: Drafted.booleanvoidIt()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:
getDocStatusin interfaceDocAction- Returns:
- document status
-
setDocStatus
Set Doc Status - Ignored- Specified by:
setDocStatusin 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:
invalidateItin 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:
completeItin 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:
reverseCorrectItin interfaceDocAction- Returns:
- true if success
- See Also:
-
reverseAccrualIt
public boolean reverseAccrualIt()Reverse Accrual Document.
Status: Reversed.- Specified by:
reverseAccrualItin interfaceDocAction- Returns:
- true if success
- See Also:
-
reActivateIt
public boolean reActivateIt()Re-activate Document.
Status: In Progress.- Specified by:
reActivateItin 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:
getProcessMsgin interfaceDocAction- Returns:
- clear text error message
-
setProcessMsg
Set Process Message- Parameters:
msg- clear text error message
-
getSummary
Not applicable, throw exception- Specified by:
getSummaryin interfaceDocAction- Returns:
- Summary of Document
-
getDocumentNo
Not applicable, throw exception- Specified by:
getDocumentNoin interfaceDocAction- Returns:
- Document No
-
getDocumentInfo
Not applicable, throw exception- Specified by:
getDocumentInfoin interfaceDocAction- Returns:
- Type and Document No
-
getDoc_User_ID
public int getDoc_User_ID()Not applicable, throw exception- Specified by:
getDoc_User_IDin interfaceDocAction- Returns:
- AD_User_ID
-
getC_Currency_ID
public int getC_Currency_ID()Not applicable, throw exception- Specified by:
getC_Currency_IDin interfaceDocAction- Returns:
- C_Currency_ID
-
getApprovalAmt
Not applicable, throw exception- Specified by:
getApprovalAmtin interfaceDocAction- Returns:
- amount
-
getAD_Client_ID
public int getAD_Client_ID()Not applicable, throw exception- Specified by:
getAD_Client_IDin interfaceDocAction- Returns:
- AD_Client_ID
-
getAD_Org_ID
public int getAD_Org_ID()Not applicable, throw exception- Specified by:
getAD_Org_IDin interfaceDocAction- Returns:
- AD_Org_ID
-
getDocAction
Get Doc Action- Specified by:
getDocActionin interfaceDocAction- Returns:
- Document Action
-
save
public boolean save()Not applicable, throw exception -
saveEx
Not applicable, throw exception- Specified by:
saveExin 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_IDin interfaceDocAction- Returns:
- AD_Table_ID
-
get_Logger
Get Logger- Specified by:
get_Loggerin interfaceDocAction- Returns:
- logger
-
get_TrxName
Get Transaction- Specified by:
get_TrxNamein 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 listpo-- Returns:
- End index of valid options[] (exclusive)
-
getValidActions
public static int getValidActions(String docStatus, Object processing, String orderType, String isSOTrx, int AD_Table_ID, String[] docAction, String[] options, boolean periodOpen, boolean isBackDateTrxAllowed, 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 listisBackDateTrxAllowed- - flag indicating if back-date transaction is allowedpo-- 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-
-
canReactivateThisDocType
public static boolean canReactivateThisDocType(int docTypeID)
-