atg.commerce.gifts
Class GiftlistManager

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.gifts.GiftlistManager
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, java.util.EventListener
Direct Known Subclasses:
PurchaselistManager

public class GiftlistManager
extends GenericService

This class is the business layer object for the management of giftlist and giftitem object manipulation. It provides the high level access to giftlists. It makes calls to lowerlevel utilities in GiftlistTools which perform the operations on the repository.


Field Summary
static java.lang.String ALL
           
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String CURRENT
           
protected  java.lang.String[] mCompareGiftListAddressPropertyNames
           
protected static java.util.ResourceBundle sResourceBundle
          Resource Bundle
 
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
GiftlistManager()
          Constructs a GiftlistManager object.
 
Method Summary
 void addCatalogItemToGiftlist(java.lang.String pSkuId, java.lang.String pProductId, java.lang.String pGiftlistId, java.lang.String pSiteId, long pQuantity)
           
 void addGiftToOrder(RepositoryItem pProfile, Order pOrder, java.lang.String pItemId, ShippingGroup pShippingGroup, long pQuantity, java.lang.String pGiftlistId, java.lang.String pGiftlistItemId)
          Creates a new shipping group based on the given gift list and moves the item from the given shipping group to the new shipping group.
 void addItemToGiftlist(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId)
          Add the given giftlistItem to the given giftlist.
 void addOtherGiftlistToProfile(MutableRepositoryItem pProfile, java.lang.String pGiftlistId)
          Adds other giftlist to the profileId and from the profile repository.
 boolean addSpecialInstruction(java.lang.String pGiftlistId, java.lang.String pKey, java.lang.String pValue)
          Add a new special instruction to this giftlist
 void adjustGiftsForQuantityDecrease(Order pOrder, ShippingGroup pShippingGroup, CommerceItem pCommerceItem, long pNewQuantity, long pQuantityDecrease)
          Adjusts the gift handling instructions for a decrease of item quantity in a shipping group.
 void adjustGiftsForQuantityIncrease(Order pOrder, ShippingGroup pShippingGroup, CommerceItem pCommerceItem, long pNewQuantity, long pQuantityIncrease)
          Adjusts the gift handling instructions for an increase of item quantity in a shipping group.
protected  boolean areSitesCompatible(java.lang.String pSiteId1, java.lang.String pSiteId2)
          Checks if two sites are compatible using GiftlistManager's siteScope setting.
protected  boolean areSitesCompatible(java.lang.String pSiteId1, java.lang.String pSiteId2, java.lang.String pSiteScope)
          Checks if two sites are compatible.
 void buyItemFromGiftlist(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId, Order pOrder, ShippingGroup pShippingGroup)
          Moves the given giftlistItem from the given giftlist to the shopping cart.
 java.lang.String createGiftlist(java.lang.String pProfileId, boolean pPublished, java.lang.String pEventName, java.util.Date pEventDate, java.lang.String pEventType, java.lang.String pShippingAddressId)
          Creates a new giflist using @see GiftlistTools#createGiftlist and returns its id
 java.lang.String createGiftlist(java.lang.String pProfileId, boolean pPublished, java.lang.String pEventName, java.util.Date pEventDate, java.lang.String pEventType, java.lang.String pDescription, java.lang.String pComments, java.lang.String pShippingAddressId, java.lang.String pInstructions)
          Creates a new giflist @see GiftlistTools#createGiftlist and returns its id
 java.lang.String createGiftlist(java.lang.String pProfileId, boolean pPublished, java.lang.String pEventName, java.util.Date pEventDate, java.lang.String pEventType, java.lang.String pDescription, java.lang.String pComments, java.lang.String pShippingAddressId, java.lang.String pInstructions, java.lang.String pSiteId)
          Creates a new giflist @see GiftlistTools#createGiftlist and returns its id
 java.lang.String createGiftlistItem(java.lang.String pCatalogRefId, java.lang.Object pCatalogRef, java.lang.String pProductId, java.lang.Object pProductRef, long pQuantityDesired, java.lang.String pDisplayName, java.lang.String pDescription)
          Creates a new GiftlistItem object using the default GiftlistItem type defined in GiftlistTools.
 java.lang.String createGiftlistItem(java.lang.String pCatalogRefId, java.lang.Object pCatalogRef, java.lang.String pProductId, java.lang.Object pProductRef, long pQuantityDesired, java.lang.String pDisplayName, java.lang.String pDescription, java.lang.String pSiteId)
          Creates a new GiftlistItem object using the default GiftlistItem type defined in GiftlistTools.
 HardgoodShippingGroup createShippingGroupFromGiftlist(java.lang.String pGiftlistId)
          Creates a hardgood shipping address based on the address in the given gift list.
 boolean decreaseGiftlistItemQuantityPurchased(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId, long pQuantity)
          Decreate the quantityPurchased for this giftlist item by the given quantity
 void decreaseGiftQuantityForItem(Order pOrder, ShippingGroup pShippingGroup, CommerceItem pCommerceItem, long pQuantityDecrease)
          Decreases the gift quantity for an item in a shipping group.
