atg.commerce.gifts
Class GiftitemDroplet

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.nucleus.servlet.ServletService
                  extended by atg.nucleus.servlet.HttpServletService
                      extended by atg.servlet.DynamoServlet
                          extended by atg.commerce.gifts.GiftitemDroplet
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, ParameterServlet, java.util.EventListener, javax.servlet.Servlet
Direct Known Subclasses:
PurchaselistItemDroplet

public class GiftitemDroplet
extends DynamoServlet

This servlet looks up an item in a giftlist. If the item if found, it is either removed or moved to the current shopping cart (order) based on the configuration.

This servlet is configurable using the properties file. For example: RemoveItemFromGiftlist.properties

 $class=atg.commerce.gifts.GiftitemDroplet
 $scope=request
 
 giftlistManager=GiftlistManager
 giftlistRepository=Giftlists
 shoppingCart=/atg/commerce/ShoppingCart
 action=remove
 profile=/atg/userprofiling/Profile
 
The invocation of the droplet can then be invoked with the following parameters:
 <DROPLET bean="/atg/commerce/gifts/RemoveItemFromGiftlist">
 <PARAM NAME="giftlistId" VALUE="param:giftlistId">
 <PARAM NAME="giftId" VALUE="param:giftId">
 <OPARAM NAME="output">
 Output
 </OPARAM>
 <OPARAM NAME="error">
 Error
 </OPARAM>
 </DROPLET>
 

If the item is found in the giftlist then it is removed (or moved) from the giftlist by calling the correct method in GiftlistManager. If the item is not found or the person does not have the correct access to the giftlist, an error message is displayed.

The required input parameters for this servlet are:

giftlistId
The id of the giftlist
giftId
The id of the gift
The following parameters are optional:
none

The output parameters for this servlet are:

output
Rendered if list removed successfully.
error
Any exception that may have occured while adding or removing list.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String ERRORMESSAGE
          The output parameter that includes the error message.
protected static java.lang.String MSG_EXCEPTION
           
protected static java.lang.String MSG_NO_GIFTLIST
           
protected static java.lang.String MSG_NOT_GIFTLIST_OWNER
           
 
Fields inherited from class atg.servlet.DynamoServlet
mAllowCleanupRequest, mParameters
 
Fields inherited from class atg.nucleus.servlet.ServletService
SERVLET_INFO_KEY
 
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
GiftitemDroplet()
           
 
Method Summary
 java.lang.String getAction()
          Returns property action.
 java.lang.String getGiftActionBuyProperty()
          Returns property giftActionBuyProperty.
 java.lang.String getGiftActionRemoveProperty()
          Returns property giftActionRemoveProperty.
 GiftlistManager getGiftlistManager()
          Returns property giftlistManager.
 Repository getGiftlistRepository()
          Returns property giftlistRepository.
 Order getOrder()
          Returns property Order, if the shoppingCart property is not null, then return the current order of the shopping cart order holder
 RepositoryItem getProfile()
          Returns property Profile
 ShippingGroup getShippingGroup()
          Returns property ShippingGroup.
 OrderHolder getShoppingCart()
          Returns property ShoppingCart
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Looks for a giftitem in a giftlist and if found, either removes it from the giftlist or moves it to the current default shopping cart.
 void setAction(java.lang.String pAction)
          Sets property action.
 void setGiftActionBuyProperty(java.lang.String pGiftActionBuyProperty)
          Sets property giftActionBuyProperty
 void setGiftActionRemoveProperty(java.lang.String pGiftActionRemoveProperty)
          Sets property giftActionRemoveProperty.
 void setGiftlistManager(GiftlistManager pGiftlistManager)
          Sets property giftlistManager.
 void setGiftlistRepository(Repository pGiftlistRepository)
          Sets property giftlistRepository.
 void setProfile(RepositoryItem pProfile)
          Sets property profile.
 void setShippingGroup(ShippingGroup pShippingGroup)
          Sets property ShippingGroup.
 void setShoppingCart(OrderHolder pShoppingCart)
          Sets property ShoppingCart
 
