public class CampaignRuntimeUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ALL_FILTERS
Constant for result filter type: All filters.
|
static int |
ASSOCIATE_CATENTRY_ALLOW_TO_DISPLAY
Constant for result filter type: Associated catalog entry is allowed to display.
|
static int |
ASSOCIATE_CATENTRY_ENTITLED_IN_CONTRACT
Constant for result filter type: Associated catalog entry included in contract entitlement.
|
static int |
ASSOCIATE_CATENTRY_EXIST_IN_SHOPCART
Constant for result filter type: Associated catalog entry already exists in the current
shopping cart.
|
static int |
ASSOCIATE_CATENTRY_IN_CURRENT_CATALOG
Constant for result filter type: Associated catalog entry within the current catalog.
|
static int |
ASSOCIATE_CATENTRY_NOT_EXPIRED
Constant for result filter type: Associated catalog entry has not expired.
|
static int |
ASSOCIATE_CATENTRY_NOT_MARK_FOR_DELETE
Constant for result filter type: Associated catalog entry is not marked for delete.
|
static int |
ASSOCIATE_CATENTRY_WITH_INVENTORY
Constant for result filter type: Associated catalog entry satisfies the inventory level
requirement.
|
static int |
CATEGORY_ALLOW_TO_DISPLAY
Constant for result filter type: Category is allowed to display.
|
static int |
CATEGORY_ENTITLED_IN_CONTRACT
Constant for result filter type: Category included in contract entitlement.
|
static int |
CATEGORY_IN_CURRENT_CATALOG
Constant for result filter type: Category within the current catalog.
|
static int |
CATEGORY_NOT_MARK_FOR_DELETE
Constant for result filter type: Category is not marked for delete.
|
static int |
CATENTRY_ALLOW_TO_DISPLAY
Constant for result filter type: Catalog entry is allowed to display.
|
static int |
CATENTRY_ENTITLED_IN_CONTRACT
Constant for result filter type: Catalog entry included in contract entitlement.
|
static int |
CATENTRY_EXIST_IN_SHOPCART
Constant for result filter type: Catalog entry already exists in the current shopping cart.
|
static int |
CATENTRY_IN_CURRENT_CATALOG
Constant for result filter type: Catalog entry within the current catalog.
|
static int |
CATENTRY_NO_DUPLICATE
Constant for result filter type: No multiple catalog items for the same product.
|
static int |
CATENTRY_NOT_EXPIRED
Constant for result filter type: Catalog entry has not expired.
|
static int |
CATENTRY_NOT_MARK_FOR_DELETE
Constant for result filter type: Catalog entry is not marked for delete.
|
static int |
CATENTRY_WITH_INVENTORY
Constant for result filter type: Catalog entry satisfies the inventory level requirement.
|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static int |
ESPOT_RESULT_ORDER_ORIGINAL
Constant for result order type: Order of result is the same as the order of selecting the
content when the campaign Web activity was created.
|
static int |
ESPOT_RESULT_ORDER_RANDOM
Constant for result order type: Order of result is randomized.
|
static int |
PROMOTION_CONTENT_ENTITLED_IN_CONTRACT
Constant for result filter type: Promotion content included in contract entitlement.
|
Constructor and Description |
---|
CampaignRuntimeUtil()
Constructor for this utility class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkCatalogEntryEntitlement(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
Checks whether the given catalog entry is entitled to the contracts for which the current user
is eligible.
|
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 |
checkCatalogEntryInCatalog(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
Checks whether the given catalog entry is contained in the catalog that the customer is
currently viewing.
|
boolean |
checkCatalogEntryInventoryLevel(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
Checks whether the given catalog entry is satisfied the required inventory level.
|
boolean |
checkCatalogEntryNotExistInShopcart(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
Checks whether the given catalog entry exists in the current shopping cart.
|
boolean |
checkCatalogEntryNotExpired(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
Checks whether the given catalog entry has expired, according to its end date.
|
boolean |
checkCatalogEntryNotMarkForDelete(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
Checks whether the given catalog entry is marked for delete.
|
boolean |
checkCatalogEntryPublishStatus(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
Checks whether the given catalog entry is allowed to display, based on its publish flag.
|
int |
checkCatalogEntryRelation(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catalogEntryDataBean1,
com.ibm.commerce.catalog.beans.CatalogEntryDataBean catalogEntryDataBean2)
Checks whether the two given catalog entries are related.
|
boolean |
checkCatalogGroupEntitlement(com.ibm.commerce.catalog.beans.CategoryDataBean catgroup)
Checks whether the given catalog group 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 |
checkCatalogGroupInCatalog(com.ibm.commerce.catalog.beans.CategoryDataBean catgroup)
Checks whether the given catalog group is contained in the catalog that the customer is
currently viewing.
|
boolean |
checkCatalogGroupNotMarkForDelete(com.ibm.commerce.catalog.beans.CategoryDataBean catgroup)
Checks whether the given catalog group is marked for delete.
|
boolean |
checkCatalogGroupPublishStatus(com.ibm.commerce.catalog.beans.CategoryDataBean catgroup)
Checks whether the given catalog group is allowed to display, based on its publish flag.
|
boolean |
checkPromotionContentEntitlement(CollateralDataBean collateral)
Checks whether the promotion content that is assigned to the given collateral is entitled to
the contracts for which the current user is eligible.
|
static java.lang.String |
generateEMarketingSpotInvocationKey(java.lang.String emsName,
int maxAssociateCatalogEntries,
int maxCatalogEntries,
int maxCategories,
int maxCollateral)
Creates a String that can be used to uniquely identify an eMarketingSpot configuration
|
com.ibm.commerce.command.CommandContext |
getCommandContext()
Gets the current command context that is used to retrieve the runtime attributes like the
store ID and the member ID.
|
java.lang.Long |
getCurrentCatalogId()
Gets the ID of the catalog that the customer is currently viewing.
|
int |
getMaximumNumberOfAssociateCatalogEntries()
Gets the maximum number of associated catalog entries that can be displayed in an e-Marketing Spot.
|
int |
getMaximumNumberOfCatalogEntries()
Gets the maximum number of catalog entries can be displayed in an e-Marketing Spot.
|
int |
getMaximumNumberOfCategories()
Gets the maximum number of categories can be displayed in an e-Marketing Spot.
|
int |
getMaximumNumberOfCollateral()
Gets the maximum number of ad copies can be displayed in an e-Marketing Spot.
|
java.util.Vector |
getResultFilter()
Gets the list of flags that will be used to determine the result filtering to be performed.
|
int |
getResultOrder()
Gets the flag that will be used to determine the result ordering logic to be performed.
|
com.ibm.commerce.order.objects.OrderItemAccessBean[] |
getShoppingCartOrderItemAccessBeans()
Gets the list of order item objects that represent items currently in the shopping cart.
|
com.ibm.commerce.contract.objects.TradingAgreementAccessBean[] |
getTradingAgreementAccessBeans()
Gets the list of trading agreement objects that are used to check product and category entitlement.
|
java.util.Vector |
performArrayRandomization(java.util.Vector resultEntries,
java.lang.Object[] initiativeOrderArray,
boolean isRandomizingOrder)
The performArrayRandomization method sorts the entries in the array using the given priority.
|
boolean |
performAssociateCatalogEntryFiltering(EMarketingSpot.AssociateCatalogEntry associateCatalogEntry)
Checks whether the given associated catalog entry object satisfies all of the filtering
criteria.
|
boolean |
performCatalogEntryFiltering(EMarketingSpot.CatalogEntry catalogEntry)
Checks whether the given catalog entry object satisfies all of the filtering criteria.
|
boolean |
performCategoryFiltering(EMarketingSpot.Category category)
Checks whether the given category object satisfies all of the filtering criteria.
|
boolean |
performCollateralFiltering(EMarketingSpot.Collateral collateral)
Checks whether the given collateral object satisfies all of the filtering criteria.
|
java.util.Vector |
performResultOrdering(java.util.Vector resultEntries,
java.lang.Object[] initiativeOrderArray)
This method orders the e-Marketing Spot result array based on the ordering logic indicated in
the resultOrder flag.
|
void |
setCommandContext(com.ibm.commerce.command.CommandContext newCommandContext)
Sets the current command context used to retrieve the runtime attributes like the store ID
and the member ID.
|
void |
setCurrentCatalogId(java.lang.Long newCurrentCatalogId)
Sets the ID of the catalog that the customer is currently viewing.
|
void |
setMaximumNumberOfAssociateCatalogEntries(int newMaximumNumberOfAssociateCatalogEntries)
Sets the maximum number of associated catalog entries that can be displayed in an e-Marketing
Spot.
|
void |
setMaximumNumberOfCatalogEntries(int newMaximumNumberOfCatalogEntries)
Sets the maximum number of catalog entries that can be displayed in an e-Marketing Spot.
|
void |
setMaximumNumberOfCategories(int newMaximumNumberOfCategories)
Sets the maximum number of categories that can be displayed in an e-Marketing Spot.
|
void |
setMaximumNumberOfCollateral(int newMaximumNumberOfCollateral)
Sets the maximum number of ad copies that can be displayed in an e-Marketing Spot.
|
void |
setResultFilter(java.util.Vector newResultFilter)
Sets the list of flags that will be used to determine the result filtering to be performed.
|
void |
setResultOrder(int newResultOrder)
Sets the flag that will be used to determine the result ordering logic to be performed.
|
void |
setShoppingCartOrderItemAccessBeans(com.ibm.commerce.order.objects.OrderItemAccessBean[] newShoppingCartOrderItemAccessBeans)
Sets the list of order item objects that represent items currently in the shopping cart.
|
void |
setTradingAgreementAccessBeans(com.ibm.commerce.contract.objects.TradingAgreementAccessBean[] newTradingAgreementAccessBeans)
Sets the list of trading agreement objects that are used to check product and category
entitlement.
|
java.util.Vector |
sortArrayByRank(java.util.Vector sourceArray)
The sortArrayByRank method sorts the entries in the array using the given ranks.
Step 1: Sort all ranks in reverse order. Step 2: Calculate order with weight. Step 3: Determine which index in the array wins this round by comparing the index with the results of Random.nextInt, which uses the sum of all percentages as the bound. Step 4: Repeat step 3 until the size of the array with waiting entries is 0. Step 5: Re-sort the previous sorted array using the randomize result. Step 6: Remove unnecessary elements from the target array. |
public static final int ALL_FILTERS
public static final int ASSOCIATE_CATENTRY_ALLOW_TO_DISPLAY
public static final int ASSOCIATE_CATENTRY_ENTITLED_IN_CONTRACT
public static final int ASSOCIATE_CATENTRY_EXIST_IN_SHOPCART
public static final int ASSOCIATE_CATENTRY_IN_CURRENT_CATALOG
public static final int ASSOCIATE_CATENTRY_NOT_EXPIRED
public static final int ASSOCIATE_CATENTRY_NOT_MARK_FOR_DELETE
public static final int ASSOCIATE_CATENTRY_WITH_INVENTORY
public static final int CATEGORY_ALLOW_TO_DISPLAY
public static final int CATEGORY_ENTITLED_IN_CONTRACT
public static final int CATEGORY_IN_CURRENT_CATALOG
public static final int CATEGORY_NOT_MARK_FOR_DELETE
public static final int CATENTRY_ALLOW_TO_DISPLAY
public static final int CATENTRY_ENTITLED_IN_CONTRACT
public static final int CATENTRY_EXIST_IN_SHOPCART
public static final int CATENTRY_IN_CURRENT_CATALOG
public static final int CATENTRY_NO_DUPLICATE
public static final int CATENTRY_NOT_EXPIRED
public static final int CATENTRY_NOT_MARK_FOR_DELETE
public static final int CATENTRY_WITH_INVENTORY
public static final java.lang.String COPYRIGHT
public static final int ESPOT_RESULT_ORDER_ORIGINAL
public static final int ESPOT_RESULT_ORDER_RANDOM
public static final int PROMOTION_CONTENT_ENTITLED_IN_CONTRACT
public CampaignRuntimeUtil()
public boolean checkCatalogEntryEntitlement(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
catentry
- The catalog entry to be evaluated.public boolean checkCatalogEntryEntitlement(java.lang.Long catalogEntryId)
catalogEntryId
- ID of the catalog entry to be evaluated.public boolean checkCatalogEntryInCatalog(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
catentry
- The catalog entry to be evaluated.public boolean checkCatalogEntryInventoryLevel(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
catentry
- The catalog entry to be evaluated.public boolean checkCatalogEntryNotExistInShopcart(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
catentry
- The catalog entry to be evaluated.public boolean checkCatalogEntryNotExpired(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
catentry
- The catalog entry to be evaluated.public boolean checkCatalogEntryNotMarkForDelete(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
catentry
- The catalog entry to be evaluated.public boolean checkCatalogEntryPublishStatus(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catentry)
catentry
- The catalog entry to be evaluated.public int checkCatalogEntryRelation(com.ibm.commerce.catalog.beans.CatalogEntryDataBean catalogEntryDataBean1, com.ibm.commerce.catalog.beans.CatalogEntryDataBean catalogEntryDataBean2)
catalogEntryDataBean1
- The first catalog entry to be evaluated, represented by
CatalogEntryDataBean
.catalogEntryDataBean2
- The second catalog entry to be evaluated, represented by
CatalogEntryDataBean
.public boolean checkCatalogGroupEntitlement(com.ibm.commerce.catalog.beans.CategoryDataBean catgroup)
catgroup
- The catalog group to be evaluated.public boolean checkCatalogGroupEntitlement(java.lang.Long catalogGroupId)
catalogGroupId
- ID of the catalog group to be evaluated.public boolean checkCatalogGroupInCatalog(com.ibm.commerce.catalog.beans.CategoryDataBean catgroup)
catgroup
- The catalog group to be evaluated.public boolean checkCatalogGroupNotMarkForDelete(com.ibm.commerce.catalog.beans.CategoryDataBean catgroup)
catgroup
- The catalog group to be evaluated.public boolean checkCatalogGroupPublishStatus(com.ibm.commerce.catalog.beans.CategoryDataBean catgroup)
catgroup
- The catalog group to be evaluated.public boolean checkPromotionContentEntitlement(CollateralDataBean collateral)
collateral
- The collateral to be evaluated.public static final java.lang.String generateEMarketingSpotInvocationKey(java.lang.String emsName, int maxAssociateCatalogEntries, int maxCatalogEntries, int maxCategories, int maxCollateral)
emsName
- the name of the eMarketingSpot.maxAssociateCatalogEntries
- the maximum number of associated catalog entries the eMarketingSpot is set to display.maxCatalogEntries
- the maximum number of catalog entries the eMarketingSpot is set to display.maxCategories
- the maximum number of categories the eMarketingSpot is set to display.maxCollateral
- the maximum number of collateral the eMarketingSpot is set to display.public com.ibm.commerce.command.CommandContext getCommandContext()
public java.lang.Long getCurrentCatalogId()
public int getMaximumNumberOfAssociateCatalogEntries()
public int getMaximumNumberOfCatalogEntries()
public int getMaximumNumberOfCategories()
public int getMaximumNumberOfCollateral()
public java.util.Vector getResultFilter()
public int getResultOrder()
public com.ibm.commerce.order.objects.OrderItemAccessBean[] getShoppingCartOrderItemAccessBeans()
public com.ibm.commerce.contract.objects.TradingAgreementAccessBean[] getTradingAgreementAccessBeans()
public java.util.Vector performArrayRandomization(java.util.Vector resultEntries, java.lang.Object[] initiativeOrderArray, boolean isRandomizingOrder)
resultEntries
- The original array of result entries that needs to be randomized.initiativeOrderArray
- Order of web activities based on their priorities.isRandomizingOrder
- True if the order of the array is randomized; false otherwise.public boolean performAssociateCatalogEntryFiltering(EMarketingSpot.AssociateCatalogEntry associateCatalogEntry)
associateCatalogEntry
- Associated catalog entry object to be evaluated, in the form of
a com.ibm.commerce.marketing.beans.EMarketingSpot.AssociateCatalogEntry
object.public boolean performCatalogEntryFiltering(EMarketingSpot.CatalogEntry catalogEntry)
catalogEntry
- Catalog entry object to be evaluated, in the form of
a com.ibm.commerce.marketing.beans.EMarketingSpot.CatalogEntry
object.public boolean performCategoryFiltering(EMarketingSpot.Category category)
category
- Category object to be evaluated, in the form of a
com.ibm.commerce.marketing.beans.EMarketingSpot.Category
object.public boolean performCollateralFiltering(EMarketingSpot.Collateral collateral)
collateral
- Collateral object to be evaluated, in the form of a
com.ibm.commerce.marketing.beans.EMarketingSpot.Collateral
object.public java.util.Vector performResultOrdering(java.util.Vector resultEntries, java.lang.Object[] initiativeOrderArray)
resultEntries
- The original array of result entries that needs to be re-ordered.initiativeOrderArray
- Order of Web activities based on their priorities.public void setCommandContext(com.ibm.commerce.command.CommandContext newCommandContext)
newCommandContext
- The current command context.public void setCurrentCatalogId(java.lang.Long newCurrentCatalogId)
newCurrentCatalogId
- The ID of the catalog that the customer is currently viewing.public void setMaximumNumberOfAssociateCatalogEntries(int newMaximumNumberOfAssociateCatalogEntries)
newMaximumNumberOfAssociateCatalogEntries
- The maximum number of associated catalog
entries that can be displayed in an e-Marketing Spot.public void setMaximumNumberOfCatalogEntries(int newMaximumNumberOfCatalogEntries)
newMaximumNumberOfCatalogEntries
- The maximum number of catalog entries can be displayed
in an e-Marketing Spot.public void setMaximumNumberOfCategories(int newMaximumNumberOfCategories)
newMaximumNumberOfCategories
- The maximum number of categories that can be displayed in
an e-Marketing Spot.public void setMaximumNumberOfCollateral(int newMaximumNumberOfCollateral)
newMaximumNumberOfCollateral
- The maximum number of ad copies that can be displayed in
an e-Marketing Spot.public void setResultFilter(java.util.Vector newResultFilter)
newResultFilter
- The list of flags that will be used to determine the result filtering
to be performed.public void setResultOrder(int newResultOrder)
newResultOrder
- The flag that will be used to determine the result ordering logic to be
performed.public void setShoppingCartOrderItemAccessBeans(com.ibm.commerce.order.objects.OrderItemAccessBean[] newShoppingCartOrderItemAccessBeans)
newShoppingCartOrderItemAccessBeans
- The list of order item objects that represent
items currently in the shopping cart.public void setTradingAgreementAccessBeans(com.ibm.commerce.contract.objects.TradingAgreementAccessBean[] newTradingAgreementAccessBeans)
newTradingAgreementAccessBeans
- The list of trading agreement objects that are used to
check product and category entitlement.public java.util.Vector sortArrayByRank(java.util.Vector sourceArray)
sourceArray
- The original array that needs to be sorted.