protected  HardgoodShippingGroup findGiftShippingGroupWithAddress(Order pOrder, java.lang.String pGiftlistId)
          Finds a gift shipping group with an address that matches the gift list address
 java.util.Collection getAllGiftHandlingInstructions(Order pOrder)
          Returns a Collection of all gift handling instructions in the order.
 CatalogTools getCatalogTools()
          Returns property catalogTools.
 java.lang.String[] getCompareGiftListAddressPropertyNames()
          Returns the CompareGiftListAddressPropertyNames
 java.util.Collection getGiftHandlingForShippingGroup(ShippingGroup pShippingGroup, CommerceItem pCommerceItem)
          Returns the gift handling instructions for a given item in a given shipping group
 GiftlistHandlingInstruction getGiftHandlingInstructionForCommerceItem(ShippingGroup pShippingGroup, java.lang.String pCommerceItemId, java.lang.String pGiftlistId, java.lang.String pGiftlistItemId)
          Returns the gift list handling instruction for the item with a commerce item id, matching gift list id and gift list item id.
 RepositoryItem getGiftitem(java.lang.String pId)
          Gets the giftitem from the repository with the id passed.
 RepositoryItem getGiftlist(java.lang.String pId)
          Gets the giftlist from the repository with the id passed.
 java.lang.String getGiftlistComments(java.lang.String pGiftlistId)
          Return the comments of this giftlist
 java.lang.String getGiftlistDescription(java.lang.String pGiftlistId)
          Return the description of this giftlist
 java.util.Date getGiftlistEventDate(java.lang.String pGiftlistId)
          Return the eventDate of this giftlist
 java.lang.String getGiftlistEventName(java.lang.String pGiftlistId)
          Return the eventName of this giftlist
 java.lang.String getGiftlistEventType(java.lang.String pGiftlistId)
          Return the eventType of this giftlist
 java.lang.String getGiftlistItemCatalogRefId(java.lang.String pGiftlistItemId)
          Return the catalogRefId of this giftlist item
 java.lang.String getGiftlistItemDescription(java.lang.String pGiftlistItemId)
          Return the description of this giftlist item
 java.lang.String getGiftlistItemDisplayName(java.lang.String pGiftlistItemId)
          Return the displayName of this giftlist item
 java.lang.String getGiftlistItemId(java.lang.String pGiftlistId, java.lang.String pSkuId)
          Return the giftlistItemId if the sku is in the giftlist, null otherwise
 java.lang.String getGiftlistItemId(java.lang.String pGiftlistId, java.lang.String pSkuId, java.lang.String pProductId, java.lang.String pSiteId)
          Return the giftlistItemId if the sku with the same SKU ID, product ID and site ID is in the giftlist, null otherwise
 java.lang.String getGiftlistItemProductId(java.lang.String pGiftlistItemId)
          Return the productId of this giftlist item
 long getGiftlistItemQuantityDesired(java.lang.String pGiftlistItemId)
          Return the quantityDesired of this giftlist item
 long getGiftlistItemQuantityPurchased(java.lang.String pGiftlistItemId)
          Return the quantityPurchased of this giftlist item
 java.util.List getGiftlistItems(java.lang.String pGiftlistId)
          Get the list of giftlist items from the giftlist
 java.lang.String getGiftlistItemSite(java.lang.String pGiftlistItemId)
          Return the site id of this giftlist item
 java.lang.String getGiftlistOwner(java.lang.String pGiftlistId)
          Return the owner of this giftlist
 RepositoryItem getGiftlistShippingAddress(java.lang.String pGiftlistId)
          Return the shippingAddress of this giftlist
 java.lang.String getGiftlistSite(java.lang.String pGiftlistId)
          Return the site id of this giftlist
 GiftlistTools getGiftlistTools()
          Returns property giftlistTools.
 java.util.List getGiftOnlyShippingGroups(Order pOrder)
          Returns a list of shipping groups the contain just gifts.
 long getGiftQuantity(CommerceItem pCommerceItem, ShippingGroup pShippingGroup)
          Returns the quantity of the CommerceItem that is a gift in the given shipping group
 long getGiftQuantity(Order pOrder, CommerceItem pCommerceItem)
          Returns the quantity of a CommerceItem that should be treated as a gift.
 long getGiftQuantityForShippingGroup(ShippingGroup pShippingGroup, CommerceItem pCommerceItem)
          Returns the gift quantity for a items relationship to a shipping group.
 java.util.List getGiftShippingGroups(Order pOrder)
          Returns a list of all shipping groups that contain gifts.
 SimpleOrderManager getOrderManager()
          Returns property orderManager.
 CommerceProfileTools getProfileTools()
          Returns property profileTools.
 SiteGroupManager getSiteGroupManager()
          Returns property siteGroupManager.
 java.lang.String getSiteScope()
          gets the property siteScope
 java.util.Map getSpecialInstruction(java.lang.String pGiftlistId)
          Return the specialInstructions of this giftlist
 java.lang.String getWishlistId(java.lang.String pProfileId)
          Return the id of the customer's wishlist
 boolean increaseGiftlistItemQuantityDesired(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId, long pQuantity)
          Increase the quantityDesired for this giftlist item by the given quantity
 boolean increaseGiftlistItemQuantityPurchased(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId, long pQuantity)
          Increase the quantityPurchased for this giftlist item by the given quantity
 void increaseGiftQuantityForItem(Order pOrder, ShippingGroup pShippingGroup, CommerceItem pCommerceItem, long pQuantityIncrease)
          Increases the gift quantity for an item in a shipping group.
protected  boolean isGiftlistOwner(java.lang.String pGiftlistId, java.lang.String pProfileId)
           
 boolean isGiftlistPublic(java.lang.String pGiftlistId)
          Return the public property of this giftlist
 boolean isGiftlistPublished(java.lang.String pGiftlistId)
          Return the published property of this giftlist
 boolean isGiftOnlyShippingGroup(ShippingGroup pShippingGroup)
          Determines if the items in the shipping group are all gifts
 boolean isGiftShippingGroup(ShippingGroup pShippingGroup)
          Returns true if a shipping group has gift handling instructions
 boolean isRemoveItemFromGiftlistOnMoveToCart()
          Gets property removeItemFromGiftlistOnMoveToCart.
 void removeGiftlist(java.lang.String pProfileId, java.lang.String pGiftlistId)
          Deletes the giftlist from the profileId and from the profile repository.
 void removeItemFromGiftlist(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId)
          Removes the given giftlistItem from the given giftlist.
 void removeOtherGiftlistFromProfile(MutableRepositoryItem pProfile, java.lang.String pGiftlistId)
          Deletes other giftlist from the profileId and from the profile repository.
 void setCatalogTools(CatalogTools pCatalogTools)
          Sets property catalogTools.
 void setCompareGiftListAddressPropertyNames(java.lang.String[] pCompareGiftListAddressPropertyNames)
          Sets the CompareGiftListAddressPropertyNames
 boolean setGiftlistComments(java.lang.String pGiftlistId, java.lang.String pComments)
          Set the comments of the giftlist
 boolean setGiftlistDescription(java.lang.String pGiftlistId, java.lang.String pDescription)
          Set the description of the giftlist
 boolean setGiftlistEventDate(java.lang.String pGiftlistId, java.util.Date pEventDate)
          Set the eventDate of the giftlist
 boolean setGiftlistEventName(java.lang.String pGiftlistId, java.lang.String pEventName)
          Set the eventName of the giftlist
 boolean setGiftlistEventType(java.lang.String pGiftlistId, java.lang.String pEventType)
          Set the eventType of the giftlist
 boolean setGiftlistItemCatalogRefId(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId, java.lang.String pCatalogRefId)
          Set the catalogRefId of the giftlist item
 boolean setGiftlistItemDescription(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId, java.lang.String pDescription)
          Set the description of the giftlist item
 boolean setGiftlistItemDisplayName(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId, java.lang.String pDisplayName)
          Set the displayName of the giftlist item
 boolean setGiftlistItemProductId(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId, java.lang.String pProductId)
          Set the productId of the giftlist item
 boolean setGiftlistItemQuantityDesired(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId, long pQuantityDesired)
          Set the quantityDesired of the giftlist item
 boolean setGiftlistItemQuantityPurchased(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId, long pQuantityPurchased)
          Set the quantityPurchased of the giftlist item
 boolean setGiftlistItemSite(java.lang.String pGiftlistId, java.lang.String pGiftlistItemId, java.lang.String pSiteId)
          Set the site of the giftlist item
 boolean setGiftlistOwner(java.lang.String pGiftlistId, RepositoryItem pProfile)
          Set the owner of the giftlist
 boolean setGiftlistOwner(java.lang.String pGiftlistId, java.lang.String pProfileId)
          Set the owner of the giftlist
 boolean setGiftlistPublic(java.lang.String pGiftlistId, boolean pPublic)
          Set the public property of this giftlist
 boolean setGiftlistPublished(java.lang.String pGiftlistId, boolean pPublished)
          Set the published property of the giftlist.
 boolean setGiftlistShippingAddress(java.lang.String pGiftlistId, java.lang.String pShippingAddressId)
          Set the ShippingAddress of the giftlist
 boolean setGiftlistSite(java.lang.String pGiftlistId, java.lang.String pSiteId)
          Set the site id of the giftlist
 void setGiftlistTools(GiftlistTools pGiftlistTools)
          Sets property giftlistTools.
 void setOrderManager(SimpleOrderManager pOrderManager)
          Sets property OrderManager.
 void setProfileTools(CommerceProfileTools pProfileTools)
          Sets property profileTools.
 void setRemoveItemFromGiftlistOnMoveToCart(boolean pRemoveItemFromGiftlistOnMoveToCart)
          Sets property removeItemFromGiftlistOnMoveToCart.
 void setSiteGroupManager(SiteGroupManager pSiteGroupManager)
          Sets property SiteGroupManager.
 void setSiteScope(java.lang.String pSiteScope)
          Sets the property siteScope.
 boolean updateGiftlist(java.lang.String pProfileId, java.lang.String pGiftlistId, boolean pPublished, java.lang.String pEventName, java.util.Date pEventDate, java.lang.String pEventType, java.lang.String pDescription, java.lang.String pComments, java.lang.String pShippingAddressId, java.lang.String pInstructions)
          Updates the giftlist with the values passed in.
 boolean updateGiftlist(java.lang.String pProfileId, java.lang.String pGiftlistId, boolean pPublished, java.lang.String pEventName, java.util.Date pEventDate, java.lang.String pEventType, java.lang.String pDescription, java.lang.String pComments, java.lang.String pShippingAddressId, java.lang.String pInstructions, java.lang.String pSiteId)
          Updates the giftlist with the values passed in.
 
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 final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values