Methods inherited from class atg.servlet.DynamoServlet
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, service, service, setParameter
 
Methods inherited from class atg.nucleus.servlet.ServletService
destroy, getServletConfig, getServletInfo, init, setServletInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, 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
Class version string


ERRORMESSAGE

public static final java.lang.String ERRORMESSAGE
The output parameter that includes the error message.

See Also:
Constant Field Values

MSG_NO_GIFTLIST

protected static final java.lang.String MSG_NO_GIFTLIST
See Also:
Constant Field Values

MSG_NOT_GIFTLIST_OWNER

protected static final java.lang.String MSG_NOT_GIFTLIST_OWNER
See Also:
Constant Field Values

MSG_EXCEPTION

protected static final java.lang.String MSG_EXCEPTION
See Also:
Constant Field Values
Constructor Detail

GiftitemDroplet

public GiftitemDroplet()
Method Detail

setProfile

public void setProfile(RepositoryItem pProfile)
Sets property profile.

Parameters:
pProfile - the profile of the current customer.

getProfile

public RepositoryItem getProfile()
Returns property Profile


setGiftlistManager

public void setGiftlistManager(GiftlistManager pGiftlistManager)
Sets property giftlistManager.

Parameters:
pGiftlistManager - the giftlistManager class to perform high level operations on giftlists and giftitems.

getGiftlistManager

public GiftlistManager getGiftlistManager()
Returns property giftlistManager. Default GiftlistManager.


setGiftlistRepository

public void setGiftlistRepository(Repository pGiftlistRepository)
Sets property giftlistRepository.

Parameters:
pGiftlistRepository - the giftlist repository where giftlists are stored.

getGiftlistRepository

public Repository getGiftlistRepository()
Returns property giftlistRepository. Default GiftlistRepository.


setAction

public void setAction(java.lang.String pAction)
Sets property action.

Parameters:
pAction - the property to store the action for this droplet to perform on the item

getAction

public java.lang.String getAction()
Returns property action.


setGiftActionRemoveProperty

public void setGiftActionRemoveProperty(java.lang.String pGiftActionRemoveProperty)
Sets property giftActionRemoveProperty.

Parameters:
pGiftActionRemoveProperty - the property to store the value for the remove action.

getGiftActionRemoveProperty

public java.lang.String getGiftActionRemoveProperty()
Returns property giftActionRemoveProperty. Default remove.


setGiftActionBuyProperty

public void setGiftActionBuyProperty(java.lang.String pGiftActionBuyProperty)
Sets property giftActionBuyProperty

Parameters:
pGiftActionBuyProperty - the property to store the value for the buy action.

getGiftActionBuyProperty

public java.lang.String getGiftActionBuyProperty()
Returns property giftActionBuyProperty. Default buy.


setShoppingCart

public void setShoppingCart(OrderHolder pShoppingCart)
Sets property ShoppingCart

Parameters:
pShoppingCart - the property to store the current shopping cart.

getShoppingCart

public OrderHolder getShoppingCart()
Returns property ShoppingCart


getOrder

public Order getOrder()
Returns property Order, if the shoppingCart property is not null, then return the current order of the shopping cart order holder


setShippingGroup

public void setShippingGroup(ShippingGroup pShippingGroup)
Sets property ShippingGroup.

Parameters:
pShippingGroup - the property to store the default shipping group for the current customer

getShippingGroup

public ShippingGroup getShippingGroup()
Returns property ShippingGroup.


service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Looks for a giftitem in a giftlist and if found, either removes it from the giftlist or moves it to the current default shopping cart. If no item found or error creating the order item, render the error oparam, otherwise render the output param.

Overrides:
service in class DynamoServlet
Parameters:
pRequest - the dynamo request object
pResponse - the dynamo response object
Throws:
javax.servlet.ServletException - if something went wrong
java.io.IOException - if something went wrong