atg.commerce.profile
Class CommerceProfileTools

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.userprofiling.ProfileTools
              extended by atg.commerce.profile.CommerceProfileTools
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

public class CommerceProfileTools
extends ProfileTools

This set of utilities provide additional profile functionality as required by Dynamo Commerce Server (DCS). The functions include creating and editing primary and secondary addresses as well as credit card information for a customer.

See Also:
ProfileTools, CommercePropertyManager

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected static java.lang.String[] CREDIT_CARD_PROPERTIES
           
protected static java.lang.String ID_PROPERTY_NAME
           
protected static java.lang.String LOCK_NAME_ATTRIBUTE_NAME
           
protected  ComponentName mProfilePath
           
protected  ComponentName mShoppingCartPath
           
protected  ComponentName mUserPricingModelsPath
           
protected static java.lang.String NO_CREDIT_CARD
           
protected static int ONE
           
protected static int TWO
           
protected static int ZERO
           
 
Fields inherited from class atg.userprofiling.ProfileTools
DPS_VERSION, DPS_VERSION_NUM, mPasswordGenerator, mPasswordRuleChecker, mPreviousNPasswordManager
 
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
CommerceProfileTools()
          Constructs an CommerceProfileTools object.
 
Method Summary
protected  void acquireTransactionLock()
          Attempt to acquire a local lock before creating a transaction that may modify the order, but only if useLocksAroundTransactions is set to true.
