# com.bea.p13n.tracking
TrackingEventHelper Class

public class TrackingEventHelper
extends `Object`

Helper methods for dispatching Behavior Tracking events to the Event Service.

Hierarchy
  `Object`
  `TrackingEventHelper`

## Constructor Summary

TrackingEventHelper()

## Method Summary

`public static void` | `dispatchEvent`(`Event` theEvent) Dispatch an event, looking up the EventService EJB each time.
`public static void` | `dispatchEvent`(`EventService` eventService, `Event` evt) Fire the event, passing in the reference of the EventService EJB.
`public static void` | `dispatchEvent`(`HttpServletRequest` theRequest, `Event` theEvent) Dispatch an event using an EventService that is cached in theRequest.
`public static void` | `dispatchSessionLoginEvent`(`HttpServletRequest` theRequest, `String` userId) Utility method to dispatch a SessionLoginEvent for the specified userId, if it hasn't been done already.
`public static void` | `dispatchSessionLoginEvent`(`HttpServletRequest` theRequest) Utility method to dispatch a SessionLoginEvent for the user logged into the given servlet request, if it hasn't been done already.
`public static void` | `dispatchSessionLoginEvent`(`HttpSession` session, `String` userId) Utility method to dispatch a SessionLoginEvent for the user logged into the given servlet request, if it hasn't been done already.
`public static void` | `dispatchUserRegistrationEvent`(`HttpServletRequest` request, `String` newUserId, `UserRegistrationEvent` evt) Utility method to dispatch a UserRegistrationEvent for the specified user, if it hasn't been done already.
`public static void` | `dispatchUserRegistrationEvent`(`HttpServletRequest` request, `String` newUserId) Utility method to dispatch a UserRegistrationEvent for the specified user, if it hasn't been done already.
`public static void` | `dispatchUserRegistrationEvent`(`HttpServletRequest` request) Utility method to dispatch a UserRegistrationEvent for the user logged into the given servlet request, if it hasn't been done already.
`public static `EventService`` | `getEventService`() Get an instance of the EventService EJB.
`public static `EventService`` | `getEventService`(`String` lookup) Get an instance of the EventService EJB.
`public static `EventService`` | `getEventService`(`HttpServletRequest` theRequest) Get a new event service instance and set it in theRequest for later event dispatching.
`public static `String`` | `getUserId`(`HttpServletRequest` req) Return the user id of the currently logged in user (i.e. the user associated to the thread, not neccessarily the request's remote user).

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Detail

### TrackingEventHelper

    public TrackingEventHelper()

## Method Detail

### dispatchEvent(Event) Method

DEPRECATED Use EventService.dispatchEvent(Event theEvent).

    public static void dispatchEvent(Event theEvent)

Dispatch an event, looking up the EventService EJB each time. It is recommended that the caller instead get an instance of the EventServiceBean using TrackingEventHelperImpl.getEventService(), then call TrackingEventHelperImpl.dispatchEvent() with with that EventServiceBean.

To enable debugging for monitoring event firing, set this in debug.properties:

com.bea.p13n.tracking.TrackingEventHelperImpl: on

### dispatchEvent(EventService, Event) Method

    public static void dispatchEvent(EventService eventService,
                                     Event evt)

Fire the event, passing in the reference of the EventService EJB. To enable debugging for monitoring event firing, set this in debug.properties:

com.bea.p13n.tracking.TrackingEventHelperImpl: on

### dispatchEvent(HttpServletRequest, Event) Method

    public static void dispatchEvent(HttpServletRequest theRequest,
                                     Event theEvent)

Dispatch an event using an EventService that is cached in theRequest. To enable debugging for monitoring event firing, set this in debug.properties:

com.bea.p13n.tracking.TrackingEventHelperImpl: on

### dispatchSessionLoginEvent(HttpServletRequest, String) Method

    public static void dispatchSessionLoginEvent(HttpServletRequest theRequest,
                                                 String userId)

Utility method to dispatch a SessionLoginEvent for the specified userId, if it hasn't been done already.

#### Parameters

theRequest
  the http servlet request the event is generating from.

userId
  the user id to generate the event for.

### dispatchSessionLoginEvent(HttpServletRequest) Method

    public static void dispatchSessionLoginEvent(HttpServletRequest theRequest)

Utility method to dispatch a SessionLoginEvent for the user logged into the given servlet request, if it hasn't been done already.

#### Parameters

theRequest
  the http servlet request the event is generating from.

Related Topics

``TrackingEventHelper.getUserId(HttpServletRequest)``

### dispatchSessionLoginEvent(HttpSession, String) Method

    public static void dispatchSessionLoginEvent(HttpSession session,
                                                 String userId)

Utility method to dispatch a SessionLoginEvent for the user logged into the given servlet request, if it hasn't been done already.

#### Parameters

session
  the http servlet request the event is generating from.

Related Topics

``TrackingEventHelper.getUserId(HttpServletRequest)``

### dispatchUserRegistrationEvent(HttpServletRequest, String, UserRegistrationEvent) Method

    public static void dispatchUserRegistrationEvent(HttpServletRequest request,
                                                     String newUserId,
                                                     UserRegistrationEvent evt)

Utility method to dispatch a UserRegistrationEvent for the specified user, if it hasn't been done already.

#### Parameters

request
  the http servlet request the event is generating from.

newUserId
  the user id to generate the event for.

evt
  the event to fire.

### dispatchUserRegistrationEvent(HttpServletRequest, String) Method

    public static void dispatchUserRegistrationEvent(HttpServletRequest request,
                                                     String newUserId)

Utility method to dispatch a UserRegistrationEvent for the specified user, if it hasn't been done already.

#### Parameters

request
  the http servlet request the event is generating from.

newUserId
  the user id to generate the event for.

### dispatchUserRegistrationEvent(HttpServletRequest) Method

    public static void dispatchUserRegistrationEvent(HttpServletRequest request)

Utility method to dispatch a UserRegistrationEvent for the user logged into the given servlet request, if it hasn't been done already.

#### Parameters

request
  the http servlet request the event is generating from.

Related Topics

``TrackingEventHelper.getUserId(HttpServletRequest)``

### getEventService() Method

    public static EventService getEventService()
         throws Exception

Get an instance of the EventService EJB. This class (Helper) should not be responsible for caching instances of the EventService EJB. That should be done by the calling application.

This API will use the ApplicationHelper to get the application name and prepend it to .BEA_personalization.EventService to do the JNDI lookup. If the JNDI lookup name is known (such as an ejb-ref), then use the getEventService(String lookup) API.

#### Exceptions

``Exception``

### getEventService(String) Method

    public static EventService getEventService(String lookup)
         throws Exception

Get an instance of the EventService EJB. This class (Helper) should not be responsible for caching instances of the EventService EJB. That should be done by the calling application.

This API will use the ApplicationHelper to get the application name and prepend it to .BEA_personalization.EventService to do the JNDI lookup. If the JNDI lookup name is not known, then use the getEventService() API.

#### Parameters

lookup
  The JNDI lookup name

#### Exceptions

``Exception``

### getEventService(HttpServletRequest) Method

    public static EventService getEventService(HttpServletRequest theRequest)
         throws RemoteException, Exception

Get a new event service instance and set it in theRequest for later event dispatching.

#### Exceptions

``RemoteException``
``Exception``

### getUserId(HttpServletRequest) Method

    public static String getUserId(HttpServletRequest req)

Return the user id of the currently logged in user (i.e. the user associated to the thread, not neccessarily the request's remote user).