Package org.compiere.process
Class SvrProcess
java.lang.Object
org.compiere.process.SvrProcess
- All Implemented Interfaces:
ProcessCall
- Direct Known Subclasses:
AcctSchemaCopyAcct
,AcctSchemaDefaultCopy
,AD_PrintPaper_Default
,AddAuthorizationProcess
,Aging
,AllocationAuto
,AllocationReset
,ApplyMigrationScripts
,ASPGenerateFields
,ASPGenerateLevel
,AssetDelivery
,BankRegister
,BankStatementMatcher
,BankStatementPayment
,BOMFlagValidate
,BOMValidate
,BOMVerify
,BPartnerOrgLink
,BPartnerOrgUnLink
,BPartnerValidate
,BPGroupAcctCopy
,CacheReset
,CacheReset
,ChangeBaseLanguage
,ChangeLogProcess
,ChangePartitionStatus
,CleanOrphanCascade
,ClientAcctProcessor
,ColumnEncryption
,ColumnSync
,CommissionAPInvoice
,CommissionCalc
,CommissionCopy
,ConvertLead
,CopyColumnsFromTable
,CopyComponentsFromView
,CopyFromBankStmt
,CopyFromInvoice
,CopyFromJournal
,CopyFromJournalDoc
,CopyFromOrder
,CopyFromPackOut
,CopyFromProject
,CopyImportFormat
,CopyInfoWindowColumns
,CopyOrder
,CopyProduct
,CopyReportProcess
,CopyRole
,CostAdjustmentLineRefreshCost
,CostCreate
,CostUpdate
,CreateForeignKey
,CreateFromInOut
,CreateFromInvoice
,CreateFromRMA
,CreatePartition
,CreateTable
,CreateTableIndex
,CreateWindowFromTable
,DatabaseColumnDrop
,DatabaseConstraintDrop
,DatabaseElementColumnRename
,DatabaseTableColumnRename
,DatabaseTableDrop
,DatabaseTableRename
,DatabaseViewDrop
,DatabaseViewValidate
,DeleteTraceLogs
,DepositBatchClose
,DiscardThisVerifyMigration
,DiscountSchemaReSeq
,DistributionCreate
,DistributionRun
,DistributionVerify
,DocTypeCounterValidate
,DocumentTypeVerify
,DrillRuleValidate
,DunningPrint
,DunningPrint
,DunningRunCreate
,EMailTest
,EntityTypeRegister
,ExpenseAPInvoice
,ExpenseSOrder
,ExpenseTypesFromAccounts
,Export
,FactAcctReset
,FactAcctSummary
,FactReconcile
,FactReconciliation
,Fill1099Extract
,FinReport
,FinStatement
,GenerateModel
,HashPasswords
,HouseKeeping
,ImmediateBankTransfer
,ImportAccount
,ImportBankStatement
,ImportBPartner
,ImportConversionRate
,ImportCSVProcess
,ImportDelete
,ImportGLJournal
,ImportInOutConfirm
,ImportInventory
,ImportInvoice
,ImportOrder
,ImportPayment
,ImportPriceList
,ImportProduct
,ImportReportLine
,IndentedBOM
,InfoWindowValidate
,InitialClientSetup
,InOutCreateConfirm
,InOutCreateInvoice
,InOutGenerate
,InOutGenerateRMA
,InventoryCountCreate
,InventoryCountUpdate
,InventoryValue
,InvoiceBatchProcess
,InvoiceCreateCreditMemo
,InvoiceCreateInOut
,InvoiceGenerate
,InvoiceGenerateRMA
,InvoiceNGL
,InvoicePayScheduleValidate
,InvoicePrint
,InvoicePrint
,InvoiceWriteOff
,IssueReport
,KillAllSession
,KillCurrentSession
,LandedCostDistribute
,LanguageMaintenance
,LoadBankStatement
,M_PriceList_Create
,M_Production_Run
,MaintainSupportRoles
,MatchInvDelete
,MatchInvReverse
,MatchPODelete
,MatchPOReverse
,MFACompleteRegistration
,MFARegister
,MFARevokeDevice
,MFAUnregister
,MigraID
,MigrateStorageProvider
,ModelExporter
,ModelImporter
,MoveClient
,MPrintFormatProcess
,NoteDelete
,OnlineShipmentProcess
,OrderBatchProcess
,OrderCreateProduction
,OrderLineCreateProduction
,OrderLineCreateShipment
,OrderOpen
,OrderPayScheduleValidate
,OrderPOCreate
,OrderRePrice
,OrgOwnership
,PackageCreate
,PackInFolder
,PackInProcess
,PackOutProcess
,PackRollProcess
,PaymentOnline
,PaymentTermValidate
,PaySelectionCheckReverse
,PaySelectionCreateCheck
,PaySelectionCreateFrom
,PeriodControlStatus
,PeriodStatus
,PosKeyGenerate
,PrepareMigrationScripts
,PrintFormatItemSync
,PrintShippingLabel
,ProductCategoryAcctCopy
,ProductionCreate
,ProductionProcess
,ProductUOMConvert
,ProjectClose
,ProjectGenOrder
,ProjectGenPO
,ProjectGenProduction
,ProjectIssue
,ProjectLinePricing
,ProjectPhaseGenOrder
,ProjectSetType
,RateInquiryProcess
,RecreateStorageReservation
,Recurring
,RecurringRun
,RegisterSystem
,ReplenishReport
,ReplenishReportProduction
,ReportColumnSet_Copy
,ReportLineSet_Copy
,RequestEMailProcessor
,RequestInvoice
,RequestReOpen
,RequisitionPOCreate
,ResetLockedAccount
,RevenueRecognition
,RfQClose
,RfQCopyLines
,RfQCreate
,RfQCreatePO
,RfQCreateSO
,RfQResponseCComplete
,RfQResponseInvite
,RfQResponseRank
,RMACreateOrder
,RoleAccessUpdate
,RollUpCosts
,SalesOrderRateInquiryProcess
,SendMailText
,SequenceCheck
,ShipperCopyFrom
,ShipperCreateFrom
,SLAGoalProcess
,SLAMeasureProcess
,StorageCleanup
,SynchronizeTerminology
,SystemValidate
,TabCopy
,TabCreateFields
,TableCreateColumns
,TableIndexDrop
,TableIndexValidate
,TaxDeclarationCreate
,TestUUChangeActive
,TransactionXRef
,TranslationDocSync
,TranslationImpExp
,TreeMaintenance
,TrialBalance
,UniversalSubstitution
,UpdateRoleMenu
,UserPassword
,UUIDGenerator
,ValidateAddressProcess
,ValidateTaxProviderConnection
,VerifyLanguageConfiguration
,VerifyMigration
,VoidOnlineAuthorizationPaymentTransaction
,VoidShipmentProcess
,WFActivityManage
,WFProcessManage
,WindowCopy
,WorkflowMoveToClient
,WorkflowValidate
,YearCreatePeriods
Abstract base class for Server Process.
- Version:
- $Id: SvrProcess.java,v 1.4 2006/08/10 01:00:44 jjanke Exp $
- Author:
- Jorg Janke, Teo Sarca, SC ARHIPAC SERVICE SRL
- FR [ 1646891 ] SvrProcess - post process support
- BF [ 1877935 ] SvrProcess.process should catch all throwables
- FR [ 1877937 ] SvrProcess: added commitEx method
- BF [ 1878743 ] SvrProcess.getAD_User_ID
- BF [ 1935093 ] SvrProcess.unlock() is setting invalid result
- FR [ 2788006 ] SvrProcess: change access to some methods https://sourceforge.net/p/adempiere/feature-requests/709/
-
Field Summary
Modifier and TypeFieldDescriptionprotected CLogger
Loggerprotected static String
protected static String
Common Error Messagestatic final String
Key to store process info as environment context attributestatic final String
Key to store process UI as environment context attributeprotected IProcessUI
-
Constructor Summary
ConstructorDescriptionServer Process.
Note that the class is initiated by startProcess. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBufferLog
(int id, Timestamp date, BigDecimal number, String msg, int tableId, int recordId) Add log to buffer, buffer is flush after commit of process transactionvoid
addLog
(int id, Timestamp date, BigDecimal number, String msg) Add Log Entryvoid
addLog
(int id, Timestamp date, BigDecimal number, String msg, int tableId, int recordId) Add Log Entry with table namevoid
Add Logprotected void
commit()
Deprecated.suggested to use commitEx insteadprotected void
commitEx()
Commit and throw exception if errorprotected abstract String
doIt()
Process implementation class will override this method to execution process actions.Call class method using Java reflectionGet the main transaction of the current process.protected int
Get AD_Client_ID of process infoprotected int
Get Process Instanceprotected int
Get AD_User_IDgetCtx()
Get Contextprotected String
getName()
Get Name/Titleprotected ProcessInfoParameter[]
Get ParametersGet Process Infoprotected int
Get Record_IDGet Record_IDsprotected String
Get Record_UUGet Record_UUsprotected int
Get AD_Table_IDprotected boolean
isLocked()
Is an object Locked?protected boolean
lockObject
(PO po) Lock PO.
Needs to be explicitly called.protected void
postProcess
(boolean success) Post process actions (outside trx).
Please note that at this point the transaction is committed so you can't rollback.
This method is useful if you need to do some custom work after the process committed the changes (e.g. open some windows).protected abstract void
prepare()
Prepare process - e.g., get Parameters.protected void
rollback()
Rollback transactionsaveProgress
(int id, Timestamp date, BigDecimal number, String msg) Save Progress Log Entry to DB immediatelysaveStatus
(int id, Timestamp date, BigDecimal number, String msg) Save Status Log Entry to DB immediatelyvoid
setProcessUI
(IProcessUI monitor) Set process UI interfacefinal boolean
startProcess
(Properties ctx, ProcessInfo pi, Trx trx) Start the process.
Calls the methodprocess
.protected void
statusUpdate
(String message) Publish status update message to clientprotected boolean
Unlock PO.
Is automatically called at the end of process.void
updateProgress
(String pInstanceLogUU, int id, Timestamp date, BigDecimal number, String msg) Update Progress Log Entry with the specified AD_PInstance_Log_UU, update if exists
-
Field Details
-
PROCESS_INFO_CTX_KEY
Key to store process info as environment context attribute- See Also:
-
PROCESS_UI_CTX_KEY
Key to store process UI as environment context attribute- See Also:
-
log
Logger -
processUI
-
MSG_SaveErrorRowNotFound
Common Error Message -
MSG_InvalidArguments
-
-
Constructor Details
-
SvrProcess
public SvrProcess()Server Process.
Note that the class is initiated by startProcess.
-
-
Method Details
-
addBufferLog
public void addBufferLog(int id, Timestamp date, BigDecimal number, String msg, int tableId, int recordId) Add log to buffer, buffer is flush after commit of process transaction- Parameters:
id
-date
-number
-msg
-tableId
-recordId
-
-
startProcess
Start the process.
Calls the methodprocess
.- Specified by:
startProcess
in interfaceProcessCall
- Parameters:
ctx
- Contextpi
- Process Infotrx
- transaction- Returns:
- true if success
- See Also:
-
prepare
protected abstract void prepare()Prepare process - e.g., get Parameters.ProcessInfoParameter[] para = getParameter(); for (int i = 0; i < para.length; i++) { String name = para[i].getParameterName(); if (para[i].getParameter() == null) ; else if (name.equals("A_Asset_Group_ID")) p_A_Asset_Group_ID = para[i].getParameterAsInt(); else if (name.equals("GuaranteeDate")) p_GuaranteeDate = (Timestamp)para[i].getParameter(); else if (name.equals("AttachAsset")) p_AttachAsset = "Y".equals(para[i].getParameter()); else log.log(Level.SEVERE, "Unknown Parameter: " + name); }
- See Also:
-
doIt
Process implementation class will override this method to execution process actions.- Returns:
- Message (variables are parsed)
- Throws:
Exception
- if not successful e.g. throw new AdempiereUserError ("@FillMandatory@ @C_BankAccount_ID@");
-
postProcess
protected void postProcess(boolean success) Post process actions (outside trx).
Please note that at this point the transaction is committed so you can't rollback.
This method is useful if you need to do some custom work after the process committed the changes (e.g. open some windows).- Parameters:
success
- true if the process was success- Since:
- 3.1.4
-
commit
protected void commit()Deprecated.suggested to use commitEx insteadCommit -
commitEx
Commit and throw exception if error- Throws:
SQLException
- on commit error
-
rollback
protected void rollback()Rollback transaction -
lockObject
Lock PO.
Needs to be explicitly called. Unlock is automatic.- Parameters:
po
- object- Returns:
- true if locked
-
isLocked
protected boolean isLocked()Is an object Locked?- Returns:
- true if object locked
-
unlockObject
protected boolean unlockObject()Unlock PO.
Is automatically called at the end of process.- Returns:
- true if unlocked or if there was nothing to unlock
-
getProcessInfo
Get Process Info- Returns:
- Process Info
-
getCtx
Get Context- Returns:
- Properties
-
getName
Get Name/Title- Returns:
- Name
-
getAD_PInstance_ID
protected int getAD_PInstance_ID()Get Process Instance- Returns:
- Process Instance
-
getTable_ID
protected int getTable_ID()Get AD_Table_ID- Returns:
- AD_Table_ID
-
getRecord_ID
protected int getRecord_ID()Get Record_ID- Returns:
- Record_ID
-
getRecord_IDs
Get Record_IDs- Returns:
- Record_IDs
-
getRecord_UU
Get Record_UU- Returns:
- Record_UU
-
getRecord_UUs
Get Record_UUs- Returns:
- Record_UUs
-
getAD_User_ID
protected int getAD_User_ID()Get AD_User_ID- Returns:
- AD_User_ID of Process owner or -1 if not found
-
getAD_Client_ID
protected int getAD_Client_ID()Get AD_Client_ID of process info- Returns:
- AD_Client_ID
-
getParameter
Get Parameters- Returns:
- parameters
-
addLog
public void addLog(int id, Timestamp date, BigDecimal number, String msg, int tableId, int recordId) Add Log Entry with table name- Parameters:
id
- ID parameter, usually same as record iddate
-number
-msg
-tableId
-recordId
-
-
addLog
Add Log Entry- Parameters:
id
- ID parameter, usually same as record iddate
- date or nullnumber
- number or nullmsg
- message or null
-
addLog
Add Log- Parameters:
msg
- message
-
saveProgress
Save Progress Log Entry to DB immediately- Parameters:
date
- date or nullid
- record id or 0number
- number or nullmsg
- message or null- Returns:
- String AD_PInstance_Log_UU
-
saveStatus
Save Status Log Entry to DB immediately- Parameters:
date
- date or nullid
- record id or 0number
- number or nullmsg
- message or null- Returns:
- String AD_PInstance_Log_UU
-
updateProgress
public void updateProgress(String pInstanceLogUU, int id, Timestamp date, BigDecimal number, String msg) Update Progress Log Entry with the specified AD_PInstance_Log_UU, update if exists- Parameters:
pInstanceLogUU
- AD_PInstance_Log_UUid
- record id or 0date
- date or nullnumber
- number or nullmsg
- message or null
-
doIt
Call class method using Java reflection- Parameters:
className
- classmethodName
- methodargs
- arguments- Returns:
- result
-
get_TrxName
Get the main transaction of the current process.- Returns:
- the transaction name
-
setProcessUI
Description copied from interface:ProcessCall
Set process UI interface- Specified by:
setProcessUI
in interfaceProcessCall
-
statusUpdate
Publish status update message to client- Parameters:
message
-
-