protected  void addActivePromotions(RepositoryItem pGuestUser, RepositoryItem pAuthenticatedUser)
          Copy the active promotions from the guest user to the authenticated user, if the promotion was granted as a result of a coupon claim then follow the same coupon claim logic.
 void addAddressesFromMapProperties(RepositoryItem pProfile, java.lang.String[] pPropertyNames, java.util.List pDestination)
          This method adds addresses from map properties to the all available address list.
 void addCostCenterToUsersList(RepositoryItem pProfile, RepositoryItem pCostCenter)
          Adds the new cost center to the users profile.
 void addCreditCardToUsersMap(RepositoryItem pProfile, RepositoryItem pCreditCard)
          Deprecated.  
 void addCreditCardToUsersMap(RepositoryItem pProfile, RepositoryItem pCreditCard, java.lang.String pNickName)
          Adds the new credit card to the users profile.
 void addProfileGiftlistAddress(RepositoryItem pProfile, java.lang.String pAddressName, RepositoryItem pAddress)
          This method adds a giftlift address to the customer's giftlist address property.
 void addProfileRepositoryAddress(RepositoryItem pProfile, java.lang.String pAddressName, RepositoryItem pAddress)
          This method adds a profile repository address to the customer's secondary addresses or address book.
 void addUniqueAddressToAddressList(java.util.Collection pAddresses, RepositoryItem pNewAddress)
          This method iterates through list of addresses and if any same address found in the collection, this method ends the process and returns.
 boolean areAddressesEqual(java.lang.Object pAddress1, java.lang.Object pAddress2, java.lang.String[] pPropertyNamesToCompare)
          Compares two addresses to determine if they are equal.
 boolean areAddressesEqual(RepositoryItem pAddress1, RepositoryItem pAddress2, java.lang.String[] pPropertyNamesToCompare)
          Compares two contactInfo repository items to determine if they are equal.
 void changeCreditCardNickname(RepositoryItem pProfile, java.lang.String pOldCreditCardNickname, java.lang.String pNewCreditCardNickname)
          Changes credit card nickname in the map of user's credit cards
 void changeSecondaryAddressName(RepositoryItem pProfile, java.lang.String pOldAddressName, java.lang.String pNewAddressName)
          Changes secondary address nickname
 MutableRepositoryItem cloneContactInfoItem(RepositoryItem pContactInfoItem, java.util.Map pExcludedProperties, java.util.Map pPropExceptions, boolean pDeepCopy, java.lang.String pRepositoryId)
          Clones a contact info repository item.
 void copyCreditCard(CreditCard pFromCreditCard, RepositoryItem pToCreditCard)
          Copying a credit card is a two step process.
 void copyCreditCard(RepositoryItem pFromCreditCard, CreditCard pToCreditCard)
          Copying a credit card is a two step process.
 void copyCreditCardToPaymentGroup(java.lang.String pNickname, CreditCard paymentGroup, RepositoryItem pProfile, java.util.Locale pLocale)
          Copy the credit card from the users profile to the payment group.
 void copyCreditCardToProfile(CreditCard pCreditCard, RepositoryItem pProfile)
          Deprecated.  
 void copyCreditCardToProfile(CreditCard pCreditCard, RepositoryItem pProfile, java.lang.String pNickName)
          Copy the credit card passed in the parameter pCreditCard to the profile passed in the parameter pProfile.
 void copyShallowCreditCardProperties(java.lang.Object pFromCreditCard, java.lang.Object pToCreditCard)
          The shallow properties of a credit card are copied.
 java.lang.String createCostCenter(RepositoryItem pProfile, java.lang.String pCostCenterIdentifier, java.lang.String pDescription, boolean isDefault)
          Creates a new cost center in the user's Profile in the costCenter property and optionally adds the cost center as the default.
 MutableRepositoryItem createCreditCardItem(RepositoryItem pProfile)
          Creates a new credit card repository item for the given profile
 java.lang.String createProfileCreditCard(RepositoryItem pProfile, java.util.Map pNewCreditCard, java.lang.String pCreditCardNickname, java.lang.Object pBillingAddress)
          This method constructs a new credit card.
 java.lang.String createProfileRepositoryPrimaryAddress(RepositoryItem pProfile, java.lang.String pAddressProperty, Address pAddress)
          Creates a new address in the user's Profile primary address book.
 java.lang.String createProfileRepositorySecondaryAddress(RepositoryItem pProfile, java.lang.String pAddressName, Address pAddress)
          Creates a new address in the user's Profile (under the secondaryAddresses attribute.
 java.lang.String editCostCenter(RepositoryItem pProfile, java.lang.String pCostCenterIdentifier, java.lang.String pNewDescription, boolean isDefault)
          Changes the properties of a cost center in the user's Profile under the costCenter attribute.
 int findOrderToLoad(java.util.List pOrders)
          Return the index of the order that should be used as the primary order for this user.
 java.lang.String generateUniqueNickname(java.lang.String pNickname)
          This method generates the unique nickname.
 Address getAddressFromRepositoryItem(RepositoryItem pItem)
          This method creates an address object and sets the property values to values in the repository item passed in.
 java.util.List getAllAvailableAddresses(RepositoryItem pProfile)
          This method constructs a consolidated collection of addresses that are associated with the current customer profile.
 java.util.List getAllBillingAddresses(RepositoryItem pProfile)
          This method constructs a consolidated collection of all billing addresses that are associated with the current customer profile.
 java.util.List getAllShippingAddresses(RepositoryItem pProfile)
          This method constructs a consolidated collection of all shipping addresses that are associated with the current customer profile.
 java.lang.String[] getBillingAddressMapProperties()
           
 ClaimableManager getClaimableManager()
          Returns property claimableManager
 java.lang.String[] getCompareAddressPropertyNames()
          Returns the CompareAddressPropertyNames
 RepositoryItem getCostCenterByIdentifier(java.lang.String pCostCenterIdentifier, RepositoryItem pProfile)
          Retrieves cost center by identifier and profile.
 RepositoryItem getCreditCardById(java.lang.String pCreditCardRepositoryId)
          Given an id for credit card to retrieve, grab it out of the users Profile object and return this as a RepositoryItem.
 RepositoryItem getCreditCardByNickname(java.lang.String pCreditCardNickname, RepositoryItem pProfile)
          Retrieves credit card by nickname and profile.
 java.lang.String getCreditCardNickname(RepositoryItem pProfile, RepositoryItem pCreditCard)
          Gets nickname for the given profile's credit card.
 java.lang.String[] getCreditCardProperties()
          Return the creditCardProperties property.
 RepositoryItem getDefaultBillingAddress(RepositoryItem pProfile)
          Get the default Billing address repository item by getting property name from the property manager.
 RepositoryItem getDefaultCreditCard(RepositoryItem pProfile)
          Get the default credit card repository item by getting property name from the property manager.
 java.util.Locale getDefaultLocale()
          Returns property DefaultLocale.
 RepositoryItem getDefaultShippingAddress(RepositoryItem pProfile)
          Get the default shipping address repository item by getting property name from the property manager.
 java.lang.String[] getEmptyAddressPropertyNames()
          Returns the emptyAddressPropertyNames
 atg.service.localeservice.LocaleService getLocaleService()
          Returns property localeService
 java.lang.String getOrderItemDescriptorName()
          Return the orderItemDescriptorName property.
 OrderManager getOrderManager()
          Returns property orderManager
 java.util.Map getPricingParameters()
          This returns the map that will be passed into pricingTools.performPricingOperation as the pExtraParameters.
 PricingTools getPricingTools()
          Returns property pricingTools
 RepositoryItem getProfileAddress(RepositoryItem pProfile, java.lang.String pProfileAddressName)
          Given a nickname for an address to retrieve, grab it out of the users Profile object and return this as a RepositoryItem.
 RepositoryItem getProfileAddressById(java.lang.String pProfileAddressId)
          Given an id for an address to retrieve, grab it out of the users Profile object and return this as a RepositoryItem.
 java.util.Map getProfileAddresses(RepositoryItem pProfile)
          Returns a map of all addresses by id that the user has in their address book.
 java.lang.String getProfileAddressName(RepositoryItem pProfile, RepositoryItem pAddress)
          Gets nickname for the given profile's address.
 java.util.Collection getProfileAddressNames(RepositoryItem pProfile)
          Returns a list of all the names that the user has in their address book.
 RepositoryItem getProfileForOrder(Order pOrder)
          Return the user profile of the user who placed a given order.
 RepositoryItem getProfileForOrder(java.lang.String pOrderId)
          Return the user profile of the user who placed the order with id pOrderId.
 java.lang.String getProfileIdPropertyName()
          Return the ProfileIdPropertyName property.
 MutableRepositoryItem getProfileItem(java.lang.String pProfileId)
          Get the profile repository item for the given user If the given id is null, returns the current user
 java.lang.String getProfilePath()
          Returns property ProfilePath
 PromotionTools getPromotionTools()
          The promotion management utility
 java.lang.String getRepriceOrderPricingOp()
          Returns the pricing operation that should be performed when the order(s) is priced after login.
 java.lang.String[] getShippingAddressMapProperties()
           
 java.lang.String getShoppingCartPath()
          Returns property ShoppingCartPath
 SiteGroupManager getSiteGroupManager()
          Returns the SiteGroupManager
 java.lang.String getSortOrdersByProperty()
          Returns property SortOrdersByProperty
 TransactionLockFactory getTransactionLockFactory()
          The factory used to get the service that is used to get and release locks before modifying the order
 java.lang.String getUniqueAddressNickname(java.lang.Object pAddress, java.util.Collection pNicknames, java.lang.String pNewNickname)
          This method returns a unique address nickname.
 java.lang.String getUniqueCreditCardNickname(java.lang.Object pCreditCard, java.util.Collection pNicknames, java.lang.String pNewNickname)
          This method returns a unique credit card nickname.
 java.lang.String getUniqueCreditCardNickname(java.lang.Object pCreditCard, RepositoryItem pProfile, java.lang.String pNewNickname)
          This method returns a unique credit card nickname.
 java.lang.String getUniqueNickname(java.util.Collection pNickNames, java.lang.String pCurrentNickname)
          This method returns a unique name from profile and a collection of names.
 java.lang.String getUniqueNicknameSeparator()
           
 java.lang.String getUniqueShippingAddressNickname(java.lang.Object pAddress, RepositoryItem pProfile, java.lang.String pNewNickname)
          This method returns a unique shipping address nickname.
 java.util.Locale getUserLocale(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns the locale associated with the request.
 java.lang.String getUserPricingModelsPath()
          Returns property UserPricingModelsPath
 java.util.List getUsersCostCenterList(RepositoryItem pProfile)
          Retrieves list of cost centers for a given profile.
 java.util.Map getUsersCreditCardMap(RepositoryItem pProfile)
          Retrieves map of credit cards for a given profile.
protected  java.util.Map getUsersCreditCardMap(RepositoryItem pProfile, java.lang.String pCreditCardMapPropertyName)
          Retrieves map of credit cards for a given profile and property name.
 boolean isAddressEmpty(java.lang.Object pAddress)
          Determines if the given address is empty.
 boolean isAddressEmpty(RepositoryItem pAddress)
          Determines if the given repository address is empty.
 boolean isAscendingOrder()
          Returns property AscendingOrder
 boolean isCreditCardEmpty(CreditCard pCreditCard)
          Checks to see if a CreditCard object is empty.
 boolean isDuplicateAddressNickName(RepositoryItem pProfile, java.lang.String pNewNickname)
          Determines if the nickname is already in the profile's address map.
 boolean isDuplicateCreditCardNickname(RepositoryItem pProfile, java.lang.String pNewNickname)
          Determines if the nickname is already in the profile's credit card map.
 boolean isDuplicateNickname(java.util.Collection pNicknames, java.lang.String pNewNickname)
          Determines if the nickname is already in the collection.
 boolean isMergeOrders()
          Return the mergeOrders property.
 boolean isRepriceOrderOnLogin()
          Returns property RepriceOrderOnLogin
 boolean isSelectLastModifiedOrder()
          Returns property SelectLastModifiedOrder
 boolean isUseRequestLocale()
          Returns property UseRequestLocale
 void loadShoppingCarts(RepositoryItem pProfile, OrderHolder pShoppingCart)
          This method finds all the shopping carts for the user and places them into the session-scope OrderHolder component.
 void loadShoppingCartsWithLock(RepositoryItem pProfile, OrderHolder pShoppingCart)
          Deprecated. Please use loadShoppingCarts instead
 void loadUserShoppingCartForLogin(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          When an auto-login operation occurs, we attempt to find any old shopping carts from previous sessions.
 void loadUserShoppingCartForLogin(RepositoryItem pProfile, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          When an auto-login operation occurs, we attempt to find any old shopping carts from previous sessions.
 void loadUserShoppingCartForLogin(RepositoryItem pProfile, OrderHolder pShoppingCart, PricingModelHolder pUserPricingModels, java.util.Locale pLocale)
          When a login operation occurs, we attempt to find any old shopping carts from previous sessions.
protected  void persistOrderIfNeeded(Order pOrder)
          If the order is transient and not empty then make it persistent through the Order Manager.
 void persistShoppingCarts(RepositoryItem pProfile, OrderHolder pShoppingCart)
          This method will persist the current and any "saved" shopping carts.
 void persistShoppingCartsWithLock(RepositoryItem pProfile, OrderHolder pShoppingCart)
          Deprecated. use persistShoppingCarts
protected  void postCreateUser(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse, RepositoryItem pProfile, OrderHolder pShoppingCart)
          After registration, any transient orders are made persistent through the persistShoppingCarts method of the CommerceProfileTools component
protected  void postLoginUser(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse, RepositoryItem pProfile, OrderHolder pShoppingCart, PricingModelHolder pPricingModelHolder)
          After logging in the user's session cached promotions are reloaded into the PricingModelHolder.
protected  void releaseTransactionLock()
          Attempt to release a local lock
 void removeAllCostCenters(RepositoryItem pProfile)
          Removes all cost center entries from the users Profile.
 void removeCostCenter(RepositoryItem pProfile, RepositoryItem pCostCenter)
          Removes the cost center entry from the users Profile.
 void removeProfileCreditCard(RepositoryItem pProfile, java.lang.String pCreditCardName)
          Removes credit card from profile's credit cards map.
 void removeProfileRepositoryAddress(RepositoryItem pProfile, java.lang.String pAddressName)
          Removes the named address entry from the users Profile.
 void removeProfileRepositoryAddress(RepositoryItem pProfile, java.lang.String pAddressName, boolean pCheckIfDefault)
          Removes the named address entry from the users Profile.
protected  void repriceOrder(Order pOrder, RepositoryItem pProfile, PricingModelHolder pUserPricingModels, java.util.Locale pLocale, java.lang.String pPricingOperation)
          Reprice a single given order, this calls into the PricingTools.performPricingOperation method.
 void repriceShoppingCarts(RepositoryItem pProfile, OrderHolder pShoppingCart, PricingModelHolder pUserPricingModels, java.util.Locale pLocale)
          Reprice all of the orders in the OrderHolder component
 void repriceShoppingCarts(RepositoryItem pProfile, OrderHolder pShoppingCart, PricingModelHolder pUserPricingModels, java.util.Locale pLocale, java.lang.String pPricingOperation)
          Reprice all of the orders in the OrderHolder component
 void repriceShoppingCarts(RepositoryItem pProfile, OrderHolder pShoppingCart, java.lang.String pPricingOperation, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Reprice all of the orders in the OrderHolder component.
 void repriceShoppingCartsWithLock(RepositoryItem pProfile, OrderHolder pShoppingCart, PricingModelHolder pUserPricingModels, java.util.Locale pLocale, java.lang.String pPricingOperation)
          Deprecated. use repriceShoppingCarts
 void setAscendingOrder(boolean pAscendingOrder)
          Sets property AscendingOrder
 void setBillingAddressMapProperties(java.lang.String[] pBillingAddressMapProperties)
          Sets an array of profile map properties that contain addresses.
 void setClaimableManager(ClaimableManager pClaimableManager)
          Sets property claimableManager
 void setCompareAddressPropertyNames(java.lang.String[] pCompareAddressPropertyNames)
          Sets the CompareAddressPropertyNames
 void setCreditCardProperties(java.lang.String[] pCreditCardProperties)
          Set the creditCardProperties property.
 boolean setDefaultCreditCard(RepositoryItem pProfile, java.lang.String pCreditCardNickname)
          Make the credit card identified by pCreditCardName default in the given profile.
 boolean setDefaultCreditCardIfNull(RepositoryItem pProfile, java.lang.String pCreditCardName)
          Sets specified by nickname credit card as default credit card if profile's default credit card is not specified yet
 void setDefaultLocale(java.util.Locale pDefaultLocale)
          Sets property DefaultLocale
 boolean setDefaultShippingAddress(RepositoryItem pProfile, java.lang.String pAddressName)
          Sets specified by nickname secondary address as default shipping address.
 boolean setDefaultShippingAddressIfNull(RepositoryItem pProfile, java.lang.String pAddressName)
          Sets specified by nickname shipping address as default shipping address if profile's default shipping address is not specified
 void setEmptyAddressPropertyNames(java.lang.String[] pEmptyAddressPropertyNames)
          Sets the emptyAddressPropertyNames
 MutableRepositoryItem setItemPropertyToAddress(RepositoryItem pItem, RepositoryItem pAddress, java.lang.String pPropertyName, java.util.Map pExcludedProperties, java.util.Map pPropExceptions)
          Deprecated.  
 MutableRepositoryItem setItemPropertyToAddress(RepositoryItem pItem, RepositoryItem pAddress, java.lang.String pPropertyName, java.util.Map pExcludedProperties, java.util.Map pPropExceptions, boolean pPerformCloning)
          If desired (based on the performCloning flag), Clones the address item and changes the item's property to reference the clone.
 void setLocaleService(atg.service.localeservice.LocaleService pLocaleService)
          Sets property localeService
 void setMergeOrders(boolean pMergeOrders)
          Set the mergeOrders property.
 void setOrderItemDescriptorName(java.lang.String pOrderItemDescriptorName)
          Set the orderItemDescriptorName property.
 void setOrderManager(OrderManager pOrderManager)
          Sets property orderManager
 void setPricingTools(PricingTools pPricingTools)
          Sets property pricingTools
 void setProfileIdPropertyName(java.lang.String pProfileIdPropertyName)
          Set the ProfileIdPropertyName property.
 void setProfilePath(java.lang.String pProfilePath)
          Sets property ProfilePath
 void setPromotionTools(PromotionTools pPromotionTools)
           
 void setRepriceOrderOnLogin(boolean pRepriceOrderOnLogin)
          Sets property RepriceOrderOnLogin
 void setRepriceOrderPricingOp(java.lang.String pRepriceOrderPricingOp)
          This property should be set to the type of pricing operation that should be executed when the order(s) is repriced after login.
 void setSelectLastModifiedOrder(boolean pSelectLastModifiedOrder)
          If set to true will return the order that was last modified in the list of open orders for the user.
 void setShippingAddressMapProperties(java.lang.String[] pShippingAddressMapProperties)
          Sets an array of profile map properties that contain addresses.
 void setShoppingCartPath(java.lang.String pShoppingCartPath)
          Sets property ShoppingCartPath
 void setSiteGroupManager(SiteGroupManager pSiteGroupManager)
          Sets the SiteGroupManager
 void setSortOrdersByProperty(java.lang.String pSortOrdersByProperty)
          Sets property SortOrdersByProperty
 void setTransactionLockFactory(TransactionLockFactory pTransactionLockFactory)
           
 void setUniqueNicknameSeparator(java.lang.String pUniqueNicknameSeparator)
           
 void setUseRequestLocale(boolean pUseRequestLocale)
          Sets property UseRequestLocale
 void setUserPricingModelsPath(java.lang.String pUserPricingModelsPath)
          Sets property UserPricingModelsPath
 boolean shouldLoadShoppingCarts(OrderHolder pShoppingCart)
          Returns whether shopping carts should be loaded.
protected  void updateOrderProfileId(Order pOrder, RepositoryItem pProfile)
          This method makes sure the profile id of the order is the same as the current user.
 void updateProfileCreditCard(RepositoryItem pCardToUpdate, RepositoryItem pProfile, java.util.Map pUpdatedCreditCard, java.lang.String pNewCreditCardNickname, java.util.Map pBillingAddress, java.lang.String pBillingAddressClassName)
          Updates profile's credit card.
 void updateProfileRepositoryAddress(RepositoryItem pRepositoryAddress, Address pAddress)
          updates a repository address item with values in address object passed in.
 
Methods inherited from class atg.userprofiling.ProfileTools
addMultiPropertyValues, assumeSecurityIdentity, assumeSecurityIdentity, buildPropertyUpdatesForDictionary, buildPropertyUpdatesForRepositoryFormList, buildPropertyUpdatesForRepositoryFormMap, buildUpdateMessage, buildUpdateMessage, changePassword, changePassword, convertNewValueToString, convertOldValueToString, convertPropertyUpdateValueToString, createNewUser, createNewUser, createPropertyUpdate, doStartService, formatMultiValueUpdateString, generateEmailQuery, generateLoginQuery, generateNameQuery, generateNewPasswordForProfile, getAutoLogin, getCookieManager, getDefaultProfileType, getGroupContainer, getIllegalPasswordChecker, getItem, getItem, getItemFromEmail, getItemFromEmail, getItems, getItems, getItemsFromEmail, getItemsFromEmail, getLoggingIdentifier, getLogin, getLoginUserAuthority, getMutableItem, getPassword, getPasswordGenerationTriesLimit, getPasswordGenerator, getPasswordRuleChecker, getPreviousNPasswordManager, getProfileEventTrigger, getProfileItemFinder, getProfileRepository, getPropertyManager, getSecurityStatus, getUserLoginManager, isAutoLoginSecurityStatus, isEnableSecurityStatus, isValidCredentials, isValidCredentials, isValidCredentials, isValidCredentials, isValidCredentialsEncrypted, locateUserFromEmail, locateUserFromEmail, locateUserFromId, locateUserFromId, locateUserFromLogin, locateUserFromLogin, locateUserFromLogin, locateUserFromLogin, main, passwordSaltForLogin, prefixPropertyNames, propagateLocale, revokeSecurityIdentity, revokeSecurityIdentity, sendEmailToUser, setAutoLoginSecurityStatus, setCookieManager, setDefaultProfileType, setEnableSecurityStatus, setGroupContainer, setIllegalPasswordChecker, setLoginSecurityStatus, setLoginUserAuthority, setPasswordGenerationTriesLimit, setPasswordGenerator, setPasswordRuleChecker, setPreviousNPasswordManager, setProfileEventTrigger, setProfileItemFinder, setProfileRepository, setPropertyManager, setSecurityStatus, setUserLoginManager, shouldSendProfileCookies, toString, updateProperties, updateProperty
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, 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, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values

ZERO

protected static final int ZERO
See Also:
Constant Field Values

ONE

protected static final int ONE
See Also:
Constant Field Values

TWO

protected static final int TWO
See Also:
Constant Field Values

CREDIT_CARD_PROPERTIES

protected static final java.lang.String[] CREDIT_CARD_PROPERTIES

NO_CREDIT_CARD

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

LOCK_NAME_ATTRIBUTE_NAME

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

ID_PROPERTY_NAME

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

mUserPricingModelsPath

protected ComponentName mUserPricingModelsPath

mShoppingCartPath

protected ComponentName mShoppingCartPath

mProfilePath

protected ComponentName mProfilePath
Constructor Detail

CommerceProfileTools

public CommerceProfileTools()
Constructs an CommerceProfileTools object.

Method Detail

getOrderManager

public OrderManager getOrderManager()
Returns property orderManager

Returns:
returns property orderManager

setOrderManager

public void setOrderManager(OrderManager pOrderManager)
Sets property orderManager

Parameters:
pOrderManager - the value to set for property orderManager

getClaimableManager

public ClaimableManager getClaimableManager()
Returns property claimableManager

Returns:
returns property claimableManager

setClaimableManager

public void setClaimableManager(ClaimableManager pClaimableManager)
Sets property claimableManager

Parameters:
pClaimableManager - the value to set for property claimableManager

getLocaleService

public atg.service.localeservice.LocaleService getLocaleService()
Returns property localeService

Returns:
returns property localeService

setLocaleService

public void setLocaleService(atg.service.localeservice.LocaleService pLocaleService)
Sets property localeService

Parameters:
pLocaleService - the value to set for property localeService

getSiteGroupManager

public SiteGroupManager getSiteGroupManager()
Returns the SiteGroupManager

Returns:
returns property siteGroupManager

setSiteGroupManager

public void setSiteGroupManager(SiteGroupManager pSiteGroupManager)
Sets the SiteGroupManager

Parameters:
pSiteGroupManager - the value to set for property siteGroupManager

getPricingTools

public PricingTools getPricingTools()
Returns property pricingTools

Returns:
returns property pricingTools

setPricingTools

public void setPricingTools(PricingTools pPricingTools)
Sets property pricingTools

Parameters:
pPricingTools - the value to set for property pricingTools

setUserPricingModelsPath

public void setUserPricingModelsPath(java.lang.String pUserPricingModelsPath)
Sets property UserPricingModelsPath


getUserPricingModelsPath

public java.lang.String getUserPricingModelsPath()
Returns property UserPricingModelsPath


setShoppingCartPath

public void setShoppingCartPath(java.lang.String pShoppingCartPath)
Sets property ShoppingCartPath


getShoppingCartPath

public java.lang.String getShoppingCartPath()
Returns property ShoppingCartPath


setProfilePath

public void setProfilePath(java.lang.String pProfilePath)
Sets property ProfilePath


getProfilePath

public java.lang.String getProfilePath()
Returns property ProfilePath


setMergeOrders

public void setMergeOrders(boolean pMergeOrders)
Set the mergeOrders property.


isMergeOrders

public boolean isMergeOrders()
Return the mergeOrders property.


setSelectLastModifiedOrder

public void setSelectLastModifiedOrder(boolean pSelectLastModifiedOrder)
If set to true will return the order that was last modified in the list of open orders for the user. If it is set to false, the behavior of selecting the first non-explicitly saved order is used instead. The default is set to true.


isSelectLastModifiedOrder

public boolean isSelectLastModifiedOrder()
Returns property SelectLastModifiedOrder


setSortOrdersByProperty

public void setSortOrdersByProperty(java.lang.String pSortOrdersByProperty)
Sets property SortOrdersByProperty


getSortOrdersByProperty

public java.lang.String getSortOrdersByProperty()
Returns property SortOrdersByProperty


setAscendingOrder

public void setAscendingOrder(boolean pAscendingOrder)
Sets property AscendingOrder


isAscendingOrder

public boolean isAscendingOrder()
Returns property AscendingOrder


setRepriceOrderOnLogin

public void setRepriceOrderOnLogin(boolean pRepriceOrderOnLogin)
Sets property RepriceOrderOnLogin


isRepriceOrderOnLogin

public boolean isRepriceOrderOnLogin()
Returns property RepriceOrderOnLogin


setDefaultLocale

public void setDefaultLocale(java.util.Locale pDefaultLocale)
Sets property DefaultLocale


getDefaultLocale

public java.util.Locale getDefaultLocale()
Returns property DefaultLocale. If the property value is null, then JVM's default locale is returned.


setUseRequestLocale

public void setUseRequestLocale(boolean pUseRequestLocale)
Sets property UseRequestLocale


isUseRequestLocale

public boolean isUseRequestLocale()
Returns property UseRequestLocale


setRepriceOrderPricingOp

public void setRepriceOrderPricingOp(java.lang.String pRepriceOrderPricingOp)
This property should be set to the type of pricing operation that should be executed when the order(s) is repriced after login. The operations which are acceptable are defined in the atg.commerce.pricing.PricingConstants interface. They include: If this value is null, then the system will default to ORDER_TOTAL.


getRepriceOrderPricingOp

public java.lang.String getRepriceOrderPricingOp()
Returns the pricing operation that should be performed when the order(s) is priced after login.


setCreditCardProperties

public void setCreditCardProperties(java.lang.String[] pCreditCardProperties)
Set the creditCardProperties property.


getCreditCardProperties

public java.lang.String[] getCreditCardProperties()
Return the creditCardProperties property.


setOrderItemDescriptorName

public void setOrderItemDescriptorName(java.lang.String pOrderItemDescriptorName)
Set the orderItemDescriptorName property.


getOrderItemDescriptorName

public java.lang.String getOrderItemDescriptorName()
Return the orderItemDescriptorName property.


setProfileIdPropertyName

public void setProfileIdPropertyName(java.lang.String pProfileIdPropertyName)
Set the ProfileIdPropertyName property.


getProfileIdPropertyName

public java.lang.String getProfileIdPropertyName()
Return the ProfileIdPropertyName property.


getEmptyAddressPropertyNames

public java.lang.String[] getEmptyAddressPropertyNames()
Returns the emptyAddressPropertyNames


setEmptyAddressPropertyNames

public void setEmptyAddressPropertyNames(java.lang.String[] pEmptyAddressPropertyNames)
Sets the emptyAddressPropertyNames


getCompareAddressPropertyNames

public java.lang.String[] getCompareAddressPropertyNames()
Returns the CompareAddressPropertyNames


setCompareAddressPropertyNames

public void setCompareAddressPropertyNames(java.lang.String[] pCompareAddressPropertyNames)
Sets the CompareAddressPropertyNames

These property names are used to compare two address to one another.

See Also:
areAddressesEqual(atg.repository.RepositoryItem, atg.repository.RepositoryItem, java.lang.String[])

setPromotionTools

public void setPromotionTools(PromotionTools pPromotionTools)

getPromotionTools

public PromotionTools getPromotionTools()
The promotion management utility


setTransactionLockFactory

public void setTransactionLockFactory(TransactionLockFactory pTransactionLockFactory)

getTransactionLockFactory

public TransactionLockFactory getTransactionLockFactory()
The factory used to get the service that is used to get and release locks before modifying the order


getUniqueNicknameSeparator

public java.lang.String getUniqueNicknameSeparator()
Returns:
Returns the uniqueNicknameSeparator.

setUniqueNicknameSeparator

public void setUniqueNicknameSeparator(java.lang.String pUniqueNicknameSeparator)
Parameters:
pUniqueNicknameSeparator - The uniqueNicknameSeparator to set.

getBillingAddressMapProperties

public java.lang.String[] getBillingAddressMapProperties()
Returns:
the billingAddressMapProperties

setBillingAddressMapProperties

public void setBillingAddressMapProperties(java.lang.String[] pBillingAddressMapProperties)
Sets an array of profile map properties that contain addresses. These addresses will be included to obtain list of all available billing addresses.

Parameters:
pBillingAddressMapProperties - The billingAddressMapProperties to set.

getShippingAddressMapProperties

public java.lang.String[] getShippingAddressMapProperties()
Returns:
the shippingAddressMapProperties

setShippingAddressMapProperties

public void setShippingAddressMapProperties(java.lang.String[] pShippingAddressMapProperties)
Sets an array of profile map properties that contain addresses. These addresses will be included to obtain list of all available shipping addresses.

Parameters:
pShippingAddressMapProperties - The shippingAddressMapProperties to set.
See Also:
this.getAllAvailableAddresses()

shouldLoadShoppingCarts

public boolean shouldLoadShoppingCarts(OrderHolder pShoppingCart)
Returns whether shopping carts should be loaded. By default this returns true if PersistOrders is true. Subclasses may override this method to implement different behavior if necessary.


getProfileAddressNames

public java.util.Collection getProfileAddressNames(RepositoryItem pProfile)
Returns a list of all the names that the user has in their address book. This list is composed of the nicknames from this book as well as the default shipping/billing address that are associated with the Profile object. The "names" given to the default shipping/billing address are defined by the propeties DefaultBillingAddrName and DefaultShippingAddrName.

Parameters:
pProfile - the customer profile.
Returns:
the collection of address names

getProfileAddresses

public java.util.Map getProfileAddresses(RepositoryItem pProfile)
Returns a map of all addresses by id that the user has in their address book. The list is componsed of both primary and secondary addresses.

Parameters:
pProfile - the customer profile.
Returns:
the collection of address names

createProfileRepositorySecondaryAddress

public java.lang.String createProfileRepositorySecondaryAddress(RepositoryItem pProfile,
                                                                java.lang.String pAddressName,
                                                                Address pAddress)
                                                         throws RepositoryException
Creates a new address in the user's Profile (under the secondaryAddresses attribute. Only the name is filled in. All other values will be filled in later when the user goes to the "Detail Shipping Addresses" screen.

Parameters:
pProfile - the customer profile.
pAddressName - The name of the new address in the address book.
pAddress - The Address object.
Returns:
the repository address id
Throws:
RepositoryException - if there was an error when creating the new repository item.

createProfileRepositoryPrimaryAddress

public java.lang.String createProfileRepositoryPrimaryAddress(RepositoryItem pProfile,
                                                              java.lang.String pAddressProperty,
                                                              Address pAddress)
                                                       throws RepositoryException
Creates a new address in the user's Profile primary address book.

Parameters:
pProfile - the customer profile.
pAddressProperty - The name of the Profile property that will hold the new address.
pAddress - The Address object.
Returns:
the repository address id
Throws:
RepositoryException - if there was an error when creating the new repository item.

updateProfileRepositoryAddress

public void updateProfileRepositoryAddress(RepositoryItem pRepositoryAddress,
                                           Address pAddress)
                                    throws RepositoryException
updates a repository address item with values in address object passed in.

Parameters:
pRepositoryAddress - the repository address
pAddress - the address object
Throws:
RepositoryException - if there was an error when creating the new repository item.

getProfileAddress

public RepositoryItem getProfileAddress(RepositoryItem pProfile,
                                        java.lang.String pProfileAddressName)
Given a nickname for an address to retrieve, grab it out of the users Profile object and return this as a RepositoryItem.

Parameters:
pProfile - the customer profile.
pProfileAddressName - nickname for a users address object
Returns:
the address object

getProfileAddressById

public RepositoryItem getProfileAddressById(java.lang.String pProfileAddressId)
Given an id for an address to retrieve, grab it out of the users Profile object and return this as a RepositoryItem.

Parameters:
pProfileAddressId - id for a users address object
Returns:
the address object

getCreditCardById

public RepositoryItem getCreditCardById(java.lang.String pCreditCardRepositoryId)
Given an id for credit card to retrieve, grab it out of the users Profile object and return this as a RepositoryItem.

Parameters:
pCreditCardRepositoryId - id for a users credit card object
Returns:
the credit card object

getProfileItem

public MutableRepositoryItem getProfileItem(java.lang.String pProfileId)
                                     throws RepositoryException
Get the profile repository item for the given user If the given id is null, returns the current user

Parameters:
pProfileId - The profile id to look for
Returns:
The repository item for the given profile. null if the id is invalid
Throws:
RepositoryException

getCreditCardByNickname

public RepositoryItem getCreditCardByNickname(java.lang.String pCreditCardNickname,
                                              RepositoryItem pProfile)
Retrieves credit card by nickname and profile.

Parameters:
pCreditCardNickname - the credit card nickname.
pProfile - the customer profile.
Returns:
the credit card repository item.

getUsersCreditCardMap

public java.util.Map getUsersCreditCardMap(RepositoryItem pProfile)
Retrieves map of credit cards for a given profile.

Parameters:
pProfile - the customer profile.
Returns:
the map of credit cards

getUsersCreditCardMap

protected java.util.Map getUsersCreditCardMap(RepositoryItem pProfile,
                                              java.lang.String pCreditCardMapPropertyName)
Retrieves map of credit cards for a given profile and property name.

Parameters:
pProfile - the customer profile.
pCreditCardMapPropertyName - the name of the credit card map property name
Returns:
the map of credit cards

createCreditCardItem

public MutableRepositoryItem createCreditCardItem(RepositoryItem pProfile)
                                           throws RepositoryException
Creates a new credit card repository item for the given profile

Parameters:
pProfile - the customer profile.
Returns:
The new credit card repository item.
Throws:
RepositoryException - if there was an error when creating the new repository item.

addCreditCardToUsersMap

public void addCreditCardToUsersMap(RepositoryItem pProfile,
                                    RepositoryItem pCreditCard)
Deprecated. 

Adds the new credit card to the users profile.

Parameters:
pProfile - the customer profile.
pCreditCard - the credit card.

addCreditCardToUsersMap

public void addCreditCardToUsersMap(RepositoryItem pProfile,
                                    RepositoryItem pCreditCard,
                                    java.lang.String pNickName)
Adds the new credit card to the users profile.

Parameters:
pProfile - the customer profile.
pCreditCard - the credit card.

getAddressFromRepositoryItem

public Address getAddressFromRepositoryItem(RepositoryItem pItem)
                                     throws RepositoryException
This method creates an address object and sets the property values to values in the repository item passed in.

Parameters:
pItem - the repository item
Returns:
address the address object with data from repository
Throws:
RepositoryException - if there was an error when creating the new repository item.

addProfileRepositoryAddress

public void addProfileRepositoryAddress(RepositoryItem pProfile,
                                        java.lang.String pAddressName,
                                        RepositoryItem pAddress)
                                 throws RepositoryException
This method adds a profile repository address to the customer's secondary addresses or address book.

Parameters:
pProfile - the profile of the user.
pAddressName - The name of the new address entry in address book.
pAddress - The address to add to the address book.
Throws:
RepositoryException - if there was an error when creating the new repository item.

removeProfileRepositoryAddress

public void removeProfileRepositoryAddress(RepositoryItem pProfile,
                                           java.lang.String pAddressName)
                                    throws RepositoryException
Removes the named address entry from the users Profile. First, check to see if its the default billing or shipping address, if it is then remove those. Else, its in the users secondary address map so obtain those entries and remove.

Parameters:
pProfile - profile from which the named address will be removed
pAddressName - the nickname of the address that will be removed
Throws:
RepositoryException - if there was an error when creating the new repository item.

removeProfileRepositoryAddress

public void removeProfileRepositoryAddress(RepositoryItem pProfile,
                                           java.lang.String pAddressName,
                                           boolean pCheckIfDefault)
                                    throws RepositoryException
Removes the named address entry from the users Profile. First, check to see if its the default billing or shipping address, if it is then remove those. Else, its in the users secondary address map so obtain those entries and remove. If address in the user's secondary address map and pCheckIfDefault is true then checks if it is also default shipping address and if so sets default shipping address to null

Parameters:
pProfile - profile from which the named address will be removed
pAddressName - the nickname of the address that will be removed
pCheckIfDefault - if true checks if secondary address that should be removed is also is default shipping address
Throws:
RepositoryException - if there was an error when creating the new repository item.

addProfileGiftlistAddress

public void addProfileGiftlistAddress(RepositoryItem pProfile,
                                      java.lang.String pAddressName,
                                      RepositoryItem pAddress)
                               throws RepositoryException
This method adds a giftlift address to the customer's giftlist address property.

Parameters:
pProfile - the profile of the user.
pAddressName - The name of the new address entry in address book.
pAddress - The address to add to the address book.
Throws:
RepositoryException - if there was an error when creating the new repository item.

isAddressEmpty

public boolean isAddressEmpty(RepositoryItem pAddress)
Determines if the given repository address is empty. The notion of empty can vary, but in this implementation the properties are obtained from the emptyAddressPropertyNames property in this class. If all of them are null or have no characters then the address is considered empty. Override this method if the notion of empty should be different.

Parameters:
pAddress - a value of type RepositoryItem
Returns:
true if the address is empty, false otherwise

isAddressEmpty

public boolean isAddressEmpty(java.lang.Object pAddress)
Determines if the given address is empty. The notion of empty can vary, but in this implementation the properties are obtained from the emptyAddressPropertyNames property in this class. If all of them are null or have no characters then the address is considered empty. Override this method if the notion of empty should be different.

Parameters:
pAddress - a value of type Object
Returns:
true if the address is empty, false otherwise

getDefaultShippingAddress

public RepositoryItem getDefaultShippingAddress(RepositoryItem pProfile)
Get the default shipping address repository item by getting property name from the property manager.

Parameters:
pProfile - profile that shipping address will be extracted from
Returns:
the shipping address

getDefaultBillingAddress

public RepositoryItem getDefaultBillingAddress(RepositoryItem pProfile)
Get the default Billing address repository item by getting property name from the property manager.

Parameters:
pProfile - profile that Billing address will be extracted from
Returns:
the Billing address

getDefaultCreditCard

public RepositoryItem getDefaultCreditCard(RepositoryItem pProfile)
Get the default credit card repository item by getting property name from the property manager.

Parameters:
pProfile - profile that will be extracted from
Returns:
the Credit Card

areAddressesEqual

public boolean areAddressesEqual(RepositoryItem pAddress1,
                                 RepositoryItem pAddress2,
                                 java.lang.String[] pPropertyNamesToCompare)
Compares two contactInfo repository items to determine if they are equal.

True is returned if the two items are the same repository item.

Also compares the values of each property defined in the compareAddressPropertyNames array if an array of property names is not provided.

Case is ignored for string comparisons.

Parameters:
pAddress1 - address to compare to pAddress2
pAddress2 - address to compare to pAddress1
pPropertyNamesToCompare - array of property names to use in the comparison. If null the properties defined by compareAddressPropertyNames are used.
Returns:
true if the addresses are considered equal

areAddressesEqual

public boolean areAddressesEqual(java.lang.Object pAddress1,
                                 java.lang.Object pAddress2,
                                 java.lang.String[] pPropertyNamesToCompare)
Compares two addresses to determine if they are equal. This method is used to compare any two address objects. Compares the values of each property defined in the compareAddressPropertyNames array if an array of property names is not provided.

Case is ignored for string comparisons.

Parameters:
pAddress1 - address to compare to pAddress2
pAddress2 - address to compare to pAddress1
pPropertyNamesToCompare - array of property names to use in the comparison. If null the properties defined by compareAddressPropertyNames are used.
Returns:
true if the addresses are considered equal

loadUserShoppingCartForLogin

public void loadUserShoppingCartForLogin(DynamoHttpServletRequest pRequest,
                                         DynamoHttpServletResponse pResponse)
                                  throws javax.servlet.ServletException,
                                         java.io.IOException
When an auto-login operation occurs, we attempt to find any old shopping carts from previous sessions. In this process we may move items from any transient shopping carts to their previous persistent shopping carts. However if the mergeOrders property is to set false (default true), then we persist any existing transient shopping carts that may have built up while navigating as an anonymous user. All the shopping carts are also repriced to make sure that their prices are up to date. This can be toggeled through the repriceOrderOnLogin property. This method will resolve the Profile out of the request, plus the user's session-scoped pricing model holder, order holder, and their locale.

Parameters:
pRequest - the request object that the login operation occurs within
pResponse - the response object that the login operation occurs within
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

loadUserShoppingCartForLogin

public void loadUserShoppingCartForLogin(RepositoryItem pProfile,
                                         DynamoHttpServletRequest pRequest,
                                         DynamoHttpServletResponse pResponse)
                                  throws javax.servlet.ServletException,
                                         java.io.IOException
When an auto-login operation occurs, we attempt to find any old shopping carts from previous sessions. In this process we may move items from any transient shopping carts to their previous persistent shopping carts. However if the mergeOrders property is to set false (default true), then we persist any existing transient shopping carts that may have built up while navigating as an anonymous user. All the shopping carts are also repriced to make sure that their prices are up to date. This can be toggeled through the repriceOrderOnLogin property. This method will use the supplied Profile, and resolve the user's session-scoped pricing model holder, order holder, and their locale.

Parameters:
pProfile - the user who under went auto-login
pRequest - the request object that the login operation occurs within
pResponse - the response object that the login operation occurs within
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

loadUserShoppingCartForLogin

public void loadUserShoppingCartForLogin(RepositoryItem pProfile,
                                         OrderHolder pShoppingCart,
                                         PricingModelHolder pUserPricingModels,
                                         java.util.Locale pLocale)
                                  throws CommerceException
When a login operation occurs, we attempt to find any old shopping carts from previous sessions. In this process we may move items from any transient shopping carts to their previous persistent shopping carts. However if the mergeOrders property is to set false (default true), then we persist any existing transient shopping carts that may have built up while navigating as an anonymous user. All the shopping carts are also repriced to make sure that their prices are up to date. This can be toggeled through the repriceOrderOnLogin property.

Parameters:
pProfile - the user profile
pShoppingCart - the OrderHolder component for this user
pUserPricingModels - the pricing models for this user
pLocale - the locale of the user
Throws:
CommerceException - is any errors occur while loading, repricing or persisting the shopping carts

loadShoppingCarts

public void loadShoppingCarts(RepositoryItem pProfile,
                              OrderHolder pShoppingCart)
                       throws CommerceException
This method finds all the shopping carts for the user and places them into the session-scope OrderHolder component. "Shopping Carts" are defined to be orders whose state is INCOMPLETE. Only orders that are allowed to share the shopping cart with the current site are found. The orders are sorted by last activity date, and the last order touched is made the current order. This method will optionally merge the current shopping cart for the session (from the OrderHolder.current property) with the first persistent order loaded from the database. This functionality is toggeled through the mergeOrders property of this component. NOTE: This method used to acquire a transaction lock, but we've found deadlock issues and have decided to remove the locks. See bug 146012. This method now performs its actions without a lock.

Parameters:
pProfile - the user profile
pShoppingCart - the OrderHolder component for this user
Throws:
CommerceException - is any errors occur while loading the shopping carts

loadShoppingCartsWithLock

public void loadShoppingCartsWithLock(RepositoryItem pProfile,
                                      OrderHolder pShoppingCart)
                               throws CommerceException
Deprecated. Please use loadShoppingCarts instead

Parameters:
pProfile - the user profile
pShoppingCart - the OrderHolder component for this user
Throws:
CommerceException - is any errors occur while loading the shopping carts

repriceShoppingCarts

public void repriceShoppingCarts(RepositoryItem pProfile,
                                 OrderHolder pShoppingCart,
                                 java.lang.String pPricingOperation,
                                 DynamoHttpServletRequest pRequest,
                                 DynamoHttpServletResponse pResponse)
                          throws javax.servlet.ServletException,
                                 java.io.IOException,
                                 CommerceException
Reprice all of the orders in the OrderHolder component. The locale and the UserPricingModels component are resolved out of the request object

Parameters:
pProfile - the user profile
pShoppingCart - the OrderHolder component for this user
pPricingOperation -
pRequest -
pResponse -
Throws:
CommerceException - is any errors occur while repricing the shopping carts
javax.servlet.ServletException
java.io.IOException

repriceShoppingCarts

public void repriceShoppingCarts(RepositoryItem pProfile,
                                 OrderHolder pShoppingCart,
                                 PricingModelHolder pUserPricingModels,
                                 java.util.Locale pLocale)
                          throws CommerceException
Reprice all of the orders in the OrderHolder component

Parameters:
pProfile - the user profile
pShoppingCart - the OrderHolder component for this user
pUserPricingModels - the pricing models for this user
pLocale - the locale of the user
Throws:
CommerceException - is any errors occur while repricing the shopping carts

repriceShoppingCarts

public void repriceShoppingCarts(RepositoryItem pProfile,
                                 OrderHolder pShoppingCart,
                                 PricingModelHolder pUserPricingModels,
                                 java.util.Locale pLocale,
                                 java.lang.String pPricingOperation)
                          throws CommerceException
Reprice all of the orders in the OrderHolder component

Parameters:
pProfile - the user profile
pShoppingCart - the OrderHolder component for this user
pUserPricingModels - the pricing models for this user
pLocale - the locale of the user
pPricingOperation - The operations which are acceptable are defined in the atg.commerce.pricing.PricingConstants interface. They include:
  • PricingConstants.OP_REPRICE_ORDER_TOTAL -> ORDER_TOTAL
  • PricingConstants.OP_REPRICE_ORDER_SUBTOTAL -> ORDER_SUBTOTAL
  • PricingConstants.OP_REPRICE_ORDER_SUBTOTAL_SHIPPING -> ORDER_SUBTOTAL_SHIPPING
  • PricingConstants.OP_REPRICE_ORDER_SUBTOTAL_TAX -> ORDER_SUBTOTAL_TAX
  • PricingConstants.OP_REPRICE_ITEMS -> ITEMS
  • PricingConstants.OP_REPRICE_SHIPPING -> SHIPPING
  • PricingConstants.OP_REPRICE_ORDER -> ORDER
  • PricingConstants.OP_REPRICE_TAX -> TAX
  • PricingConstants.OP_NO_REPRICE -> NO_REPRICE
NOTE: This method used to acquire a transaction lock, but we've found deadlock issues and have decided to remove the locks. See bug 146012. This method now performs its actions without a lock.
Throws:
CommerceException - is any errors occur while repricing the shopping carts

repriceShoppingCartsWithLock

public void repriceShoppingCartsWithLock(RepositoryItem pProfile,
                                         OrderHolder pShoppingCart,
                                         PricingModelHolder pUserPricingModels,
                                         java.util.Locale pLocale,
                                         java.lang.String pPricingOperation)
                                  throws CommerceException
Deprecated. use repriceShoppingCarts

Throws:
CommerceException - is any errors occur while repricing the shopping carts

repriceOrder

protected void repriceOrder(Order pOrder,
                            RepositoryItem pProfile,
                            PricingModelHolder pUserPricingModels,
                            java.util.Locale pLocale,
                            java.lang.String pPricingOperation)
                     throws CommerceException
Reprice a single given order, this calls into the PricingTools.performPricingOperation method.

Parameters:
pOrder - the order to reprice
pProfile - the user profile
pUserPricingModels - the pricing models for this user
pLocale - the locale of the user
pPricingOperation - The operations which are acceptable are defined in the atg.commerce.pricing.PricingConstants interface. They include:
  • PricingConstants.OP_REPRICE_ORDER_TOTAL -> ORDER_TOTAL
  • PricingConstants.OP_REPRICE_ORDER_SUBTOTAL -> ORDER_SUBTOTAL
  • PricingConstants.OP_REPRICE_ORDER_SUBTOTAL_SHIPPING -> ORDER_SUBTOTAL_SHIPPING
  • PricingConstants.OP_REPRICE_ORDER_SUBTOTAL_TAX -> ORDER_SUBTOTAL_TAX
  • PricingConstants.OP_REPRICE_ITEMS -> ITEMS
  • PricingConstants.OP_REPRICE_SHIPPING -> SHIPPING
  • PricingConstants.OP_REPRICE_ORDER -> ORDER
  • PricingConstants.OP_REPRICE_TAX -> TAX
  • PricingConstants.OP_NO_REPRICE -> NO_REPRICE
Throws:
CommerceException - is any errors occur while repricing the shopping carts
See Also:
PricingTools

getPricingParameters

public java.util.Map getPricingParameters()
This returns the map that will be passed into pricingTools.performPricingOperation as the pExtraParameters. The default implementation of this is to return a new HashMap

Returns:
A new empty HashMap

persistShoppingCarts

public void persistShoppingCarts(RepositoryItem pProfile,
                                 OrderHolder pShoppingCart)
                          throws CommerceException
This method will persist the current and any "saved" shopping carts. NOTE: This method used to acquire a transaction lock, but we've found deadlock issues and have decided to remove the locks. See bug 146012. This method now performs its actions without a lock.

Parameters:
pProfile - the user profile
pShoppingCart - the OrderHolder component for this user
Throws:
CommerceException - is any errors occur while persisting the shopping carts

persistShoppingCartsWithLock

public void persistShoppingCartsWithLock(RepositoryItem pProfile,
                                         OrderHolder pShoppingCart)
                                  throws CommerceException
Deprecated. use persistShoppingCarts

Parameters:
pProfile - the user profile
pShoppingCart - the OrderHolder component for this user
Throws:
CommerceException - is any errors occur while persisting the shopping carts

getUserLocale

public java.util.Locale getUserLocale(DynamoHttpServletRequest pRequest,
                                      DynamoHttpServletResponse pResponse)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
Returns the locale associated with the request. The method first searches for a request paramater named locale. This value can be either a java.util.Locale object or a String which represents the locale. Next if the useRequestLocale property is true, then the locale of the request will be returned. Finally, if the locale cannot be determined, the the defaultLocale property is used.

Throws:
javax.servlet.ServletException
java.io.IOException

persistOrderIfNeeded

protected void persistOrderIfNeeded(Order pOrder)
                             throws CommerceException
If the order is transient and not empty then make it persistent through the Order Manager.

Throws:
CommerceException

updateOrderProfileId

protected void updateOrderProfileId(Order pOrder,
                                    RepositoryItem pProfile)
                             throws CommerceException
This method makes sure the profile id of the order is the same as the current user. (e.g. in case user ids change during registration).

Throws:
CommerceException

copyCreditCardToProfile

public void copyCreditCardToProfile(CreditCard pCreditCard,
                                    RepositoryItem pProfile)
Deprecated. 

Copy the credit card passed in the parameter pCreditCard to the profile passed in the parameter pProfile. This is done by creating a new Credit Card itemDescriptor object by making use of the @see atg.commmerce.profile.CommerceProfileTools class to create a creditCardItem. Next, the @see #copyCreditCard(CreditCard, RepositoryItem) is called to perform the actual copying of data. The resulting object is then updated to the repository and copied into the users map of credit cards.

Parameters:
pCreditCard - the credit card that is to be copied to a users profile
pProfile - the user profile

copyCreditCardToProfile

public void copyCreditCardToProfile(CreditCard pCreditCard,
                                    RepositoryItem pProfile,
                                    java.lang.String pNickName)
Copy the credit card passed in the parameter pCreditCard to the profile passed in the parameter pProfile. This is done by creating a new Credit Card itemDescriptor object by making use of the @see atg.commmerce.profile.CommerceProfileTools class to create a creditCardItem. Next, the @see #copyCreditCard(CreditCard, RepositoryItem) is called to perform the actual copying of data. The resulting object is then updated to the repository and copied into the users map of credit cards.

Parameters:
pCreditCard - the credit card that is to be copied to a users profile
pProfile - the user profile

copyCreditCardToPaymentGroup

public void copyCreditCardToPaymentGroup(java.lang.String pNickname,
                                         CreditCard paymentGroup,
                                         RepositoryItem pProfile,
                                         java.util.Locale pLocale)
Copy the credit card from the users profile to the payment group. The credit card item named by pNickname is obtained from the pProfile parameter and then copied in theo the paymentGroup parameter. This is done by making calls to @see #copyCreditCard(RepositoryItem, CreditCard)

Parameters:
pNickname - a value of type 'String'
paymentGroup - a value of type 'CreditCard'
pProfile - the user profile
pLocale - the user local

copyCreditCard

public void copyCreditCard(RepositoryItem pFromCreditCard,
                           CreditCard pToCreditCard)
Copying a credit card is a two step process.

The first is copying the shallow properties of the credit card. These are objects like String, Integer etc. that can be copied. This shallow copying is performed by the @see #copyShallowCreditCardProperties method.

Next, any post copying is done. The single object that must have a "deep" coyp performed on it is the billingAddress of the credit card. The billingAddress is obtained from both objects and then a call is made to the

Parameters:
pFromCreditCard - a value of type 'RepositoryItem'
pToCreditCard - a value of type 'CreditCard'
See Also:
to perform the copy.

If there is additional deep copying that needs to be done, this method should be overriden.


copyCreditCard

public void copyCreditCard(CreditCard pFromCreditCard,
                           RepositoryItem pToCreditCard)
Copying a credit card is a two step process.

The first is copying the shallow properties of the credit card. These are objects like String, Integer etc. that can be copied. This shallow copying is performed by the @see #copyShallowCreditCardProperties method.

Next, any post copying is done. The single object that must have a "deep" coyp performed on it is the billingAddress of the credit card. The billingAddress is obtained from both objects and then a call is made to the

Parameters:
pFromCreditCard - a value of type 'RepositoryItem'
pToCreditCard - a value of type 'CreditCard'
See Also:
to perform the copy.

If there is additional deep copying that needs to be done, this method should be overriden.


copyShallowCreditCardProperties

public void copyShallowCreditCardProperties(java.lang.Object pFromCreditCard,
                                            java.lang.Object pToCreditCard)
                                     throws PropertyNotFoundException
The shallow properties of a credit card are copied. This is done by consulting the @see #propertyManager for a String array of properties to copy, as named by the shallowCreditCardPropertyNames property. These properties are then copied via DynamicBeans

Parameters:
pFromCreditCard - the credit card that the address is copied from
pToCreditCard - the destination credit card for address
Throws:
PropertyNotFoundException - if a property listed by shallowCreditCardPropertyNames is not found

isCreditCardEmpty

public boolean isCreditCardEmpty(CreditCard pCreditCard)
Checks to see if a CreditCard object is empty. Empty means that certain necessary fields are missing. The properties that it checks for are those specified by the creditCardProperties String array.

This behavior can be overriden by making additions to the String array creditCardProperties, or if necessary extending this method.

Parameters:
pCreditCard - a value of type 'CreditCard'
Returns:
true if the payment group is empty.

getProfileForOrder

public RepositoryItem getProfileForOrder(Order pOrder)
                                  throws RepositoryException
Return the user profile of the user who placed a given order.

Parameters:
pOrder - The order whose owner is being retreived.
Throws:
RepositoryException - if any error occurs while looking up the user profile in the profile repository.

getProfileForOrder

public RepositoryItem getProfileForOrder(java.lang.String pOrderId)
                                  throws RepositoryException,
                                         CommerceException
Return the user profile of the user who placed the order with id pOrderId.

Parameters:
pOrderId - The order id of the order whose owner is being retreived.
Throws:
CommerceException - if any error occurs while loading the order from the order repository.
RepositoryException - if any error occurs while looking up the user profile in the profile repository.

findOrderToLoad

public int findOrderToLoad(java.util.List pOrders)
Return the index of the order that should be used as the primary order for this user. This method will return the most recently changed if the @see isSelectLastModifiedOrder is set to true which is the 0th element in the default implementation due to the order by clause.

Parameters:
pOrders - A List of the orders to select from
Returns:
the index in the list which should be used, -1 if no order is found

addActivePromotions

protected void addActivePromotions(RepositoryItem pGuestUser,
                                   RepositoryItem pAuthenticatedUser)
                            throws RepositoryException
Copy the active promotions from the guest user to the authenticated user, if the promotion was granted as a result of a coupon claim then follow the same coupon claim logic. This will allow the max number of coupons per profile to be satisfied.

Parameters:
pGuestUser - the user to copy values from
pAuthenticatedUser - the user to copy values to
Throws:
RepositoryException

postCreateUser

protected void postCreateUser(DynamoHttpServletRequest pRequest,
                              DynamoHttpServletResponse pResponse,
                              RepositoryItem pProfile,
                              OrderHolder pShoppingCart)
                       throws javax.servlet.ServletException
After registration, any transient orders are made persistent through the persistShoppingCarts method of the CommerceProfileTools component

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
pProfile - The profile of the just created user
pShoppingCart - The shopping cart for the new user
Throws:
javax.servlet.ServletException - if there was an error while executing the code

postLoginUser

protected void postLoginUser(DynamoHttpServletRequest pRequest,
                             DynamoHttpServletResponse pResponse,
                             RepositoryItem pProfile,
                             OrderHolder pShoppingCart,
                             PricingModelHolder pPricingModelHolder)
                      throws javax.servlet.ServletException
After logging in the user's session cached promotions are reloaded into the PricingModelHolder. In addition any non-transient orders are made persistent and old shopping carts are loaded from the database.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
pProfile - The profile of the user that just logged in
pShoppingCart - The shopping cart for the user that just logged in
pPricingModelHolder - The pricing models for the user that just logged in
Throws:
javax.servlet.ServletException - if there was an error while executing the code

acquireTransactionLock

protected void acquireTransactionLock()
                               throws DeadlockException
Attempt to acquire a local lock before creating a transaction that may modify the order, but only if useLocksAroundTransactions is set to true.

Throws:
DeadlockException

releaseTransactionLock

protected void releaseTransactionLock()
Attempt to release a local lock


cloneContactInfoItem

public MutableRepositoryItem cloneContactInfoItem(RepositoryItem pContactInfoItem,
                                                  java.util.Map pExcludedProperties,
                                                  java.util.Map pPropExceptions,
                                                  boolean pDeepCopy,
                                                  java.lang.String pRepositoryId)
                                           throws RepositoryException
Clones a contact info repository item.

Parameters:
pContactInfoItem - the item to clone
pExcludedProperties -
pPropExceptions -
pDeepCopy -
Returns:
the clone
Throws:
RepositoryException
See Also:
RepositoryUtils.cloneItem(RepositoryItem, boolean, Map, Map, MutableRepository, String)

setItemPropertyToAddress

public MutableRepositoryItem setItemPropertyToAddress(RepositoryItem pItem,
                                                      RepositoryItem pAddress,
                                                      java.lang.String pPropertyName,
                                                      java.util.Map pExcludedProperties,
                                                      java.util.Map pPropExceptions)
                                               throws RepositoryException
Deprecated. 

Clones the address item and changes the item's property to reference the clone.

Parameters:
pItem - the repository item that will reference the address
pAddress - the address to be cloned
pPropertyName - the name of the property on the item that will reference the clone
pExcludedProperties - Properties to exclude from clone. Keys are item-type names and the values are collections of property names to exclude. Optional.
pPropExceptions - Hierarchical map of property name exceptions to the above mode. Keys are property names while values are null or another Map if the property is an item. For example, if you clone a product using pDeepCopy=true, you could add the key "parentCategory" with a null value into pPropExceptions to cause a shallow copy of the product.parentCategory. Alternatively, you could add the key "parentCategory" but set the value to another map of exceptions that included the key/value pair "keywords"/null to do a deep copy of product.parentCategory but a shallow copy of the product.parentCategory.keywords. Optional.
Returns:
the clone repository item
Throws:
RepositoryException
See Also:
cloneContactInfoItem(RepositoryItem, Map, Map, boolean, String)

setItemPropertyToAddress

public MutableRepositoryItem setItemPropertyToAddress(RepositoryItem pItem,
                                                      RepositoryItem pAddress,
                                                      java.lang.String pPropertyName,
                                                      java.util.Map pExcludedProperties,
                                                      java.util.Map pPropExceptions,
                                                      boolean pPerformCloning)
                                               throws RepositoryException
If desired (based on the performCloning flag), Clones the address item and changes the item's property to reference the clone. Otherwise this method does not clone. Without cloning, this method uses, the same address item that has been passed to this method.

Parameters:
pItem - the repository item that will reference the address
pAddress - the address to be cloned
pPropertyName - the name of the property on the item that will reference the clone
pExcludedProperties - Properties to exclude from clone. Keys are item-type names and the values are collections of property names to exclude. Optional.
pPropExceptions - Hierarchical map of property name exceptions to the above mode. Keys are property names while values are null or another Map if the property is an item. For example, if you clone a product using pDeepCopy=true, you could add the key "parentCategory" with a null value into pPropExceptions to cause a shallow copy of the product.parentCategory. Alternatively, you could add the key "parentCategory" but set the value to another map of exceptions that included the key/value pair "keywords"/null to do a deep copy of product.parentCategory but a shallow copy of the product.parentCategory.keywords. Optional.
Returns:
the clone repository item
Throws:
RepositoryException
See Also:
cloneContactInfoItem(RepositoryItem, Map, Map, boolean, String)

isDuplicateAddressNickName

public boolean isDuplicateAddressNickName(RepositoryItem pProfile,
                                          java.lang.String pNewNickname)
Determines if the nickname is already in the profile's address map.

Parameters:
pProfile -
pNewNickname -
Returns:

isDuplicateCreditCardNickname

public boolean isDuplicateCreditCardNickname(RepositoryItem pProfile,
                                             java.lang.String pNewNickname)
Determines if the nickname is already in the profile's credit card map.

Parameters:
pProfile -
pNewNickname -
Returns:

isDuplicateNickname

public boolean isDuplicateNickname(java.util.Collection pNicknames,
                                   java.lang.String pNewNickname)
Determines if the nickname is already in the collection.

Parameters:
pNicknames -
pNewNickname -
Returns:

getUniqueShippingAddressNickname

public java.lang.String getUniqueShippingAddressNickname(java.lang.Object pAddress,
                                                         RepositoryItem pProfile,
                                                         java.lang.String pNewNickname)
This method returns a unique shipping address nickname. This method checks to see if there is any existence of nickname parameter value (pNickName). If there is any matching nickname found, this method appends numbers to qualify the unique string. Once the unique string is found, this method returns the unique nickname string. If the user is trying to create the nickname with 'home', this method returns home##0. If you do not pass the nickname parameter (pNickName), this method returns 'Address' or 'Address##0' or 'Address##1'. If there is already an nickname with 'Address', this method will return 'Address##0'. Also the 'Address' text is resourced. Based on the Locale, different text could be used.

Parameters:
pAddress - -- The address object is not used anymore.
pProfile - -- From the profile, the existing nick names are obtained.
pNewNickname - This is optional. In case if the user did not provide nickname and the system wants generate the nickname dynamically, then pass in null for the nickname.
Returns:

getUniqueAddressNickname

public java.lang.String getUniqueAddressNickname(java.lang.Object pAddress,
                                                 java.util.Collection pNicknames,
                                                 java.lang.String pNewNickname)
This method returns a unique address nickname. This method checks to see if there is any existence of nickname parameter value (pNickName). If there is any matching nickname found, this method appends numbers to qualify the unique string. Once the unique string is found, this method returns the unique nickname string. If the user is trying to create the nickname with 'home', this method returns home##0. If you do not pass the nickname parameter (pNickName), this method returns 'Address' or 'Address##0' or 'Address##1'. If there is already an nickname with 'Address', this method will return 'Address##0'. Also the 'Address' text is resourced. Based on the Locale, different text could be used.

Parameters:
pAddress - -- The address is not used anymore
pNicknames - -- List of nicknames to be checked against
pNewNickname - This is optional. In case if the user did not provide nickname and the system wants generate the nickname dynamically, then pass in null for the nickname.
Returns:

getUniqueCreditCardNickname

public java.lang.String getUniqueCreditCardNickname(java.lang.Object pCreditCard,
                                                    RepositoryItem pProfile,
                                                    java.lang.String pNewNickname)
This method returns a unique credit card nickname. This method gets all the credit cards nicknames from the profile and checks to see if there is any existence of nickname parameter value (pNickName) or ( pCreditCard.getCreditCardType()+ " - " + last four digits of pCreditCard.getCcreditCardNumber()). If there is any matching nickname found, this method appends numbers to identify the unique string. Once the unique string is found, this method returns the unique nickname string. For example, let us assume that a user has two credit card with following nicknames. Home ==> Visa, 4111111111111111 Work ==> Visa, 1111111111111111 If the user is trying to create the nickname with Home, this method retuns Home##0. If you do not pass the nickname parameter (pNickName), this method uses ( pCreditCard.getCreditCardType()+ " - " + last four digits of pCreditCard.getCcreditCardNumber().

Parameters:
pCreditCard -
pProfile -
pNewNickname - This is optional. In case if the user did not provide nickname and the system wants generate the nickname dynamically, then pass in null for the nickname.
Returns:

getUniqueCreditCardNickname

public java.lang.String getUniqueCreditCardNickname(java.lang.Object pCreditCard,
                                                    java.util.Collection pNicknames,
                                                    java.lang.String pNewNickname)
This method returns a unique credit card nickname. This method checks to see if there is any existence of nickname parameter value (pNickName) or ( pCreditCard.getCreditCardType()+ " - " + last four digits of pCreditCard.getCcreditCardNumber()). If there is any matching nickname found, this method appends numbers to identify the unique string. Once the unique string is found, this method returns the unique nickname string. For example, let us assume that a user has two credit card with following nicknames. Home ==> Visa, 4111111111111111 Work ==> Visa, 1111111111111111 If the user is trying to create the nickname with Home, this method retuns Home##0. If you do not pass the nickname parameter (pNickName), this method uses ( pCreditCard.getCreditCardType()+ " - " + last four digits of pCreditCard.getCcreditCardNumber().

Parameters:
pCreditCard -
pNicknames -
pNewNickname - This is optional. In case if the user did not provide nickname and the system wants generate the nickname dynamically, then pass in null for the nickname.
Returns:

getUniqueNickname

public java.lang.String getUniqueNickname(java.util.Collection pNickNames,
                                          java.lang.String pCurrentNickname)
This method returns a unique name from profile and a collection of names. Profile repository is not always central location of all possible nicknames. In order to gaurantee that system provides a unique nickname, this method take a collection and profile. this method will check from the profile and in the collection. It will make sure that the nickname does not exist in the profile and in colletion that passed in.

Parameters:
pNickNames -
pCurrentNickname -
Returns:
String unique nickname from the list.

generateUniqueNickname

public java.lang.String generateUniqueNickname(java.lang.String pNickname)
This method generates the unique nickname. This method checks to see if there is two tokens in the string based on the separator. If there is no token, then this method adds the separator and zero (0) to the string and returns. Also the supplied string has two tokens, then the obtain the second token and increment the number by one and return the string.

Parameters:
pNickname -
Returns:

getAllAvailableAddresses

public java.util.List getAllAvailableAddresses(RepositoryItem pProfile)
This method constructs a consolidated collection of addresses that are associated with the current customer profile. The collection includes that default shipping address, default billing address, all the addresses included in the configured maps, and all the billing addresses from existing credit cards.

Returns:
a Collection of all address items

getAllShippingAddresses

public java.util.List getAllShippingAddresses(RepositoryItem pProfile)
This method constructs a consolidated collection of all shipping addresses that are associated with the current customer profile. The collection includes that default shipping address, all the addresses included in the configured maps.

Parameters:
pProfile -
Returns:

addAddressesFromMapProperties

public void addAddressesFromMapProperties(RepositoryItem pProfile,
                                          java.lang.String[] pPropertyNames,
                                          java.util.List pDestination)
This method adds addresses from map properties to the all available address list.

Parameters:
pProfile -
pPropertyNames -
pDestination -

getAllBillingAddresses

public java.util.List getAllBillingAddresses(RepositoryItem pProfile)
This method constructs a consolidated collection of all billing addresses that are associated with the current customer profile. The collection includes that default billing address and credit card addresses.

Parameters:
pProfile -
Returns:

addUniqueAddressToAddressList

public void addUniqueAddressToAddressList(java.util.Collection pAddresses,
                                          RepositoryItem pNewAddress)
This method iterates through list of addresses and if any same address found in the collection, this method ends the process and returns. If there is no duplicate address found, then this method adds the address to the list.

Parameters:
pAddresses -
pNewAddress -

setDefaultCreditCard

public boolean setDefaultCreditCard(RepositoryItem pProfile,
                                    java.lang.String pCreditCardNickname)
                             throws RepositoryException
Make the credit card identified by pCreditCardName default in the given profile.

Parameters:
pProfile - The Profile repository item
pCreditCardNickname - The Nickname of the credit card to be default
Throws:
RepositoryException

setDefaultShippingAddressIfNull

public boolean setDefaultShippingAddressIfNull(RepositoryItem pProfile,
                                               java.lang.String pAddressName)
                                        throws RepositoryException
Sets specified by nickname shipping address as default shipping address if profile's default shipping address is not specified

Parameters:
pProfile - profile repository item
pAddressName - shipping address nickname to be set as default
Returns:
true if specified shipping address was set as default
Throws:
RepositoryException

setDefaultShippingAddress

public boolean setDefaultShippingAddress(RepositoryItem pProfile,
                                         java.lang.String pAddressName)
                                  throws RepositoryException
Sets specified by nickname secondary address as default shipping address. Firstly checks if there is already default shipping address in profile, if so makes copy of current default shipping address and adds it to the map of user's secondary addresses.

Parameters:
pProfile - profile repository item
pAddressName - nickname of the address to be set as default
Throws:
RepositoryException

setDefaultCreditCardIfNull

public boolean setDefaultCreditCardIfNull(RepositoryItem pProfile,
                                          java.lang.String pCreditCardName)
                                   throws RepositoryException
Sets specified by nickname credit card as default credit card if profile's default credit card is not specified yet

Parameters:
pProfile - The Profile repository item
pCreditCardName - credit card nickname
Returns:
true if specified credit card wsa set as dafult
Throws:
RepositoryException

getProfileAddressName

public java.lang.String getProfileAddressName(RepositoryItem pProfile,
                                              RepositoryItem pAddress)
Gets nickname for the given profile's address. Firstly check if address is stored in the map of user's secondary addresses, if so returns corresponding address nickname. Otherwise check if address is user's default shipping address or default billing address and if so returns corresponding names.

Parameters:
pProfile - The profile repository item
pAddress - Address repository item
Returns:
nickname for secondary address repository item

getCreditCardNickname

public java.lang.String getCreditCardNickname(RepositoryItem pProfile,
                                              RepositoryItem pCreditCard)
Gets nickname for the given profile's credit card.

Parameters:
pProfile - user's profile object
pCreditCard - credit-card repository item
Returns:
nickname for credit-card repository item

changeSecondaryAddressName

public void changeSecondaryAddressName(RepositoryItem pProfile,
                                       java.lang.String pOldAddressName,
                                       java.lang.String pNewAddressName)
                                throws RepositoryException
Changes secondary address nickname

Parameters:
pProfile - profile repository item
pOldAddressName - old secondary address nickname
pNewAddressName - new secondary address nickname
Throws:
RepositoryException

changeCreditCardNickname

public void changeCreditCardNickname(RepositoryItem pProfile,
                                     java.lang.String pOldCreditCardNickname,
                                     java.lang.String pNewCreditCardNickname)
                              throws RepositoryException
Changes credit card nickname in the map of user's credit cards

Parameters:
pProfile - profile repository item
pOldCreditCardNickname - credit card's old nickname
pNewCreditCardNickname - credit card's new nickname
Throws:
RepositoryException

createProfileCreditCard

public java.lang.String createProfileCreditCard(RepositoryItem pProfile,
                                                java.util.Map pNewCreditCard,
                                                java.lang.String pCreditCardNickname,
                                                java.lang.Object pBillingAddress)
                                         throws RepositoryException,
                                                java.beans.IntrospectionException,
                                                PropertyNotFoundException
This method constructs a new credit card. Created credit card repository item is added to user's map of credit cards. If user's default billing address is null than new credit card's billing address is set as default billing address. If user's default credit card is null that new credit card is set as default credit card for this user.

Parameters:
pProfile - user's profile object
pNewCreditCard - map of credit cards properties' values
pCreditCardNickname - nickname for credit card
pBillingAddress - Map or RepositoryItem that should be taken as billing address
Returns:
created credit card's nickname
Throws:
RepositoryException - if there was an error accessing the repository
java.beans.IntrospectionException
PropertyNotFoundException

updateProfileCreditCard

public void updateProfileCreditCard(RepositoryItem pCardToUpdate,
                                    RepositoryItem pProfile,
                                    java.util.Map pUpdatedCreditCard,
                                    java.lang.String pNewCreditCardNickname,
                                    java.util.Map pBillingAddress,
                                    java.lang.String pBillingAddressClassName)
                             throws java.lang.InstantiationException,
                                    java.lang.IllegalAccessException,
                                    java.lang.ClassNotFoundException,
                                    java.beans.IntrospectionException,
                                    RepositoryException
Updates profile's credit card. Changes nickname if new one is provided.

Parameters:
pCardToUpdate - credit card repository item to update
pProfile - user's profile object
pUpdatedCreditCard - map of credit card properties's values
pNewCreditCardNickname - new credit card nickname
pBillingAddress - map of credit card' billing address properties values
Throws:
java.beans.IntrospectionException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
RepositoryException

removeProfileCreditCard

public void removeProfileCreditCard(RepositoryItem pProfile,
                                    java.lang.String pCreditCardName)
                             throws RepositoryException
Removes credit card from profile's credit cards map. Checks if credit cards billing address is profile's default billing address, if so sets default billing address to null. Checks if credit card is profile's default credit card if so sets default credit card to null.

Parameters:
pProfile - user's profile object
pCreditCardName - credit card nickname
Throws:
RepositoryException

getUsersCostCenterList

public java.util.List getUsersCostCenterList(RepositoryItem pProfile)
Retrieves list of cost centers for a given profile.

Parameters:
pProfile - the customer profile.
Returns:
the list of cost centers

createCostCenter

public java.lang.String createCostCenter(RepositoryItem pProfile,
                                         java.lang.String pCostCenterIdentifier,
                                         java.lang.String pDescription,
                                         boolean isDefault)
                                  throws RepositoryException
Creates a new cost center in the user's Profile in the costCenter property and optionally adds the cost center as the default. This method assumes the caller will both get the profile item for update before calling this method and update the item after calling it.

Parameters:
pProfile - the customer profile.
pCostCenterIdentifier - The name of the new cost center.
pDescription - A description of the cost center.
Returns:
the repository address id
Throws:
RepositoryException - if there was an error when creating the new repository item.

addCostCenterToUsersList

public void addCostCenterToUsersList(RepositoryItem pProfile,
                                     RepositoryItem pCostCenter)
Adds the new cost center to the users profile. This method assumes the caller will both get the profile item for update before calling this method and update the item after calling it.

Parameters:
pProfile - the customer profile.
pCostCenter - the cost center.

editCostCenter

public java.lang.String editCostCenter(RepositoryItem pProfile,
                                       java.lang.String pCostCenterIdentifier,
                                       java.lang.String pNewDescription,
                                       boolean isDefault)
                                throws RepositoryException
Changes the properties of a cost center in the user's Profile under the costCenter attribute.

Parameters:
pProfile - the customer profile.
pCostCenterIdentifier - The old name of the cost center.
pNewDescription - A new description of the cost center.
Returns:
the repository address id
Throws:
RepositoryException - if there was an error when creating the new repository item.

removeCostCenter

public void removeCostCenter(RepositoryItem pProfile,
                             RepositoryItem pCostCenter)
                      throws RepositoryException
Removes the cost center entry from the users Profile. If the cost-center entry is also the default cost-center that property will be set to null. This method assumes the caller will both get the profile item for update before calling this method and update the item after calling it.

Parameters:
pProfile - profile from which the cost center will be removed
pCostCenter - the cost center that will be removed
Throws:
RepositoryException - if there was an error when removing the repository item.

removeAllCostCenters

public void removeAllCostCenters(RepositoryItem pProfile)
                          throws RepositoryException
Removes all cost center entries from the users Profile. This method assumes the caller will both get the profile item for update before calling this method and update the item after calling it.

Parameters:
pProfile - profile from which the cost center will be removed
Throws:
RepositoryException - if there was an error when removing the repository item.

getCostCenterByIdentifier

public RepositoryItem getCostCenterByIdentifier(java.lang.String pCostCenterIdentifier,
                                                RepositoryItem pProfile)
Retrieves cost center by identifier and profile.

Parameters:
pCostCenterIdentifier - the cost center identifier.
pProfile - the customer profile.
Returns:
the cost center repository item.