ALL

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

CURRENT

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

sResourceBundle

protected static java.util.ResourceBundle sResourceBundle
Resource Bundle


mCompareGiftListAddressPropertyNames

protected java.lang.String[] mCompareGiftListAddressPropertyNames
Constructor Detail

GiftlistManager

public GiftlistManager()
Constructs a GiftlistManager object.

Method Detail

getCompareGiftListAddressPropertyNames

public java.lang.String[] getCompareGiftListAddressPropertyNames()
Returns the CompareGiftListAddressPropertyNames


setCompareGiftListAddressPropertyNames

public void setCompareGiftListAddressPropertyNames(java.lang.String[] pCompareGiftListAddressPropertyNames)
Sets the CompareGiftListAddressPropertyNames

These property names are used to compare the gift list address to shipping group addresses already in the order when adding a gift to an order.


setOrderManager

public void setOrderManager(SimpleOrderManager pOrderManager)
Sets property OrderManager.

Parameters:
pOrderManager - the orderManager class which provides low level operations on giftlists.

getOrderManager

public SimpleOrderManager getOrderManager()
Returns property orderManager. return property orderManager.


setProfileTools

public void setProfileTools(CommerceProfileTools pProfileTools)
Sets property profileTools.

Parameters:
pProfileTools - the profileTools class which provides low level operations on profiles.

getProfileTools

public CommerceProfileTools getProfileTools()
Returns property profileTools. return property profileTools.


setGiftlistTools

public void setGiftlistTools(GiftlistTools pGiftlistTools)
Sets property giftlistTools.

Parameters:
pGiftlistTools - the giftlistTools class which provides low level operations on giftlists.

getGiftlistTools

public GiftlistTools getGiftlistTools()
Returns property giftlistTools. return property giftlistTools.


setSiteGroupManager

public void setSiteGroupManager(SiteGroupManager pSiteGroupManager)
Sets property SiteGroupManager.

Parameters:
pSiteGroupManager - the siteGroupManager

getSiteGroupManager

public SiteGroupManager getSiteGroupManager()
Returns property siteGroupManager. return property siteGroupManager.


isRemoveItemFromGiftlistOnMoveToCart

public boolean isRemoveItemFromGiftlistOnMoveToCart()
Gets property removeItemFromGiftlistOnMoveToCart.


setRemoveItemFromGiftlistOnMoveToCart

public void setRemoveItemFromGiftlistOnMoveToCart(boolean pRemoveItemFromGiftlistOnMoveToCart)
Sets property removeItemFromGiftlistOnMoveToCart.

Parameters:
pRemoveItemFromGiftlistOnMoveToCart - The value which tells Dynamo whether to remove a giftlist item when it is transferred to a user's cart.

setSiteScope

public void setSiteScope(java.lang.String pSiteScope)
Sets the property siteScope. This property expects the following values: "all", "current", or existing shareable type ID. The property specifies whether gift lists are not site-limited, limited to one site or to shareable correspondingly.


getSiteScope

public java.lang.String getSiteScope()
gets the property siteScope


setCatalogTools

public void setCatalogTools(CatalogTools pCatalogTools)
Sets property catalogTools.

Parameters:
pCatalogTools - the catalogTools which provides low level operations on the catalog.

getCatalogTools

public CatalogTools getCatalogTools()
Returns property catalogTools.

Returns:
The value of the property CatalogTools.

createGiftlist

public java.lang.String createGiftlist(java.lang.String pProfileId,
                                       boolean pPublished,
                                       java.lang.String pEventName,
                                       java.util.Date pEventDate,
                                       java.lang.String pEventType,
                                       java.lang.String pShippingAddressId)
                                throws CommerceException
Creates a new giflist using @see GiftlistTools#createGiftlist and returns its id

Parameters:
pProfileId - the id of the Profile object to which this giftlist belongs.
pPublished - If true, this giftlist will be visible to all.
pEventName - The name of the event that these gifts are for
pEventDate - The date of the even
pEventType - The type of event (e.g. birthday)
pShippingAddressId - The id of the address that these gifts should be shipped to
Returns:
The id of the newly created giftlist.
Throws:
CommerceException - if there were any errors creating giftlist.

