Compiere 3.1

org.compiere.process
Class SvrProcess

java.lang.Object
  extended by org.compiere.process.SvrProcess
All Implemented Interfaces:
ProcessCall
Direct Known Subclasses:
AcctSchemaCopyAcct, AcctSchemaDefaultCopy, Aging, AllocationAuto, AllocationReset, AssetDelivery, BankStatementMatcher, BankStatementPayment, BOMValidate, BPartnerOrgLink, BPartnerOrgUnLink, BPartnerValidate, BPGroupAcctCopy, BPPaymentAllocCleanup, CacheClearAll, CacheClearServer, CacheReset, CacheResetWeb, ChangeLogProcess, ColumnEncryption, ColumnSync, CommissionAPInvoice, CommissionCalc, CommissionCopy, ComponentProduct, ComponentRemove, CopyFromInvoice, CopyFromJournal, CopyFromOrder, CopyFromProject, CopyImportFormat, CopyOrder, CostCreate, CostUpdate, CStageValidate, DataMigrationCreate, DataMigrationImport, DataMigrationIncludeClient, DataMigrationPreview, DiscountSchemaReSeq, DistributionCreate, DistributionRun, DistributionVerify, DocTypeCounterValidate, DocumentTypeVerify, DunningPrint, DunningRunCreate, EMailTest, EntityTypeComponent, EntityTypeRegister, ExpenseAPInvoice, ExpenseSOrder, FactAcctReset, FinBalance, FinReport, FinStatement, ImportAccount, ImportBankStatement, ImportBPartner, ImportContact, ImportConversionRate, ImportDelete, ImportGLJournal, ImportInOutConfirm, ImportInventory, ImportInvoice, ImportLocator, ImportOrder, ImportPayment, ImportProduct, ImportReportLine, ImportRequest, IndexValidate, InfoWindowValidate, InOutCreateConfirm, InOutCreateInvoice, InOutGenerate, InventoryCountCreate, InventoryCountUpdate, InventoryValue, InvoiceBatchProcess, InvoiceCreateInOut, InvoiceGenerate, InvoiceNGL, InvoicePayScheduleValidate, InvoicePrint, InvoiceWriteOff, IssueReport, KIndexRerun, LandedCostDistribute, LanguageMaintenance, LeadBPartner, LeadProject, LeadRequest, LoadBankStatement, MatchInvDelete, MatchPODelete, MediaDirectDeploy, MergeProcess, MPrintFormatProcess, NoteDelete, OrderBatchProcess, OrderOpen, OrderPOCreate, OrderRePrice, OrgOwnership, PackageCreate, PaymentOnline, PaymentTermValidate, PaySelectionCreateCheck, PaySelectionCreateFrom, PeriodControlStatus, PeriodStatus, PriceListCreate, ProductCategoryAcctCopy, ProductUOMConvert, ProjectClose, ProjectGenOrder, ProjectGenPO, ProjectIssue, ProjectLinePricing, ProjectPhaseGenOrder, ProjectSetType, Recurring, RegisterSystem, ReplenishReport, ReplicationLocal, ReplicationRemote, ReportColumnSet_Copy, ReportLineSet_Copy, RequestInvoice, RequestReOpen, RequestUpdate, RequisitionPOCreate, RfQClose, RfQCopyLines, RfQCreate, RfQCreatePO, RfQCreateSO, RfQResponseCComplete, RfQResponseInvite, RfQResponseRank, RoleAccessUpdate, SchedulerRun, SendMailText, SequenceCheck, SLAGoalProcess, SLAMeasureProcess, StorageCleanup, SynchronizeTerminology, SystemValidate, TabCopy, TabCreateFields, TableCreateColumns, TableCreateSub, TaxDeclarationCreate, TemplateValidate, TransactionXRef, TranslationDocSync, TreeMaintenance, TrialBalance, UserPassword, ValidateOrg, ViewCreate, ViewImport, ViewImportFromDB, VolumeTest, 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

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 abstract  String doIt()
          Perform process.
 Object doIt(String className, String methodName, Object[] args)
          Execute function
protected  Trx get_Trx()
          Return the main transaction of the current process.
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
 Ctx 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 abstract  void prepare()
          Prepare - e.g., get Parameters.
protected  void rollback()
          Rollback
 boolean startProcess(Ctx 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(Ctx 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(Ctx, 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 CompiereUserError ("@FillMandatory@ @C_BankAccount_ID@");

commit

protected void commit()
Commit


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 Ctx 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

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

get_Trx

protected Trx get_Trx()
Return the main transaction of the current process.

Returns:
the transaction

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.