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
Server Process Template
- 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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBufferLog
(int id, Timestamp date, BigDecimal number, String msg, int tableId, int recordId) Add log to buffer, only process total success, flush buffervoid
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()
Perform process.Execute functionReturn the main transaction of the current process.protected int
Get AD_User_IDprotected int
Get Process Instanceprotected int
Get AD_User_IDgetCtx()
Get Propertiesprotected String
getName()
Get Name/Titleprotected ProcessInfoParameter[]
Get ParameterGet Process Infoprotected int
Get Record_IDGet Record_IDsprotected String
Get Record_UUGet Record_UUsprotected int
Get Table_IDprotected boolean
isLocked()
Is an object Locked?protected boolean
lockObject
(PO po) Lock Object.protected void
postProcess
(boolean success) Post process actions (outside trx).protected abstract void
prepare()
Prepare - e.g., get Parameters.protected void
rollback()
RollbacksaveProgress
(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) final boolean
startProcess
(Properties ctx, ProcessInfo pi, Trx trx) Start the process.protected void
statusUpdate
(String message) publish status update messageprotected boolean
Unlock Object.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
- See Also:
-
PROCESS_UI_CTX_KEY
- 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, only process total success, flush buffer- Parameters:
id
-date
-number
-msg
-tableId
-recordId
-
-
startProcess
Start the process. Calls the abstract methodsprocess
. It should only return false, if the function could not be performed as this causes the process to abort.- Specified by:
startProcess
in interfaceProcessCall
- Parameters:
ctx
- Contextpi
- Process Infotrx
- transaction- Returns:
- true if the next process should be performed
- See Also:
-
prepare
protected abstract void prepare()Prepare - 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); }
-
doIt
Perform process.- 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 when the process complete the work (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 -
lockObject
Lock Object. 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 Object. 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 Properties- 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 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_User_ID- Returns:
- AD_User_ID of Process owner
-
getParameter
Get Parameter- Returns:
- parameter
-
addLog
public void addLog(int id, Timestamp date, BigDecimal number, String msg, int tableId, int recordId) Add Log Entry with table name -
addLog
Add Log Entry- Parameters:
date
- date or nullid
- record id or 0number
- 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
Execute function- Parameters:
className
- classmethodName
- methodargs
- arguments- Returns:
- result
-
get_TrxName
Return the main transaction of the current process.- Returns:
- the transaction name
-
setProcessUI
- Specified by:
setProcessUI
in interfaceProcessCall
-
statusUpdate
publish status update message- Parameters:
message
-
-