atg.b2bcommerce.invoice.pipeline
Class SetPaymentDueDate

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.b2bcommerce.invoice.pipeline.SetPaymentDueDate
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, PipelineProcessor, java.util.EventListener

public class SetPaymentDueDate
extends GenericService
implements PipelineProcessor

Pipeline processor that computes the due date for an invoice from the payment terms in an InvoiceRequestInfo object.


Field Summary
static java.lang.String CLASS_VERSION
           
static int[] RETCODES
           
static int SUCCESS
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.service.pipeline.PipelineProcessor
STOP_CHAIN_EXECUTION, STOP_CHAIN_EXECUTION_AND_COMMIT, STOP_CHAIN_EXECUTION_AND_ROLLBACK
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
SetPaymentDueDate()
           
 
Method Summary
protected  java.util.Date computePaymentDueDate(MutableRepositoryItem pInvoice, InvoiceRequestInfo pInfo)
          Compute and return the payment due date for an invoice based on information in the invoice and the invoice request info object used to initialize the repository item.
protected  int getErrorReturnCode()
          Return the value that the pipeline processor should return to the pipeline chain in case of error.
 int[] getRetCodes()
          Return all possible return values for this processor.
 boolean isEnabled()
          Query whether this processor is enabled or disabled.
 boolean isRollbackOnError()
          Query whether failure of this processor is considered a fatal error.
 int runProcess(java.lang.Object pParam, PipelineResult pResult)
          Copy properties from an InvoiceRequestInfo object into the corresponding Invoice repository item, where both objects are obtained from the invoice pipeline arguments supplied to this pipeline processor.
 void setEnabled(boolean pEnabled)
          Set the flag that allows applications to enable or disable this pipeline processor without having to reconfigure the invoice pipeline.
 void setRollbackOnError(boolean pRollbackOnError)
          Specify whether or failure in this processor is considered fatal error.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION

SUCCESS

public static final int SUCCESS
See Also:
Constant Field Values

RETCODES

public static final int[] RETCODES
Constructor Detail

SetPaymentDueDate

public SetPaymentDueDate()
Method Detail

setEnabled

public void setEnabled(boolean pEnabled)
Set the flag that allows applications to enable or disable this pipeline processor without having to reconfigure the invoice pipeline.


isEnabled

public boolean isEnabled()
Query whether this processor is enabled or disabled.


setRollbackOnError

public void setRollbackOnError(boolean pRollbackOnError)
Specify whether or failure in this processor is considered fatal error. If this value is set to true, then any error in runProcess processor to return a value meaning "abort execution and roll back the current transaction". If this value is set to false, then errors will be ignored and the pipeline processor will always return a success status code. The default value is true.


isRollbackOnError

public boolean isRollbackOnError()
Query whether failure of this processor is considered a fatal error.


computePaymentDueDate

protected java.util.Date computePaymentDueDate(MutableRepositoryItem pInvoice,
                                               InvoiceRequestInfo pInfo)
Compute and return the payment due date for an invoice based on information in the invoice and the invoice request info object used to initialize the repository item. Returns null if the due date cannot be computed from the information at hand.

By default this method returns a date pInfo.netDays from today. It does not try to account for weekends, holidays, or other non-business days.

Application-specific subclasses can extend this logic by overriding computePaymentDueDate and calling the superclass method to compute the basic due date, then adjusting the resulting date and returning the adjusted value.


runProcess

public int runProcess(java.lang.Object pParam,
                      PipelineResult pResult)
Copy properties from an InvoiceRequestInfo object into the corresponding Invoice repository item, where both objects are obtained from the invoice pipeline arguments supplied to this pipeline processor.

Specified by:
runProcess in interface PipelineProcessor
Parameters:
pParam - Pipeline parameters, which should be an instance of InvoicePipelineArgs.
pResult - Standard pipeline result object.
Returns:
an integer value which is mapped to the next processor to execute. STOP_CHAIN_EXECUTION will notify the PipelineManager to stop execution. An unmapped value will throw a RunProcessException.

getErrorReturnCode

protected int getErrorReturnCode()
Return the value that the pipeline processor should return to the pipeline chain in case of error. The value returned is determined by the setting of the rollbackOnError property.


getRetCodes

public int[] getRetCodes()
Return all possible return values for this processor.

Specified by:
getRetCodes in interface PipelineProcessor
Returns:
an array of all the return codes that could be returned by this PipelineProcessor.