© 2005 BEA Systems, Inc.

com.bea.campaign.action
Class Action

java.lang.Object
  extended bycom.bea.campaign.action.Action
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AddAdToPlaceholderAction, AddUserDiscountAction, EndStateAction, MailAction

public abstract class Action
extends Object
implements Serializable

Base class for a campaign/scenario action.

An Action defines the behavior that will result from a rule firing in a Scenario. Actions should have the following objects set on after init() is called, but before run() is called:

See Also:
Serialized Form

Constructor Summary
Action()
           
 
Method Summary
 Event getEvent()
          Get the event that initially triggered this action.
 Number getRandom()
          Get the random that was used in the scenario rules.
 Request getRequest()
          Get the request this Action is executing in.
 Scenario getScenario()
          Get the scenario that created this Action.
 ScenarioContainer getScenarioContainer()
          Get the that this action was created under.
 String getScenarioContainerName()
          Get the name of the ScenarioContainer
 String getScenarioId()
          Get the id of the scenario that created this Action
 String getScenarioName()
          Get the name of the scenario that created this Action
 ServiceLocator getServiceLocator()
          Get the ServiceLocator given to this action
 Session getSession()
          Get the session this Action is executing in.
 Timestamp getTimestamp()
          Get the timestamp of the event that caused this action.
 ProfileWrapper getUser()
          Get the user this Action is executing for.
 String getUserId()
          Get the userId associated with the event that triggered this Action
abstract  void init(Map params)
          Initialize the action with an arbitrary set of parameters.
 Object locateService(String name)
          Use this Action's ServiceLocator to lookup a service
abstract  void run()
          Run the behavior defined in the implementation of this Action.
 void setEvent(Event evt)
          Set the event that initially triggered this action This will be called by the ScenarioService prior to running the Action.
 void setRandom(Number n)
          Set the random number that was used in the scenario rules.
 void setRequest(Request aRequest)
          Set the request this Action is executing in This will be called by the ScenarioService prior to running the Action.
 void setScenario(Scenario s)
          Set the scenario that created this Action This will be called by the ScenarioService prior to running the Action.
 void setScenarioContainer(ScenarioContainer s)
          Set the ScenarioContainer that this action was created under This will be called by the ScenarioService prior to running the Action.
 void setServiceLocator(ServiceLocator s)
          Set a ServiceLocator for this Action to use.
 void setSession(Session aSession)
          Set the session this Action is executing in This will be called by the ScenarioService prior to running the Action.
 void setTimestamp(Timestamp s)
          Set the timestamp of the event that caused this action This will be called by the ScenarioService prior to running the Action.
 void setUser(ProfileWrapper aUser)
          Set the user this Action is executing for This will be called by the ScenarioService prior to running the Action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Action

public Action()
Method Detail

getEvent

public Event getEvent()
Get the event that initially triggered this action.


getRandom

public Number getRandom()
Get the random that was used in the scenario rules.


getRequest

public Request getRequest()
Get the request this Action is executing in.


getScenario

public Scenario getScenario()
Get the scenario that created this Action.


getScenarioContainer

public ScenarioContainer getScenarioContainer()
Get the that this action was created under.


getScenarioContainerName

public String getScenarioContainerName()
Get the name of the ScenarioContainer


getScenarioId

public String getScenarioId()
Get the id of the scenario that created this Action


getScenarioName

public String getScenarioName()
Get the name of the scenario that created this Action


getServiceLocator

public ServiceLocator getServiceLocator()
Get the ServiceLocator given to this action

Returns:
this Action's ServiceLocator

getSession

public Session getSession()
Get the session this Action is executing in.


getTimestamp

public Timestamp getTimestamp()
Get the timestamp of the event that caused this action.


getUser

public ProfileWrapper getUser()
Get the user this Action is executing for.


getUserId

public String getUserId()
Get the userId associated with the event that triggered this Action


init

public abstract void init(Map params)
                   throws IllegalArgumentException
Initialize the action with an arbitrary set of parameters. It is up to the provider of the Action implementation to define what these parameters are, and to do any sort of necessary error checking on them.

Parameters:
params - A map of name/value pairs
Throws:
IllegalArgumentException - if any required params are missing

locateService

public Object locateService(String name)
Use this Action's ServiceLocator to lookup a service

Parameters:
name - the name of the service
Returns:
the located service, or null if it could not be found

run

public abstract void run()
                  throws ActionException
Run the behavior defined in the implementation of this Action.

Throws:
ActionException - will be thrown if an error occurs

setEvent

public void setEvent(Event evt)
Set the event that initially triggered this action This will be called by the ScenarioService prior to running the Action.


setRandom

public void setRandom(Number n)
Set the random number that was used in the scenario rules. This will be called by the ScenarioService prior to running the Action.


setRequest

public void setRequest(Request aRequest)
Set the request this Action is executing in This will be called by the ScenarioService prior to running the Action.


setScenario

public void setScenario(Scenario s)
Set the scenario that created this Action This will be called by the ScenarioService prior to running the Action.


setScenarioContainer

public void setScenarioContainer(ScenarioContainer s)
Set the ScenarioContainer that this action was created under This will be called by the ScenarioService prior to running the Action.


setServiceLocator

public void setServiceLocator(ServiceLocator s)
Set a ServiceLocator for this Action to use. This will be called by the ScenarioService prior to running the Action.

Parameters:
s - the ServiceLocator

setSession

public void setSession(Session aSession)
Set the session this Action is executing in This will be called by the ScenarioService prior to running the Action.


setTimestamp

public void setTimestamp(Timestamp s)
Set the timestamp of the event that caused this action This will be called by the ScenarioService prior to running the Action.


setUser

public void setUser(ProfileWrapper aUser)
Set the user this Action is executing for This will be called by the ScenarioService prior to running the Action.


© 2005 BEA Systems, Inc.

Copyright © 2005 BEA Systems, Inc. All Rights Reserved