public class SensorEventListener
extends com.ibm.commerce.event.usertraffic.UserTrafficEventListener
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASSNAME
The name of this class.
|
static java.lang.String |
COMPONENT_NAME
Component name "SensorEventListener"
|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static java.lang.String |
TYPE_COMMAND_EXIT
Trigger on the successful exit of a command
|
static java.lang.String |
TYPE_REQUEST_BEGIN
Trigger on the beginning of a request
|
static java.lang.String |
TYPE_REQUEST_END
Trigger on the end of a request
|
Constructor and Description |
---|
SensorEventListener() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
buildBehaviorRuleKey(java.lang.Integer elementTypeId,
java.lang.String command,
java.lang.Integer storeId)
This method constructs a key to find
UserBehaviorRule objects in the cache. |
void |
destroy()
Destroys this event listener, and calls the marketing engine to persist the statistics.
|
java.util.List |
getBehaviorRules(java.lang.String key)
This method get the current active filter rules that match the given key.
|
java.util.List |
getBehaviorRules(java.lang.String command,
java.lang.Integer storeId,
java.lang.String urlString,
java.lang.String referralURL,
java.lang.Integer elementTypeId,
java.lang.String eventOccurrence)
This method looks in the cache for activities that match the command, store and url string (i.e.
|
static java.lang.String |
getCustomInformation(CommandContext commandContext,
java.lang.String existingCustomInformation)
This method gets the custom information from the current marketing context and returns
a string to be placed in the user XML string.
|
MarketingFacadeClient |
getMarketingFacadeClient()
This method gets the marketing facade client to use when making web service calls.
|
MarketingFacadeClient |
getMarketingFacadeClient(java.lang.Integer storeId,
java.lang.String forUserId)
This method gets the marketing facade client to use when making web service calls.
|
java.lang.Integer[] |
getStorePath(java.lang.Integer storeId)
This method gets the store IDs related to the specified store id by the campaigns store relationship type.
|
void |
init(org.w3c.dom.Element node)
Initializes this event listener, using the component attributes provided in the method parameter.
|
boolean |
isDateValidForActivity(java.lang.Integer activityId)
This method returns true if the current timestamp is in the range of valid dates for this activity.
|
static void |
processActivityEvent(CommandContext commandContext,
javax.servlet.http.HttpServletRequest httpServletRequest,
java.lang.String eventOccurrence,
java.lang.String commandName,
java.lang.String forUserId)
This method processes events sent at the beginning of every request, or when a command
successfully exits.
|
void |
processActivityEvent(com.ibm.commerce.event.usertraffic.UserTrafficData data,
java.lang.String eventOccurrence,
java.lang.String customInformation,
java.lang.String forUserId)
Processes events sent at the beginning of every request, or when a command
successfully exits.
|
void |
processActivityEvent(com.ibm.commerce.event.WCSEvent event)
Processes events sent at the end of every request.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String CLASSNAME
public static final java.lang.String COMPONENT_NAME
public static final java.lang.String TYPE_REQUEST_BEGIN
public static final java.lang.String TYPE_REQUEST_END
public static final java.lang.String TYPE_COMMAND_EXIT
public void init(org.w3c.dom.Element node) throws java.lang.Exception
init
in interface ComponentConfiguration
init
in class com.ibm.commerce.event.EventComponentConfiguration
node
- the element object that contains detail of the componentjava.lang.Exception
- Thrown when an error occurs while initializing this listener.public void destroy()
destroy
in interface ComponentConfiguration
destroy
in class com.ibm.commerce.event.usertraffic.UserTrafficEventListener
public static void processActivityEvent(CommandContext commandContext, javax.servlet.http.HttpServletRequest httpServletRequest, java.lang.String eventOccurrence, java.lang.String commandName, java.lang.String forUserId)
commandContext
- The command context of the event.httpServletRequest
- The servlet request associated with the event.eventOccurrence
- When did this event occur. Valid values are 0 (at the beginning
of a request - TYPE_REQUEST_BEGIN), 1 (at the end of a request - TYPE_REQUEST_END), or 2
(when a command successfully exits - TYPE_COMMAND_EXIT).commandName
- The name of the command being processed. This is passed in for when
a command successfully exits.forUserId
- An optional parameter that specifies that the Process MarketingTrigger
request should be called in the context of the provided user ID.public void processActivityEvent(com.ibm.commerce.event.usertraffic.UserTrafficData data, java.lang.String eventOccurrence, java.lang.String customInformation, java.lang.String forUserId) throws ECException
data
- The user traffic data to process.eventOccurrence
- When did this event occur. Valid values are 0 (at the beginning
of a request - TYPE_REQUEST_BEGIN), 1 (at the end of a request - TYPE_REQUEST_END), or 2
(when a command successfully exits - TYPE_COMMAND_EXIT).customInformation
- The custom information to include in the user identifier xml.forUserId
- An optional parameter that specifies that the Process MarketingTrigger
request should be called in the context of the provided user ID.ECException
- Problem processing the event.public void processActivityEvent(com.ibm.commerce.event.WCSEvent event) throws ECException
processActivityEvent
in interface com.ibm.commerce.event.WCSEventListener
processActivityEvent
in class com.ibm.commerce.event.usertraffic.UserTrafficEventListener
event
- The user traffic event to process.ECException
- Problem processing the event.public static java.lang.String getCustomInformation(CommandContext commandContext, java.lang.String existingCustomInformation)
commandContext
- The user's command context.existingCustomInformation
- The custom information to include in the user identifier xml.public java.lang.String buildBehaviorRuleKey(java.lang.Integer elementTypeId, java.lang.String command, java.lang.Integer storeId)
UserBehaviorRule
objects in the cache.elementTypeId
- The ID of the type of the campaign element template.command
- The current request command name.storeId
- The ID of the store.public boolean isDateValidForActivity(java.lang.Integer activityId)
activityId
- The ID of the activity to check.public java.util.List getBehaviorRules(java.lang.String command, java.lang.Integer storeId, java.lang.String urlString, java.lang.String referralURL, java.lang.Integer elementTypeId, java.lang.String eventOccurrence)
List
where the keys are the set of matching elementIds,
the values are a Map of the data for each element that needs to be included in the ActivityTrigger.command
- The command to look if there are matching behavior rules for.storeId
- The store to look for behavior rules for.urlString
- A URL string containing the parameters.referralURL
- The referral URL for the current request.elementTypeId
- The type of the element.eventOccurrence
- When did this event occur. Valid values are 0 (at the beginning
of a request - TYPE_REQUEST_BEGIN), 1 (at the end of a request - TYPE_REQUEST_END), or 2
(when a command successfully exits - TYPE_COMMAND_EXIT).List
which contains two List
objects is returned. The two List
s encapsulated contain:INDEX_UBRS
is a List
of UserBehaviorRule
objects that are waiting to record this command.INDEX_NVPS
is a List
of Map
s where each map
contains the Name/Value pairs that need to be detected
for the UserBehaviorRule
.
UserBehaviorRule
at matches.get(INDEX_UBRS).get(i)
are found at matches.get(INDEX_NVPS).get(i)
.public java.util.List getBehaviorRules(java.lang.String key)
key
- The key for the filter rule.UserBehaviorRule
objects that match the given key.public java.lang.Integer[] getStorePath(java.lang.Integer storeId) throws javax.naming.NamingException, java.sql.SQLException
storeId
- The store IDjavax.naming.NamingException
java.sql.SQLException
public MarketingFacadeClient getMarketingFacadeClient()
public MarketingFacadeClient getMarketingFacadeClient(java.lang.Integer storeId, java.lang.String forUserId)
storeId
- The ID of the store to set in the business context.forUserId
- An optional parameter that specifies that the Process MarketingTrigger
request should be called in the context of the provided user ID.