public class ConditionUtil
extends java.lang.Object
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.
|
static java.lang.String |
OPERATOR_CONTAINS
Contains operator -
"contains" . |
static java.lang.String |
OPERATOR_DOES_NOT_CONTAIN
Does not contain -
"doesNotContain" . |
static java.lang.String |
OPERATOR_DOES_NOT_END_WITH
Does not end with operator -
"doesNotEndWith" . |
static java.lang.String |
OPERATOR_DOES_NOT_START_WITH
Does not start with operator -
"doesNotStartWith" . |
static java.lang.String |
OPERATOR_ENDS_WITH
Ends with operator -
"endsWith" . |
static java.lang.String |
OPERATOR_EQUAL_TO
Equal to operator -
"=" . |
static java.lang.String |
OPERATOR_GREATER_THAN
Greater than operator -
">" . |
static java.lang.String |
OPERATOR_GREATER_THAN_OR_EQUAL_TO
Greater than or equal to operator -
">=" . |
static java.lang.String |
OPERATOR_LESS_THAN
Less than operator -
"<" . |
static java.lang.String |
OPERATOR_LESS_THAN_OR_EQUAL_TO
Less than or equal to operator -
"<=" . |
static java.lang.String |
OPERATOR_NOT_EQUAL_TO
Not equal to operator -
"!=" . |
static java.lang.String |
OPERATOR_STARTS_WITH
Starts with operator -
"startsWith" . |
static java.lang.String |
PREVIOUS_ORDERS
Check the specified number of previous orders -
"previousOrders" . |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkEqualDate(java.lang.String dateValue1,
java.sql.Timestamp orderDate)
This method checks if two dates are equal.
|
static boolean |
checkOrderForPromotion(java.lang.String orderId,
java.lang.String promotionId,
java.lang.String dateOperator1,
java.lang.String dateValue1,
java.lang.String dateOperator2,
java.lang.String dateValue2)
This method checks the order to determine if the specified promotion was used.
|
static boolean |
checkShoppingCartForPromotion(java.lang.String promotionId,
java.lang.Long memberId,
java.lang.Integer storeId)
This method checks the current shopping cart for the customer to determine if the specified promotion is currently applied.
|
static boolean |
evaluate2Strings(java.lang.String value1,
java.lang.String value2,
java.lang.String operator,
java.lang.String value3)
This method will compare two string values to a third using the specified operator.
|
static boolean |
evaluateBigDecimal(java.math.BigDecimal value1,
java.lang.String operator,
java.math.BigDecimal value2)
This method will compare two big decimal values using the specified operator.
|
static boolean |
evaluateDate(java.lang.String value1,
java.lang.String operator,
java.lang.String value2)
This method will compare two date values using the specified operator.
|
static boolean |
evaluateDouble(java.lang.Double doubleValue1,
java.lang.String operator,
java.lang.Double doubleValue2)
This method will compare two double values using the specified operator.
|
static boolean |
evaluateDurationInDays(java.sql.Timestamp timestamp,
java.lang.String operator,
java.lang.Integer value)
This method will compare a timestamp to an integer value using the specified operator.
|
static boolean |
evaluateInteger(java.lang.Integer value1,
java.lang.String operator,
java.lang.Integer value2)
This method will compare two integer values using the specified operator.
|
static boolean |
evaluateString(java.lang.String value1,
java.lang.String operator,
java.lang.String value2)
This method will compare two string values using the specified operator.
|
static boolean |
evaluateStringIgnoreCase(java.lang.String value1,
java.lang.String operator,
java.lang.String value2)
This method will compare two string values using the specified operator.
|
static java.util.List |
getChildCatentries(java.lang.Integer storeId,
java.lang.String catentryId)
This method gets the child catalog entries (items) of the specified catalog entry (product).
|
static java.lang.String |
getDateClause(java.lang.String type,
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 gets the SQL clause for checking dates in an order or an orderitem.
|
static java.sql.PreparedStatement |
getOrderStatementDateParameters(java.sql.PreparedStatement statement,
int index,
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 sets the date parameters into a SQL prepared statement.
|
static java.util.List |
getOwnersOfAbandonedShoppingCarts(java.lang.Integer storeId,
boolean includeGuestShoppers,
java.lang.String afterDate,
java.lang.String beforeDate)
This method gets the member IDs and personalization IDs for customers who have abandoned
their shopping cart.
|
static OrderInfo[] |
getPurchaseHistoryOrderItems(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)
This method gets the order items in a set of completed orders for a customer.
|
static OrderInfo[] |
getPurchaseHistoryOrders(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)
This method gets the set of completed orders for a customer.
|
static OrderInfo[] |
getShoppingCartOrderItems(java.lang.Integer storeId,
java.lang.Long memberId,
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 gets the order items in a shopping cart for a customer.
|
static java.math.BigDecimal |
getTotalAdjustmentForOrderByCalculationUsageId(java.lang.Long orderId,
java.lang.Integer calculationUsageId)
This method gets the adjustments made to an order associated with a particular
adjustment type.
|
static java.math.BigDecimal |
getTotalAdjustmentForOrderItemByCalculationUsageId(java.lang.Long orderItemId,
java.lang.Integer calculationUsageId)
This method gets the adjustments made to an order item associated with a particular
adjustment type.
|
static java.util.List |
getUsersByBirthday(java.lang.Integer storeId,
java.lang.String targetMM,
java.lang.String targetDD)
This method gets the member IDs and personalization IDs for customers whose birthday is
at the specific month and day.
|
static java.math.BigDecimal |
toBigDecimal(java.lang.String value)
Converts a
String value to BigDecimal . |
static java.lang.Double |
toDouble(java.lang.String value)
Converts a
String value to Double . |
static java.lang.Integer |
toInteger(java.lang.String value)
Converts a
String value to Integer . |
public static final java.lang.String COPYRIGHT
public static final java.lang.String CLASSNAME
public static final java.lang.String OPERATOR_EQUAL_TO
"="
.public static final java.lang.String OPERATOR_NOT_EQUAL_TO
"!="
.public static final java.lang.String OPERATOR_GREATER_THAN
">"
.public static final java.lang.String OPERATOR_LESS_THAN
"<"
.public static final java.lang.String OPERATOR_GREATER_THAN_OR_EQUAL_TO
">="
.public static final java.lang.String OPERATOR_LESS_THAN_OR_EQUAL_TO
"<="
.public static final java.lang.String OPERATOR_STARTS_WITH
"startsWith"
.public static final java.lang.String OPERATOR_DOES_NOT_START_WITH
"doesNotStartWith"
.public static final java.lang.String OPERATOR_ENDS_WITH
"endsWith"
.public static final java.lang.String OPERATOR_DOES_NOT_END_WITH
"doesNotEndWith"
.public static final java.lang.String OPERATOR_CONTAINS
"contains"
.public static final java.lang.String OPERATOR_DOES_NOT_CONTAIN
"doesNotContain"
.public static final java.lang.String PREVIOUS_ORDERS
"previousOrders"
.public static boolean evaluateString(java.lang.String value1, java.lang.String operator, java.lang.String value2)
value1
- a string valueoperator
- the operator used to compare the string values. The following
values are supported:
OPERATOR_EQUAL_TO
OPERATOR_NOT_EQUAL_TO
OPERATOR_STARTS_WITH
OPERATOR_DOES_NOT_START_WITH
OPERATOR_ENDS_WITH
OPERATOR_DOES_NOT_END_WITH
OPERATOR_CONTAINS
OPERATOR_DOES_NOT_CONTAIN
value2
- a string valuetrue
if the expression evaluates to true.public static boolean evaluateStringIgnoreCase(java.lang.String value1, java.lang.String operator, java.lang.String value2)
value1
- a string valueoperator
- the operator used to compare the string values. The following
values are supported:
OPERATOR_EQUAL_TO
OPERATOR_NOT_EQUAL_TO
OPERATOR_STARTS_WITH
OPERATOR_DOES_NOT_START_WITH
OPERATOR_ENDS_WITH
OPERATOR_DOES_NOT_END_WITH
OPERATOR_CONTAINS
OPERATOR_DOES_NOT_CONTAIN
value2
- a string valuetrue
if the expression evaluates to true.public static boolean evaluate2Strings(java.lang.String value1, java.lang.String value2, java.lang.String operator, java.lang.String value3)
value1
- a string valuevalue2
- a string valueoperator
- the operator used to compare the string values. The following
values are supported:
OPERATOR_EQUAL_TO
OPERATOR_NOT_EQUAL_TO
OPERATOR_STARTS_WITH
OPERATOR_DOES_NOT_START_WITH
OPERATOR_ENDS_WITH
OPERATOR_DOES_NOT_END_WITH
OPERATOR_CONTAINS
OPERATOR_DOES_NOT_CONTAIN
value3
- a string valuetrue
if the expression evaluates to true.public static boolean evaluateInteger(java.lang.Integer value1, java.lang.String operator, java.lang.Integer value2)
value1
- an integer valueoperator
- the operator used to compare the integer values. The following
values are supported:
OPERATOR_EQUAL_TO
OPERATOR_NOT_EQUAL_TO
OPERATOR_LESS_THAN
OPERATOR_GREATER_THAN
OPERATOR_LESS_THAN_OR_EQUAL_TO
OPERATOR_GREATER_THAN_OR_EQUAL_TO
value2
- an integer valuetrue
if the expression evaluates to true.public static boolean evaluateDouble(java.lang.Double doubleValue1, java.lang.String operator, java.lang.Double doubleValue2)
doubleValue1
- an double valueoperator
- the operator used to compare the double values. The following
values are supported:
OPERATOR_EQUAL_TO
OPERATOR_NOT_EQUAL_TO
OPERATOR_LESS_THAN
OPERATOR_GREATER_THAN
OPERATOR_LESS_THAN_OR_EQUAL_TO
OPERATOR_GREATER_THAN_OR_EQUAL_TO
doubleValue2
- an double valuetrue
if the expression evaluates to true.public static boolean evaluateBigDecimal(java.math.BigDecimal value1, java.lang.String operator, java.math.BigDecimal value2)
value1
- a big decimal valueoperator
- the operator used to compare the big decimal values. The following
values are supported:
OPERATOR_EQUAL_TO
OPERATOR_NOT_EQUAL_TO
OPERATOR_LESS_THAN
OPERATOR_GREATER_THAN
OPERATOR_LESS_THAN_OR_EQUAL_TO
OPERATOR_GREATER_THAN_OR_EQUAL_TO
value2
- a big decimal valuetrue
if the expression evaluates to true.public static boolean evaluateDurationInDays(java.sql.Timestamp timestamp, java.lang.String operator, java.lang.Integer value)
timestamp
- a timestampoperator
- the operator used to compare the string values. The following
values are supported:
OPERATOR_EQUAL_TO
OPERATOR_NOT_EQUAL_TO
OPERATOR_LESS_THAN
OPERATOR_GREATER_THAN
OPERATOR_LESS_THAN_OR_EQUAL_TO
OPERATOR_GREATER_THAN_OR_EQUAL_TO
value
- days since the current timetrue
if the expression evaluates to true.public static boolean evaluateDate(java.lang.String value1, java.lang.String operator, java.lang.String value2)
value1
- a date value in the form yyyy-mm-ddoperator
- the operator used to compare the date values. The following
values are supported:
OPERATOR_EQUAL_TO
OPERATOR_NOT_EQUAL_TO
OPERATOR_LESS_THAN
OPERATOR_GREATER_THAN
OPERATOR_LESS_THAN_OR_EQUAL_TO
OPERATOR_GREATER_THAN_OR_EQUAL_TO
value2
- a date value in the form yyyy-mm-ddtrue
if the expression evaluates to true.public static java.math.BigDecimal toBigDecimal(java.lang.String value)
String
value to BigDecimal
.value
- The value to convert to a BigDecimal
.BigDecimal
object or null
.public static java.lang.Integer toInteger(java.lang.String value)
String
value to Integer
.value
- The value to convert to an Integer
.Integer
object or null
.public static java.lang.Double toDouble(java.lang.String value)
String
value to Double
.value
- The value to convert to a Double
.Double
object or null
.public static boolean checkEqualDate(java.lang.String dateValue1, java.sql.Timestamp orderDate)
dateValue1
- The first date.orderDate
- The date of the order.public static java.lang.String getDateClause(java.lang.String type, java.lang.String daysOperator, java.lang.String daysValue, java.lang.String dateOperator1, java.lang.String dateValue1, java.lang.String dateOperator2, java.lang.String dateValue2)
getOrderStatementDateParameters
to create the PreparedStatement
.type
- The type of query being done. If this value is "order", then the SQL clause will
use "AND ORDERS.TIMEPLACED". If this value is "orderitem", then the SQL clause will use
"AND ORDERITEMS.LASTCREATE". If both of these clauses are not appropriate for the query, then
use this parameter to pass in the appropriate date clause. For example, for interest item list,
the type parameter can be " AND iitem.LASTUPDATE ". If passing in a date clause, then
the clause should include a leading and trailing space.daysOperator
- The operator for checking if the order items are within/prior the specified number of days.
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 this method will do nothing.daysValue
- The number of days for checking if the order items are within/prior the specified number of days.dateOperator1
- The operator for checking if the order items are within the specified date.dateValue1
- The date value for checking if the order items are within the specified date.dateOperator2
- The operator for checking if the order items are within the specified date.dateValue2
- The date value for checking if the order items are within the specified date.public static java.sql.PreparedStatement getOrderStatementDateParameters(java.sql.PreparedStatement statement, int index, java.lang.String daysOperator, java.lang.String daysValue, java.lang.String dateOperator1, java.lang.String dateValue1, java.lang.String dateOperator2, java.lang.String dateValue2) throws java.sql.SQLException
getDateClause
method.statement
- The SQL prepared statement to modify.index
- The index of the next parameter to replace in the prepared statement.daysOperator
- The operator for checking if the order items are within/prior the specified number of days.
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 this method will do nothing.daysValue
- The number of days for checking if the order items are within/prior the specified number of days.dateOperator1
- The operator for checking if the order items are within the specified date.dateValue1
- The date value for checking if the order items are within the specified date.dateOperator2
- The operator for checking if the order items are within the specified date.dateValue2
- The date value for checking if the order items are within the specified date.java.sql.SQLException
public static OrderInfo[] getShoppingCartOrderItems(java.lang.Integer storeId, java.lang.Long memberId, java.lang.String daysOperator, java.lang.String daysValue, java.lang.String dateOperator1, java.lang.String dateValue1, java.lang.String dateOperator2, java.lang.String dateValue2) throws java.lang.Exception
storeId
- The unique ID of the store.memberId
- The member ID for which to retrieve the shopping cart order items.daysOperator
- The operator for checking if the shopping cart order items are within/prior the specified number of days.daysValue
- The number of days for checking if the shopping cart order items are within/prior the specified number of days.dateOperator1
- The operator for checking if the shopping cart order items are within the specified date.dateValue1
- The date value for checking if the shopping cart order items are within the specified date.dateOperator2
- The operator for checking if the shopping cart order items are within the specified date.dateValue2
- The date value for checking if the shopping cart order items are within the specified date.java.lang.Exception
public static java.util.List getUsersByBirthday(java.lang.Integer storeId, java.lang.String targetMM, java.lang.String targetDD)
storeId
- The unique ID of the store.targetMM
- The string for the specific month in MM format.targetDD
- The string for the specific day in DD format.public static java.util.List getOwnersOfAbandonedShoppingCarts(java.lang.Integer storeId, boolean includeGuestShoppers, java.lang.String afterDate, java.lang.String beforeDate) throws java.lang.Exception
beforeDate
parameter. The afterDate
parameter restricts the query to find carts whose last update date is between
afterDate
and before beforeDate
.storeId
- The unique ID of the store.includeGuestShoppers
- Should this method return carts abandoned by guest shoppers.afterDate
- The oldest value allowed for the shopping cart last update date.beforeDate
- The most recent value allowed for the shopping cart last update date.java.lang.Exception
public static OrderInfo[] getPurchaseHistoryOrderItems(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) throws java.lang.Exception
storeId
- The unique ID of the store.memberIds
- The member IDs for which to retrieve the order items.daysOperator
- The operator for checking if the order items are within/prior the specified number of days.
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
- The number of days for checking if the order items are within/prior the specified number of days.dateOperator1
- The operator for checking if the order items are within the specified date.dateValue1
- The date value for checking if the order items are within the specified date.dateOperator2
- The operator for checking if the order items are within the specified date.dateValue2
- The date value for checking if the order items are within the specified date.java.lang.Exception
public static OrderInfo[] getPurchaseHistoryOrders(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) throws java.lang.Exception
storeId
- The unique ID of the store.memberIds
- The member IDs for which to retrieve the orders.daysOperator
- The operator for checking if the order is within/prior the specified number of days.
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
- The number of days for checking if the order is within/prior the specified number of days.dateOperator1
- The operator for checking if the order is within the specified date.dateValue1
- The date value for checking if the order is within the specified date.dateOperator2
- The operator for checking if the order is within the specified date.dateValue2
- The date value for checking if the order is within the specified date.java.lang.Exception
public static java.util.List getChildCatentries(java.lang.Integer storeId, java.lang.String catentryId) throws java.lang.Exception
storeId
- The unique ID of the store.catentryId
- The unique ID of the catalog entry for which to find the child catalog entries.List
of strings with the child catalog entry IDs.java.lang.Exception
public static java.math.BigDecimal getTotalAdjustmentForOrderItemByCalculationUsageId(java.lang.Long orderItemId, java.lang.Integer calculationUsageId)
orderItemId
- The ID of the order item.calculationUsageId
- The ID of the adjustment type.public static java.math.BigDecimal getTotalAdjustmentForOrderByCalculationUsageId(java.lang.Long orderId, java.lang.Integer calculationUsageId)
orderId
- The ID of the order.calculationUsageId
- The ID of the adjustment type.public static boolean checkOrderForPromotion(java.lang.String orderId, java.lang.String promotionId, java.lang.String dateOperator1, java.lang.String dateValue1, java.lang.String dateOperator2, java.lang.String dateValue2) throws java.lang.Exception
orderId
- The ID of the order.promotionId
- The promotion ID specified in the trigger.dateOperator1
- The operator for checking if the order items are within the specified date.dateValue1
- The date value for checking if the order items are within the specified date.dateOperator2
- The operator for checking if the order items are within the specified date.dateValue2
- The date value for checking if the order items are within the specified date.true
if the promotion is used in the order.java.lang.Exception
public static boolean checkShoppingCartForPromotion(java.lang.String promotionId, java.lang.Long memberId, java.lang.Integer storeId) throws java.lang.Exception
promotionId
- The ID of the promotion ID.memberId
- The member ID for which to check the shopping cart.storeId
- The unique ID of the store.true
if the promotion is used in the order.java.lang.Exception