Action Class
- 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 Action.run()
is called:
-
Hierarchy
-
Object
Action
-
All Implemented Interfaces
-
Serializable
-
Direct Known Subclasses
-
AddAdToPlaceholderAction
, AddUserDiscountAction
, EndStateAction
, MailAction
public Event |
-
getEvent ()
- Get the event that initially triggered this action.
|
public Number |
-
getRandom ()
- Get the random that was used in the scenario rules.
|
public Request |
-
getRequest ()
- Get the request this Action is executing in.
|
public Scenario |
-
getScenario ()
- Get the scenario that created this Action.
|
public ScenarioContainer |
-
getScenarioContainer ()
- Get the that this action was created under.
|
public String |
-
getScenarioContainerName ()
- Get the name of the ScenarioContainer
|
public String |
-
getScenarioId ()
- Get the id of the scenario that created this Action
|
public String |
-
getScenarioName ()
- Get the name of the scenario that created this Action
|
public ServiceLocator |
-
getServiceLocator ()
- Get the ServiceLocator given to this action
|
public Session |
-
getSession ()
- Get the session this Action is executing in.
|
public Timestamp |
-
getTimestamp ()
- Get the timestamp of the event that caused this action.
|
public ProfileWrapper |
-
getUser ()
- Get the user this Action is executing for.
|
public String |
-
getUserId ()
- Get the userId associated with the event that triggered this Action
|
public abstract void |
-
init (Map params)
- Initialize the action with an arbitrary set of parameters.
|
public Object |
-
locateService (String name)
- Use this Action's ServiceLocator to lookup a service
|
public abstract void |
-
run ()
- Run the behavior defined in the implementation of this
Action.
|
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.
|
public void |
-
setRandom (Number n)
- Set the random number that was used in the scenario rules.
|
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.
|
public void |
-
setScenario (Scenario s)
- Set the scenario that created this Action
This will be called by the ScenarioService prior to running the Action.
|
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.
|
public void |
-
setServiceLocator (ServiceLocator s)
- Set a ServiceLocator for this Action to use.
|
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.
|
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.
|
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.
|
Methods from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Action
public Action()
getEvent() Method
public Event
getEvent()
Get the event that initially triggered this action.
getRandom() Method
public Number
getRandom()
Get the random that was used in the scenario rules.
getRequest() Method
public Request
getRequest()
Get the request this Action is executing in.
getScenario() Method
public Scenario
getScenario()
Get the scenario that created this Action.
getScenarioContainer() Method
public ScenarioContainer
getScenarioContainer()
Get the that this action was created under.
getScenarioContainerName() Method
public String
getScenarioContainerName()
Get the name of the ScenarioContainer
getScenarioId() Method
public String
getScenarioId()
Get the id of the scenario that created this Action
getScenarioName() Method
public String
getScenarioName()
Get the name of the scenario that created this Action
getServiceLocator() Method
public ServiceLocator
getServiceLocator()
Get the ServiceLocator given to this action
Returns
- this Action's ServiceLocator
getSession() Method
public Session
getSession()
Get the session this Action is executing in.
getTimestamp() Method
public Timestamp
getTimestamp()
Get the timestamp of the event that caused this action.
getUser() Method
public ProfileWrapper
getUser()
Get the user this Action is executing for.
getUserId() Method
public String
getUserId()
Get the userId associated with the event that triggered this Action
init(Map) Method
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
Exceptions
-
IllegalArgumentException
- if any required params are missing
locateService(String) Method
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() Method
public abstract void run()
throws ActionException
Run the behavior defined in the implementation of this
Action.
Exceptions
-
ActionException
- will be thrown if an error occurs
setEvent(Event) Method
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(Number) Method
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(Request) Method
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(Scenario) Method
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(ScenarioContainer) Method
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(ServiceLocator) Method
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(Session) Method
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(Timestamp) Method
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(ProfileWrapper) Method
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.