atg.commerce.promotion
Class PromotionTools

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.promotion.PromotionTools
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 PromotionTools
extends GenericService

Utility service with methods to help process promotions.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String COPIED_DURING_LOGIN
           
static java.lang.String EXTRA_PARAM_QUALIFIERSERVICE
          Key into extra parameters map to an optional Qualifier service reference
protected  Qualifier mQualifierService
           
protected  java.util.Map<java.lang.String,Qualifier> mQualifierServices
          Cache of qualifier service path names to service instances
protected  ComponentName mUserPricingModelHolderPath
           
static java.lang.String REVOKED_DURING_LOGIN
           
 
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
PromotionTools()
           
 
Method Summary
 void addAllPromotions(MutableRepositoryItem pProfile, java.util.Collection pPromotions)
          Adds all of the promotions in the collection to the user's activePromotion attribute value.
 void addAllPromotions(MutableRepositoryItem pProfile, java.util.Collection pPromotions, java.lang.String pComment)
          Adds all of the promotions in the collection to the user's activePromotion attribute value.
 void addCouponToExistingPromoStatus(java.util.Collection<RepositoryItem> pPromotionStatuses, RepositoryItem pPromotion, RepositoryItem pCoupon)
          This method adds a coupon to an existing promostatus if it is not already in the list.
 boolean addPromotion(MutableRepositoryItem pProfile, RepositoryItem pPromotion)
          Adds the promotion to the user's activePromotion attribute value.
 boolean addPromotion(MutableRepositoryItem pProfile, RepositoryItem pPromotion, java.lang.String pComment)
          Adds the promotion to the user's activePromotion attribute value.
 boolean addPromotion(MutableRepositoryItem pProfile, RepositoryItem pPromotion, java.lang.String pComment, java.lang.String pSiteId)
          Adds the promotion to the user's activePromotion attribute value.
 java.util.Map calculatePromotionsForOrder(Order pOrder)
          This method will return a map containing the count of promotions contained in the given order, and the total value of those promotions
 boolean checkPromotionExpiration(RepositoryItem pPromotion, java.util.Date pNow)
          Return true if the promotion or the promotionStatus has expired and should not be used in pricing.
 boolean checkPromotionGrant(RepositoryItem pProfile, RepositoryItem pPromotion)
          Will throw appropriate exception or return true if it's OK to grant the promotion to the passed in profile
 boolean checkPromotionGrant(RepositoryItem pProfile, RepositoryItem pPromotion, RepositoryItem pCoupon, java.lang.String[] pCheckProps)
          Will throw appropriate exception or return true if it's OK to grant the promotion to the passed in profile
 boolean checkPromotionGrant(RepositoryItem pProfile, RepositoryItem pPromotion, java.lang.String[] pCheckProps)
          Will throw appropriate exception or return true if it's OK to grant the promotion to the passed in profile
 boolean consumePromotion(MutableRepositoryItem pProfile, RepositoryItem pPromotion)
          This method moves a promotion from the user's activePromotions list to their usedPromotions list.
 java.util.Collection convertPromoStatusToPromo(java.util.Collection pPromoStatuses)
          This method returns a collection of propmotions from the passed in collection of promotion statuses.
 RepositoryItem convertSinglePromoStatusToPromo(RepositoryItem pPromoStatus)
          This method returns the single promotion from a promotion status
 java.util.Map createPromotionCountMap(Order pOrder)
          Creates a Map of promotion id to the use count in the order.
 RepositoryItem createPromotionStatus(RepositoryItem pProfile, RepositoryItem pPromotion, java.lang.Integer pNumUses)
          This method calls createTransientPromotionStatus to create and return a PromotionStatus repository item.
 RepositoryItem createPromotionStatus(RepositoryItem pProfile, RepositoryItem pPromotion, java.lang.Integer pNumUses, RepositoryItem pCoupon)
          This method calls createTransientPromotionStatus to create and return a PromotionStatus repository item.
 java.util.Map createPromotionValueMap(Order pOrder, boolean pIncludeOrderPromos, boolean pIncludeItemPromos, boolean pIncludeShippingPromos, boolean pIncludeTaxPromos)
          Creates a map of promotion id to adjustment value for each promotion applied to the given order.
 MutableRepositoryItem createTransientPromotionStatus(RepositoryItem pProfile, RepositoryItem pPromotion, java.lang.Integer pNumUses)
          This method creates a PromotionStatus repository item and returns it without saving it.
 MutableRepositoryItem createTransientPromotionStatus(RepositoryItem pProfile, RepositoryItem pPromotion, java.lang.Integer pNumUses, RepositoryItem pCoupon)
          This method creates a PromotionStatus repository item and returns it without saving it.
 void expirePromotion(RepositoryItem pPromotion, RepositoryItem pProfile)
          This method will remove the passed in promotion from the Profile.
 java.lang.String getActivePromotionsProperty()
          Property of the profile to which we add new promotions
 java.lang.String getAddItemEventPipeline()
          The name of the pipeline used to send the ScenarioAddedItemToOrder event Defaults to PipelineConstants.SENDSCENARIOEVENT
 java.lang.String getAllowMultipleProperty()
          Property name of the 'allowMultiple' property in the promotion
 java.lang.String[] getAlternateUserPricingModelHolderPaths()
          Returns property AlternateUserPricingModelHolderPaths
 java.lang.String getBaseClosenessQualifierItemType()
          Returns property BaseClosenessQualifierItemType
 java.lang.String getBasePromotionItemType()
          Returns property BasePromotionItemType
 CurrentDate getCurrentDate()
          The name of the current date component used to get the current date.
 GetService getGetService()
          The tool used to convert promotions to xml in getPromotionsAsXML
 java.lang.String getGiveToAnonymousProfilesProperty()
          Property name of the 'giveToAnonymousProfiles' property in the promotion
 void getItemPromotions(CommerceItem pItem, java.util.Collection pPromotions)
          Returns the promotions used in the CommerceItem.
 void getItemPromotions(CommerceItem pItem, java.util.Collection pPromotions, boolean pGetAdjustments)
          Deprecated. as of 10.2; use getItemPromotions(CommerceItem, Collection, Collection, boolean) instead
 void getItemPromotions(CommerceItem pItem, java.util.Collection pPromotions, java.util.Collection pPromotionInstancesAdded, boolean pGetAdjustments)
          Returns the promotions used in the CommerceItem.
 java.lang.String getMappingFileName()
          The name of the mapping file that describes the XML format for getPromotionsAsXML
 void getOrderPromotions(Order pOrder, java.util.Collection pPromotions)
          Returns the promotions used in the order.
 void getOrderPromotions(Order pOrder, java.util.Collection pPromotions, boolean pGetAdjustments)
          Returns the promotions used in the order.
 void getOrderPromotions(Order pOrder, java.util.Collection pOrderPromotions, java.util.Collection pTaxPromotions, java.util.Collection pItemPromotions, java.util.Collection pShippingPromotions)
          This method retrieves all the promotions in an order and adds them to their respective collection.
 void getOrderPromotions(Order pOrder, java.util.Collection pOrderPromotions, java.util.Collection pTaxPromotions, java.util.Collection pItemPromotions, java.util.Collection pShippingPromotions, boolean pGetAdjustments)
          This method retrieves all the promotions in an order and adds them to their respective collection.
 PipelineManager getPipelineManager()
          The PipelineManager is used to run the pipeline process that sends scenario events
 int getPMDLVersion(RepositoryItem pPricingModel)
          Utility method to get the pmdl version for a given promotion.
 PricingModelProperties getPricingModelProperties()
          Returns a bean that contains properties for a PricingModel
 PricingTools getPricingTools()
          Return the PricingTools component
 RepositoryItem getProfile(java.lang.String pProfileId)
          Gets the profile repository item with the given id
 java.lang.String getProfileItemType()
           
 MutableRepository getProfileRepository()
          Return the editable profile repository
 java.lang.String getPromoStatusCouponsPropertyName()
          Returns the descriptor name for the Coupons property
 java.lang.String getPromoStatusDescriptorName()
          Returns the descriptor name for the promoStatus descriptor
 java.util.Collection getPromoStatuses(RepositoryItem pProfile, java.lang.String[] pCheckProps)
          Get all of the promoStatuses for the profile
 java.lang.String getPromoStatusNumUsesProperty()
          Returns the promoStatus num_uses property name
 java.lang.String getPromoStatusProfileIdProperty()
          Returns the promoStatus profile id property name
 java.lang.String getPromoStatusPromoProperty()
          Returns the promoStatus promo property name
 int getPromotionCount(Order pOrder, RepositoryItem pPromotion)
          Returns the number of times a promotion appears in the order.
 RepositoryItem getPromotionFromComposite(RepositoryItem pPromotion)
          For composite promotion items we need to get the item from the promotions repository
