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,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,CreateTable,CreateTableIndex,CreateWindowFromTable,DatabaseColumnDrop,DatabaseConstraintDrop,DatabaseElementColumnRename,DatabaseTableColumnRename,DatabaseTableDrop,DatabaseTableRename,DatabaseViewDrop,DatabaseViewValidate,DepositBatchClose,DiscountSchemaReSeq,DistributionCreate,DistributionRun,DistributionVerify,DocTypeCounterValidate,DocumentTypeVerify,DunningPrint,DunningPrint,DunningRunCreate,EMailTest,EntityTypeRegister,ExpenseAPInvoice,ExpenseSOrder,ExpenseTypesFromAccounts,Export,FactAcctReset,FactAcctSummary,FactReconcile,FactReconciliation,Fill1099Extract,FinReport,FinStatement,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,OrderLineCreateProduction,OrderLineCreateShipment,OrderOpen,OrderPayScheduleValidate,OrderPOCreate,OrderRePrice,OrgOwnership,PackageCreate,PackInFolder,PackInProcess,PackOutProcess,PackRollProcess,PaymentOnline,PaymentTermValidate,PaySelectionCreateCheck,PaySelectionCreateFrom,PeriodControlStatus,PeriodStatus,PosKeyGenerate,PrepareMigrationScripts,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,TransactionXRef,TranslationDocSync,TranslationImpExp,TreeMaintenance,TrialBalance,UniversalSubstitution,UpdateRoleMenu,UserPassword,UUIDGenerator,ValidateAddressProcess,ValidateTaxProviderConnection,VerifyLanguageConfiguration,VoidOnlineAuthorizationPaymentTransaction,VoidShipmentProcess,WFActivityManage,WFProcessManage,WindowCopy,WorkflowMoveToClient,WorkflowValidate,YearCreatePeriods
public abstract class SvrProcess extends Object implements ProcessCall
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
Fields Modifier and Type Field Description protected CLoggerlogLoggerprotected static StringMSG_InvalidArgumentsprotected static StringMSG_SaveErrorRowNotFoundCommon Error Messagestatic StringPROCESS_INFO_CTX_KEYstatic StringPROCESS_UI_CTX_KEYprotected IProcessUIprocessUI
-
Constructor Summary
Constructors Constructor Description SvrProcess()Server Process.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddBufferLog(int id, Timestamp date, BigDecimal number, String msg, int tableId, int recordId)Add log to buffer, only process total success, flush buffervoidaddLog(int id, Timestamp date, BigDecimal number, String msg)Add Log EntryvoidaddLog(int id, Timestamp date, BigDecimal number, String msg, int tableId, int recordId)Add Log Entry with table namevoidaddLog(String msg)Add Logprotected voidcommit()Deprecated.suggested to use commitEx insteadprotected voidcommitEx()Commit and throw exception if errorprotected abstract StringdoIt()Perform process.ObjectdoIt(String className, String methodName, Object[] args)Execute functionStringget_TrxName()Return the main transaction of the current process.protected intgetAD_Client_ID()Get AD_User_IDprotected intgetAD_PInstance_ID()Get Process Instanceprotected intgetAD_User_ID()Get AD_User_IDPropertiesgetCtx()Get Propertiesprotected StringgetName()Get Name/Titleprotected ProcessInfoParameter[]getParameter()Get ParameterProcessInfogetProcessInfo()Get Process Infoprotected intgetRecord_ID()Get Record_IDprotected List<Integer>getRecord_IDs()Get Record_IDsprotected intgetTable_ID()Get Table_IDprotected booleanisLocked()Is an object Locked?protected booleanlockObject(PO po)Lock Object.protected voidpostProcess(boolean success)Post process actions (outside trx).protected abstract voidprepare()Prepare - e.g., get Parameters.protected voidrollback()RollbackvoidsetProcessUI(IProcessUI monitor)booleanstartProcess(Properties ctx, ProcessInfo pi, Trx trx)Start the process.protected voidstatusUpdate(String message)publish status update messageprotected booleanunlockObject()Unlock Object.
-
-
-
Field Detail
-
PROCESS_INFO_CTX_KEY
public static final String PROCESS_INFO_CTX_KEY
- See Also:
- Constant Field Values
-
PROCESS_UI_CTX_KEY
public static final String PROCESS_UI_CTX_KEY
- See Also:
- Constant Field Values
-
log
protected CLogger log
Logger
-
processUI
protected IProcessUI processUI
-
MSG_SaveErrorRowNotFound
protected static String MSG_SaveErrorRowNotFound
Common Error Message
-
MSG_InvalidArguments
protected static String MSG_InvalidArguments
-
-
Method Detail
-
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
public final boolean startProcess(Properties ctx, ProcessInfo pi, Trx trx)
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:
startProcessin interfaceProcessCall- Parameters:
ctx- Contextpi- Process Infotrx- transaction- Returns:
- true if the next process should be performed
- See Also:
ProcessCall.startProcess(Properties, ProcessInfo, Trx)
-
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
protected abstract String doIt() throws Exception
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
protected void commitEx() throws SQLExceptionCommit and throw exception if error- Throws:
SQLException- on commit error
-
rollback
protected void rollback()
Rollback
-
lockObject
protected boolean lockObject(PO po)
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
public ProcessInfo getProcessInfo()
Get Process Info- Returns:
- Process Info
-
getCtx
public Properties getCtx()
Get Properties- Returns:
- Properties
-
getName
protected String 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
-
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
protected ProcessInfoParameter[] 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
public void addLog(int id, Timestamp date, BigDecimal number, String msg)Add Log Entry- Parameters:
date- date or nullid- record id or 0number- number or nullmsg- message or null
-
addLog
public void addLog(String msg)
Add Log- Parameters:
msg- message
-
doIt
public Object doIt(String className, String methodName, Object[] args)
Execute function- Parameters:
className- classmethodName- methodargs- arguments- Returns:
- result
-
get_TrxName
public String get_TrxName()
Return the main transaction of the current process.- Returns:
- the transaction name
-
setProcessUI
public void setProcessUI(IProcessUI monitor)
- Specified by:
setProcessUIin interfaceProcessCall
-
statusUpdate
protected void statusUpdate(String message)
publish status update message- Parameters:
message-
-
-