createGiftlist

public java.lang.String createGiftlist(java.lang.String pProfileId,
                                       boolean pPublished,
                                       java.lang.String pEventName,
                                       java.util.Date pEventDate,
                                       java.lang.String pEventType,
                                       java.lang.String pDescription,
                                       java.lang.String pComments,
                                       java.lang.String pShippingAddressId,
                                       java.lang.String pInstructions)
                                throws CommerceException
Creates a new giflist @see GiftlistTools#createGiftlist and returns its id

Parameters:
pProfileId - the id of the Profile object to which this giftlist belongs.
pPublished - If true, this giftlist will be visible to all.
pEventName - The name of the event that these gifts are for
pEventDate - The date of the even
pEventType - The type of event (e.g. birthday)
pDescription - The description of this giftlist
pComments - The owner's comments for this giftlist
pShippingAddressId - The id of the address that these gifts should be shipped to
pInstructions - the extra information or instructions
Returns:
The id of the newly created giftlist
Throws:
CommerceException - if there were any errors creating giftlist.

createGiftlist

public java.lang.String createGiftlist(java.lang.String pProfileId,
                                       boolean pPublished,
                                       java.lang.String pEventName,
                                       java.util.Date pEventDate,
                                       java.lang.String pEventType,
                                       java.lang.String pDescription,
                                       java.lang.String pComments,
                                       java.lang.String pShippingAddressId,
                                       java.lang.String pInstructions,
                                       java.lang.String pSiteId)
                                throws CommerceException
Creates a new giflist @see GiftlistTools#createGiftlist and returns its id

Parameters:
pProfileId - the id of the Profile object to which this giftlist belongs.
pPublished - If true, this giftlist will be visible to all.
pEventName - The name of the event that these gifts are for
pEventDate - The date of the even
pEventType - The type of event (e.g. birthday)
pDescription - The description of this giftlist
pComments - The owner's comments for this giftlist
pShippingAddressId - The id of the address that these gifts should be shipped to
pInstructions - the extra information or instructions
pSiteId - the site id where gift list is created
Returns:
The id of the newly created giftlist
Throws:
CommerceException - if there were any errors creating giftlist.

updateGiftlist

public boolean updateGiftlist(java.lang.String pProfileId,
                              java.lang.String pGiftlistId,
                              boolean pPublished,
                              java.lang.String pEventName,
                              java.util.Date pEventDate,
                              java.lang.String pEventType,
                              java.lang.String pDescription,
                              java.lang.String pComments,
                              java.lang.String pShippingAddressId,
                              java.lang.String pInstructions)
                       throws CommerceException
Updates the giftlist with the values passed in.

Parameters:
pProfileId - the owner of the giftlist
pGiftlistId - the giftlist id
pPublished - If true, this giftlist will be visible to all.
pEventName - The name of the event that these gifts are for
pEventDate - The date of the even
pEventType - The type of event (e.g. birthday)
pDescription - The description of this giftlist
pComments - The owner's comments for this giftlist
pShippingAddressId - The id of the address that these gifts should be shipped to
pInstructions - the extra information or instructions
Returns:
boolean success
Throws:
CommerceException - if there were any errors updating giftlist.

updateGiftlist

public boolean updateGiftlist(java.lang.String pProfileId,
                              java.lang.String pGiftlistId,
                              boolean pPublished,
                              java.lang.String pEventName,
                              java.util.Date pEventDate,
                              java.lang.String pEventType,
                              java.lang.String pDescription,
                              java.lang.String pComments,
                              java.lang.String pShippingAddressId,
                              java.lang.String pInstructions,
                              java.lang.String pSiteId)
                       throws CommerceException
Updates the giftlist with the values passed in.

Parameters:
pProfileId - the owner of the giftlist
pGiftlistId - the giftlist id
pPublished - If true, this giftlist will be visible to all.
pEventName - The name of the event that these gifts are for
pEventDate - The date of the even
pEventType - The type of event (e.g. birthday)
pDescription - The description of this giftlist
pComments - The owner's comments for this giftlist
pShippingAddressId - The id of the address that these gifts should be shipped to
pInstructions - the extra information or instructions
pSiteId - the site id
Returns:
boolean success
Throws:
CommerceException - if there were any errors updating giftlist.

getGiftlist

public RepositoryItem getGiftlist(java.lang.String pId)
                           throws CommerceException
Gets the giftlist from the repository with the id passed.

Parameters:
pId - the id of the Giftlist object.
Returns:
The RepositoryItem for this giftlist
Throws:
CommerceException - if there were any errors getting giftlist.
See Also:
RepositoryItem

getGiftitem

public RepositoryItem getGiftitem(java.lang.String pId)
                           throws CommerceException
Gets the giftitem from the repository with the id passed.

Parameters:
pId - the id of the Giftitem object.
Returns:
The RepositoryItem for this giftlist
Throws:
CommerceException - if there were any errors getting gift item.
See Also:
RepositoryItem

removeGiftlist

public void removeGiftlist(java.lang.String pProfileId,
                           java.lang.String pGiftlistId)
                    throws CommerceException,
                           RepositoryException
Deletes the giftlist from the profileId and from the profile repository.

Parameters:
pProfileId - the id to remove the giftlist from
pGiftlistId - the id of the giftlist
Throws:
CommerceException - if there were any errors removing giftlist.
RepositoryException - if an error occurs accessing the repository

removeOtherGiftlistFromProfile

public void removeOtherGiftlistFromProfile(MutableRepositoryItem pProfile,
                                           java.lang.String pGiftlistId)
                                    throws CommerceException,
                                           RepositoryException
Deletes other giftlist from the profileId and from the profile repository.

Parameters:
pProfile - the profile to remove the giftlist from
pGiftlistId - the id of the giftlist to remove
Throws:
CommerceException - if there were any errors removing giftlist from profile.
RepositoryException - if an error occurs accessing the repository

addOtherGiftlistToProfile

public void addOtherGiftlistToProfile(MutableRepositoryItem pProfile,
                                      java.lang.String pGiftlistId)
                               throws CommerceException,
                                      RepositoryException
Adds other giftlist to the profileId and from the profile repository.

Parameters:
pProfile - the profile to add the giftlist to
pGiftlistId - the id of the giftlist to add
Throws:
CommerceException - if there were any errors adding giftlist to profile.
RepositoryException - if an error occurs accessing the repository

createGiftlistItem