since for example the promotion may have come from the profile repository which
could be composite.
 MessageSender getPromotionGrantedMessageSender()
          Gets property MessageSender.
 MessageSender getPromotionRevokedMessageSender()
          Gets property PromotionRevokedMessageSender.
 Repository getPromotions()
          Returns property Promotions
 java.util.Collection getPromotions(java.lang.String pProfileId)
          This method will look up the given profile and return all of the available promotions for that user.
 java.lang.String[] getPromotionsAsXML(java.lang.String pProfileId)
          This method will look up the given profile, and for each available promotion, will return an xml representation of it using the GetService and the mappingFileName.
 Qualifier getQualifierService()
          Gets the default Qualifier service to use.
 Qualifier getQualifierService(RepositoryItem pPricingModel, java.util.Map pExtraParameters, Qualifier pDefaultQualifier)
          Gets the Qualifier service to use for the given promotion item.
 void getShippingPromotions(ShippingGroup pGroup, java.util.Collection pPromotions)
          Returns the promotions used in the ShippingGroup.
 void getShippingPromotions(ShippingGroup pGroup, java.util.Collection pPromotions, boolean pGetAdjustments)
          Deprecated. as of 10.2; use getShippingPromotions(ShippingGroup, Collection, Collection, boolean) instead
 void getShippingPromotions(ShippingGroup pGroup, java.util.Collection pPromotions, java.util.Collection pPromotionInstancesAdded, boolean pGetAdjustments)
          Returns the promotions used in the ShippingGroup.
 java.lang.String getSiteGroupPropertyName()
          Return the SiteGroupPropertyName property.
 java.lang.String getSiteGroupsPropertyName()
          Return the SiteGroupsPropertyName property.
 java.lang.String getSiteIdPropertyName()
          Return the SiteIdPropertyName property.
 java.lang.String getSitesPropertyName()
          Return the SitesPropertyName property.
 void getTaxPromotions(Order pOrder, java.util.Collection pPromotions)
          Returns the promotions used in the tax calculation.
 void getTaxPromotions(Order pOrder, java.util.Collection pPromotions, boolean pGetAdjustments)
          Returns the promotions used in the tax calculation.
 java.lang.String getUsedPromotionsProperty()
          Property of the profile to which we add consumed promotions
 java.lang.String getUserPricingModelHolderPath()
          Returns property UserPricingModelHolderPath
 java.lang.String getUsesProperty()
          Returns the usesProperty
 void grantPromotion(MutableRepositoryItem pProfile, RepositoryItem pPromotion)
          Adds the given promotion to the user's "activePromotions" list.
 void grantPromotion(MutableRepositoryItem pProfile, RepositoryItem pPromotion, java.lang.String pComment)
          Adds the given promotion to the user's "activePromotions" list.
 void grantPromotion(MutableRepositoryItem pProfile, RepositoryItem pPromotion, java.lang.String pComment, java.lang.String pSiteId)
          Adds the given promotion to the user's "activePromotions" list.
 void grantPromotion(MutableRepositoryItem pProfile, RepositoryItem pPromotion, java.lang.String pComment, java.lang.String pSiteId, RepositoryItem pCoupon)
          Adds the given promotion to the user's "activePromotions" list.
 void grantPromotion(java.lang.String pProfileId, java.lang.String pPromotionId)
          Adds the given promotion to the user's "activePromotions" list.
 void grantPromotion(java.lang.String pProfileId, java.lang.String pPromotionId, java.lang.String pComment)
          Adds the given promotion to the user's "activePromotions" list.
 void grantPromotion(java.lang.String pProfileId, java.lang.String pPromotionId, java.lang.String pComment, java.lang.String pSiteId)
          Adds the given promotion to the user's "activePromotions" list.
 void initializePricingModels()
          Initialize the set of pricing models/promotions that a user currently holds while having an active session.
 void initializePricingModels(boolean pRemoveExpiredGlobalPromotions)
          Initialize the set of pricing models/promotions that a user currently holds while having an active session.
 void initializePricingModels(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Initialize the set of pricing models/promotions that a user currently holds while having an active session.
 boolean isClosenessQualifierItem(java.lang.Object pObj)
          Method to determine if a passed in repository item or item descriptor is from a closeness qualifier.
 boolean isFirePromotionGrantedEvent()
          Gets property FirePromotionGrantedEvent
 boolean isFirePromotionRevokedEvent()
          Gets property FirePromotionRevokedEvent
 boolean isItemOfType(java.lang.Object pObj, RepositoryItemDescriptor pBaseType)
          Method to determine if a passed in repository item or item descriptor is of a base type.
 boolean isPromotionInPromotionStatuses(RepositoryItem pPromotion, java.util.Collection pPromotionStatuses)
          This method takes a promotion and a collection of promotion statuses, and returns a boolean indicating if the given promotion is represented in the status collection.
 boolean isPromotionItem(java.lang.Object pObj)
          Method to determine if a passed in repository item or item descriptor is from a promotion.
 boolean isRemoveExpiredGlobalPromotions()
          Indicates if expired global promotions should be removed.
 boolean isSendEventOnAddItem()
          If this is true, then the ScenarioAddedItemToCart event will be sent If this is false, then the ScenarioAddedItemToCart event will not be sent.
 boolean isUsable(RepositoryItem pPromotion)
          This method determines if the given promotion is usable based on the date allowed on the promotion compared to the current date.
 boolean isUsable(RepositoryItem pPromotion, java.util.Date pNow)
          This method determines if the given promotion is usable based on the date allowed on the promotion compared to the passed in date.
 RepositoryItem lookupPromotion(java.lang.String pPromotionId)
          Does a simple lookup to return the promotion repository item for the given id from the repository.
 boolean removePromotion(MutableRepositoryItem pProfile, RepositoryItem pPromotion, boolean pRemoveAll)
          Removes the passed in promotion pPromotion from the pProfile's list of active promotions.
protected  Qualifier resolveQualifierService(java.lang.String pQualifierPath)
          Resolves the given String nucleus path to a Qualifier service object reference.
 boolean revokePromotion(MutableRepositoryItem pProfile, RepositoryItem pPromotion, boolean pRemoveAll)
          Removes the passed in promotion pPromotion from the pProfile's list of active promotions.
 boolean revokePromotion(java.lang.String pProfileId, java.lang.String pPromotionId, boolean pRemoveAllInstances)
          Removes the passed in promotion pPromotion from the pProfile's list of active promotions.
 boolean scenarioAddedItemToOrder(Order pOrder, CommerceItem pItem, long pQuantity)
          This method is called by the AddItemToOrder scenario action.
 boolean scenarioAddedItemToOrder(Order pOrder, CommerceItem pItem, long pQuantity, java.lang.String pSiteId)
          This method is called by the AddItemToOrder scenario action.
 void sendPromotionGrantedEvent(MutableRepositoryItem pProfile, RepositoryItem pPromotion)
          Sends an PromotionGranted Event through the PromotionGrantedMessageSender if FirePromotionGrantedEvent is set to true.
 void sendPromotionGrantedEvent(MutableRepositoryItem pProfile, RepositoryItem pPromotion, java.lang.String pComment)
          Sends an PromotionGranted Event through the PromotionGrantedMessageSender if FirePromotionGrantedEvent is set to true.
 void sendPromotionGrantedEvent(MutableRepositoryItem pProfile, RepositoryItem pPromotion, java.lang.String pComment, java.lang.String pSiteId)
          Sends an PromotionGranted Event through the PromotionGrantedMessageSender if FirePromotionGrantedEvent is set to true.
 void sendPromotionRevokedEvent(RepositoryItem pProfile, RepositoryItem pPromotion)
          Sends a PromotionRevoked Event through the PromotionRevokedMessageSender if FirePromotionRevokedEvent is set to true.
 void sendPromotionRevokedEvent(RepositoryItem pProfile, RepositoryItem pPromotion, java.lang.String pComment)
          Sends a PromotionRevoked Event through the PromotionRevokedMessageSender if FirePromotionRevokedEvent is set to true.
 void sendPromotionRevokedEvent(RepositoryItem pProfile, RepositoryItem pPromotion, java.lang.String pComment, java.lang.String pSiteId)
          Sends a PromotionRevoked Event through the PromotionRevokedMessageSender if FirePromotionRevokedEvent is set to true.
 void setActivePromotionsProperty(java.lang.String pActivePromotionsProperty)
           
 void setAddItemEventPipeline(java.lang.String pAddItemEventPipeline)
           
 void setAllowMultipleProperty(java.lang.String pAllowMultipleProperty)
           
 void setAlternateUserPricingModelHolderPaths(java.lang.String[] pAlternateUserPricingModelHolderPaths)
          Sets property AlternateUserPricingModelHolderPaths
 void setBaseClosenessQualifierItemType(java.lang.String pBaseClosenessQualifierItemType)
          Sets property BaseClosenessQualifierItemType
 void setBasePromotionItemType(java.lang.String pBasePromotionItemType)
          Sets property BasePromotionItemType
 void setCurrentDate(CurrentDate pCurrentDate)
           
 void setFirePromotionGrantedEvent(boolean pFirePromotionGrantedEvent)
          Sets property FirePromotionGrantedEvent
 void setFirePromotionRevokedEvent(boolean pFirePromotionRevokedEvent)
          Sets property FirePromotionRevokedEvent
 void setGetService(GetService pGetService)
           
 void setGiveToAnonymousProfilesProperty(java.lang.String pGiveToAnonymousProfilesProperty)
           
 void setMappingFileName(java.lang.String pMappingFileName)
           
 void setPipelineManager(PipelineManager pPipelineManager)
           
 void setPricingModelProperties(PricingModelProperties pPricingModelProperties)
           
 void setPricingTools(PricingTools pPricingTools)
           
 void setProfileItemType(java.lang.String pProfileItemType)
           
 void setProfileRepository(MutableRepository pProfileRepository)
           
 void setPromoStatusCouponsPropertyName(java.lang.String pPromoStatusCouponsPropertyName)
           
 void setPromoStatusDescriptorName(java.lang.String pPromoStatusDescriptorName)
           
 void setPromoStatusNumUsesProperty(java.lang.String pPromoStatusNumUsesProperty)
           
 void setPromoStatusProfileIdProperty(java.lang.String pPromoStatusProfileIdProperty)
           
 void setPromoStatusPromoProperty(java.lang.String pPromoStatusPromoProperty)
           
 void setPromotionGrantedMessageSender(MessageSender pPromotionGrantedMessageSender)
          Sets property PromotionGrantedMessageSender.
 void setPromotionRevokedMessageSender(MessageSender pPromotionRevokedMessageSender)
          Sets property PromotionRevokedMessageSender.
 void setPromotions(Repository pPromotions)
          Sets property Promotions
 void setQualifierService(Qualifier pQualifierService)
          Sets the default Qualifier service to use.
 void setRemoveExpiredGlobalPromotions(boolean pRemoveExpiredGlobalPromotions)
           
 void setSendEventOnAddItem(boolean pSendEventOnAddItem)
           
 void setSiteGroupPropertyName(java.lang.String pSiteGroupPropertyName)
          Set the SiteGroupPropertyName property.
 void setSiteGroupsPropertyName(java.lang.String pSiteGroupsPropertyName)
          Set the SiteGroupsPropertyName property.
 void setSiteIdPropertyName(java.lang.String pSiteIdPropertyName)
          Set the SiteIdPropertyName property.
 void setSitesPropertyName(java.lang.String pSitesPropertyName)
          Set the SitesPropertyName property.
 void setUsedPromotionsProperty(java.lang.String pUsedPromotionsProperty)
           
 void setUserPricingModelHolderPath(java.lang.String pUserPricingModelHolderPath)
          Sets property UserPricingModelHolderPath
 void setUsesProperty(java.lang.String pUsesProperty)
          Sets the usesProperty
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

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

See Also:
Constant Field Values

COPIED_DURING_LOGIN

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

REVOKED_DURING_LOGIN

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

EXTRA_PARAM_QUALIFIERSERVICE

public static final java.lang.String EXTRA_PARAM_QUALIFIERSERVICE
Key into extra parameters map to an optional Qualifier service reference

See Also:
Constant Field Values

mQualifierService

protected Qualifier mQualifierService

mUserPricingModelHolderPath

protected ComponentName mUserPricingModelHolderPath

mQualifierServices

protected java.util.Map<java.lang.String,Qualifier> mQualifierServices
Cache of qualifier service path names to service instances

Constructor Detail

PromotionTools

public PromotionTools()
Method Detail

getQualifierService

public Qualifier getQualifierService()
Gets the default Qualifier service to use.

Returns:
Qualifier service reference

setQualifierService

public void setQualifierService(Qualifier pQualifierService)
Sets the default Qualifier service to use.

Parameters:
pQualifierService - Qualifier service reference

setSiteGroupsPropertyName

public void setSiteGroupsPropertyName(java.lang.String pSiteGroupsPropertyName)
Set the SiteGroupsPropertyName property.


getSiteGroupsPropertyName

public java.lang.String getSiteGroupsPropertyName()
Return the SiteGroupsPropertyName property.


setSiteGroupPropertyName

public void setSiteGroupPropertyName(java.lang.String pSiteGroupPropertyName)
Set the SiteGroupPropertyName property.


getSiteGroupPropertyName

public java.lang.String getSiteGroupPropertyName()
Return the SiteGroupPropertyName property.


setSiteIdPropertyName

public void setSiteIdPropertyName(java.lang.String pSiteIdPropertyName)
Set the SiteIdPropertyName property.


getSiteIdPropertyName

public java.lang.String getSiteIdPropertyName()
Return the SiteIdPropertyName property.


setSitesPropertyName

public void setSitesPropertyName(java.lang.String pSitesPropertyName)
Set the SitesPropertyName property.


getSitesPropertyName

public java.lang.String getSitesPropertyName()
Return the SitesPropertyName property.


setFirePromotionGrantedEvent

public void setFirePromotionGrantedEvent(boolean pFirePromotionGrantedEvent)
Sets property FirePromotionGrantedEvent


isFirePromotionGrantedEvent

public boolean isFirePromotionGrantedEvent()
Gets property FirePromotionGrantedEvent


setFirePromotionRevokedEvent

public void setFirePromotionRevokedEvent(boolean pFirePromotionRevokedEvent)
Sets property FirePromotionRevokedEvent


isFirePromotionRevokedEvent

public boolean isFirePromotionRevokedEvent()
Gets property FirePromotionRevokedEvent


setPromotionGrantedMessageSender

public void setPromotionGrantedMessageSender(MessageSender pPromotionGrantedMessageSender)
Sets property PromotionGrantedMessageSender. The MessageSender is used to send PromotionGranted Events.


getPromotionGrantedMessageSender

public MessageSender getPromotionGrantedMessageSender()
Gets property MessageSender.


setPromotionRevokedMessageSender

public void setPromotionRevokedMessageSender(MessageSender pPromotionRevokedMessageSender)
Sets property PromotionRevokedMessageSender. The MessageSender is used to send PromotionRevoked Events.


getPromotionRevokedMessageSender

public MessageSender getPromotionRevokedMessageSender()
Gets property PromotionRevokedMessageSender.


setPipelineManager

public void setPipelineManager(PipelineManager pPipelineManager)

getPipelineManager

public PipelineManager getPipelineManager()
The PipelineManager is used to run the pipeline process that sends scenario events


setSendEventOnAddItem

public void setSendEventOnAddItem(boolean pSendEventOnAddItem)

isSendEventOnAddItem

public boolean isSendEventOnAddItem()
If this is true, then the ScenarioAddedItemToCart event will be sent If this is false, then the ScenarioAddedItemToCart event will not be sent. The default value is true


setAddItemEventPipeline

public void setAddItemEventPipeline(java.lang.String pAddItemEventPipeline)

getAddItemEventPipeline

public java.lang.String getAddItemEventPipeline()
The name of the pipeline used to send the ScenarioAddedItemToOrder event Defaults to PipelineConstants.SENDSCENARIOEVENT


setPricingModelProperties

public void setPricingModelProperties(PricingModelProperties pPricingModelProperties)

getPricingModelProperties

public PricingModelProperties getPricingModelProperties()
Returns a bean that contains properties for a PricingModel


setActivePromotionsProperty

public void setActivePromotionsProperty(java.lang.String pActivePromotionsProperty)

getActivePromotionsProperty

public java.lang.String getActivePromotionsProperty()
Property of the profile to which we add new promotions


setUsedPromotionsProperty

public void setUsedPromotionsProperty(java.lang.String pUsedPromotionsProperty)

getUsedPromotionsProperty

public java.lang.String getUsedPromotionsProperty()
Property of the profile to which we add consumed promotions


setAllowMultipleProperty

public void setAllowMultipleProperty(java.lang.String pAllowMultipleProperty)

getAllowMultipleProperty

public java.lang.String getAllowMultipleProperty()
Property name of the 'allowMultiple' property in the promotion


setGiveToAnonymousProfilesProperty

public void setGiveToAnonymousProfilesProperty(java.lang.String pGiveToAnonymousProfilesProperty)

getGiveToAnonymousProfilesProperty

public java.lang.String getGiveToAnonymousProfilesProperty()
Property name of the 'giveToAnonymousProfiles' property in the promotion


setUsesProperty

public void setUsesProperty(java.lang.String pUsesProperty)
Sets the usesProperty


getUsesProperty

public java.lang.String getUsesProperty()
Returns the usesProperty


setPromoStatusDescriptorName

public void setPromoStatusDescriptorName(java.lang.String pPromoStatusDescriptorName)

getPromoStatusDescriptorName

public java.lang.String getPromoStatusDescriptorName()
Returns the descriptor name for the promoStatus descriptor


setPromoStatusCouponsPropertyName

public void setPromoStatusCouponsPropertyName(java.lang.String pPromoStatusCouponsPropertyName)

getPromoStatusCouponsPropertyName

public java.lang.String getPromoStatusCouponsPropertyName()
Returns the descriptor name for the Coupons property


setPromoStatusProfileIdProperty

public void setPromoStatusProfileIdProperty(java.lang.String pPromoStatusProfileIdProperty)

getPromoStatusProfileIdProperty

public java.lang.String getPromoStatusProfileIdProperty()
Returns the promoStatus profile id property name


setPromoStatusNumUsesProperty

public void setPromoStatusNumUsesProperty(java.lang.String pPromoStatusNumUsesProperty)

getPromoStatusNumUsesProperty

public java.lang.String getPromoStatusNumUsesProperty()
Returns the promoStatus num_uses property name


setPromoStatusPromoProperty

public void setPromoStatusPromoProperty(java.lang.String pPromoStatusPromoProperty)

getPromoStatusPromoProperty

public java.lang.String getPromoStatusPromoProperty()
Returns the promoStatus promo property name


setProfileRepository

public void setProfileRepository(MutableRepository pProfileRepository)

getProfileRepository

public MutableRepository getProfileRepository()
Return the editable profile repository


setProfileItemType

public void setProfileItemType(java.lang.String pProfileItemType)

getProfileItemType

public java.lang.String getProfileItemType()

setPricingTools

public void setPricingTools(PricingTools pPricingTools)

getPricingTools

public PricingTools getPricingTools()
Return the PricingTools component


setPromotions

public void setPromotions(Repository pPromotions)
Sets property Promotions


getPromotions

public Repository getPromotions()
Returns property Promotions


setBasePromotionItemType

public void setBasePromotionItemType(java.lang.String pBasePromotionItemType)
Sets property BasePromotionItemType


getBasePromotionItemType

public java.lang.String getBasePromotionItemType()
Returns property BasePromotionItemType


setBaseClosenessQualifierItemType

public void setBaseClosenessQualifierItemType(java.lang.String pBaseClosenessQualifierItemType)
Sets property BaseClosenessQualifierItemType


getBaseClosenessQualifierItemType

public java.lang.String getBaseClosenessQualifierItemType()
Returns property BaseClosenessQualifierItemType


setUserPricingModelHolderPath

public void setUserPricingModelHolderPath(java.lang.String pUserPricingModelHolderPath)
Sets property UserPricingModelHolderPath


getUserPricingModelHolderPath

public java.lang.String getUserPricingModelHolderPath()
Returns property UserPricingModelHolderPath


setAlternateUserPricingModelHolderPaths

public void setAlternateUserPricingModelHolderPaths(java.lang.String[] pAlternateUserPricingModelHolderPaths)
Sets property AlternateUserPricingModelHolderPaths


getAlternateUserPricingModelHolderPaths

public java.lang.String[] getAlternateUserPricingModelHolderPaths()
Returns property AlternateUserPricingModelHolderPaths


setGetService

public void setGetService(GetService pGetService)

getGetService

public GetService getGetService()
The tool used to convert promotions to xml in getPromotionsAsXML


setMappingFileName

public void setMappingFileName(java.lang.String pMappingFileName)

getMappingFileName

public java.lang.String getMappingFileName()
The name of the mapping file that describes the XML format for getPromotionsAsXML


setCurrentDate

public void setCurrentDate(CurrentDate pCurrentDate)

getCurrentDate

public CurrentDate getCurrentDate()
The name of the current date component used to get the current date.

Returns:
A component that contains the current date information

setRemoveExpiredGlobalPromotions

public void setRemoveExpiredGlobalPromotions(boolean pRemoveExpiredGlobalPromotions)

isRemoveExpiredGlobalPromotions

public boolean isRemoveExpiredGlobalPromotions()
Indicates if expired global promotions should be removed.

Returns:
true if expired global promotions should be removed, false otherwise.

createPromotionStatus

public RepositoryItem createPromotionStatus(RepositoryItem pProfile,
                                            RepositoryItem pPromotion,
                                            java.lang.Integer pNumUses)
                                     throws RepositoryException
This method calls createTransientPromotionStatus to create and return a PromotionStatus repository item. If the profile is not transient, then it will add the returned PromotionStatus to the promotions repository.

Parameters:
pProfile - - the profile of the user for whom the promotion status is being created.
pPromotion - - the promotion to be added.
pNumUses - - the number of uses that this promotion can have.
Throws:
RepositoryException

createPromotionStatus

public RepositoryItem createPromotionStatus(RepositoryItem pProfile,
                                            RepositoryItem pPromotion,
                                            java.lang.Integer pNumUses,
                                            RepositoryItem pCoupon)
                                     throws RepositoryException
This method calls createTransientPromotionStatus to create and return a PromotionStatus repository item. If the profile is not transient, then it will add the returned PromotionStatus to the promotions repository.

Parameters:
pProfile - - the profile of the user for whom the promotion status is being created.
pPromotion - - the promotion to be added.
pNumUses - - the number of uses that this promotion can have.
pCoupon - the coupon that the promotion was claimed from
Throws:
RepositoryException

createTransientPromotionStatus

public MutableRepositoryItem createTransientPromotionStatus(RepositoryItem pProfile,
                                                            RepositoryItem pPromotion,
                                                            java.lang.Integer pNumUses)
                                                     throws RepositoryException
This method creates a PromotionStatus repository item and returns it without saving it. This method is responsible for setting the expiration date on the promotionStatus if this promotion is a relative expiration promotion. It also sets the grantedDate property to the current date and time.

Parameters:
pProfile - - the profile of the user for whom the promotion status is being created.
pPromotion - - the promotion to be added.
pNumUses - - the number of uses that this promotion can have.
Returns:
an initialized promotion status item that has not been saved
Throws:
RepositoryException

createTransientPromotionStatus

public MutableRepositoryItem createTransientPromotionStatus(RepositoryItem pProfile,
                                                            RepositoryItem pPromotion,
                                                            java.lang.Integer pNumUses,
                                                            RepositoryItem pCoupon)
                                                     throws RepositoryException
This method creates a PromotionStatus repository item and returns it without saving it. This method is responsible for setting the expiration date on the promotionStatus if this promotion is a relative expiration promotion. It also sets the grantedDate property to the current date and time.

Parameters:
pProfile - - the profile of the user for whom the promotion status is being created.
pPromotion - - the promotion to be added.
pNumUses - - the number of uses that this promotion can have.
Returns:
an initialized promotion status item that has not been saved
Throws:
RepositoryException

initializePricingModels

public void initializePricingModels()
                             throws javax.servlet.ServletException,
                                    java.io.IOException
Initialize the set of pricing models/promotions that a user currently holds while having an active session.

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

initializePricingModels

public void initializePricingModels(boolean pRemoveExpiredGlobalPromotions)
                             throws javax.servlet.ServletException,
                                    java.io.IOException
Initialize the set of pricing models/promotions that a user currently holds while having an active session. The pRemoveExpiredGlobalPromotions parameter gives the ability for expired global promotions to be removed before initialization.

Parameters:
pRemoveExpiredGlobalPromotions - indicator as to whether the removeExpiredGlobalPromotions should be set or not
Throws:
javax.servlet.ServletException
java.io.IOException

initializePricingModels

public void initializePricingModels(DynamoHttpServletRequest pRequest,
                                    DynamoHttpServletResponse pResponse)
                             throws javax.servlet.ServletException,
                                    java.io.IOException
Initialize the set of pricing models/promotions that a user currently holds while having an active session.

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

getPromotionFromComposite

public RepositoryItem getPromotionFromComposite(RepositoryItem pPromotion)
For composite promotion items we need to get the item from the promotions repository
since for example the promotion may have come from the profile repository which
could be composite.

See bugs COMMERCE-168557, COMMERCE-168558, COMMERCE-126830, COMMERCE-168127

Parameters:
pPromotion - RepositoryItem which may be a CompositeItem
Returns:
RepositoryItem from the promotions repository or null if it wasn't found.

isPromotionItem

public boolean isPromotionItem(java.lang.Object pObj)
                        throws java.lang.IllegalArgumentException,
                               RepositoryException
Method to determine if a passed in repository item or item descriptor is from a promotion.
The passed in object can be of any super type of the base promotion type.

Parameters:
pObj - Object to check, RepositoryItem or RepositoryItemDescriptor
Returns:
true if pObj is of a type which is a sub-type of the base promotion type
Throws:
java.lang.IllegalArgumentException - if pObj is null or not a RepositoryItem or a RepositoryItemDescriptor
RepositoryException - if pObj is a RepositoryItem and it's type could not be accessed or the base promotion type could not be determined.

isClosenessQualifierItem

public boolean isClosenessQualifierItem(java.lang.Object pObj)
                                 throws java.lang.IllegalArgumentException,
                                        RepositoryException
Method to determine if a passed in repository item or item descriptor is from a closeness qualifier.
The passed in object can be of any super type of the base closeness qualifier type.

Parameters:
pObj - Object to check, RepositoryItem or RepositoryItemDescriptor
Returns:
true if pObj is of a type which is a sub-type of the base closeness qualifier type
Throws:
java.lang.IllegalArgumentException - if pObj is null or not a RepositoryItem or a RepositoryItemDescriptor
RepositoryException - if pObj is a RepositoryItem and it's type could not be accessed or the base closeness qualifier type could not be determined.

isItemOfType

public boolean isItemOfType(java.lang.Object pObj,
                            RepositoryItemDescriptor pBaseType)
                     throws java.lang.IllegalArgumentException,
                            RepositoryException
Method to determine if a passed in repository item or item descriptor is of a base type.
The passed in object can be of any super type of the base type.

Parameters:
pObj - Object to check, RepositoryItem or RepositoryItemDescriptor
pBaseType - RepositoryItemDescriptor for the base type
Returns:
true if pObj is of a type which is a sub-type of the base type
Throws:
java.lang.IllegalArgumentException - if pBaseType is null or pObj is null or not a RepositoryItem or a RepositoryItemDescriptor
RepositoryException - if pObj is a RepositoryItem and it's type could not be determined

checkPromotionExpiration

public boolean checkPromotionExpiration(RepositoryItem pPromotion,
                                        java.util.Date pNow)
Return true if the promotion or the promotionStatus has expired and should not be used in pricing.

Parameters:
pPromotion - the promotion that should be verified
pNow - the current date
Returns:
true if the promotion has expired, false otherwise

addAllPromotions

public void addAllPromotions(MutableRepositoryItem pProfile,
                             java.util.Collection pPromotions)
Adds all of the promotions in the collection to the user's activePromotion attribute value.


addAllPromotions

public void addAllPromotions(MutableRepositoryItem pProfile,
                             java.util.Collection pPromotions,
                             java.lang.String pComment)
Adds all of the promotions in the collection to the user's activePromotion attribute value.

Parameters:
pProfile - The profile being modified
pPromotion - The promotion being added
pComment - And extra string describe this event.

addPromotion

public boolean addPromotion(MutableRepositoryItem pProfile,
                            RepositoryItem pPromotion)
Adds the promotion to the user's activePromotion attribute value.

Parameters:
pProfile - The profile being modified
pPromotion - The promotion being added
Returns:
true if the promotion was added

addPromotion

public boolean addPromotion(MutableRepositoryItem pProfile,
                            RepositoryItem pPromotion,
                            java.lang.String pComment)
Adds the promotion to the user's activePromotion attribute value.

Parameters:
pProfile - The profile being modified
pPromotion - The promotion being added
pComment - And extra string describe this event.
Returns:
true if the promotion was added

addPromotion

public boolean addPromotion(MutableRepositoryItem pProfile,
                            RepositoryItem pPromotion,
                            java.lang.String pComment,
                            java.lang.String pSiteId)
Adds the promotion to the user's activePromotion attribute value.

Parameters:
pProfile - The profile being modified
pPromotion - The promotion being added
pComment - And extra string describe this event.
pSiteId - site with which the promotion is associated
Returns:
true if the promotion was added

lookupPromotion

public RepositoryItem lookupPromotion(java.lang.String pPromotionId)
                               throws RepositoryException
Does a simple lookup to return the promotion repository item for the given id from the repository.

Parameters:
pPromotionId - String repository id
Returns:
RepositoryItem for the given id
Throws:
RepositoryException - if the id is not found in the promotion repository

grantPromotion

public void grantPromotion(java.lang.String pProfileId,
                           java.lang.String pPromotionId)
                    throws atg.commerce.promotion.PromotionException
Adds the given promotion to the user's "activePromotions" list.

Parameters:
pProfileId -
pPromotionId -
Throws:
PromotionException - Thrown if the promotion can't be added for some reason (e.g. the promotion is expired, the user already had the promotion)

grantPromotion

public void grantPromotion(java.lang.String pProfileId,
                           java.lang.String pPromotionId,
                           java.lang.String pComment)
                    throws atg.commerce.promotion.PromotionException
Adds the given promotion to the user's "activePromotions" list.

Parameters:
pProfileId - The profile gaining the promotion
pPromotionId - The promotion being added
pComment - And extra string describe this event.
Throws:
PromotionException - Thrown if the promotion can't be added for some reason (e.g. the promotion is expired, the user already had the promotion)

grantPromotion

public void grantPromotion(java.lang.String pProfileId,
                           java.lang.String pPromotionId,
                           java.lang.String pComment,
                           java.lang.String pSiteId)
                    throws atg.commerce.promotion.PromotionException
Adds the given promotion to the user's "activePromotions" list.

Parameters:
pProfileId - The profile gaining the promotion
pPromotionId - The promotion being added
pComment - And extra string describe this event.
pSiteId - The site with which the promotion is associated
Throws:
PromotionException - Thrown if the promotion can't be added for some reason (e.g. the promotion is expired, the user already had the promotion)

grantPromotion

public void grantPromotion(MutableRepositoryItem pProfile,
                           RepositoryItem pPromotion)
                    throws atg.commerce.promotion.PromotionException
Adds the given promotion to the user's "activePromotions" list.

Parameters:
pProfile -
pPromotion -
Throws:
PromotionException - Thrown if the promotion can't be added for some reason (e.g. the promotion is expired, the user already had the promotion)

grantPromotion

public void grantPromotion(MutableRepositoryItem pProfile,
                           RepositoryItem pPromotion,
                           java.lang.String pComment)
                    throws atg.commerce.promotion.PromotionException
Adds the given promotion to the user's "activePromotions" list.

Parameters:
pProfile - The profile gaining the promotion
pPromotion - The promotion being added
pComment - And extra string describe this event.
Throws:
PromotionException - Thrown if the promotion can't be added for some reason (e.g. the promotion is expired, the user already had the promotion)

grantPromotion

public void grantPromotion(MutableRepositoryItem pProfile,
                           RepositoryItem pPromotion,
                           java.lang.String pComment,
                           java.lang.String pSiteId)
                    throws atg.commerce.promotion.PromotionException
Adds the given promotion to the user's "activePromotions" list.

Parameters:
pProfile - The profile gaining the promotion
pPromotion - The promotion being added
pComment - And extra string describe this event.
pSiteId - The site with which the promotion is associated
Throws:
PromotionException - Thrown if the promotion can't be added for some reason (e.g. the promotion is expired, the user already had the promotion)

grantPromotion

public void grantPromotion(MutableRepositoryItem pProfile,
                           RepositoryItem pPromotion,
                           java.lang.String pComment,
                           java.lang.String pSiteId,
                           RepositoryItem pCoupon)
                    throws atg.commerce.promotion.PromotionException
Adds the given promotion to the user's "activePromotions" list.

Parameters:
pProfile - The profile gaining the promotion
pPromotion - The promotion being added
pComment - And extra string describe this event.
pSiteId - The site with which the promotion is associated
pCoupon - the coupon that was claimed that contained the promotion to be granted
Throws:
PromotionException - Thrown if the promotion can't be added for some reason (e.g. the promotion is expired, the user already had the promotion)

checkPromotionGrant

public boolean checkPromotionGrant(RepositoryItem pProfile,
                                   RepositoryItem pPromotion)
                            throws atg.commerce.promotion.PromotionException
Will throw appropriate exception or return true if it's OK to grant the promotion to the passed in profile

Parameters:
pProfile - The profile gaining the promotion
pPromotion - The promotion being added
Returns:
true indicates that no checks that may have prevented the grant are applicable
Throws:
PromotionException

checkPromotionGrant

public boolean checkPromotionGrant(RepositoryItem pProfile,
                                   RepositoryItem pPromotion,
                                   java.lang.String[] pCheckProps)
                            throws atg.commerce.promotion.PromotionException
Will throw appropriate exception or return true if it's OK to grant the promotion to the passed in profile

Parameters:
pProfile - The profile gaining the promotion
pPromotion - The promotion being added
pCheckProps - Array of property names in which to look for granted promotions in the profile
Returns:
true indicates that no checks that may have prevented the grant are applicable
Throws:
PromotionException

checkPromotionGrant

public boolean checkPromotionGrant(RepositoryItem pProfile,
                                   RepositoryItem pPromotion,
                                   RepositoryItem pCoupon,
                                   java.lang.String[] pCheckProps)
                            throws atg.commerce.promotion.PromotionException
Will throw appropriate exception or return true if it's OK to grant the promotion to the passed in profile

Parameters:
pProfile - The profile gaining the promotion
pPromotion - The promotion being added
pCoupon - The coupon that caused the promotion grant
pCheckProps - Array of property names in which to look for granted promotions in the profile
Returns:
true indicates that no checks that may have prevented the grant are applicable
Throws:
PromotionException

getPromoStatuses

public java.util.Collection getPromoStatuses(RepositoryItem pProfile,
                                             java.lang.String[] pCheckProps)
Get all of the promoStatuses for the profile

Parameters:
pProfile -
pCheckProps -
Returns:

sendPromotionGrantedEvent

public void sendPromotionGrantedEvent(MutableRepositoryItem pProfile,
                                      RepositoryItem pPromotion)
Sends an PromotionGranted Event through the PromotionGrantedMessageSender if FirePromotionGrantedEvent is set to true.

Parameters:
pProfile - the user's profile to record with the event
pPromotion - pPromotion the promotion to record with the event

sendPromotionGrantedEvent

public void sendPromotionGrantedEvent(MutableRepositoryItem pProfile,
                                      RepositoryItem pPromotion,
                                      java.lang.String pComment)
Sends an PromotionGranted Event through the PromotionGrantedMessageSender if FirePromotionGrantedEvent is set to true.

Parameters:
pProfile - the user's profile to record with the event
pPromotion - pPromotion the promotion to record with the event
pComment - An extra comment describing the eveng

sendPromotionGrantedEvent

public void sendPromotionGrantedEvent(MutableRepositoryItem pProfile,
                                      RepositoryItem pPromotion,
                                      java.lang.String pComment,
                                      java.lang.String pSiteId)
Sends an PromotionGranted Event through the PromotionGrantedMessageSender if FirePromotionGrantedEvent is set to true.

Parameters:
pProfile - the user's profile to record with the event
pPromotion - pPromotion the promotion to record with the event
pComment - An extra comment describing the event
pSiteId - site id associated with the event

sendPromotionRevokedEvent

public void sendPromotionRevokedEvent(RepositoryItem pProfile,
                                      RepositoryItem pPromotion)
Sends a PromotionRevoked Event through the PromotionRevokedMessageSender if FirePromotionRevokedEvent is set to true.

Parameters:
pProfile - the user's profile to record with the event
pPromotion - pPromotion the promotion to record with the event

sendPromotionRevokedEvent

public void sendPromotionRevokedEvent(RepositoryItem pProfile,
                                      RepositoryItem pPromotion,
                                      java.lang.String pComment)
Sends a PromotionRevoked Event through the PromotionRevokedMessageSender if FirePromotionRevokedEvent is set to true.

Parameters:
pProfile - the user's profile to record with the event
pPromotion - pPromotion the promotion to record with the event
pComment - An extra comment describing the event

sendPromotionRevokedEvent

public void sendPromotionRevokedEvent(RepositoryItem pProfile,
                                      RepositoryItem pPromotion,
                                      java.lang.String pComment,
                                      java.lang.String pSiteId)
Sends a PromotionRevoked Event through the PromotionRevokedMessageSender if FirePromotionRevokedEvent is set to true.

Parameters:
pProfile - the user's profile to record with the event
pPromotion - pPromotion the promotion to record with the event
pComment - An extra comment describing the event
pSiteId - site id associated with the event

isPromotionInPromotionStatuses

public boolean isPromotionInPromotionStatuses(RepositoryItem pPromotion,
                                              java.util.Collection pPromotionStatuses)
This method takes a promotion and a collection of promotion statuses, and returns a boolean indicating if the given promotion is represented in the status collection. This method is called when granting a promotion to determine if the promotion already exists among the user's active promotions


addCouponToExistingPromoStatus

public void addCouponToExistingPromoStatus(java.util.Collection<RepositoryItem> pPromotionStatuses,
                                           RepositoryItem pPromotion,
                                           RepositoryItem pCoupon)
This method adds a coupon to an existing promostatus if it is not already in the list.

Parameters:
pPromotion - promotion that is being granted
pCoupon - coupon that caused the promotion grant
pPromotionStatuses - collection of promo statuses to check for promotion

consumePromotion

public boolean consumePromotion(MutableRepositoryItem pProfile,
                                RepositoryItem pPromotion)
This method moves a promotion from the user's activePromotions list to their usedPromotions list. It does this only for promotions marked as "use once".

Parameters:
pProfile - the user's profile
pPromotion - the promotion to consume
Returns:
true if the promotion was moved, false if the promotion is not found.

removePromotion

public boolean removePromotion(MutableRepositoryItem pProfile,
                               RepositoryItem pPromotion,
                               boolean pRemoveAll)
Removes the passed in promotion pPromotion from the pProfile's list of active promotions. If the pRemoveAll flag is set then all instances of this promotion are removed, otherwise the first one of it's kind is removed.

Parameters:
pProfile - - the profile of the user from whom the promotion will be taken out
pPromotion - - the promotion to be removed
pRemoveAll - - true if all instances of this promotion should be removed, false otherwise
Returns:
true if one or more instances of the promotion was removed from the list of active promotions.

revokePromotion

public boolean revokePromotion(java.lang.String pProfileId,
                               java.lang.String pPromotionId,
                               boolean pRemoveAllInstances)
                        throws atg.commerce.promotion.PromotionException
Removes the passed in promotion pPromotion from the pProfile's list of active promotions. If the pRemoveAll flag is set then all instances of this promotion are removed, otherwise the first one of it's kind is removed.

Parameters:
pProfileId - - the profile of the user from whom the promotion will be taken out
pPromotionId - - the promotion to be removed
pRemoveAll - - true if all instances of this promotion should be removed, false otherwise
Returns:
true if the promotion was removed, false if nothing happened
Throws:
PromotionException - if the promotion could not be removed.

revokePromotion

public boolean revokePromotion(MutableRepositoryItem pProfile,
                               RepositoryItem pPromotion,
                               boolean pRemoveAll)
                        throws atg.commerce.promotion.PromotionException
Removes the passed in promotion pPromotion from the pProfile's list of active promotions. If the pRemoveAll flag is set then all instances of this promotion are removed, otherwise the first one of it's kind is removed.

Parameters:
pProfile - - the profile of the user from whom the promotion will be taken out
pPromotion - - the promotion to be removed
pRemoveAll - - true if all instances of this promotion should be removed, false otherwise
Returns:
true if the promotion was removed, false if nothing happened
Throws:
PromotionException - if the promotion could not be removed.

getOrderPromotions

public void getOrderPromotions(Order pOrder,
                               java.util.Collection pPromotions)
Returns the promotions used in the order.

Parameters:
pOrder - the order that the promotions are in
pPromotions - a collection that the promotions are to be added to

getTaxPromotions

public void getTaxPromotions(Order pOrder,
                             java.util.Collection pPromotions)
Returns the promotions used in the tax calculation.

Parameters:
pOrder - the order that the promotions are in
pPromotions - a collection that the promotions are to be added to

getItemPromotions

public void getItemPromotions(CommerceItem pItem,
                              java.util.Collection pPromotions)
Returns the promotions used in the CommerceItem. If calling this method for multiple items, use getItemPromotions(CommerceItem, Collection, Collection, boolean) instead as the passed parameter, pPromotionInstancesAdded tracks each unique promotion instance.

Parameters:
pItem - the CommerceItem that the promotions are in
pPromotions - a collection that the promotions are to be added to

getShippingPromotions

public void getShippingPromotions(ShippingGroup pGroup,
                                  java.util.Collection pPromotions)
Returns the promotions used in the ShippingGroup. If calling this method for multiple shipping groups, use getShippingPromotions(ShippingGroup, Collection, Collection, boolean) instead as the passed parameter, pPromotionInstancesAdded tracks each unique promotion instance.

Parameters:
pGroup - the ShippingGroup that the promotions are in
pPromotions - a collection that the promotions are to be added to

getOrderPromotions

public void getOrderPromotions(Order pOrder,
                               java.util.Collection pOrderPromotions,
                               java.util.Collection pTaxPromotions,
                               java.util.Collection pItemPromotions,
                               java.util.Collection pShippingPromotions)
This method retrieves all the promotions in an order and adds them to their respective collection.

Parameters:
pOrder - the order to retrieve the promotions from
pOrderPromotions - the collection to add the order level promotions to
pTaxPromotions - the collection to add the tax level promotions to
pItemPromotions - the collection to add the item level promotions to
pShippingPromotions - the collection to add the shipping level promotions to

getOrderPromotions

public void getOrderPromotions(Order pOrder,
                               java.util.Collection pPromotions,
                               boolean pGetAdjustments)
Returns the promotions used in the order. If pGetAdjustments is true then pPromotions is populated with each PricingAdjustment associated with a promotion. If it is false, then pPromotions is populated with the actual pricing model repository items.

Parameters:
pOrder - the order that the promotions are in
pPromotions - a collection that the promotions are to be added to
pGetAdjustments - If true, get the PricingAdjustments, if false get the promotions

getTaxPromotions

public void getTaxPromotions(Order pOrder,
                             java.util.Collection pPromotions,
                             boolean pGetAdjustments)
Returns the promotions used in the tax calculation. If pGetAdjustments is true then pPromotions is populated with each PricingAdjustment associated with a promotion. If it is false, then pPromotions is populated with the actual pricing model repository items.

Parameters:
pOrder - the order that the promotions are in
pPromotions - a collection that the promotions are to be added to
pGetAdjustments - If true, get the PricingAdjustments, if false get the promotions

getItemPromotions

@Deprecated
public void getItemPromotions(CommerceItem pItem,
                                         java.util.Collection pPromotions,
                                         boolean pGetAdjustments)
Deprecated. as of 10.2; use getItemPromotions(CommerceItem, Collection, Collection, boolean) instead

Returns the promotions used in the CommerceItem. If pGetAdjustments is true then pPromotions is populated with each PricingAdjustment associated with a promotion. If it is false, then pPromotions is populated with the actual pricing model repository items.

Parameters:
pItem - the CommerceItem that the promotions are in
pPromotions - a collection that the promotions are to be added to
pGetAdjustments - If true, get the PricingAdjustments, if false get the promotions

getItemPromotions

public void getItemPromotions(CommerceItem pItem,
                              java.util.Collection pPromotions,
                              java.util.Collection pPromotionInstancesAdded,
                              boolean pGetAdjustments)
Returns the promotions used in the CommerceItem. If pGetAdjustments is true then pPromotions is populated with each PricingAdjustment associated with a promotion. If it is false, then pPromotions is populated with the actual pricing model repository items.

Parameters:
pItem - the CommerceItem that the promotions are in
pPromotions - a collection that the promotions are to be added to
pPromotionInstancesAdded - a collection tracking the unique promotion instances added to pPromotions
pGetAdjustments - If true, get the PricingAdjustments, if false get the promotions

getShippingPromotions

@Deprecated
public void getShippingPromotions(ShippingGroup pGroup,
                                             java.util.Collection pPromotions,
                                             boolean pGetAdjustments)
Deprecated. as of 10.2; use getShippingPromotions(ShippingGroup, Collection, Collection, boolean) instead

Returns the promotions used in the ShippingGroup. If pGetAdjustments is true then pPromotions is populated with each PricingAdjustment associated with a promotion. If it is false, then pPromotions is populated with the actual pricing model repository items.

Parameters:
pGroup - the ShippingGroup that the promotions are in
pPromotions - a collection that the promotions are to be added to
pGetAdjustments - If true, get the PricingAdjustments, if false get the promotions

getShippingPromotions

public void getShippingPromotions(ShippingGroup pGroup,
                                  java.util.Collection pPromotions,
                                  java.util.Collection pPromotionInstancesAdded,
                                  boolean pGetAdjustments)
Returns the promotions used in the ShippingGroup. If pGetAdjustments is true then pPromotions is populated with each PricingAdjustment associated with a promotion. If it is false, then pPromotions is populated with the actual pricing model repository items.

Parameters:
pGroup - the ShippingGroup that the promotions are in
pPromotions - a collection that the promotions are to be added to
pPromotionInstancesAdded - a collection tracking the unique promotion instances added to pPromotions
pGetAdjustments - If true, get the PricingAdjustments, if false get the promotions

getOrderPromotions

public void getOrderPromotions(Order pOrder,
                               java.util.Collection pOrderPromotions,
                               java.util.Collection pTaxPromotions,
                               java.util.Collection pItemPromotions,
                               java.util.Collection pShippingPromotions,
                               boolean pGetAdjustments)
This method retrieves all the promotions in an order and adds them to their respective collection. If pGetAdjustments is true then each promotion collection is populated with each PricingAdjustment associated with a promotion. If it is false, then each promotion collection is populated with the actual pricing model repository items.

Parameters:
pOrder - the order to retrieve the promotions from
pOrderPromotions - the collection to add the order level promotions to
pTaxPromotions - the collection to add the tax level promotions to
pItemPromotions - the collection to add the item level promotions to
pShippingPromotions - the collection to add the shipping level promotions to
pGetAdjustments - If true, get the PricingAdjustments, if false get the promotions

expirePromotion

public void expirePromotion(RepositoryItem pPromotion,
                            RepositoryItem pProfile)
This method will remove the passed in promotion from the Profile.

Parameters:
pPromotion - the promotion which has expired
pProfile - the profile for which a promotion has expired

convertPromoStatusToPromo

public java.util.Collection convertPromoStatusToPromo(java.util.Collection pPromoStatuses)
This method returns a collection of propmotions from the passed in collection of promotion statuses.

Parameters:
pPromoStatuses -
Returns:
collection of promotions

convertSinglePromoStatusToPromo

public RepositoryItem convertSinglePromoStatusToPromo(RepositoryItem pPromoStatus)
This method returns the single promotion from a promotion status

Parameters:
pPromoStatus - - promoStatus to get the promotion from
Returns:
the promotion in the promoStatus

scenarioAddedItemToOrder

public boolean scenarioAddedItemToOrder(Order pOrder,
                                        CommerceItem pItem,
                                        long pQuantity)
This method is called by the AddItemToOrder scenario action. It will create a ScenarioAddedItemToOrder scenario event and send it. If sendEventOnAddItem is false, then nothing happens and true is returned.

Parameters:
pOrder - The order that was modified
pItem - The item that was added
pQuantity - The quantity of pItem added to pOrder
Returns:
false if there were errors, true otherwise

scenarioAddedItemToOrder

public boolean scenarioAddedItemToOrder(Order pOrder,
                                        CommerceItem pItem,
                                        long pQuantity,
                                        java.lang.String pSiteId)
This method is called by the AddItemToOrder scenario action. It will create a ScenarioAddedItemToOrder scenario event and send it. If sendEventOnAddItem is false, then nothing happens and true is returned.

Parameters:
pOrder - The order that was modified
pItem - The item that was added
pQuantity - The quantity of pItem added to pOrder
pSiteId - The site ID associated with a scenario event
Returns:
false if there were errors, true otherwise

getProfile

public RepositoryItem getProfile(java.lang.String pProfileId)
                          throws RepositoryException
Gets the profile repository item with the given id

Parameters:
pProfileId - the id of the profile to retrieve
Returns:
the profie repository item
Throws:
RepositoryException - if there was an error while retrieving the profile

getPromotionsAsXML

public java.lang.String[] getPromotionsAsXML(java.lang.String pProfileId)
                                      throws atg.commerce.promotion.PromotionException
This method will look up the given profile, and for each available promotion, will return an xml representation of it using the GetService and the mappingFileName. Both active promotions in the profile and global promotions are returned.

Parameters:
pProfileId - The id of the user whose promotions are returned
Returns:
An XML representation of each active promotion in the profile
Throws:
PromotionException

getPromotions

public java.util.Collection getPromotions(java.lang.String pProfileId)
                                   throws atg.commerce.promotion.PromotionException
This method will look up the given profile and return all of the available promotions for that user. This will include active promotions in the profile, as well as global promotions.

Parameters:
pProfileId - The id of the user whose promotions are returned
Returns:
A collection of promotion items
Throws:
PromotionException

calculatePromotionsForOrder

public java.util.Map calculatePromotionsForOrder(Order pOrder)
This method will return a map containing the count of promotions contained in the given order, and the total value of those promotions

Parameters:
pOrder - the order whose promotions we would like to calculate.

getPromotionCount

public int getPromotionCount(Order pOrder,
                             RepositoryItem pPromotion)
Returns the number of times a promotion appears in the order.

Parameters:
pOrder - the order
pPromotion - the promotion
Returns:
number of occurrences

createPromotionCountMap

public java.util.Map createPromotionCountMap(Order pOrder)
Creates a Map of promotion id to the use count in the order.

Parameters:
pOrder -

isUsable

public boolean isUsable(RepositoryItem pPromotion)
This method determines if the given promotion is usable based on the date allowed on the promotion compared to the current date.

Parameters:
pPromotion - the promotion that should be verified
Returns:
true if the promotion should be added to the list of promotions which can be used for pricing

isUsable

public boolean isUsable(RepositoryItem pPromotion,
                        java.util.Date pNow)
This method determines if the given promotion is usable based on the date allowed on the promotion compared to the passed in date.

Parameters:
pPromotion - the promotion that should be verified
pNow - the current date
Returns:
true if the promotion should be added to the list of promotions which can be used for pricing

getPMDLVersion

public int getPMDLVersion(RepositoryItem pPricingModel)
Utility method to get the pmdl version for a given promotion.

Parameters:
pPricingModel - Promotion RepositoryItem to check
Returns:
int pmdl version 1 = old type, 2+ = new type.

getQualifierService

public Qualifier getQualifierService(RepositoryItem pPricingModel,
                                     java.util.Map pExtraParameters,
                                     Qualifier pDefaultQualifier)
Gets the Qualifier service to use for the given promotion item. First checks the extra parameters map for a Qualifier with key EXTRA_PARAM_QUALIFIERSERVICE. Then checks the given promotion item 'qualifierService' property. If this is not null then it tries to resolve it into a Qualifier to use. If we still don't have a Qualifier then the passed in default qualifier service is used. If this is also null then the Qualifier service this service is configured with is used.

Parameters:
pPricingModel - RepositoryItem of the promotion. May be null.
pExtraParameters - Map of optional extra parameters. May be null.
pDefaultQualifier - Qualifier to use if promotion item 'qualifierService' property is null. May be null.
Returns:
Qualifier to use.

resolveQualifierService

protected Qualifier resolveQualifierService(java.lang.String pQualifierPath)
                                     throws PricingException
Resolves the given String nucleus path to a Qualifier service object reference. Caches the service references for efficiency.

Parameters:
pQualifierPath - String nucleus path to resolve.
Returns:
Qualifier service
Throws:
PricingException - if the qualifier service could not be resolved

createPromotionValueMap

public java.util.Map createPromotionValueMap(Order pOrder,
                                             boolean pIncludeOrderPromos,
                                             boolean pIncludeItemPromos,
                                             boolean pIncludeShippingPromos,
                                             boolean pIncludeTaxPromos)
Creates a map of promotion id to adjustment value for each promotion applied to the given order.

Parameters:
pOrder -
pIncludeOrderPromos - if true, the order promotions are included in the Map
pIncludeItemPromos - if true, the item promotions are included in the Map
pIncludeShippingPromos - if true, the shipping promotions are included in the Map
pIncludeTaxPromos - if true, the tax promotions are included in the Map
Returns:
Map of promotion id to total adjustment value