atg.commerce.fulfillment
Class HardgoodShipper

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.fulfillment.HardgoodShipper
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, Schedulable, java.util.EventListener

public class HardgoodShipper
extends GenericService
implements Schedulable

This class is a scheduled service that finds all shipping groups that are PENDING_SHIPMENT and calls the fulfillers shippingGroupHasShipped method. The scheduled job always runs in a separate thread.

Created: Tue Feb 08 10:49:54 2000


Field Summary
static java.lang.String CLASS_VERSION
           
static java.lang.String DEFAULT_ORDER_STATE_PROPERTY
           
static java.lang.String DEFAULT_SHIPPING_GROUP_ORDER_PROPERTY
           
static java.lang.String DEFAULT_SHIPPING_GROUP_SHIP_ON_DATE_PROPERTY
           
static java.lang.String DEFAULT_SHIPPING_GROUP_STATE_PROPERTY
           
static java.lang.String DEFAULT_SHIPPING_GROUP_SUBMITTED_DATE_PROPERTY
           
static java.lang.String DEFAULT_SHIPPING_GROUP_VIEW_NAME
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
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
HardgoodShipper()
           
 
Method Summary
 void doStartService()
          This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values.
 void doStopService()
          This is called when a Service is required to shut down.
 HardgoodFulfiller getHardgoodFulfiller()
          The fulfiller that this thread will be shipping groups for.
 java.util.Date getLastRun()
          The last time this service ran
 java.lang.String getOrderStatePropertyName()
          The name of the state property in the order
 OrderStates getOrderStates()
          The class containing state information for orders
 Schedule getSchedule()
          The schedule for this service
 Scheduler getScheduler()
          The scheduler for this service.
 java.lang.String getShippingGroupOrderPropertyName()
          The name of the order property in the shipping group
 java.lang.String getShippingGroupShipOnDatePropertyName()
          The name of the property in ShippingGroups that specifies when a shipping group should be shipped.
 java.lang.String getShippingGroupStatePropertyName()
          The name of the state property for ShippingGroups
 java.lang.String getShippingGroupSubmittedDatePropertyName()
          The name of the property for ShippingGroups that says when it was submitted.
 java.lang.String getShippingGroupViewName()
          The name of the view in the order repository for shipping groups.
 boolean isReuseThread()
          If true the thread within which the scheduled job runs will be reused each time the HardgoodShipper runs.
 void performScheduledTask(Scheduler pScheduler, ScheduledJob pJob)
          The method that gets called at the given schedule.
protected  java.util.HashMap retrieveOrderPendingShipMap()
          Returns a HashMap whose ids are the order ids of orders that contain shipping groups and the values are the shipping group ids that are ready for shipment.
 void setHardgoodFulfiller(HardgoodFulfiller pHardgoodFulfiller)
           
 void setOrderStatePropertyName(java.lang.String pOrderStatePropertyName)
           
 void setOrderStates(OrderStates pOrderStates)
           
 void setReuseThread(boolean pReuseThread)
           
 void setSchedule(Schedule pSchedule)
           
 void setScheduler(Scheduler pScheduler)
           
 void setShippingGroupOrderPropertyName(java.lang.String pShippingGroupOrderPropertyName)
           
 void setShippingGroupShipOnDatePropertyName(java.lang.String pShippingGroupShipOnDatePropertyName)
           
 void setShippingGroupStatePropertyName(java.lang.String pShippingGroupStatePropertyName)
           
 void setShippingGroupSubmittedDatePropertyName(java.lang.String pShippingGroupSubmittedDatePropertyName)
           
 void setShippingGroupViewName(java.lang.String pShippingGroupViewName)
           
protected  void shipShippingGroup(java.lang.String pOrderId, java.lang.String pShipGroupId)
          This method is called when the shipping group pShipGroupId is ready for shipment and is in a PENDING_SHIPMENT state.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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

DEFAULT_SHIPPING_GROUP_ORDER_PROPERTY

public static final java.lang.String DEFAULT_SHIPPING_GROUP_ORDER_PROPERTY
See Also:
Constant Field Values

DEFAULT_SHIPPING_GROUP_STATE_PROPERTY

public static final java.lang.String DEFAULT_SHIPPING_GROUP_STATE_PROPERTY
See Also:
Constant Field Values

DEFAULT_SHIPPING_GROUP_SHIP_ON_DATE_PROPERTY

public static final java.lang.String DEFAULT_SHIPPING_GROUP_SHIP_ON_DATE_PROPERTY
See Also:
Constant Field Values

DEFAULT_SHIPPING_GROUP_SUBMITTED_DATE_PROPERTY

public static final java.lang.String DEFAULT_SHIPPING_GROUP_SUBMITTED_DATE_PROPERTY
See Also:
Constant Field Values

DEFAULT_SHIPPING_GROUP_VIEW_NAME

