Adempiere 3.5.2a

org.compiere.process
Class SvrProcess

java.lang.Object
  extended by org.compiere.process.SvrProcess
All Implemented Interfaces:
ProcessCall
Direct Known Subclasses:
AcctSchemaCopyAcct, AcctSchemaDefaultCopy, AD_PrintPaper_Default, Aging, AllocationAuto, AllocationReset, ApplyMigrationScripts, ASPGenerateFields, ASPGenerateLevel, AssetDelivery, AssetDisposed, AssetRevalEntry, AssetSplit, AssetTransfer, BankStatementMatcher, BankStatementPayment, BOMValidate, BPartnerOrgLink, BPartnerOrgUnLink, BPartnerValidate, BPGroupAcctCopy, BuildDepForecastFile, BuildDepWorkFile, CacheReset, CalculateLowLevel, ChangeLogProcess, ColumnEncryption, ColumnSync, CommissionAPInvoice, CommissionCalc, CommissionCopy, CompletePrintOrder, ComponentChange, CopyColumnsFromTable, CopyFromBOM, CopyFromInvoice, CopyFromJournal, CopyFromOrder, CopyFromProject, CopyImportFormat, CopyOrder, CopyPriceToStandard, CopyRole, CostCreate, CostUpdate, CreateCostElement, CreateDocType, CreateGLAsset, CreateInvoicedAsset, CreateProductPlanning, CRP, CRPSummary, CStageValidate, DiscountSchemaReSeq, DistributionCreate, DistributionRun, DistributionRunOrders, DistributionVerify, DocTypeCounterValidate, DocumentTypeVerify, DunningPrint, DunningRunCreate, EMailTest, EntityTypeRegister, ExpenseAPInvoice, ExpenseSOrder, Export, ExportFormatGenerator, FactAcctReset, FinReport, FinStatement, FixPaymentCashLine, HRAttributeEmployee, HRCreateConcept, HRCreatePeriods, ImportAccount, ImportAsset, ImportBankStatement, ImportBPartner, ImportConversionRate, ImportDelete, ImportFAJournal2, ImportGLJournal, ImportInOutConfirm, ImportInventory, ImportInvoice, ImportOrder, ImportPayment, ImportProduct, ImportReportLine, InfoWindowValidate, InOutCreateConfirm, InOutCreateInvoice, InOutGenerate, InOutGenerateRMA, InventoryCountCreate, InventoryCountUpdate, InventoryValue, InvoiceBatchProcess, InvoiceCalculateTax, InvoiceCreateInOut, InvoiceGenerate, InvoiceGenerateRMA, InvoiceNGL, InvoicePayScheduleValidate, InvoicePrint, InvoiceWriteOff, IssueReport, KIndexRerun, LandedCostDistribute, LanguageMaintenance, LoadBankStatement, LoadRoles, M_PriceList_Create, M_Product_BOM_Check, M_Product_CostingUpdate, M_Production_Run, MatchInvDelete, MatchPODelete, ModelExporter, ModelImporter, MovementGenerate, MPrintFormatProcess, MRP, MRPUpdate, NoteDelete, OrderBatchProcess, OrderOpen, OrderPOCreate, OrderRePrice, OrgOwnership, PackageCreate, PackIn, PackOut, PackRoll, PaymentOnline, PaymentTermValidate, PayrollViaEMail, PaySelectionCreateCheck, PaySelectionCreateFrom, PeriodControlStatus, PeriodStatus, PP_Product_BOM_Check, PrepareMigrationScripts, PrintBOM, ProductCategoryAcctCopy, ProductUOMConvert, ProjectClose, ProjectGenOrder, ProjectGenPO, ProjectIssue, ProjectLinePricing, ProjectPhaseGenOrder, ProjectSetType, Recurring, RegisterSystem, ReplenishReport, ReplicationLocal, ReplicationRemote, ReportColumnSet_Copy, ReportLineSet_Copy, RequestEMailProcessor, RequestInvoice, RequestReOpen, RequisitionPOCreate, RequisitionPOCreate, RfQClose, RfQCopyLines, RfQCreate, RfQCreatePO, RfQCreateSO, RfQResponseCComplete, RfQResponseInvite, RfQResponseRank, RMACreateOrder, RoleAccessUpdate, RollupBillOfMaterial, RollupWorkflow, SendMailText, SequenceCheck, SLAGoalProcess, SLAMeasureProcess, StorageCleanup, SynchronizeTerminology, SystemValidate, T_InventoryValue_Create, TabCopy, TabCreateFields, TableCreateColumns, TaxDeclarationCreate, TemplateValidate, TransactionXRef, TranslationDocSync, TreeMaintenance, TrialBalance, UpdateRoleMenu, UpdateSequenceNo, UserPassword, WebProjectDeploy, 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

  • Field Summary
    protected  CLogger log
              Logger
    protected static String MSG_InvalidArguments
               
    protected static String MSG_SaveErrorRowNotFound
              Common Error Message
     
    Constructor Summary
    SvrProcess()
              Server Process.
     
    Method Summary
     void addLog(int id, Timestamp date, BigDecimal number, String msg)
              Add Log Entry
     void addLog(String msg)
              Add Log
    protected  void commit()
              Commit
    protected  void commitEx()
              Commit and throw exception if error
    protected abstract  String doIt()
              Perform process.
     Object doIt(String className, String methodName, Object[] args)
              Execute function
    protected  String get_TrxName()
              Return the main transaction of the current process.
    protected  int getAD_Client_ID()
              Get AD_User_ID
    protected  int getAD_PInstance_ID()
              Get Process Instance
    protected  int getAD_User_ID()
              Get AD_User_ID
     Properties getCtx()
              Get Properties
    protected  String getName()
              Get Name/Title
    protected  ProcessInfoParameter[] getParameter()
              Get Parameter
     ProcessInfo getProcessInfo()
              Get Process Info
    protected  int getRecord_ID()
              Get Record_ID
    protected  int getTable_ID()
              Get Table_ID
    protected  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()
              Rollback
     boolean startProcess(Properties ctx, ProcessInfo pi, Trx trx)
              Start the process.
    protected  boolean unlockObject()
              Unlock Object.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    log

    protected CLogger log
    Logger


    MSG_SaveErrorRowNotFound

    protected static String MSG_SaveErrorRowNotFound
    Common Error Message


    MSG_InvalidArguments

    protected static String MSG_InvalidArguments
    Constructor Detail

    SvrProcess

    public SvrProcess()
    Server Process. Note that the class is initiated by startProcess.

    Method Detail

    startProcess

    public final boolean startProcess(Properties ctx,
                                      ProcessInfo pi,
                                      Trx trx)
    Start the process. Calls the abstract methods process. It should only return false, if the function could not be performed as this causes the process to abort.

    Specified by:
    startProcess in interface ProcessCall
    Parameters:
    ctx - Context
    pi - Process Info
    trx - 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()
    Commit


    commitEx

    protected void commitEx()
                     throws SQLException
    Commit 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)
    Add Log Entry

    Parameters:
    date - date or null
    id - record id or 0
    number - number or null
    msg - 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 - class
    methodName - method
    args - arguments
    Returns:
    result

    get_TrxName

    protected String get_TrxName()
    Return the main transaction of the current process.

    Returns:
    the transaction name

    Adempiere 3.5.2a

    Adempiere® is a registered trademark of ADempiere Business Inc. ©2004-2008 HumanFlash.com All rights reserved.