public java.lang.String createGiftlistItem(java.lang.String pCatalogRefId,
                                           java.lang.Object pCatalogRef,
                                           java.lang.String pProductId,
                                           java.lang.Object pProductRef,
                                           long pQuantityDesired,
                                           java.lang.String pDisplayName,
                                           java.lang.String pDescription)
                                    throws CommerceException
Creates a new GiftlistItem object using the default GiftlistItem type defined in GiftlistTools. Populates the GiftlistItem with the supplied data.

Parameters:
pCatalogRefId - the id of the catalog object reference that this CommerceItem represents
pCatalogRef - the catalog object reference that this CommerceItem represents
pProductId - the product id that this CommerceItem references
pProductRef - the product object reference that this CommerceItem represents
pQuantityDesired - the quantity that this CommerceItem should represent
pDisplayName - the display name of the catalog item
pDescription - the description of the catalog item
Returns:
The id of the newly created giftlistItem.
Throws:
CommerceException - if there were any errors creating gift item.

createGiftlistItem

public java.lang.String createGiftlistItem(java.lang.String pCatalogRefId,
                                           java.lang.Object pCatalogRef,
                                           java.lang.String pProductId,
                                           java.lang.Object pProductRef,
                                           long pQuantityDesired,
                                           java.lang.String pDisplayName,
                                           java.lang.String pDescription,
                                           java.lang.String pSiteId)
                                    throws CommerceException
Creates a new GiftlistItem object using the default GiftlistItem type defined in GiftlistTools. Populates the GiftlistItem with the supplied data.

Parameters:
pCatalogRefId - the id of the catalog object reference that this CommerceItem represents
pCatalogRef - the catalog object reference that this CommerceItem represents
pProductId - the product id that this CommerceItem references
pProductRef - the product object reference that this CommerceItem represents
pQuantityDesired - the quantity that this CommerceItem should represent
pDisplayName - the display name of the catalog item
pDescription - the description of the catalog item
pSiteId - the site id where gift item is created
Returns:
The id of the newly created giftlistItem.
Throws:
CommerceException - if there were any errors creating gift item.

addCatalogItemToGiftlist

public void addCatalogItemToGiftlist(java.lang.String pSkuId,
                                     java.lang.String pProductId,
                                     java.lang.String pGiftlistId,
                                     java.lang.String pSiteId,
                                     long pQuantity)
                              throws CommerceException
Throws:
CommerceException

addItemToGiftlist

public void addItemToGiftlist(java.lang.String pGiftlistId,
                              java.lang.String pGiftlistItemId)
                       throws CommerceException,
                              RepositoryException
Add the given giftlistItem to the given giftlist.

Parameters:
pGiftlistId - the id of the giftlist to add the item to
pGiftlistItemId - the id of the giftlist item to add
Throws:
CommerceException - if there were any errors adding item to giftlist.
RepositoryException - if an error occurs accessing the repository

removeItemFromGiftlist

public void removeItemFromGiftlist(java.lang.String pGiftlistId,
                                   java.lang.String pGiftlistItemId)
                            throws CommerceException,
                                   RepositoryException
Removes the given giftlistItem from the given giftlist.

Parameters:
pGiftlistId - the id of the giftlist from which to remove the item
pGiftlistItemId - the id of the giftlist item to remove
Throws:
CommerceException - if there were any errors removing item from giftlist.
RepositoryException - if an error occurs accessing the repository

buyItemFromGiftlist

public void buyItemFromGiftlist(java.lang.String pGiftlistId,
                                java.lang.String pGiftlistItemId,
                                Order pOrder,
                                ShippingGroup pShippingGroup)
                         throws CommerceException,
                                RepositoryException
Moves the given giftlistItem from the given giftlist to the shopping cart. This calls addItemToShippingGroup in the order manager class to create the commerce item and add it to the shopping cart.

Parameters:
pGiftlistId - the id of the giftlist from which to buy the item
pGiftlistItemId - the id of the giftlist item to buyg
Throws:
CommerceException - if there were any errors moving item from giftlist to cart.
RepositoryException - if an error occurs accessing the repository

getGiftlistItems

public java.util.List getGiftlistItems(java.lang.String pGiftlistId)
Get the list of giftlist items from the giftlist

Parameters:
pGiftlistId - The id of the giftlist
Returns:
The list of giftlistItems (RepositoryItems)
See Also:
RepositoryItem

setGiftlistOwner

public boolean setGiftlistOwner(java.lang.String pGiftlistId,
                                java.lang.String pProfileId)
Set the owner of the giftlist

Parameters:
pGiftlistId - The id of the giftlist being changed.
pProfileId - The id of the new owner of this giftlist
Returns:
true if successful, false otherwise

setGiftlistOwner

public boolean setGiftlistOwner(java.lang.String pGiftlistId,
                                RepositoryItem pProfile)
Set the owner of the giftlist

Parameters:
pGiftlistId - The id of the giftlist being changed.
pProfile - The new owner of this giftlist
Returns:
true if successful, false otherwise

getGiftlistOwner

public java.lang.String getGiftlistOwner(java.lang.String pGiftlistId)
Return the owner of this giftlist

Parameters:
pGiftlistId - the giftlist in question
Returns:
the owner

getWishlistId

public java.lang.String getWishlistId(java.lang.String pProfileId)
Return the id of the customer's wishlist

Parameters:
pProfileId - the profile
Returns:
the wishlistid

setGiftlistPublic

public boolean setGiftlistPublic(java.lang.String pGiftlistId,
                                 boolean pPublic)
Set the public property of this giftlist

Parameters:
pGiftlistId - The id of the giftlist being changed.
pPublic - If true, this giftlist is public, if false, it is not.
Returns:
true if successful, false otherwise

isGiftlistPublic

public boolean isGiftlistPublic(java.lang.String pGiftlistId)
Return the public property of this giftlist

Parameters:
pGiftlistId - the giftlist in question
Returns:
true if this giftlist is public, false otherwise

setGiftlistPublished

public boolean setGiftlistPublished(java.lang.String pGiftlistId,
                                    boolean pPublished)
Set the published property of the giftlist. If a giftlist is published, it is visible to other customers.

Parameters:
pGiftlistId - The id of the giftlist being changed.
pPublished - The new value of the published property
Returns:
true if successful, false otherwise

isGiftlistPublished

public boolean isGiftlistPublished(java.lang.String pGiftlistId)
Return the published property of this giftlist

Parameters:
pGiftlistId - the giftlist in question
Returns:
true if this giftlist is published, false otherwise

setGiftlistEventName

public boolean setGiftlistEventName(java.lang.String pGiftlistId,
                                    java.lang.String pEventName)
Set the eventName of the giftlist

Parameters:
pGiftlistId - The id of the giftlist being changed.
pEventName - The name of the event this giftlist refers to
Returns:
true if successful, false otherwise

