com.ibm.commerce.marketing.promotion

Class DefaultPromotion

  • java.lang.Object
    • com.ibm.commerce.marketing.promotion.DefaultPromotion
  • All Implemented Interfaces:
    Promotion, XMLizable, java.io.Serializable


    public class DefaultPromotion
    extends java.lang.Object
    implements Promotion
    This class provides default implementation of the Promotion interface. Refer to the details of the methods below. XML Snippet of the DefaultPromotion is as follows:
      <Promotion impl="com.ibm.commerce.marketing.promotion.DefaultPromotion">
     
      <!-- this identifies the promotion.  -->
      <PromotionKey>
      <!-- Name of the promotion -->
      <PromotionName>DollarsOffPromotionOne</PromotionName>
      
      <!-- The store which owns this promotion. Store key is defined as the 
      combination of the DN of the organization that owns  this store and a 
      store name -->
      <StoreKey>
      <DN>o=Root Organization</DN>
      <Identifier>BlueStore 201</Identifier>
      </StoreKey>
     
      <!-- Versions of a promotion. Statistics are associated with the
      version number,promotions with the same promotion key and version 
      number but different revision are considered different revisions of
      the same promotion.  Promotions with the same key but different 
      version numbers are considered distinct promotions. -->
      <Version>0</Version>
      <Revision>0</Revision>
      </PromotionKey>
     
      <!-- Promotions are group by groups, and groups are scoped by store, 
      refer to promotion organization for details on what a group is, its role 
      and the default groups -->
     
      <PromotionGroupKey>
      <GroupName>OrderLevelPromotion</GroupName>
      <StoreKey>
      <DN>o=Root Organization</DN>
      <Identifier>BlueStore 201</Identifier>
      </StoreKey>
      </PromotionGroupKey>
     
      <!-- Various descriptions of the promotion -->
      <TypedNLDescription impl="com.ibm.commerce.marketing.promotion.TypedNLDescription">
      <DefaultLocale>en_US</DefaultLocale>
      <Description locale="en_US" type="admin">[en_US:admin]A sample promotion</Description>
      <Description locale="en_US" type="long">[en_US:long]A sample promotion</Description>
      <Description locale="en_US" type="short">[en_US:short]A sample promotion</Description>
      <Description locale="fr_FR" type="admin">[fr_FR:admin]A sample promotion</Description>
      <Description locale="fr_FR" type="long">[fr_FR:long]A sample promotion</Description>
      <Description locale="fr_FR" type="short">[fr_FR:short]A sample promotion</Description>
      </TypedNLDescription>
     
      <!-- Priority of the promotion the higher the more important -->
      <Priority>1000</Priority>
     
      <!-- Exclusiveness of the promotion. Possible values are:  
      0: not exclusive at all 
      1: exclusive at the group level 
      2: exclusive at a global level 
      3: a backward compatibility mode that mimics the combinability 
      of order level promotions with product level promotions in 
      previous releases
      -->
      <Exclusive>3</Exclusive>
     
      <!-- For future use, always empty for now --> 
      <ExemptPolicyList />
      
      <!-- For future use, always empty for now -->
      <ExplicitlyAppliedPolicyList />
     
      <!-- Status of the promotion: 
      0: inactive
      1: active
      2: deleted
      3: suspended 
      4: obsolete
      -->
      <Status>1</Status>
     
      <!-- Audit trail, last update time and last person who updated the 
      promotion -->
      <LastUpdate>01-09-2003 12:00:00</LastUpdate>
      <LastUpdateBy>
      <CustomerKey>
      <LogonId>wcsadmin</LogonId>
      </CustomerKey>
      </LastUpdateBy>
     
      <!-- How many times this promotion can be applied to the current order, 
      possible values are:  
      -1:              unlimited
      positive number: the limit 
      -->
      <PerOrderLimit>1</PerOrderLimit>
     
      <!-- How many times this promotion can be applied to a shopper, 
      possible values are:  
      -1:              unlimited,
      positive number: the limit 
     
      This value is only valid for a registered shopper, for none registered 
      shoppers there is no way to control how many times a shopper can redeem a 
      promotion. 
      -->
      <PerShopperLimit>-1</PerShopperLimit>
     
      <!-- How many times this promotion can be redeemed overall.
      Possible values are:
      -1:              unlimited,
      positive number: the limit 
      -->
      <ApplicationLimit>-1</ApplicationLimit>
     
      <!-- Schedule information of this promotion -->
      <Schedule impl="com.ibm.commerce.marketing.promotion.schedule.PromotionSchedule">
      <DateRange impl="com.ibm.commerce.marketing.promotion.schedule.DateRangeSchedule">
      <Start inclusive="true">01-09-2003</Start>
      <End inclusive="true">31-12-2004</End>
      </DateRange>
      <TimeWithinADay impl="com.ibm.commerce.marketing.promotion.schedule.TimeRangeWithinADaySchedule">
      <Start inclusive="true">00:00:00</Start>
      <End inclusive="false">23:59:59</End>
      </TimeWithinADay>
      <Week impl= "com.ibm.commerce.marketing.promotion.schedule.WeekDaySchedule">
      <WeekDay>Sunday</WeekDay>
      <WeekDay>Monday</WeekDay>
      <WeekDay>Tuesday</WeekDay>
      <WeekDay>Wednesday</WeekDay>
      <WeekDay>Thursday</WeekDay>
      <WeekDay>Friday</WeekDay>
      <WeekDay>Saturday</WeekDay>
      </Week>
      </Schedule>
     
      <!-- Type of promotion:
      0: targeted
      1: private, that is, a coupon promotion -->
      <PromotionType>0</PromotionType>
     
      <!-- Optional, if default promotion code manager and resolver are used, 
      this is the promotion code for this promotion, if not, this can be 
      left empty or used as cue for promotion code generation 
      -->
      <PromotionCodeCue>PXO002</PromotionCodeCue>
     
      <!-- Whether a code is required to redeem this promotion. -->
      <PromotionCodeRequired>false</PromotionCodeRequired>
     
      <!-- Check the target condition or not -->
      <CheckTargetingConditionAtRuntime>true</CheckTargetingConditionAtRuntime>
     
      <!-- When a promotion code is entered, should the target condition be checked -->
      <SkipTargetingConditionOnProperPromotionCodeEntered>false</SkipTargetingConditionOnProperPromotionCodeEntered>
     
      <!-- Do not change this element-->
      <PromotionCodeCondition impl= "com.ibm.commerce.marketing.promotion.condition.PromotionCodeCondition" />
     
      <!-- Targeting condition based on customer segments defined in WebSphere Commerce -->
      <Targeting impl= "com.ibm.commerce.marketing.promotion.condition.TargetingCondition">
      <TargetedProfile>
      <CustomerProfileKey>
      <OwnerDN>o=Root Organization</OwnerDN>
      <ProfileName>EmptyNester</ProfileName>
      </CustomerProfileKey>
      <CustomerProfileKey>
      <OwnerDN>o=Root Organization</OwnerDN>
      <ProfileName>DINK Couple</ProfileName>
      </CustomerProfileKey>
      </TargetedProfile>
      <ExcludedProfile>
      <CustomerProfileKey>
      <OwnerDN>o=Root Organization</OwnerDN>
      <ProfileName>Employee</ProfileName>
      </CustomerProfileKey>
      </ExcludedProfile>
      </Targeting>
     
      <!-- Custom condition can be added here for example:
      <CustomConditions> 
      <Condition impl= "com.myCompany.condition.custom.MyOtherMoreComplexCondition">
      <!-- Where myCompany is a custom package name. -->
      <ConfigParameter1>XXXX</ConfigParameter1>
      <ConfigParameter2>
      <CP2.1>YYYY</CP2.1>
      <CP2.2>ZZZZ</CP2.2>
      </ConfigParameter2>
      </Condition>
      </CustomConditions>
      -->
     
      <CustomConditions />
     
      <!-- This is core of a promotion definition. It follows the model 
      introduced in appendix B -->
      
      <PurchaseCondition impl= "com.ibm.commerce.marketing.promotion.condition.PurchaseCondition">
      <!-- Matches the pattern targeted by the current promotion: the following 
      pattern matches the entire order, for details refer to the promotion 
      purchase condition model document -->
      <Pattern impl="com.ibm.commerce.marketing.promotion.condition.Pattern">
      
      <!-- A pattern is made up of multiple constraint, each specifying a 
      list of items that make up part of the pattern. There must be no 
      cross-sections between constraints -->
      <Constraint impl= "com.ibm.commerce.marketing.promotion.condition.Constraint">
      <!-- Quantity requirement of this constraint -->
      <WeightedRange impl= "com.ibm.commerce.marketing.promotion.condition.WeightedRange">
      <!-- minimum number of item is 1 --> 
      <LowerBound>1</LowerBound>
      
      <!-- Maximum number of item is not limited -->
      <UpperBound>-1</UpperBound>
      
      <!-- Match as many as items that satisfy the criteria defined in 
      the filter chain next -->
      <Weight>1</Weight>
      </WeightedRange>
     
      <!-- Selection criteria -->
      <FilterChain impl= "com.ibm.commerce.marketing.promotion.condition.FilterChain">
      
      <!-- Multiple filters can be specified, the are applied in a 
      contiguous fashion, that is, connected using a logical "and". -->
      <!-- The dummy filter returns anything passed to it, it 
      effectively selects anything -->
      <Filter impl= "com.ibm.commerce.marketing.promotion.condition.DummyFilter" />
      </FilterChain>
     
      <!-- The combination of the quantity requirement and the filter 
      chain would return everything present in the shopcart as one big 
      matched pattern -->
      
      </Constraint>
      
      </Pattern>
     
      <!-- Once pattern is matched, rewards are assigned, for details refer to the 
      purchase condition model document -->
     
      <Distribution impl= "com.ibm.commerce.marketing.promotion.reward.Distribution">
     
      <!-- A volume based distribution on the spending total is performed, 
      spending total is measure in CAD -->
      <Type>Volume</Type>
      <Base>Cost</Base>
      <Currency>CAD</Currency>
     
      <!-- Not all matched patterns are rewarded, for example, a combination 
      of shirts and pants priced over $120 if a combination of shirts and 
      pants which is priced at $100, it should be eliminated, for most 
      cases this filter is not required and therefore a DummyPatternFilter 
      is used -->
      <PatternFilter impl= "com.ibm.commerce.marketing.promotion.condition.DummyPatternFilter" />
      
      <!-- First range 100 <= spending <= 200 -->
      <Range impl= "com.ibm.commerce.marketing.promotion.reward.DistributionRange">
      <UpperBound>200</UpperBound>
      <LowerBound>100</LowerBound>
      
      <!-- For future purchase, choice not supported in this release -->
      <RewardChoice>
     
      <!-- This reward, if the spending total of ALL matched patterns 
      falls into the range of 100 to 200 -->
      <Reward impl= "com.ibm.commerce.marketing.promotion.reward.DefaultReward">
      <AdjustmentFunction impl="com.ibm.commerce.marketing.promotion.reward.AdjustmentFunction">
     
      <!-- Reward can be associated with a sub set of the items 
      that make up the pattern,the input of this filter chain will 
      be one matched pattern, and a sub set of items that make up 
      that pattern is returned and adjustments are associated with 
      the returned items also known as affected items -->
      <FilterChain impl= "com.ibm.commerce.marketing.promotion.condition.FilterChain">
      <Filter impl= "com.ibm.commerce.marketing.promotion.condition.DummyFilter" />
      </FilterChain>
     
      <!-- the adjustment -->
      <Adjustment impl= "com.ibm.commerce.marketing.promotion.reward.FixedAmountOffAdjustment">
      <AmountOff>15</AmountOff>
      <Currency>CAD</Currency>
      <!-- This adjustment is applied to the entire order, 
      possible values are: (case insentitive)
      wholeOrder:  The entire order, that is, $15 dollars off 
      an entire order
      AllAffectedItems: Affected items returned by the filter 
      chain defined above, that is, $15  dollars 
      off all of the affected items as a whole.
      IndividualAffectedItems: Adjustments are applied to 
      affected items individually, that is, $15 
      dollars off each and every affected item.
      -->
     
      <AdjustmentType>wholeOrder</AdjustmentType>
      </Adjustment>
      </AdjustmentFunction>
      </Reward>
      </RewardChoice>
      </Range>
     
      <!-- Another range, $200 < spending -->
      <Range impl="com.ibm.commerce.marketing.promotion.reward.DistributionRange">
      <UpperBound>-1</UpperBound>
      <LowerBound>200</LowerBound>
      <LowerBoundIncluded>false</LowerBoundIncluded>
      <RewardChoice>
      <Reward impl= "com.ibm.commerce.marketing.promotion.reward.DefaultReward">
      <AdjustmentFunction impl= "com.ibm.commerce.marketing.promotion.reward.AdjustmentFunction">
      <FilterChain impl="com.ibm.commerce.marketing.promotion.condition.FilterChain">
      <Filter impl="com.ibm.commerce.marketing.promotion.condition.DummyFilter" />
      </FilterChain>
      <Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FixedAmountOffAdjustment">
      <AmountOff>45</AmountOff>
      <Currency>CAD</Currency>
      <AdjustmentType>wholeOrder</AdjustmentType>
      </Adjustment>
      </AdjustmentFunction>
      </Reward>
      </RewardChoice>
      </Range>
      </Distribution>
     
      </PurchaseCondition>
     
      </Promotion>
      
     
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM Copy right.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultPromotion

        public DefaultPromotion()
        Default Constructor for Promotion.
    • Method Detail

      • getKey

        public PromotionKey getKey()
        Returns the key.
        Specified by:
        getKey in interface Promotion
        Returns:
        String the key of promotion
      • getDescription

        public java.lang.String getDescription(java.util.Locale alocale,
                                               int atype)
        Returns the specified type of the description of the promotion in a particular locale. The types of the description include the following:
        0: Administrative description
        1: Customer facing long description
        2: Customer facing short description
        Five other custom descriptions can also be returned for the promotion.
        Specified by:
        getDescription in interface Promotion
        Parameters:
        alocale - The Locale of the description to be returned.
        atype - The type of the description to be returned.
        Returns:
        String The specified type of the description of the promotion in a locale.
      • getExclusiveLevel

        public int getExclusiveLevel()
        Returns the exclusive level.
        Specified by:
        getExclusiveLevel in interface Promotion
        Returns:
        int the exclusive level.
      • getLastUpdate

        public java.util.Date getLastUpdate()
        Returns the lastUpdate date.
        Specified by:
        getLastUpdate in interface Promotion
        Returns:
        date which is last updated.
      • getLastUpdateBy

        public CustomerKey getLastUpdateBy()
        Returns the customer key representing who last updates the promotion.
        Specified by:
        getLastUpdateBy in interface Promotion
        Returns:
        CustomerKey representing who last updates the promotion.
      • getName

        public java.lang.String getName()
        Returns the name of promotion.
        Specified by:
        getName in interface Promotion
        Returns:
        String the name of promotion.
      • getPriority

        public java.lang.Integer getPriority()
        Returns the priority.
        Specified by:
        getPriority in interface Promotion
        Returns:
        Integer representing the priority.
      • getSchedule

        public Schedule getSchedule()
        Returns the schedule associated with the promotion.
        Specified by:
        getSchedule in interface Promotion
        Returns:
        Schedule associated with the promotion.
      • getStatus

        public int getStatus()
        Returns the status of the promotion.
        Specified by:
        getStatus in interface Promotion
        Returns:
        int representing the status of the promotion.
      • setDescription

        public void setDescription(java.util.Locale aLocale,
                                   int aType,
                                   java.lang.String aDescription)
        Sets the specified type of the description of the promotion in a particular locale. The types of the description include the following:
        0: Administrative description
        1: Customer facing long description
        2: Customer facing short description
        Five other custom descriptions can also be set for the promotion.
        Specified by:
        setDescription in interface Promotion
        Parameters:
        aLocale - The Locale of the description to be set.
        aType - The type of the description to be set.
        aDescription - The description to set.
      • setExclusiveLevel

        public void setExclusiveLevel(int anExclusive)
        Sets the exclusive level.
        Specified by:
        setExclusiveLevel in interface Promotion
        Parameters:
        anExclusive - The int representing an exclusive level to set.
      • setKey

        public void setKey(PromotionKey akey)
        Sets the key of the promotion.
        Specified by:
        setKey in interface Promotion
        Parameters:
        akey - The key of the promotion to set.
      • setLastUpdate

        public void setLastUpdate(java.util.Date aLastUpdate)
        Sets the last update date of the promotion.
        Specified by:
        setLastUpdate in interface Promotion
        Parameters:
        aLastUpdate - The last update date to set
      • setLastUpdateBy

        public void setLastUpdateBy(CustomerKey aLastUpdateBy)
        Sets the customer key representing who last update the promotion.
        Specified by:
        setLastUpdateBy in interface Promotion
        Parameters:
        aLastUpdateBy - The customer key representing who last update the promotion.
      • setPriority

        public void setPriority(java.lang.Integer aPriority)
        Sets the priority.
        Specified by:
        setPriority in interface Promotion
        Parameters:
        aPriority - The priority to set
      • setSchedule

        public void setSchedule(Schedule aSchedule)
        Sets the schedule of the promotion.
        Specified by:
        setSchedule in interface Promotion
        Parameters:
        aSchedule - The schedule to set for a promotion.
      • setStatus

        public void setStatus(int aStatus)
        Sets the status of the promotion.
        Specified by:
        setStatus in interface Promotion
        Parameters:
        aStatus - The status for a promotion to set.
      • getPromotionCodeCondition

        public Condition getPromotionCodeCondition()
        Returns the condition of promotion code.
        Specified by:
        getPromotionCodeCondition in interface Promotion
        Returns:
        the condition of promotion code.
      • setPromotionCodeCondition

        public void setPromotionCodeCondition(Condition aPromotionCodeCondition)
        Sets the promotion code condition.
        Specified by:
        setPromotionCodeCondition in interface Promotion
        Parameters:
        aPromotionCodeCondition - The promotion code condition to set.
      • setTargetingCondition

        public void setTargetingCondition(Condition aTargetingCondition)
        Sets the targeting condition.
        Specified by:
        setTargetingCondition in interface Promotion
        Parameters:
        aTargetingCondition - The targeting condition to set.
      • ignoreTargettingConditionUponProperPromotionCodeEntry

        public boolean ignoreTargettingConditionUponProperPromotionCodeEntry()
        Returns true if targeting condition is to be checked at runtime.
        Specified by:
        ignoreTargettingConditionUponProperPromotionCodeEntry in interface Promotion
        Returns:
        boolean representing if targeting condition is to be checked at runtime.
      • setIgnoreTargetingConditionUponProperPromotionCodeEntry

        public void setIgnoreTargetingConditionUponProperPromotionCodeEntry(boolean ignore)
        Sets to ignore targeting condition upon a correct code entry.
        Specified by:
        setIgnoreTargetingConditionUponProperPromotionCodeEntry in interface Promotion
        Parameters:
        ignore - to ignore targeting condition upon a correct code entry.
      • addCustomCondition

        public void addCustomCondition(Condition aRestriction)
        Adds a custom condition to this promotion.
        Specified by:
        addCustomCondition in interface Promotion
        Parameters:
        aRestriction - The custom condition to add.
      • getCustomConditions

        public java.util.Iterator getCustomConditions()
        Returns the list of custom conditions.
        Specified by:
        getCustomConditions in interface Promotion
        Returns:
        an Iterator of custom conditions.
      • getGroupKey

        public com.ibm.commerce.marketing.promotion.group.PromotionGroupKey getGroupKey()
        Returns the group that this promotion belongs to.
        Specified by:
        getGroupKey in interface Promotion
        Returns:
        PromotionGroup representing the group that this promotion belongs to.
      • setGroupKey

        public void setGroupKey(com.ibm.commerce.marketing.promotion.group.PromotionGroupKey aKey)
        Sets the group this promotion belongs to.
        Specified by:
        setGroupKey in interface Promotion
        Parameters:
        aKey - Sets the group that this promotion belongs to.
      • getPerOrderLimit

        public int getPerOrderLimit()
        Returns the perOrderLimit. This is the maximum number of times a promotion can be applied to an order. When this promotion is a private promotion, this governs the maximum number of coupons for this promotion that can be used together for any order.
        Specified by:
        getPerOrderLimit in interface Promotion
        Returns:
        int the per order redemption limit that represents the maximum number of times a promotion can be applied to an order.
      • getPerShopperLimit

        public int getPerShopperLimit()
        Returns the perShopperLimit. This is the maximum number of times a promotion can be applied to any shopper. System keeps the statistics in order to count the number of times a shopper has redeemed a promotion. The total count is not allowed to exceed this limit.
        Specified by:
        getPerShopperLimit in interface Promotion
        Returns:
        int the maximum number of times a shopper is entitled to a promotion.
      • getTotalApplicationCountLimit

        public int getTotalApplicationCountLimit()
        Returns the totalApplicationCountLimit. This controls how many times overall a promotion can be redeemed. For private promotions, this controls how many coupons will be issued.
        Specified by:
        getTotalApplicationCountLimit in interface Promotion
        Returns:
        int the limit of how many times a promotion can be redeemed overall.
      • getCodeCouponPerOrderLimit

        public int getCodeCouponPerOrderLimit()
        Returns the codeCouponPerOrderLimit. This controls how many promotion codes can give adjustments for this promotion. For example, if a promotion is $10 off of an order and this limit is 2, the shopper can add 2 unique promotion codes and get $20 off of their order.
        Returns:
        int the limit of how many times a promotion code promotion can be applied.
      • setCustomConditions

        public void setCustomConditions(java.util.Vector restrictions)
        Sets the other restrictions that may be added.
        Specified by:
        setCustomConditions in interface Promotion
        Parameters:
        restrictions - The other restrictions that may be added.
      • setPerOrderLimit

        public void setPerOrderLimit(int aPerOrderLimit)
        Sets the per order redemption limit.
        Specified by:
        setPerOrderLimit in interface Promotion
        Parameters:
        aPerOrderLimit - The per order redemption limit to set.
      • setPerShopperLimit

        public void setPerShopperLimit(int aPerShopperLimit)
        Sets the the maximum number of times a promotion can be applied to any shopper.
        Specified by:
        setPerShopperLimit in interface Promotion
        Parameters:
        aPerShopperLimit - The maximum number of times a promotion can be applied to any shopper to set.
      • setTotalApplicationCountLimit

        public void setTotalApplicationCountLimit(int aTotalApplicationCountLimit)
        Sets the limit of how many times a promotion can be redeemed overall.
        Specified by:
        setTotalApplicationCountLimit in interface Promotion
        Parameters:
        aTotalApplicationCountLimit - The limit of how many times a promotion can be redeemed overall to set.
      • setCodeCouponPerOrderLimit

        public void setCodeCouponPerOrderLimit(int codeCouponPerOrderLimit)
        Sets the limit of how many times unique promotion codes can give adjustments for the same promotion.
        Parameters:
        codeCouponPerOrderLimit - The limit of how many unique promotion codes can give adjustments for the same promotion.
      • getRevision

        public int getRevision()
        Returns the revision. Revision number of this promotion. Promotions belong to the same store with the same version number but different revision number are consider different levels of the same promotion.
        Specified by:
        getRevision in interface Promotion
        Returns:
        int the revision number of the promotion.
      • getType

        public int getType()
        Returns the type of the promotion. Types can be either targeted or private.
        Specified by:
        getType in interface Promotion
        Returns:
        Integer of type of the promotion.
      • getVersion

        public int getVersion()
        Returns the version of this promotion. Promotions with different version numbers are considered different promotions. Among all the promotions with same name in the same store, only one is active at any given time. This one is identified by promotion name, version or revision numbers, and store ID. The rest of them will be marked as obsolete.
        Specified by:
        getVersion in interface Promotion
        Returns:
        int version number of the promotion.
      • setType

        public void setType(int aType)
        Sets the type of promotion.
        0: targeted
        1: private
        Specified by:
        setType in interface Promotion
        Parameters:
        aType - The type of promotion to set.
      • getCode

        public java.lang.String getCode()
        Returns the visualCue. visualCue is the text entered either to be used as promotion code or to assist the generation of the promotion code.
        Specified by:
        getCode in interface Promotion
        Returns:
        String of the visualCue. VisualCue is the text entered either to be used as promotion code or to assist the generation of the promotion code.
      • setCode

        public void setCode(java.lang.String visualCue)
        Sets the visualCue. visualCue is the text entered either to be used as promotion code or to assist the generation of the promotion code.
        Specified by:
        setCode in interface Promotion
        Parameters:
        visualCue - The visualCue to set. VisualCue is the text entered either to be used as promotion code or to assist the generation of the promotion code.
      • isPromotionCodeRequired

        public boolean isPromotionCodeRequired()
        Returns the promotionCodeRequired. It controls if a correct promotion code is needed in order to redeem this promotion.
        Specified by:
        isPromotionCodeRequired in interface Promotion
        Returns:
        boolean that controls if a correct promotion code is needed in order to redeem this promotion.
      • setPromotionCodeRequired

        public void setPromotionCodeRequired(boolean aPromotionCodeRequired)
        Sets if promotion code is required.
        Specified by:
        setPromotionCodeRequired in interface Promotion
        Parameters:
        aPromotionCodeRequired - if promotion code is required.
      • getPurchaseCondition

        public Condition getPurchaseCondition()
        Returns the purchaseCondition. Purchase condition is the condition that governs certain purchases the customer has to make in order to qualify for a promotion.
        Specified by:
        getPurchaseCondition in interface Promotion
        Returns:
        Condition. Purchase condition is the condition that governs certain purchases the customer has to make in order to qualify for a promotion.
      • setPurchaseCondition

        public void setPurchaseCondition(Condition aPurchaseCondition)
        Sets the purchaseCondition. Purchase condition is the condition that governs certain purchases the customer has to make in order to qualify for a promotion.
        Specified by:
        setPurchaseCondition in interface Promotion
        Parameters:
        aPurchaseCondition - The purchase condition to set. Purchase condition is the condition that governs certain purchases the customer has to make in order to qualify for a promotion.
      • getCurrency

        public java.lang.String getCurrency()
        Returns the currency. This is the currency in which this promotion is defined.
        Specified by:
        getCurrency in interface Promotion
        Returns:
        String of the currency. This is the currency in which this promotion is defined.
      • setCurrency

        public void setCurrency(java.lang.String aCurrency)
        Sets the currency.
        Specified by:
        setCurrency in interface Promotion
        Parameters:
        aCurrency - The currency to set.
      • getCampaignKey

        public CampaignKey getCampaignKey()
        Returns the campaignKey. The campaign key points to the campaign to which this promotion belongs to. This relationship is optional.
        Specified by:
        getCampaignKey in interface Promotion
        Returns:
        CampaignKey which points to the campaign that this promotion belongs to. This relationship is optional.
      • setCampaignKey

        public void setCampaignKey(CampaignKey aCampaignKey)
        Sets the campaignKey. The campaign key points to the campaign to which this promotion belongs to. This relationship is optional.
        Specified by:
        setCampaignKey in interface Promotion
        Parameters:
        aCampaignKey - The campaignKey to set. The campaign key points to the campaign to which this promotion belongs to. This relationship is optional.
      • addExemptedPolicy

        public void addExemptedPolicy(PromotionPolicyKey aKey)
        Appends a policy to the list of policies from which this promotion is explicitly exempted.
        Specified by:
        addExemptedPolicy in interface Promotion
        Parameters:
        aKey - the key of the exempted policy to be added.
      • removeExemptedPolicy

        public void removeExemptedPolicy(PromotionPolicyKey aKey)
        Removes a promotion policy from the exempted list.
        Specified by:
        removeExemptedPolicy in interface Promotion
        Parameters:
        aKey - the key of the promotion policy to be removed.
      • getExemptedPolicies

        public java.util.Iterator getExemptedPolicies()
        Returns a list of explicitly exempted promotion policies.
        Specified by:
        getExemptedPolicies in interface Promotion
        Returns:
        an iterator of explicitly exempted promotion policies.
      • clearExemptedPolicyList

        public void clearExemptedPolicyList()
        Resets the exempted policies list.
      • addExplicitlyAppliedPolicy

        public void addExplicitlyAppliedPolicy(PromotionPolicyKey aKey)
        Adds a promotion policy to the list of policies that are explicitly marked as applicable to a promotion.
        Specified by:
        addExplicitlyAppliedPolicy in interface Promotion
        Parameters:
        aKey - the key of the applicable policy that to be added.
      • removeExplicitlyAppliedPolicy

        public void removeExplicitlyAppliedPolicy(PromotionPolicyKey aKey)
        Removes a promotion policy from the list of policies explicitly marked as applicable to this promotion.
        Specified by:
        removeExplicitlyAppliedPolicy in interface Promotion
        Parameters:
        aKey - the key of the promotion policy to be removed from the list.
      • getExplicitlyAppliedPolicies

        public java.util.Iterator getExplicitlyAppliedPolicies()
        Returns an iterator of all the promotion policies that are explicitly marked as applicable to this promotion.
        Specified by:
        getExplicitlyAppliedPolicies in interface Promotion
        Returns:
        an iterator of the applicable policies that are explicitly marked as applicable to this promotion.
      • clearExplicitlyAppliedPolicyList

        public void clearExplicitlyAppliedPolicyList()
        Resets the list of promotion policies that are marked as explicitly applicable.
      • checkTargetingConditionAtRuntime

        public boolean checkTargetingConditionAtRuntime()
        Returns if to check targeting condition at runtime.
        Specified by:
        checkTargetingConditionAtRuntime in interface Promotion
        Returns:
        true if targeting conditions need to be check at runtime, false otherwise.
      • setCheckTargetingConditionAtRuntime

        public void setCheckTargetingConditionAtRuntime(boolean aCheckTargetingConditionAtRuntime)
        Sets the the boolean value of checking targeting condition at runtime.
        Specified by:
        setCheckTargetingConditionAtRuntime in interface Promotion
        Parameters:
        aCheckTargetingConditionAtRuntime - The boolean value of checking targeting condition at runtime to set.
      • getCouponAttribute

        public com.ibm.commerce.marketing.promotion.CouponAttribute getCouponAttribute()
        Returns the coupon attributes associated with the promotion.
        Specified by:
        getCouponAttribute in interface Promotion
        Returns:
        PrivatePromotionAttributes the coupon attributes associated with the promotion.
      • setCouponAttribute

        public void setCouponAttribute(com.ibm.commerce.marketing.promotion.CouponAttribute aCouponAttribute)
        Sets the coupon attributes associated with the promotion.
        Specified by:
        setCouponAttribute in interface Promotion
        Parameters:
        aCouponAttribute - The coupon attributes associated with the promotion.
      • evaluate

        public boolean evaluate(PromotionContext context)
                         throws PromotionRuntimeException
        Evaluates if this promotion is applicable to an order or not. This is the runtime behavior of the DefaultPromotion class. It checks all the conditions associated with this promotion and returns the final result in two ways. First, if this promotion is applicable, this method will return true, if this promotion is not applicable, this method will return false. Second, when this promotion is applicable, this method will modify the PromotionContext parameter. A list of PromotionExecutionRecord representing how many times this promotion is applicable to the current order is appended to the context object. These records then have to go through the promotion policies to determine if there is any promotion policy that will be violated by applying them. If any promotion policy is violated, the promotion execution record will be eliminated. It is possible that some of the promotion execution records returned by this method will be eliminated while others are applied.
        Specified by:
        evaluate in interface Promotion
        Parameters:
        context - PromotionContext object which serves as both the in and out parameter to this method.
        Returns:
        true if this promotion is applicable to the current order, false otherwise.
        Throws:
        PromotionRuntimeException - if the evaluation process encounters any exception, the exception will be wrapped in PromotionRuntimeException and thrown to caller.
      • getTargetSales

        public java.math.BigDecimal getTargetSales()
        Description copied from interface: Promotion
        Returns the target sales figure
        Specified by:
        getTargetSales in interface Promotion
        Returns:
        target sales figure, null if no value is specified
        See Also:
        Promotion.getTargetSales()
      • getCorrespondingRBDTypeName

        public java.lang.String getCorrespondingRBDTypeName()
        Deprecated. This method is intended for internal usage.
        Returns corresponding Rules-Based Discount type, if one is set, null otherwise
        Specified by:
        getCorrespondingRBDTypeName in interface Promotion
        Returns:
        Rules-Based Discount type, null if one is not specified.
        See Also:
        Promotion.getCorrespondingRBDTypeName()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • getDescription

        public Description getDescription()
        Gets the description of the promotion.
        Returns:
        the description of the promotion.
      • setDescription

        public void setDescription(Description aDescription)
        Sets the description of the promotion.
        Parameters:
        aDescription - the description of the promotion to set.
      • getAttributeNames

        public java.util.List getAttributeNames()
        Gets the attribute names defined by rule list specified by promotion
        Returns:
        a list of attribute names from promotion rule list
      • setAttributeNames

        public void setAttributeNames(java.util.List<java.lang.String> names)
        Sets the attribute rule list names specified by names provided
        Parameters:
        names - a list of names to be set to be the new rule list names
      • clearAttributeNamesCache

        public void clearAttributeNamesCache()
        This methods clears the rule list names cache