public class TriggerHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALL_USERS_TRUE
A constant representing that a trigger handler is for all users.
|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static java.lang.String |
MARKETING_SPOT_BEHAVIOR
Constant to specify an e-Marketing Spot behavior.
|
static java.lang.String |
MARKETING_SPOT_BEHAVIOR_DYNAMIC
Constant to specify an e-Marketing Spot is dynamic - different results can be displayed.
|
static java.lang.String |
MARKETING_SPOT_BEHAVIOR_DYNAMIC_WITH_REFRESH
Constant to specify an e-Marketing Spot is dynamic and facet refresh is required.
|
static int |
MARKETING_SPOT_BEHAVIOR_NO_TIME_LIMIT
Constant to specify the e-Marketing Spot has no specific time limit.
|
static java.lang.String |
MARKETING_SPOT_BEHAVIOR_STATIC
Constant to specify an e-Marketing Spot is static - same results to all customers.
|
static java.lang.String |
MARKETING_SPOT_BEHAVIOR_TIME_LIMIT
Constant to specify the time limit when the e-Marketing Spot behavior may change.
|
static java.lang.String |
RETURN_MARKETING_SPOT_BEHAVIOR_TIME_LIMIT
Constant to specify the service should return the time limit when the e-Marketing Spot behavior may change.
|
static java.lang.String |
TRIGGER_ACTIVITYACTION
Trigger name for ActivityAction.
|
static java.lang.String |
TRIGGER_DISPLAYEMS
Trigger name for DisplayEms.
|
static java.lang.String |
TRIGGER_DISPLAYEMS_PARAMETER_EMS_ID
emsId parameter for DisplayEms.
|
static java.lang.String |
TRIGGER_TIMER
Trigger name for Timer.
|
static java.lang.String |
XML_ATTRIBUTE_ACTION
The action to perform.
|
static java.lang.String |
XML_ATTRIBUTE_NAME_ACTIVITY_ID
The activity ID.
|
Constructor and Description |
---|
TriggerHandler()
This is the default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
forwardTriggers(java.util.Map triggerParameters,
java.lang.String personalizationId,
java.lang.Integer storeId,
java.util.Map nvpsForSend,
java.util.Map nvpsForRecord)
This method will record user behaviors and forward triggers to the trigger handler.
|
void |
forwardTriggers(java.lang.String triggerParameters,
java.lang.String personalizationId,
java.lang.Integer storeId,
java.util.Map nvpsForSend,
java.util.Map nvpsForRecord)
This method will record user behaviors and forward triggers to the trigger handler.
|
java.util.Map |
getAndResetEmsClicksCounter()
This method returns the current accumulated statistics for the clicks of EMarketingSpots within an activity flow.
|
java.util.Map |
getAndResetEmsViewsCounter()
This method returns the current accumulated statistics for the views of EMarketingSpots within an activity flow.
|
java.util.Map |
getAndResetTestElementClicksCounter()
This method returns the current accumulated statistics for the clicks a test element within an activity experiment.
|
java.util.Map |
getAndResetTestElementViewsCounter()
This method returns the current accumulated statistics for views of a test element within an activity experiment.
|
static java.lang.String |
getBehaviorSetting(java.lang.String newBehavior,
java.lang.String currentBehavior)
This method returns the appropriate setting for the e-Marketing Spot behavior
based on the existing determined value, and the new determined value.
|
java.lang.String |
getEMSBehavior(ActivityTrigger activityTrigger,
java.lang.StringBuffer timeLimit)
This method gets the caching behavior for an e-Marketing Spot.
|
void |
incrementTestElementViewStatistics(java.lang.Integer experimentId,
java.lang.Integer testElementId,
java.lang.Integer storeId)
This method increments by one the view statistics for a test element within an activity experiment.
|
void |
incrementViewStatistics(java.lang.Integer activityId,
java.lang.Integer emsId,
java.lang.Integer storeId)
This method increments by one the view statistics for an EMarketingSpot within an activity.
|
void |
initialize()
This method initializes the shared
TriggerHandler object. |
static boolean |
isActivityActive(Activity activity)
This method returns true if the current activity is active.
|
static boolean |
isActivityActive(java.lang.Integer activityId)
This method returns true if the current activity is active.
|
static boolean |
isActivityEndDateAfter(Activity activity,
java.sql.Timestamp date)
This method returns true if the activity end date is after the given date.
|
static boolean |
isActivityEndDateAfter(java.lang.Integer activityId,
java.sql.Timestamp date)
This method returns true if the activity end date is after the given date.
|
static boolean |
isActivityEndDateBefore(Activity activity,
java.sql.Timestamp date)
This method returns true if the activity end date is before the given date.
|
static boolean |
isActivityEndDateBefore(java.lang.Integer activityId,
java.sql.Timestamp date)
This method returns true if the activity end date is before the given date.
|
static boolean |
isActivityExpired(Activity activity)
This method returns true if the current timestamp is after the end date of the activity.
|
static boolean |
isActivityStartDateAfter(Activity activity,
java.sql.Timestamp date)
This method returns true if the activity start date is after the given date.
|
static boolean |
isActivityStartDateAfter(java.lang.Integer activityId,
java.sql.Timestamp date)
This method returns true if the activity start date is after the given date.
|
static boolean |
isActivityStartDateBefore(Activity activity,
java.sql.Timestamp date)
This method returns true if the activity start date is before the given date.
|
static boolean |
isActivityStartDateBefore(java.lang.Integer activityId,
java.sql.Timestamp date)
This method returns true if the activity start date is before the given date.
|
static boolean |
isDateValidForActivity(Activity activity)
This method returns true if the current timestamp is in the range of valid dates for this activity.
|
static boolean |
isDateValidForActivity(java.lang.Integer activityId)
This method returns true if the current timestamp is in the range of valid dates for this activity.
|
java.util.List |
raiseEMSTrigger(ActivityTrigger activityTrigger)
This method handles the display of an EMarketingSpot.
|
java.util.List |
raiseEMSTrigger(ActivityTrigger activityTrigger,
java.util.List previewReport,
java.util.Map temporarySharedData)
This method handles the display of an EMarketingSpot.
|
boolean |
raiseTrigger(ActivityTrigger activityTrigger)
This method handles triggers sent to the trigger handler.
|
boolean |
raiseTrigger(java.lang.String personalizationId,
java.util.Map triggerParameters,
java.lang.Integer storeId,
java.lang.Integer triggerId,
Activity activity)
This method handles timer triggers sent to the trigger handler.
|
boolean |
raiseTrigger(java.lang.String personalizationId,
java.util.Map triggerParameters,
java.lang.Integer storeId,
java.lang.Integer triggerId,
Activity activity,
java.util.Map temporarySharedData)
This method handles timer triggers sent to the trigger handler.
|
boolean |
raiseTrigger(java.lang.String personalizationId,
java.lang.String triggerParameters,
java.lang.Integer storeId,
java.lang.Integer triggerId,
Activity activity)
This method handles timer triggers sent to the trigger handler.
|
void |
raiseTrigger(java.lang.String personalizationId,
java.lang.String triggerParameters,
java.lang.Integer storeId,
java.lang.Integer triggerId,
java.lang.Integer activityId)
This method handles timer triggers sent to the trigger handler.
|
void |
recordBehaviorXml(java.lang.String personalizationId,
java.util.Map nvps,
java.lang.Integer storeId)
This method records the given values to behavior column in the DMUSERBHVR database table for the specified user.
|
void |
registerTriggerListener(java.lang.String triggerToListenFor,
java.util.List nvps,
java.lang.Integer activityId,
java.lang.Integer storeId,
java.lang.Integer triggerId,
java.lang.Short allusers)
This method sets up an activity to start listening for a particular trigger.
|
void |
registerTriggerSender(java.lang.Integer triggerId,
java.lang.String personalizationId,
java.sql.Timestamp triggerTime,
java.lang.String triggerParameters,
java.lang.Integer storeId)
This method sets up a timer trigger to be sent at a particular time in the future.
|
void |
setEMSData(java.lang.String triggerParameters,
java.util.List emsDataBeanList)
This method sets a
EMarketingSpotDataBean to be returned to be displayed
in an e-Marketing Spot. |
static TriggerHandler |
singleton()
This method returns the shared instance of the
TriggerHandler object. |
public static final java.lang.String COPYRIGHT
public static final java.lang.String TRIGGER_DISPLAYEMS
public static final java.lang.String TRIGGER_DISPLAYEMS_PARAMETER_EMS_ID
public static final java.lang.String TRIGGER_ACTIVITYACTION
public static final java.lang.String TRIGGER_TIMER
public static final java.lang.String XML_ATTRIBUTE_NAME_ACTIVITY_ID
public static final java.lang.String XML_ATTRIBUTE_ACTION
public static final java.lang.String ALL_USERS_TRUE
public static final java.lang.String MARKETING_SPOT_BEHAVIOR
public static final java.lang.String MARKETING_SPOT_BEHAVIOR_TIME_LIMIT
public static final java.lang.String RETURN_MARKETING_SPOT_BEHAVIOR_TIME_LIMIT
public static final int MARKETING_SPOT_BEHAVIOR_NO_TIME_LIMIT
public static final java.lang.String MARKETING_SPOT_BEHAVIOR_STATIC
public static final java.lang.String MARKETING_SPOT_BEHAVIOR_DYNAMIC
public static final java.lang.String MARKETING_SPOT_BEHAVIOR_DYNAMIC_WITH_REFRESH
public TriggerHandler()
public void registerTriggerListener(java.lang.String triggerToListenFor, java.util.List nvps, java.lang.Integer activityId, java.lang.Integer storeId, java.lang.Integer triggerId, java.lang.Short allusers)
triggerToListenFor
- The name of the trigger to listen for.nvps
- The name value pairs to match in the trigger.activityId
- The activity ID that should process this trigger.storeId
- The store ID associated with the activity.triggerId
- The trigger ID to send to the engine when this trigger is received.allusers
- Should all users send this trigger to the engine, or only individual
users who are specifically waiting for this trigger.public void registerTriggerSender(java.lang.Integer triggerId, java.lang.String personalizationId, java.sql.Timestamp triggerTime, java.lang.String triggerParameters, java.lang.Integer storeId)
triggerId
- The trigger ID to send to the engine when this trigger is received.personalizationId
- The personalization ID associated with the customer.triggerTime
- The time to raise the timer trigger.triggerParameters
- The trigger parameters.storeId
- The ID of the store.public static boolean isActivityExpired(Activity activity)
activity
- The Activity
to check.public static boolean isDateValidForActivity(java.lang.Integer activityId)
activityId
- The ID of the activity to check.public static boolean isDateValidForActivity(Activity activity)
activity
- The Activity
to check.public static boolean isActivityStartDateBefore(java.lang.Integer activityId, java.sql.Timestamp date)
activityId
- The ID of the activity to check.date
- The time to check against.public static boolean isActivityStartDateBefore(Activity activity, java.sql.Timestamp date)
activity
- The Activity
to check.date
- The time to check against.public static boolean isActivityStartDateAfter(java.lang.Integer activityId, java.sql.Timestamp date)
activityId
- The ID of the activity to check.date
- The time to check against.public static boolean isActivityStartDateAfter(Activity activity, java.sql.Timestamp date)
activity
- The Activity
to check.date
- The time to check against.public static boolean isActivityEndDateBefore(java.lang.Integer activityId, java.sql.Timestamp date)
activityId
- The ID of the activity to check.date
- The time to check against.public static boolean isActivityEndDateBefore(Activity activity, java.sql.Timestamp date)
activity
- The Activity
to check.date
- The time to check against.public static boolean isActivityEndDateAfter(java.lang.Integer activityId, java.sql.Timestamp date)
activityId
- The ID of the activity to check.date
- The time to check against.public static boolean isActivityEndDateAfter(Activity activity, java.sql.Timestamp date)
activity
- The Activity
to check.date
- The time to check against.public static boolean isActivityActive(java.lang.Integer activityId)
activityId
- The ID of the activity to check.public static boolean isActivityActive(Activity activity)
activity
- The Activity
to check.public void incrementViewStatistics(java.lang.Integer activityId, java.lang.Integer emsId, java.lang.Integer storeId)
activityId
- The activity ID associated with the EMarketingSpot.emsId
- The ID of the EMarketingSpot which was viewed.storeId
- The ID of the store.public void incrementTestElementViewStatistics(java.lang.Integer experimentId, java.lang.Integer testElementId, java.lang.Integer storeId)
experimentId
- The ID of the experiment.testElementId
- The ID of the test element which was viewed.storeId
- The ID of the store.public java.util.Map getAndResetEmsViewsCounter()
public java.util.Map getAndResetEmsClicksCounter()
public java.util.Map getAndResetTestElementViewsCounter()
public java.util.Map getAndResetTestElementClicksCounter()
public java.util.List raiseEMSTrigger(ActivityTrigger activityTrigger)
activityTrigger
- The information related to the trigger that has been received.List
of EMarketingSpotDataBean
s
which have been populated with the results generated by the activities.public static java.lang.String getBehaviorSetting(java.lang.String newBehavior, java.lang.String currentBehavior)
newBehavior
- The newly determined behavior setting.currentBehavior
- The existing behavior setting.public java.lang.String getEMSBehavior(ActivityTrigger activityTrigger, java.lang.StringBuffer timeLimit)
activityTrigger
- The information related to the e-Marketing Spot being displayed.timeLimit
- The number of seconds from now of the earliest
start date or end date of activities scheduled to the e-Marketing
Spot. If there are no activities, or no start or end dates,
then a value of 0 is set. The value is set by this method.
If the time limit is greater than 68 years in the future, it
will not be returned.public java.util.List raiseEMSTrigger(ActivityTrigger activityTrigger, java.util.List previewReport, java.util.Map temporarySharedData)
activityTrigger
- The information related to the trigger that has been received.previewReport
- A list of information about the activity evaluation on the e-Marketing Spot.temporarySharedData
- The temporary shared data area is used to share information between campaign
elements. This information can be used to identify actions that have been performed, or to reuse
information to aid in performance.List
of EMarketingSpotDataBean
s
which have been populated with the results generated by the activities.public boolean raiseTrigger(ActivityTrigger activityTrigger)
activityTrigger
- The information related to the trigger that has been received.public void raiseTrigger(java.lang.String personalizationId, java.lang.String triggerParameters, java.lang.Integer storeId, java.lang.Integer triggerId, java.lang.Integer activityId)
personalizationId
- The personalization ID for the current customer.triggerParameters
- The trigger parameters.storeId
- The store ID sent with the trigger.triggerId
- The trigger ID to send to the engine.activityId
- The activity ID to which to send the trigger.public boolean raiseTrigger(java.lang.String personalizationId, java.lang.String triggerParameters, java.lang.Integer storeId, java.lang.Integer triggerId, Activity activity)
raiseTrigger
that has a Map for the triggerParameters
.personalizationId
- The personalization ID for the current customer.triggerParameters
- The trigger parameters.storeId
- The store ID sent with the trigger.triggerId
- The trigger ID to send to the engine.activity
- The activity to which to send the trigger.public boolean raiseTrigger(java.lang.String personalizationId, java.util.Map triggerParameters, java.lang.Integer storeId, java.lang.Integer triggerId, Activity activity)
personalizationId
- The personalization ID for the current customer.triggerParameters
- The trigger parameters.storeId
- The store ID sent with the trigger.triggerId
- The trigger ID to send to the engine.activity
- The activity to which to send the trigger.public boolean raiseTrigger(java.lang.String personalizationId, java.util.Map triggerParameters, java.lang.Integer storeId, java.lang.Integer triggerId, Activity activity, java.util.Map temporarySharedData)
personalizationId
- The personalization ID for the current customer.triggerParameters
- The trigger parameters.storeId
- The store ID sent with the trigger.triggerId
- The trigger ID to send to the engine.activity
- The activity to which to send the trigger.temporarySharedData
- The temporary shared data area is used to share information between campaign
elements. This information can be used to identify actions that have been performed, or to reuse
information to aid in performance.public void setEMSData(java.lang.String triggerParameters, java.util.List emsDataBeanList)
EMarketingSpotDataBean
to be returned to be displayed
in an e-Marketing Spot. The information is added to a List
of the
beans associated with the the user and specific e-Marketing Spot.
This method is no longer used. Campaign element task commands need to call
the method addEMarketingSpotDataBean
with each EMarketingSpotDataBean
.
The marketing services call the method
MarketingCampaignElementTaskCmd.getEMarketingSpotDataBeans
to get all the
data to return in the e-Marketing Spot.triggerParameters
- The trigger parameters.emsDataBeanList
- The information on what to display in the e-Marketing Spot.public void recordBehaviorXml(java.lang.String personalizationId, java.util.Map nvps, java.lang.Integer storeId)
personalizationId
- The user's personalization ID.nvps
- The name-value pairs to record in the user's behavior XML definition.storeId
- The ID of the store.public void forwardTriggers(java.lang.String triggerParameters, java.lang.String personalizationId, java.lang.Integer storeId, java.util.Map nvpsForSend, java.util.Map nvpsForRecord)
forwardTriggers
that has a Map for the triggerParameters
.triggerParameters
- The trigger parameters.personalizationId
- The personalization ID associated with the customer.storeId
- The store ID of the store in which this trigger took place.nvpsForSend
- The name-value pairs that are relevant for the triggers that the handler needs to be notified about.nvpsForRecord
- The name-value pairs that are relevant for the triggers that the handler needs to record.public void forwardTriggers(java.util.Map triggerParameters, java.lang.String personalizationId, java.lang.Integer storeId, java.util.Map nvpsForSend, java.util.Map nvpsForRecord)
triggerParameters
- The trigger parameters.personalizationId
- The personalization ID associated with the customer.storeId
- The store ID of the store in which this trigger took place.nvpsForSend
- The name-value pairs that are relevant for the triggers that the handler needs to be notified about.nvpsForRecord
- The name-value pairs that are relevant for the triggers that the handler needs to record.public void initialize() throws java.lang.Exception
TriggerHandler
object.
It prepare the configuration of Trace event, that specify the event command directly recorded in the
User Behaviour string as trace which only keep the latest value.java.lang.Exception
public static TriggerHandler singleton()
TriggerHandler
object.TriggerHandler
object to reuse.