getGiftlistEventName

public java.lang.String getGiftlistEventName(java.lang.String pGiftlistId)
Return the eventName of this giftlist

Parameters:
pGiftlistId - the giftlist in question
Returns:
the eventName

setGiftlistEventDate

public boolean setGiftlistEventDate(java.lang.String pGiftlistId,
                                    java.util.Date pEventDate)
Set the eventDate of the giftlist

Parameters:
pGiftlistId - The id of the giftlist being changed.
pEventDate - The date that this event occurs
Returns:
true if successful, false otherwise

getGiftlistEventDate

public java.util.Date getGiftlistEventDate(java.lang.String pGiftlistId)
Return the eventDate of this giftlist

Parameters:
pGiftlistId - the giftlist in question
Returns:
the eventDate

setGiftlistEventType

public boolean setGiftlistEventType(java.lang.String pGiftlistId,
                                    java.lang.String pEventType)
Set the eventType of the giftlist

Parameters:
pGiftlistId - The id of the giftlist being changed.
pEventType - The type of this event (eg birthday)
Returns:
true if successful, false otherwise

getGiftlistEventType

public java.lang.String getGiftlistEventType(java.lang.String pGiftlistId)
Return the eventType of this giftlist

Parameters:
pGiftlistId - the giftlist in question
Returns:
the eventType

setGiftlistDescription

public boolean setGiftlistDescription(java.lang.String pGiftlistId,
                                      java.lang.String pDescription)
Set the description of the giftlist

Parameters:
pGiftlistId - The id of the giftlist being changed.
pDescription - The new description of this event
Returns:
true if successful, false otherwise

getGiftlistDescription

public java.lang.String getGiftlistDescription(java.lang.String pGiftlistId)
Return the description of this giftlist

Parameters:
pGiftlistId - the giftlist in question
Returns:
the description

setGiftlistComments

public boolean setGiftlistComments(java.lang.String pGiftlistId,
                                   java.lang.String pComments)
Set the comments of the giftlist

Parameters:
pGiftlistId - The id of the giftlist being changed.
pComments - The new comments for this giftlist
Returns:
true if successful, false otherwise

getGiftlistComments

public java.lang.String getGiftlistComments(java.lang.String pGiftlistId)
Return the comments of this giftlist

Parameters:
pGiftlistId - the giftlist in question
Returns:
the comments

setGiftlistShippingAddress

public boolean setGiftlistShippingAddress(java.lang.String pGiftlistId,
                                          java.lang.String pShippingAddressId)
Set the ShippingAddress of the giftlist

Parameters:
pGiftlistId - The id of the giftlist being changed.
pShippingAddressId - The id of the new shipping address for this giftlist
Returns:
true if successful, false otherwise

getGiftlistShippingAddress

public RepositoryItem getGiftlistShippingAddress(java.lang.String pGiftlistId)
Return the shippingAddress of this giftlist

Parameters:
pGiftlistId - the giftlist in question
Returns:
the shippingAddress

setGiftlistSite

public boolean setGiftlistSite(java.lang.String pGiftlistId,
                               java.lang.String pSiteId)
Set the site id of the giftlist

Parameters:
pGiftlistId - The id of the giftlist being changed.
pSiteId - The site id
Returns:
true if successful, false otherwise

getGiftlistSite

public java.lang.String getGiftlistSite(java.lang.String pGiftlistId)
Return the site id of this giftlist

Parameters:
pGiftlistId - the giftlist in question
Returns:
the site id

addSpecialInstruction

public boolean addSpecialInstruction(java.lang.String pGiftlistId,
                                     java.lang.String pKey,
                                     java.lang.String pValue)
Add a new special instruction to this giftlist

Parameters:
pGiftlistId - The id of the giftlist being changed
pKey - The name of the new specialInstruction
pValue - The value of the instruction
Returns:
true if successful, false otherwise

getSpecialInstruction

public java.util.Map getSpecialInstruction(java.lang.String pGiftlistId)
Return the specialInstructions of this giftlist

Parameters:
pGiftlistId - the giftlist in question
Returns:
the specialInstructions map

setGiftlistItemSite

public boolean setGiftlistItemSite(java.lang.String pGiftlistId,
                                   java.lang.String pGiftlistItemId,
                                   java.lang.String pSiteId)
Set the site of the giftlist item

Parameters:
pGiftlistId - the giftlist containing the item
pGiftlistItemId - the giftlist item in question
pSiteId - The site id of the item
Returns:
true if successful, false otherwise

getGiftlistItemSite

public java.lang.String getGiftlistItemSite(java.lang.String pGiftlistItemId)
Return the site id of this giftlist item

Parameters:
pGiftlistItemId - the giftlist item in question
Returns:
the site id

setGiftlistItemCatalogRefId

public boolean setGiftlistItemCatalogRefId(java.lang.String pGiftlistId,
                                           java.lang.String pGiftlistItemId,
                                           java.lang.String pCatalogRefId)
Set the catalogRefId of the giftlist item

Parameters:
pGiftlistId - the giftlist containing the item
pGiftlistItemId - the giftlist item in question
pCatalogRefId - The catalogRefId of the item
Returns:
true if successful, false otherwise

getGiftlistItemCatalogRefId

public java.lang.String getGiftlistItemCatalogRefId(java.lang.String pGiftlistItemId)
Return the catalogRefId of this giftlist item

Parameters:
pGiftlistItemId - the giftlist item in question
Returns:
the catalogRefId

setGiftlistItemProductId

public boolean setGiftlistItemProductId(java.lang.String pGiftlistId,
                                        java.lang.String pGiftlistItemId,
                                        java.lang.String pProductId)
Set the productId of the giftlist item

Parameters:
pGiftlistId - the giftlist containing the item
pGiftlistItemId - the giftlist item in question
pProductId - The product id for this item
Returns:
true if successful, false otherwise

getGiftlistItemProductId

public java.lang.String getGiftlistItemProductId(java.lang.String pGiftlistItemId)
Return the productId of this giftlist item

Parameters:
pGiftlistItemId - the giftlist item in question
Returns:
the productId

getGiftlistItemId

public java.lang.String getGiftlistItemId(java.lang.String pGiftlistId,
                                          java.lang.String pSkuId)
Return the giftlistItemId if the sku is in the giftlist, null otherwise

Parameters:
pGiftlistId - the giftlist id
pSkuId - the sku id
Returns:
the giftlistItemId

getGiftlistItemId

public java.lang.String getGiftlistItemId(java.lang.String pGiftlistId,
                                          java.lang.String pSkuId,
                                          java.lang.String pProductId,
                                          java.lang.String pSiteId)
