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

public abstract class SvrProcess extends Object implements ProcessCall
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 Details

      • PROCESS_INFO_CTX_KEY

        public static final String PROCESS_INFO_CTX_KEY
        Key to store process info as environment context attribute
        See Also:
      • PROCESS_UI_CTX_KEY

        public static final String PROCESS_UI_CTX_KEY
        Key to store process UI as environment context attribute
        See Also:
      • 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
    • 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

        public final boolean startProcess(Properties ctx, ProcessInfo pi, Trx trx)
        Start the process.
        Calls the method process.
        Specified by:
        startProcess in interface ProcessCall
        Parameters:
        ctx - Context
        pi - Process Info
        trx - 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

        protected abstract String doIt() throws Exception
        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 instead
        Commit
      • commitEx

        protected void commitEx() throws SQLException
        Commit and throw exception if error
        Throws:
        SQLException - on commit error
      • rollback

        protected void rollback()
        Rollback transaction
      • lockObject

        protected boolean lockObject(PO po)
        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

        public ProcessInfo getProcessInfo()
        Get Process Info
        Returns:
        Process Info
      • getCtx

        public Properties getCtx()
        Get Context
        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 AD_Table_ID
        Returns:
        AD_Table_ID
      • getRecord_ID

        protected int getRecord_ID()
        Get Record_ID
        Returns:
        Record_ID
      • getRecord_IDs

        protected List<Integer> getRecord_IDs()
        Get Record_IDs
        Returns:
        Record_IDs
      • getRecord_UU

        protected String getRecord_UU()
        Get Record_UU
        Returns:
        Record_UU
      • getRecord_UUs

        protected List<String> 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

        protected ProcessInfoParameter[] 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 id
        date -
        number -
        msg -
        tableId -
        recordId -
      • addLog

        public void addLog(int id, Timestamp date, BigDecimal number, String msg)
        Add Log Entry
        Parameters:
        id - ID parameter, usually same as record id
        date - date or null
        number - number or null
        msg - message or null
      • addLog

        public void addLog(String msg)
        Add Log
        Parameters:
        msg - message
      • saveProgress

        public String saveProgress(int id, Timestamp date, BigDecimal number, String msg)
        Save Progress Log Entry to DB immediately
        Parameters:
        date - date or null
        id - record id or 0
        number - number or null
        msg - message or null
        Returns:
        String AD_PInstance_Log_UU
      • saveStatus

        public String saveStatus(int id, Timestamp date, BigDecimal number, String msg)
        Save Status Log Entry to DB immediately
        Parameters:
        date - date or null
        id - record id or 0
        number - number or null
        msg - 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_UU
        id - record id or 0
        date - date or null
        number - number or null
        msg - message or null
      • doIt

        public Object doIt(String className, String methodName, Object[] args)
        Call class method using Java reflection
        Parameters:
        className - class
        methodName - method
        args - arguments
        Returns:
        result
      • get_TrxName

        public String get_TrxName()
        Get the main transaction of the current process.
        Returns:
        the transaction name
      • setProcessUI

        public void setProcessUI(IProcessUI monitor)
        Description copied from interface: ProcessCall
        Set process UI interface
        Specified by:
        setProcessUI in interface ProcessCall
      • statusUpdate

        protected void statusUpdate(String message)
        Publish status update message to client
        Parameters:
        message -