public class CustomerFilterOrderTargetBase extends MarketingCampaignElementTaskCmdImpl
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALL
Constant to specify that all must match (all, and)
|
static java.lang.String |
ANY
Constant to specify that one or more can match (any, or)
|
static java.lang.String |
CLASSNAME
The name of this class.
|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static java.lang.String |
TYPE_PURCHASE_HISTORY
Constant to specify to evaluate the purchase history
|
static java.lang.String |
TYPE_SHOPCART
Constant to specify to evaluate the shopping cart
|
DM_FROM_FORWARD_TRIGGERS_FOR_PROCESSING, EMLPROMO_NAME_PREFIX, GENERIC_USER_ID
defaultCommandClassName
Constructor and Description |
---|
CustomerFilterOrderTargetBase()
This method is the default constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Long[] |
getMemberIdsForOrderQuery(java.lang.String type)
This method returns the member IDs to use with any order queries.
|
java.util.List |
getOrder(java.lang.String type,
java.util.List order,
java.lang.String currency,
java.lang.String daysOperator,
java.lang.String daysValue,
java.lang.String dateOperator1,
java.lang.String dateValue1,
java.lang.String dateOperator2,
java.lang.String dateValue2)
This method returns the total value of the user's order, and the quantity (unique order items for shopping cart,
number of orders for purchase history) that are within the specified dates.
|
java.util.List |
getOrderCategory(java.lang.String type,
java.util.List order,
java.lang.String categoryId,
java.lang.String currency,
java.lang.String daysOperator,
java.lang.String daysValue,
java.lang.String dateOperator1,
java.lang.String dateValue1,
java.lang.String dateOperator2,
java.lang.String dateValue2)
This method returns the total value of the user's order, and the quantity, associated with the items
contained within the specified category, that are within the specified dates.
|
OrderInfo[] |
getOrderData(java.lang.String type,
java.lang.Integer storeId,
java.lang.Long[] memberIds,
java.lang.String daysOperator,
java.lang.String daysValue,
java.lang.String dateOperator1,
java.lang.String dateValue1,
java.lang.String dateOperator2,
java.lang.String dateValue2,
boolean getItems)
This method returns the
OrderInfo objects that represent
a customer's order or orders. |
java.util.List |
getOrderProduct(java.lang.String type,
java.util.List order,
java.lang.String catentryId,
java.util.List childCatentries,
java.lang.String currency,
java.lang.String daysOperator,
java.lang.String daysValue,
java.lang.String dateOperator1,
java.lang.String dateValue1,
java.lang.String dateOperator2,
java.lang.String dateValue2)
This method returns the total value of the user's order, and the quantity, associated with the specified
product or item, that are within the specified dates.
|
java.lang.String |
getTemporarySharedDataCacheKey(java.lang.String type,
java.lang.Integer storeId,
java.lang.String daysOperator,
java.lang.String daysValue,
java.lang.String dateOperator1,
java.lang.String dateValue1,
java.lang.String dateOperator2,
java.lang.String dateValue2)
This method creates a cache key used to store temporary data that can be passed
between all the campaign elements when evaluating an e-Marketing Spot.
|
void |
validateParameters(java.util.Map elementParameters,
java.util.List validationErrors)
This method validates the numeric data for the element.
|
addEMarketingSpotDataBean, forwardTriggersForProcessing, forwardTriggersForProcessing, getActivity, getDataFromTriggerParameters, getElementId, getElementParameters, getEMarketingSpotDataBeans, getExperimentTestElements, getMarketingContent, getMarketingSpotBehavior, getMemberId, getMemberId, getMemberIdsForPersonalizationId, getMemberIdsForPersonalizationId, getNewElementParameters, getPersonalizationId, getPreviewReport, getRegisteredMemberIdForPersonalizationId, getReturnValue, getStoreId, getTemporarySharedData, getTemporarySharedDataObject, getTriggerParameters, getTriggerParametersMap, getUserDataForElement, isReadyToCallExecute, performExecute, putTemporarySharedDataObject, returnEMarketingSpotDataBeans, setActivity, setElementId, setElementParameters, setExperimentTestElements, setNewElementParameter, setOutputProperties, setPreviewReport, setReturnValue, setTemporarySharedData, setTriggerParameters, setTriggerParameters, validateCategory, validateCustomerSegment, validateDates, validateElementIsFirstInActivity, validateEmailTemplate, validateMarketingContent, validateMarketingContent, validateMarketingSpot, validateParameters, validateProduct, validatePromotion, validatePromotionCodes, validatePromotionCodesOrCoupon, validatePromotionCoupon, validatePromotionDisplay, validateSubscription, validateTimes
execute, executeFromCache, getCaller, getEntryInfo, getId, getObjectSize, getSharingPolicy, postExecute, preExecute, reset, setCaller, setObjectSize, unionDependencies, updateCache
getCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, setCommandTarget, setCommandTargetName, setHasOutputProperties, setTargetPolicy
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCache
public static final java.lang.String COPYRIGHT
public static final java.lang.String CLASSNAME
public static final java.lang.String TYPE_SHOPCART
public static final java.lang.String TYPE_PURCHASE_HISTORY
public static final java.lang.String ANY
public static final java.lang.String ALL
public CustomerFilterOrderTargetBase()
public java.lang.Long[] getMemberIdsForOrderQuery(java.lang.String type)
getMemberId(boolean)
can be used if you only want the
member ID from the context. Pass true if you do not want the generic member id
to be returned.
The method getMemberIdsForPersonalizationId(boolean)
can be used
if you want the member ID from the context as well as any member IDs associated
with the personalization ID. Pass true if you do not want the generic member id
to be returned.
This method is called by getOrder
, getOrderProduct
,
and getOrderCategory
.
The following is an example of a customization that targets the interest item list.
private static final String TYPE_INTEREST_ITEM_LIST = "ii"; Long [] memberIds = null; if (TYPE_INTEREST_ITEM_LIST.equals(type)) { // only use the current user for the interest item list target Long memberId = getMemberId(true); if (memberId != null) { memberIds = new Long[] { memberId }; } } else { memberIds = super.getMemberIdsForOrderQuery(type); }
type
- The type of order query being done. Possible values include "sc"
and "ph".public OrderInfo[] getOrderData(java.lang.String type, java.lang.Integer storeId, java.lang.Long[] memberIds, java.lang.String daysOperator, java.lang.String daysValue, java.lang.String dateOperator1, java.lang.String dateValue1, java.lang.String dateOperator2, java.lang.String dateValue2, boolean getItems) throws java.lang.Exception
OrderInfo
objects that represent
a customer's order or orders. This method is called by getOrder
,
getOrderProduct
, and getOrderCategory
. Those methods
use the order information returned from this method to evaluate if the
order matches the target criteria. Note that the methods
ConditionUtil.getDateClause
, ConditionUtil.getOrderStatementDateParameters
,
and ConditionUtil.checkEqualDate
can be used to leverage
the existing infrastructure to have the order query check the appropriate dates
set in the target.
The following is an example of a customization that targets the interest item list.
insert into dmeletemplate (dmeletemplate_id, dmelementtype_id, name, implxml) values (2000, 2, 'interestItemListCategoryContents', '<FlowElementImplementation type="Interest Item List Category Contents"> <Implementation invocationType="TaskCommand"> <Class name="com.ibm.mycompany.commands.elements.InterestItemListCategoryTargetTaskCmd"> <Argument name="type" value="ii"/> <Argument name="anyOrAll" value="MARKETING_anyOrAll"/> <Argument name="containsOperator" value="MARKETING_containsOperator"/> <Argument name="categoryIdList" value="MARKETING_categoryIdList"/> <Argument name="daysOperator" value="MARKETING_daysOperator"/> <Argument name="daysValue" value="MARKETING_days"/> <Argument name="dateOperator1" value="MARKETING_beforeAfterOnDate"/> <Argument name="dateValue1" value="MARKETING_date1"/> <Argument name="dateOperator2" value="MARKETING_beforeDate"/> <Argument name="dateValue2" value="MARKETING_date2"/> <Argument name="amountOperator1" value="MARKETING_amountOperator1"/> <Argument name="amountValue1" value="MARKETING_amountValue1"/> <Argument name="amountOperator2" value="MARKETING_amountOperator2"/> <Argument name="amountValue2" value="MARKETING_amountValue2"/> <Argument name="amountCurrency" value="MARKETING_amountCurrency"/> <Argument name="quantityOperator1" value="MARKETING_quantityOperator1"/> <Argument name="quantityValue1" value="MARKETING_quantityValue1"/> <Argument name="quantityOperator2" value="MARKETING_quantityOperator2"/> <Argument name="quantityValue2" value="MARKETING_quantityValue2"/> </Class> </Implementation> </FlowElementImplementation>'); private static final String TYPE_INTEREST_ITEM_LIST = "ii"; OrderInfo [] orderInfoList = null; if (TYPE_INTEREST_ITEM_LIST.equals(type)) { java.sql.Connection connection = com.ibm.commerce.scheduler.SchedulerDataAccessObject.getDataSourceConnection(); PreparedStatement interestItemSelectStmt = null; ResultSet interestItemSelectRs = null; try { // assume no storepath, only find interest item list in the current store final String INTEREST_ITEM_LIST_QUERY = "SELECT iitem.CATENTRY_ID, iitem.QUANTITY, iitem.LASTUPDATE FROM iitem iitem WHERE iitem.MEMBER_ID = ? and iitem.STOREENT_ID = ?"; StringBuffer strQuery = new StringBuffer(INTEREST_ITEM_LIST_QUERY); strQuery.append(ConditionUtil.getDateClause(" AND iitem.LASTUPDATE ", daysOperator, daysValue, dateOperator1, dateValue1, dateOperator2, dateValue2)); interestItemSelectStmt = connection.prepareStatement(strQuery.toString()); int index = 1; interestItemSelectStmt.setLong(index++, memberIds[0].longValue()); interestItemSelectStmt.setLong(index++, storeId.intValue()); interestItemSelectStmt = ConditionUtil.getOrderStatementDateParameters(interestItemSelectStmt, index, daysOperator, daysValue, dateOperator1, dateValue1, dateOperator2, dateValue2); interestItemSelectRs = interestItemSelectStmt.executeQuery(); if (interestItemSelectRs != null) { ArrayList tempResult = new ArrayList(1); while (interestItemSelectRs.next()) { OrderInfo orderItem = new OrderInfo(); int i = 1; orderItem.setCatentryId(interestItemSelectRs.getLong(i++)); orderItem.setQuantity(new Double(interestItemSelectRs.getDouble(i++))); if (ConditionUtil.OPERATOR_EQUAL_TO.equals(dateOperator1)) { if (ConditionUtil.checkEqualDate(dateValue1, interestItemSelectRs.getTimestamp(i++))) { tempResult.add(orderItem); } } else { tempResult.add(orderItem); } } orderInfoList = new OrderInfo[tempResult.size()]; orderInfoList = (OrderInfo[]) tempResult.toArray(orderInfoList); } } finally { // ... close interestItemSelectRs, interestItemSelectStmt, connection } } else { orderInfoList = super.getOrderData(type, storeId, memberIds, daysOperator, daysValue, dateOperator1, dateValue1, dateOperator2, dateValue2, getItems); } return orderInfoList;
type
- Specify "sc" to check the user's shopping cart, or specify "ph" to check the user's purchase history.storeId
- The store ID in which to find the order.memberIds
- The member IDs for which to find the orders. This is the information returned from
the method getMemberIdsForOrderQuery
.daysOperator
- The operator to use when checking if this behavior has occurred within or prior to a
number of days. Valid values are: =, <, <=, >, >=. However, from a business point of view, only
<= (within) and > (prior) make sense.
There is a special case for the purchase history target to specify that only a specific number
of previous orders should be checked. In that scenario the daysOperator is equal to previousOrders, and daysValue
is the number of previous orders to consider. The other date parameters are not valid when previousOrders
is used.daysValue
- When has this behavior has occurred; within or prior to the specified number
of days.dateOperator1
- The operator to use when checking if this behavior has occurred on, before, after
or between a specified date. Valid values are: =, <, <=, >, >=.dateValue1
- When has this behavior has occurred; on, before, after, or between the specified date.dateOperator2
- The operator to use when checking if this behavior has occurred on, before, after
or between a specified date. Valid values are: =, <, <=, >, >=.dateValue2
- When has this behavior has occurred; on, before, after, or between the specified date.getItems
- This flags specifies for purchase history if the order information returned should
include the information about all the order items (required for checking category and product),
or just the totals from the order are required (required for the purchase history total target).OrderInfo
objects representing the
customer's orders.java.lang.Exception
public java.lang.String getTemporarySharedDataCacheKey(java.lang.String type, java.lang.Integer storeId, java.lang.String daysOperator, java.lang.String daysValue, java.lang.String dateOperator1, java.lang.String dateValue1, java.lang.String dateOperator2, java.lang.String dateValue2)
type
- The type of data being cached. Current values in sc, scproduct, sccategory,
ph, phproduct, phcategory. Any custom type can be specified as well.storeId
- The store ID in which to find the order.daysOperator
- The operator to use when checking if this behavior has occurred within or prior to a
number of days. Valid values are: =, <, <=, >, >=. However, from a business point of view, only
<= (within) and > (prior) make sense.
There is a special case for the purchase history target to specify that only a specific number
of previous orders should be checked. In that scenario the daysOperator is equal to previousOrders, and daysValue
is the number of previous orders to consider. The other date parameters are not valid when previousOrders
is used.daysValue
- When has this behavior has occurred; within or prior to the specified number
of days.dateOperator1
- The operator to use when checking if this behavior has occurred on, before, after
or between a specified date. Valid values are: =, <, <=, >, >=.dateValue1
- When has this behavior has occurred; on, before, after, or between the specified date.dateOperator2
- The operator to use when checking if this behavior has occurred on, before, after
or between a specified date. Valid values are: =, <, <=, >, >=.dateValue2
- When has this behavior has occurred; on, before, after, or between the specified date.public java.util.List getOrder(java.lang.String type, java.util.List order, java.lang.String currency, java.lang.String daysOperator, java.lang.String daysValue, java.lang.String dateOperator1, java.lang.String dateValue1, java.lang.String dateOperator2, java.lang.String dateValue2)
type
- Specify "sc" to check the user's shopping cart, or specify "ph" to check the user's purchase history.order
- The current data retrieved by previously calling this method. If the data has already been retrieved, then
the existing data is returned.currency
- The currency in which to return the value of the user's orders.daysOperator
- The operator to use when checking if this behavior has occurred within or prior to a
number of days. Valid values are: =, <, <=, >, >=. However, from a business point of view, only
<= (within) and > (prior) make sense.
There is a special case for the purchase history target to specify that only a specific number
of previous orders should be checked. In that scenario the daysOperator is equal to previousOrders, and daysValue
is the number of previous orders to consider. The other date parameters are not valid when previousOrders
is used.daysValue
- When has this behavior has occurred; within or prior to the specified number
of days.dateOperator1
- The operator to use when checking if this behavior has occurred on, before, after
or between a specified date. Valid values are: =, <, <=, >, >=.dateValue1
- When has this behavior has occurred; on, before, after, or between the specified date.dateOperator2
- The operator to use when checking if this behavior has occurred on, before, after
or between a specified date. Valid values are: =, <, <=, >, >=.dateValue2
- When has this behavior has occurred; on, before, after, or between the specified date.List
. The first element contains the total value of the
orders as a BigDecimal
. The second element contains the quantity as an Integer
.public java.util.List getOrderProduct(java.lang.String type, java.util.List order, java.lang.String catentryId, java.util.List childCatentries, java.lang.String currency, java.lang.String daysOperator, java.lang.String daysValue, java.lang.String dateOperator1, java.lang.String dateValue1, java.lang.String dateOperator2, java.lang.String dateValue2)
type
- Specify "sc" to check the user's shopping cart, or specify "ph" to check the user's purchase history.order
- The current data retrieved by previously calling this method.catentryId
- The catalog entry ID to check in the user's orders. If this value is null, then only load the
orders, but do not do any additional checking.childCatentries
- A list of child catalog entry IDs of the product to check in the user's orders.currency
- The currency in which to return the value of the user's orders.daysOperator
- The operator to use when checking if this behavior has occurred within or prior to a
number of days. Valid values are: =, <, <=, >, >=. However, from a business point of view, only
<= (within) and > (prior) make sense.
There is a special case for the purchase history target to specify that only a specific number
of previous orders should be checked. In that scenario the daysOperator is equal to previousOrders, and daysValue
is the number of previous orders to consider. The other date parameters are not valid when previousOrders
is used.daysValue
- When has this behavior has occurred; within or prior to the specified number
of days.dateOperator1
- The operator to use when checking if this behavior has occurred on, before, after
or between a specified date. Valid values are: =, <, <=, >, >=.dateValue1
- When has this behavior has occurred; on, before, after, or between the specified date.dateOperator2
- The operator to use when checking if this behavior has occurred on, before, after
or between a specified date. Valid values are: =, <, <=, >, >=.dateValue2
- When has this behavior has occurred; on, before, after, or between the specified date.List
. The first element contains the total value of the
orders as a BigDecimal
. The second element contains the quantity as an Integer
.
The third element contains an array of OrderInfo
objects that contain the user's orders.public java.util.List getOrderCategory(java.lang.String type, java.util.List order, java.lang.String categoryId, java.lang.String currency, java.lang.String daysOperator, java.lang.String daysValue, java.lang.String dateOperator1, java.lang.String dateValue1, java.lang.String dateOperator2, java.lang.String dateValue2)
type
- Specify "sc" to check the user's shopping cart, or specify "ph" to check the user's purchase history.order
- The current data retrieved by previously calling this method.categoryId
- The category ID to check in the user's orders.currency
- The currency in which to return the value of the user's orders.daysOperator
- The operator to use when checking if this behavior has occurred within or prior to a
number of days. Valid values are: =, <, <=, >, >=. However, from a business point of view, only
<= (within) and > (prior) make sense.
There is a special case for the purchase history target to specify that only a specific number
of previous orders should be checked. In that scenario the daysOperator is equal to previousOrders, and daysValue
is the number of previous orders to consider. The other date parameters are not valid when previousOrders
is used.daysValue
- When has this behavior has occurred; within or prior to the specified number
of days.dateOperator1
- The operator to use when checking if this behavior has occurred on, before, after
or between a specified date. Valid values are: =, <, <=, >, >=.dateValue1
- When has this behavior has occurred; on, before, after, or between the specified date.dateOperator2
- The operator to use when checking if this behavior has occurred on, before, after
or between a specified date. Valid values are: =, <, <=, >, >=.dateValue2
- When has this behavior has occurred; on, before, after, or between the specified date.Vector
. The first element contains the total value of the
orders as a BigDecimal
. The second element contains the quantity as an Integer
.
The third element contains an array of OrderInfo
objects that contain the user's orders.public void validateParameters(java.util.Map elementParameters, java.util.List validationErrors)
elementParameters
- The name value pairs for this element.validationErrors
- The list of ApplicationError
exceptions
that contains any validation errors. The list may be empty.