Return the giftlistItemId if the sku with the same SKU ID, product ID and site ID is in the giftlist, null otherwise

Parameters:
pGiftlistId - the giftlist id
pSkuId - the sku id
pProductId - the product id
pSiteId - the site id
Returns:
the giftlistItemId

setGiftlistItemDisplayName

public boolean setGiftlistItemDisplayName(java.lang.String pGiftlistId,
                                          java.lang.String pGiftlistItemId,
                                          java.lang.String pDisplayName)
Set the displayName of the giftlist item

Parameters:
pGiftlistId - the giftlist containing the item
pGiftlistItemId - the giftlist item in question
pDisplayName - The displayName for this giftlist item
Returns:
true if successful, false otherwise

getGiftlistItemDisplayName

public java.lang.String getGiftlistItemDisplayName(java.lang.String pGiftlistItemId)
Return the displayName of this giftlist item

Parameters:
pGiftlistItemId - the giftlist item in question
Returns:
the displayName

setGiftlistItemDescription

public boolean setGiftlistItemDescription(java.lang.String pGiftlistId,
                                          java.lang.String pGiftlistItemId,
                                          java.lang.String pDescription)
Set the description of the giftlist item

Parameters:
pGiftlistId - the giftlist containing the item
pGiftlistItemId - the giftlist item in question
pDescription - The new description
Returns:
true if successful, false otherwise

getGiftlistItemDescription

public java.lang.String getGiftlistItemDescription(java.lang.String pGiftlistItemId)
Return the description of this giftlist item

Parameters:
pGiftlistItemId - the giftlist item in question
Returns:
the description

setGiftlistItemQuantityDesired

public boolean setGiftlistItemQuantityDesired(java.lang.String pGiftlistId,
                                              java.lang.String pGiftlistItemId,
                                              long pQuantityDesired)
Set the quantityDesired of the giftlist item

Parameters:
pGiftlistId - the giftlist containing the item
pGiftlistItemId - the giftlist item in question
pQuantityDesired - The quantity of this item that is wanted
Returns:
true if successful, false otherwise

getGiftlistItemQuantityDesired

public long getGiftlistItemQuantityDesired(java.lang.String pGiftlistItemId)
Return the quantityDesired of this giftlist item

Parameters:
pGiftlistItemId - the giftlist item in question
Returns:
the quantityDesired

increaseGiftlistItemQuantityDesired

public boolean increaseGiftlistItemQuantityDesired(java.lang.String pGiftlistId,
                                                   java.lang.String pGiftlistItemId,
                                                   long pQuantity)
Increase the quantityDesired for this giftlist item by the given quantity

Parameters:
pGiftlistId - the giftlist containing the item
pGiftlistItemId - the giftlist item in question
pQuantity - the quantity to increase by
Returns:
true if successful, false otherwise

setGiftlistItemQuantityPurchased

public boolean setGiftlistItemQuantityPurchased(java.lang.String pGiftlistId,
                                                java.lang.String pGiftlistItemId,
                                                long pQuantityPurchased)
Set the quantityPurchased of the giftlist item

Parameters:
pGiftlistId - the giftlist containing the item
pGiftlistItemId - the giftlist item in question
pQuantityPurchased - The amount of this item that have been purchased
Returns:
true if successful, false otherwise

getGiftlistItemQuantityPurchased

public long getGiftlistItemQuantityPurchased(java.lang.String pGiftlistItemId)
Return the quantityPurchased of this giftlist item

Parameters:
pGiftlistItemId - the giftlist item in question
Returns:
the quantityPurchased

increaseGiftlistItemQuantityPurchased

public boolean increaseGiftlistItemQuantityPurchased(java.lang.String pGiftlistId,
                                                     java.lang.String pGiftlistItemId,
                                                     long pQuantity)
Increase the quantityPurchased for this giftlist item by the given quantity

Parameters:
pGiftlistId - the giftlist containing the item
pGiftlistItemId - the giftlist item in question
pQuantity - the quantity to increase by
Returns:
true if successful, false otherwise

decreaseGiftlistItemQuantityPurchased

public boolean decreaseGiftlistItemQuantityPurchased(java.lang.String pGiftlistId,
                                                     java.lang.String pGiftlistItemId,
                                                     long pQuantity)
Decreate the quantityPurchased for this giftlist item by the given quantity

Parameters:
pGiftlistId - the giftlist containing the item
pGiftlistItemId - the giftlist item in question
pQuantity - the quantity to decrease by
Returns:
true if successful, false otherwise

addGiftToOrder

public void addGiftToOrder(RepositoryItem pProfile,
                           Order pOrder,
                           java.lang.String pItemId,
                           ShippingGroup pShippingGroup,
                           long pQuantity,
                           java.lang.String pGiftlistId,
                           java.lang.String pGiftlistItemId)
                    throws CommerceException
Creates a new shipping group based on the given gift list and moves the item from the given shipping group to the new shipping group. The gift list handling instructions are also created on the new shipping group.

This method will attempt to find a gift shipping group in the order with the same address and use it before defaulting to create a brand new shipping group.

If there's a matching gift handling instruction in the shipping group for the same item, gift list and gift item, then the quantity is incremented. If not, a new handling instruction is created.

Parameters:
pProfile - the current commerce profile.
pOrder - the Order to add the CommerceItem to
pItemId - the Commerce Item Id.
pShippingGroup - the Shipping group to move the item from.
pGiftlistId - the giftlist id that the item is purchased from.
pGiftlistItemId - the giftlist item id that is being purchased
Throws:
CommerceException - thrown if an error occurs while accessing the repository

createShippingGroupFromGiftlist

public HardgoodShippingGroup createShippingGroupFromGiftlist(java.lang.String pGiftlistId)
                                                      throws CommerceException
Creates a hardgood shipping address based on the address in the given gift list.

Parameters:
pGiftlistId -
Returns:
HardgppdShippingGroup
Throws:
CommerceException

findGiftShippingGroupWithAddress

protected HardgoodShippingGroup findGiftShippingGroupWithAddress(Order pOrder,
                                                                 java.lang.String pGiftlistId)
Finds a gift shipping group with an address that matches the gift list address

Parameters:
pOrder -
pAddress -
Returns:
matching shipping group

getGiftHandlingInstructionForCommerceItem

public GiftlistHandlingInstruction getGiftHandlingInstructionForCommerceItem(ShippingGroup pShippingGroup,
                                                                             java.lang.String pCommerceItemId,
                                                                             java.lang.String pGiftlistId,
                                                                             java.lang.String pGiftlistItemId)
