public class FilterContentTaskCmdImpl extends MarketingSpotCommandBaseTaskCmdImpl implements FilterContentTaskCmd, com.ibm.websphere.cache.Sizeable
RetrieveContentTaskCmd
command. Then this command checks if the specified marketing content qualifies for the defined filtering
criteria or not. To enable or disable
a filter, register the appropriate CMDREG table entry, and set the filter settings in the
PROPERTIES column.
See the file samples/samples/dynacache/marketing/cachespec.xml
for details about
caching this command. Filters that can be cached (such as check if promotion matches
the content url requirements)
are evaluated in the performExecute
method. Filters that cannot be cached
(such as check if promotion is active) are evaluated in the postFilter
method. If a custom filter is added, and the evaluation can be cached, then extend the
methods removeContent
and removeContentPromotion
. If a custom filter is added, and the evaluation
cannot be cached, then extend the method postFilter
.
The following is the process to add a new marketing content filter:
FilterContentTaskCmdImpl
, and register a new CMDREG entry for your store.removeContent(MarketingSpotActivityMarketingContentDataType content)
.
In this method, do the checking for the new filter (use getMyFilter
to get the value of the setting).
This method should return true if the filter checking determines that the marketing content should not be displayed to
the customer. Otherwise return false, and the marketing content will get displayed in the eMarketing Spot.removeContentPromotion(MarketingSpotActivityMarketingContentDataType content, Promotion promotion)
.
This method is used when the filter check is associated with a promotion.
In this method, do the checking for the new filter (use getMyFilter
to get the value of the setting).
This method should return true if the filter checking determines that the marketing content should not be displayed to
the customer. Otherwise return false, and the marketing content will get displayed in the eMarketing Spot.boolean postFilter(MarketingSpotActivityMarketingContentDataType content);
In this method, do the checking for the new filter (use getMyFilter
to get the value of the setting).
This method should return true if the filter checking determines that the marketing content should not be displayed to
the customer. Otherwise return false, and the marketing content will get displayed in the eMarketing Spot.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASSNAME
The name of this class.
|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
defaultCommandClassName, NAME
Constructor and Description |
---|
FilterContentTaskCmdImpl()
Default constructor for this command.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkCatalogEntryEntitlement(java.lang.Long catalogEntryId)
Checks whether the given catalog entry is entitled to the contracts for which the current user
is eligible.
|
boolean |
checkCatalogGroupEntitlement(java.lang.Long catalogGroupId)
Checks whether the given catalog group is entitled to the contracts for which the current user
is eligible.
|
boolean |
checkPromotionContentEntitlement(java.lang.String calCodeId,
java.lang.String pStoreId)
Checks whether the promotion content that is assigned to the given collateral is entitled to
the contracts for which the current user is eligible.
|
java.lang.String[] |
getCacheKey()
This method generates a key to enable command caching.
|
java.util.ArrayList |
getMarketingContent()
This method returns an array of filtered marketing content data objects that will be displayed
in the e-Marketing Spot.
|
long |
getObjectSize()
Returns the estimated footprint size in bytes
of this object and the objects it contains.
|
java.lang.String |
getRemoveIfMemberNotInPromotionSegment()
This method gets if promotions should not be displayed if the member does not
belong to the same segment of the promotion.
|
java.lang.String |
getRemoveIfPromotionBeforeStartDate()
This method gets if promotions should not be displayed if their start
date is before the current date.
|
java.lang.String |
getRemoveIfPromotionNotAvailable()
This method gets if promotions should not be displayed if they do not fall within
their active date/time.
|
java.lang.String |
getRemoveIfPromotionNotEntitledCatalogEntryOrCategory()
This method gets if promotions should not be displayed if the member is
not entitled to the catalog entry or category being promoted.
|
EMarketingSpotDataBean[] |
getResultDataBeans()
This method sets the data beans containing the results that the e-Marketing Spot displays.
|
TradingAgreementAccessBean[] |
getTradingAgreementAccessBeans()
Gets the list of trading agreement objects that are used to check product and category entitlement.
|
boolean |
isReadyToCallExecute()
This method checks if this command is ready to be executed or not.
|
void |
performExecute()
This method performs all the logic that needs to be executed in this command.
|
void |
postExecute()
This method is called by the Dynamic Cache when the execute method is called,
and a cache miss occurs,
after the performExecute method is called.
|
boolean |
postFilter(MarketingSpotActivityMarketingContentDataType content)
This method checks the filters that need to be evaluated every time and
cannot be cached when this command is cached.
|
void |
reset()
Re-initializes the command for re-execution.
|
void |
setMarketingSpotIdAndContentType(java.lang.Integer newEmsId,
boolean newTitleContent)
This method sets the e-Marketing Spot ID and content type associated with the content being loaded.
|
void |
setOutputProperties(com.ibm.websphere.command.TargetableCommand fromCommand)
Sets the output properties by copying them from another instance of this command.
|
void |
setRemoveIfMemberNotInPromotionSegment(java.lang.String setting)
This method sets if promotions should not be displayed if the member does not
belong to the same segment of the promotion.
|
void |
setRemoveIfPromotionBeforeStartDate(java.lang.String setting)
This method sets if promotions should not be displayed if their start
date is before the current date.
|
void |
setRemoveIfPromotionNotAvailable(java.lang.String setting)
This method sets if promotions should not be displayed if they do not fall within
their active date/time.
|
void |
setRemoveIfPromotionNotEntitledCatalogEntryOrCategory(java.lang.String setting)
This method sets if promotions should not be displayed if the member is
not entitled to the catalog entry or category being promoted.
|
void |
setResultDataBeans(EMarketingSpotDataBean[] resultDataBeans)
This method sets the data beans containing the results that the e-Marketing Spot displays.
|
getActiveOrg, getActivityId, getAdditionalParameter, getAdditionalParameters, getCacheId, getCatalogId, getContracts, getDataType, getExperimentId, getLanguageId, getMarketingSpotBehavior, getMemberGroups, getMemberIdsForPersonalizationId, getPreviewReport, getSpecificLanguageId, getSpecificStoreeId, getSpotCacheKey, getStoreId, getTestElementId, isCacheHit, populateActivityData, populateUserData, preExecute, randomize, setAdditionalParameters, setMarketingSpotBehavior, setPreviewReport, setSpecificLanguageId, setSpecificStoreId
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, setCaller, setObjectSize, unionDependencies, updateCache
getCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, setCommandTarget, setCommandTargetName, setHasOutputProperties, setTargetPolicy
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setAdditionalParameters, setMarketingSpotBehavior, setPreviewReport, setSpecificLanguageId, setSpecificStoreId
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, preExecute, setCaller, updateCache
public static final java.lang.String COPYRIGHT
public static final java.lang.String CLASSNAME
public FilterContentTaskCmdImpl()
public long getObjectSize()
getObjectSize
in interface com.ibm.websphere.cache.Sizeable
getObjectSize
in class MarketingSpotCommandBaseTaskCmdImpl
public void setRemoveIfPromotionNotAvailable(java.lang.String setting)
setting
- Set "1" if promotions should not be displayed if they are not active
at this date/time, otherwise set "0".public java.lang.String getRemoveIfPromotionNotAvailable()
public void setRemoveIfPromotionBeforeStartDate(java.lang.String setting)
setting
- Set "1" if promotions should not be displayed if the
end date has passed, otherwise set "0".public java.lang.String getRemoveIfPromotionBeforeStartDate()
public void setRemoveIfMemberNotInPromotionSegment(java.lang.String setting)
setting
- Set "1" if promotions should not be displayed if the member does not
belong to the same segment of the promotion, otherwise set "0".public java.lang.String getRemoveIfMemberNotInPromotionSegment()
public void setRemoveIfPromotionNotEntitledCatalogEntryOrCategory(java.lang.String setting)
setting
- Set "1" if promotions should not be displayed if the member is
not entitled to the catalog entry or category being promoted, otherwise set "0".public java.lang.String getRemoveIfPromotionNotEntitledCatalogEntryOrCategory()
public java.util.ArrayList getMarketingContent()
getMarketingContent
in interface FilterContentTaskCmd
public EMarketingSpotDataBean[] getResultDataBeans()
getResultDataBeans
in interface FilterContentTaskCmd
public boolean isReadyToCallExecute()
isReadyToCallExecute
in interface com.ibm.websphere.command.Command
isReadyToCallExecute
in class MarketingSpotCommandBaseTaskCmdImpl
public void reset()
reset
in interface com.ibm.websphere.command.Command
reset
in class MarketingSpotCommandBaseTaskCmdImpl
Command.reset()
public void performExecute() throws java.lang.Exception
performExecute
in interface com.ibm.websphere.command.TargetableCommand
performExecute
in class MarketingSpotCommandBaseTaskCmdImpl
java.lang.Exception
TargetableCommand.performExecute()
public boolean postFilter(MarketingSpotActivityMarketingContentDataType content)
postFilter
in interface FilterContentTaskCmd
content
- The content to check.public void postExecute()
This method is called by the Dynamic Cache when the execute method is called, and a cache miss occurs, after the performExecute method is called.
postExecute
in interface com.ibm.websphere.command.CacheableCommand
postExecute
in class MarketingSpotCommandBaseTaskCmdImpl
CacheableCommand.postExecute()
public void setOutputProperties(com.ibm.websphere.command.TargetableCommand fromCommand)
Sets the output properties by copying them from another instance of this command.
This method is intended to be called by the cacheable command framework. Do not call this method directly.
setOutputProperties
in interface com.ibm.websphere.command.TargetableCommand
setOutputProperties
in class MarketingSpotCommandBaseTaskCmdImpl
TargetableCommand.setOutputProperties(com.ibm.websphere.command.TargetableCommand)
public void setResultDataBeans(EMarketingSpotDataBean[] resultDataBeans)
EMarketingSpotDataBean
can be set.
This is to allow for the appropriate command caching.setResultDataBeans
in interface FilterContentTaskCmd
resultDataBeans
- The data beans containing the results that the e-Marketing Spot displays.public java.lang.String[] getCacheKey()
public TradingAgreementAccessBean[] getTradingAgreementAccessBeans()
public boolean checkCatalogEntryEntitlement(java.lang.Long catalogEntryId)
catalogEntryId
- ID of the catalog entry to be evaluated.public boolean checkCatalogGroupEntitlement(java.lang.Long catalogGroupId)
catalogGroupId
- ID of the catalog group to be evaluated.public boolean checkPromotionContentEntitlement(java.lang.String calCodeId, java.lang.String pStoreId)
calCodeId
- The calculation code Id.pStoreId
- The promotion store Id.public void setMarketingSpotIdAndContentType(java.lang.Integer newEmsId, boolean newTitleContent)
setMarketingSpotIdAndContentType
in interface FilterContentTaskCmd
newEmsId
- The e-Marketing Spot ID associated with the content being loaded.newTitleContent
- True if the content is associated with an e-Marketing Spot title.