public static final java.lang.String DEFAULT_SHIPPING_GROUP_VIEW_NAME
See Also:
Constant Field Values

DEFAULT_ORDER_STATE_PROPERTY

public static final java.lang.String DEFAULT_ORDER_STATE_PROPERTY
See Also:
Constant Field Values
Constructor Detail

HardgoodShipper

public HardgoodShipper()
Method Detail

setHardgoodFulfiller

public void setHardgoodFulfiller(HardgoodFulfiller pHardgoodFulfiller)

getHardgoodFulfiller

public HardgoodFulfiller getHardgoodFulfiller()
The fulfiller that this thread will be shipping groups for.


setScheduler

public void setScheduler(Scheduler pScheduler)

getScheduler

public Scheduler getScheduler()
The scheduler for this service.


setSchedule

public void setSchedule(Schedule pSchedule)

getSchedule

public Schedule getSchedule()
The schedule for this service


getLastRun

public java.util.Date getLastRun()
The last time this service ran


setOrderStates

public void setOrderStates(OrderStates pOrderStates)

getOrderStates

public OrderStates getOrderStates()
The class containing state information for orders


setShippingGroupStatePropertyName

public void setShippingGroupStatePropertyName(java.lang.String pShippingGroupStatePropertyName)

getShippingGroupStatePropertyName

public java.lang.String getShippingGroupStatePropertyName()
The name of the state property for ShippingGroups


setShippingGroupShipOnDatePropertyName

public void setShippingGroupShipOnDatePropertyName(java.lang.String pShippingGroupShipOnDatePropertyName)

getShippingGroupShipOnDatePropertyName

public java.lang.String getShippingGroupShipOnDatePropertyName()
The name of the property in ShippingGroups that specifies when a shipping group should be shipped.


setShippingGroupSubmittedDatePropertyName

public void setShippingGroupSubmittedDatePropertyName(java.lang.String pShippingGroupSubmittedDatePropertyName)

getShippingGroupSubmittedDatePropertyName

public java.lang.String getShippingGroupSubmittedDatePropertyName()
The name of the property for ShippingGroups that says when it was submitted.


setShippingGroupViewName

public void setShippingGroupViewName(java.lang.String pShippingGroupViewName)

getShippingGroupViewName

public java.lang.String getShippingGroupViewName()
The name of the view in the order repository for shipping groups. (The ItemDescriptor name)


setShippingGroupOrderPropertyName

public void setShippingGroupOrderPropertyName(java.lang.String pShippingGroupOrderPropertyName)

getShippingGroupOrderPropertyName

public java.lang.String getShippingGroupOrderPropertyName()
The name of the order property in the shipping group


setOrderStatePropertyName

public void setOrderStatePropertyName(java.lang.String pOrderStatePropertyName)

getOrderStatePropertyName

public java.lang.String getOrderStatePropertyName()
The name of the state property in the order


setReuseThread

public void setReuseThread(boolean pReuseThread)

isReuseThread

public boolean isReuseThread()
If true the thread within which the scheduled job runs will be reused each time the HardgoodShipper runs. The default is false since it is expected that this service will not run very often (on the order of hours rather than minutes). If this services is scheduled to run frequently, set this property to true.


performScheduledTask

public void performScheduledTask(Scheduler pScheduler,
                                 ScheduledJob pJob)
The method that gets called at the given schedule. It finds all shippable shipping groups and tells the fulfiller that they have shipped.

Specified by:
performScheduledTask in interface Schedulable
Parameters:
pScheduler - calling the job
pJob - the ScheduledJob
See Also:
HardgoodFulfiller.shippingGroupHasShipped(java.lang.String, java.lang.String)

doStartService

public void doStartService()
                    throws ServiceException
Description copied from class: GenericService
This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values. The Service should override this method to start any processes it requires.

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the Service had a problem starting up

doStopService

public void doStopService()
                   throws ServiceException
Description copied from class: GenericService
This is called when a Service is required to shut down. The Service should respond by stopping any processes that it has started.

Overrides:
doStopService in class GenericService
Throws:
ServiceException - if the Service had a problem shutting down

shipShippingGroup

protected void shipShippingGroup(java.lang.String pOrderId,
                                 java.lang.String pShipGroupId)
This method is called when the shipping group pShipGroupId is ready for shipment and is in a PENDING_SHIPMENT state.

Parameters:
pOrderId - the order in which this shipping group belongs
pShipGroupId - the shipping group id that is to be shipped.

retrieveOrderPendingShipMap

protected java.util.HashMap retrieveOrderPendingShipMap()
Returns a HashMap whose ids are the order ids of orders that contain shipping groups and the values are the shipping group ids that are ready for shipment. The default implementation uses the order repository to return all shipping groups whose state is PENDING_SHIPMENT.

Returns:
a HashMap where the keys are the order ids, and the values are a Set of the shipping group ids that belong.