Returns the gift list handling instruction for the item with a commerce item id, matching gift list id and gift list item id.

Parameters:
pShippingGroup -
pCommerceItemId -
pGiftlistId -
pGiftlistItemId -
Returns:
GiftlistHandlingInstruction

getAllGiftHandlingInstructions

public java.util.Collection getAllGiftHandlingInstructions(Order pOrder)
                                                    throws CommerceException
Returns a Collection of all gift handling instructions in the order.

Parameters:
pOrder - the order to use.
Throws:
CommerceException

getGiftShippingGroups

public java.util.List getGiftShippingGroups(Order pOrder)
                                     throws CommerceException
Returns a list of all shipping groups that contain gifts.

Parameters:
pOrder - the order to use.
Returns:
Throws:
CommerceException

getGiftOnlyShippingGroups

public java.util.List getGiftOnlyShippingGroups(Order pOrder)
                                         throws CommerceException
Returns a list of shipping groups the contain just gifts.

Parameters:
pOrder -
Returns:
List of shipping groups that exclusively contain gifts
Throws:
CommerceException

isGiftOnlyShippingGroup

public boolean isGiftOnlyShippingGroup(ShippingGroup pShippingGroup)
                                throws CommerceException
Determines if the items in the shipping group are all gifts

Parameters:
pShippingGroup -
Returns:
true if the shipping group only contains gifts.
Throws:
CommerceException

getGiftQuantity

public long getGiftQuantity(CommerceItem pCommerceItem,
                            ShippingGroup pShippingGroup)
                     throws CommerceException
Returns the quantity of the CommerceItem that is a gift in the given shipping group

Parameters:
pCommerceItem - the Commerce Item
pShippingGroup - the Shipping Group
Throws:
CommerceException - thrown if an input parameter is invalid

getGiftQuantity

public long getGiftQuantity(Order pOrder,
                            CommerceItem pCommerceItem)
                     throws CommerceException
Returns the quantity of a CommerceItem that should be treated as a gift.

Parameters:
pOrder - the Order containing the CommerceItem
pCommerceItem - the Commerce Item
Throws:
CommerceException - thrown if an input parameter is invalid

isGiftShippingGroup

public boolean isGiftShippingGroup(ShippingGroup pShippingGroup)
Returns true if a shipping group has gift handling instructions

Returns:
boolean true if a shipping group is for gifts

getGiftHandlingForShippingGroup

public java.util.Collection getGiftHandlingForShippingGroup(ShippingGroup pShippingGroup,
                                                            CommerceItem pCommerceItem)
Returns the gift handling instructions for a given item in a given shipping group

Parameters:
pShippingGroup -
pCommerceItem -
Returns:

getGiftQuantityForShippingGroup

public long getGiftQuantityForShippingGroup(ShippingGroup pShippingGroup,
                                            CommerceItem pCommerceItem)
                                     throws CommerceException
Returns the gift quantity for a items relationship to a shipping group.

Parameters:
pShippingGroup -
pCommerceItem -
Returns:
Throws:
CommerceException

adjustGiftsForQuantityDecrease

public void adjustGiftsForQuantityDecrease(Order pOrder,
                                           ShippingGroup pShippingGroup,
                                           CommerceItem pCommerceItem,
                                           long pNewQuantity,
                                           long pQuantityDecrease)
                                    throws CommerceException
Adjusts the gift handling instructions for a decrease of item quantity in a shipping group.

If the item is considered a gift, decrease its gift quantity by the total decrease

Parameters:
pShippingGroup - the affected shipping group
pCommerceItem - the affected commerce item
pNewQuantity - the new quantity of the relationship
pQuantityDecrease - the amount by which the quantity has been decreased.
Throws:
CommerceException

adjustGiftsForQuantityIncrease

public void adjustGiftsForQuantityIncrease(Order pOrder,
                                           ShippingGroup pShippingGroup,
                                           CommerceItem pCommerceItem,
                                           long pNewQuantity,
                                           long pQuantityIncrease)
                                    throws CommerceException
Adjusts the gift handling instructions for an increase of item quantity in a shipping group.

If the item is considered a gift, increase its gift quantity by the total increase

Parameters:
pShippingGroup - the affected shipping group
pCommerceItem - the affected commerce item
pNewQuantity - the new quantity of the relationship
pQuantityIncrease - the amount by which the quantity has been increased.
Throws:
CommerceException

increaseGiftQuantityForItem

public void increaseGiftQuantityForItem(Order pOrder,
                                        ShippingGroup pShippingGroup,
                                        CommerceItem pCommerceItem,
                                        long pQuantityIncrease)
                                 throws CommerceException
Increases the gift quantity for an item in a shipping group.

Parameters:
pOrder - the order
pShippingGroup - the shipping group for which the item contains a gift quantity
pCommerceItem - the commerce item
pQuantityIncrease - the amount by which to increase the quantity
Throws:
CommerceException

decreaseGiftQuantityForItem

public void decreaseGiftQuantityForItem(Order pOrder,
                                        ShippingGroup pShippingGroup,
                                        CommerceItem pCommerceItem,
                                        long pQuantityDecrease)
                                 throws CommerceException
Decreases the gift quantity for an item in a shipping group.

Parameters:
pOrder - the order
pShippingGroup - the shipping group for which the item contains a gift quantity
pCommerceItem - the commerce item
pQuantityDecrease - the amount by which to decrease the quantity
Throws:
CommerceException

areSitesCompatible

protected boolean areSitesCompatible(java.lang.String pSiteId1,
                                     java.lang.String pSiteId2)
Checks if two sites are compatible using GiftlistManager's siteScope setting.

Parameters:
pSiteId1 - the first site id
pSiteId2 - the secont site id
Returns:
boolean indicating if sites are compatible.

areSitesCompatible

protected boolean areSitesCompatible(java.lang.String pSiteId1,
                                     java.lang.String pSiteId2,
                                     java.lang.String pSiteScope)
Checks if two sites are compatible. The sites' compatibility depends on the pSiteScope setting passed to the method. Two sites are always compatible if gift lists are not site limited. If gift lists are limited to one site then two sites are compatible when they are the same. And if gift lists are limited to a sharing group then two sites are compatible when they share the specified shareable type or when one of the site IDs is null.

Parameters:
pSiteId1 - the first site ID
pSiteId2 - the second site ID
pSiteScope - may be "current", "all", or a shareable type ID and indicates whether gift lists are universal or limited to a single site or shareable type
Returns:
boolean indicating if sites are compatible

isGiftlistOwner

protected boolean isGiftlistOwner(java.lang.String pGiftlistId,
                                  java.lang.String pProfileId)
Returns:
true if the profile is the owner of the given gift list