public abstract class AbstractECCommand extends java.lang.Object implements ECCommand
ECCommand
objects.defaultCommandClassName
Constructor and Description |
---|
AbstractECCommand()
This is the default constructor for this class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accessControlCheck()
This method performs a command level access control check for this command.
|
void |
checkIsAllowed(java.lang.Object resource,
java.lang.String action)
This method determines whether a user can perform a specified action on a certain resource.
|
void |
checkResourcePermission()
This method performs resource level access control checking.
|
void |
createCommandExecutionEvent(com.ibm.commerce.command.event.CommandExecutionTrigger trigger)
This method creates a command execution event.
|
void |
execute()
This method is part of the command framework.
|
boolean |
getAccCheck()
This method checks to see if an access control check is required for this command.
|
CommandContext |
getCommandContext()
This method gets the command context associated with this command.
|
java.lang.String |
getCommandIfName()
This method gets the command interface name.
|
java.lang.String |
getCommandName()
This method gets the name of the originating command.
|
java.lang.Integer |
getCommandStoreId()
This method gets the store id used to create this command.
|
TypedProperty |
getDefaultProperties()
This method gets the default properties associated with this command.
|
java.util.Map |
getExceptionInvokeParameters(java.lang.String event)
This method returns the attributes for a particular event type when the command executed throws an exception.
|
java.util.Map |
getPostInvokeParameters(java.lang.String event)
This method returns the attributes for a particular event type after the command is executed.
|
java.util.Map |
getPreInvokeParameters(java.lang.String event)
This method returns the attributes for a particular event type before the command is executed.
|
AccessVector |
getResources()
This method gets the access vector accessed by this command.
|
java.lang.Integer |
getStoreId()
This method gets the store id associated with this command.
|
UserAccessBean |
getUser()
This method gets the
UserAccessBean object associated with the user. |
java.lang.Long |
getUserId()
This method gets the user id for the user associated with this command from the command context.
|
boolean |
isReadyToCallExecute()
This method is called by the targetable command framework.
|
void |
performExecute()
This method performs the business logic for this command.
|
void |
reset()
This method is called after a command has been executed.
|
void |
setAccCheck(boolean newValue)
This method sets the access control flag for this command.
|
void |
setCommandContext(CommandContext aCommandContext)
This method sets the command context associated with this command.
|
void |
setCommandIfName(java.lang.String name)
This method sets the command interface name.
|
void |
setCommandStoreId(java.lang.Integer storeId)
This method sets the store id used to create this command.
|
void |
setDefaultProperties(TypedProperty value)
This method sets default properties associated with this
ECCommand . |
static java.lang.String |
setForUserId(CommandContext currentContext)
a utility to set forUserId
|
static java.lang.String |
setUserId(CommandContext currentContext)
a utility to set userId
|
void |
validateParameters()
This method performs server side parameter checking.
|
public AbstractECCommand()
public boolean accessControlCheck() throws ECException
true
if the user has authority and false
if user has no authority.ECException
- An ECApplicationException
is thrown when an _ERR_USER_AUTHORITY
error occurs.public void checkIsAllowed(java.lang.Object resource, java.lang.String action) throws ECException
checkIsAllowed
in interface ECCommand
resource
- This is the resource to be acted on.action
- This is the action to be performed on the resource.ECException
- An ECApplicationException
is thrown when an _ERR_USER_AUTHORITY
error occurs.public void checkResourcePermission() throws ECException
AccManager
to perform
resource level access control checking based on the command interface name and the
AccessVector
returned by the getResources()
method.
This method will throw an ECApplicationException
with message _ERR_USER_AUTHORITY
if the user has no authority to perform the operation on the resource.
checkResourcePermission
in interface ECCommand
ECException
- This is thrown with the message _ERR_USER_AUTHORITY
if user does not have permission to perform the operation on the resource.public void execute() throws ECException
ECException
will be thrown if there are any errors detected during the
command execution.execute
in interface ECCommand
execute
in interface com.ibm.websphere.command.Command
ECException
- This is thrown if there are any errors detected during the command execution.public static java.lang.String setUserId(CommandContext currentContext)
currentContext
- the current context that a userId is inpublic static java.lang.String setForUserId(CommandContext currentContext) throws ECException
currentContext
- the current context that a forUserid is inECException
public boolean getAccCheck()
getAccCheck
in interface ECCommand
true
if an access control check is required for this command, and false
otherwise.public final CommandContext getCommandContext()
getCommandContext
in interface ECCommand
CommandContext
object.public final java.lang.String getCommandIfName()
getCommandIfName
in interface ECCommand
public final java.lang.String getCommandName()
URL
name defined in the URL
configuration.getCommandName
in interface ECCommand
public final TypedProperty getDefaultProperties()
getDefaultProperties
in interface ECCommand
public AccessVector getResources() throws ECException
getResources
in interface ECCommand
AccessVector
object of resource/action pairs.ECException
public final java.lang.Integer getStoreId()
getStoreId
in interface ECCommand
public final java.lang.Integer getCommandStoreId()
getCommandStoreId
in interface ECCommand
public final void setCommandStoreId(java.lang.Integer storeId)
setCommandStoreId
in interface ECCommand
storeId
- This is the command store id.public final UserAccessBean getUser() throws ECSystemException
UserAccessBean
object associated with the user.getUser
in interface ECCommand
ECSystemException
public final java.lang.Long getUserId()
public boolean isReadyToCallExecute()
true
.isReadyToCallExecute
in interface com.ibm.websphere.command.Command
boolean
value; true
if we can execute the
command and false
otherwise. This default implementation will always return true
.public void performExecute() throws ECException
performExecute
in interface ECCommand
ECException
public void reset()
reset
in interface com.ibm.websphere.command.Command
public void setAccCheck(boolean newValue)
setAccCheck
in interface ECCommand
newValue
- This is a boolean
value; true
if an access check is required,
and false
otherwise.public final void setCommandContext(CommandContext aCommandContext)
WebController
will set the command context for the top level controller command invoked by a caller.
Command writers have to set the command context for any subsequent commands to be instantiated
and executed.
It is possible that one command will need to call another command with a different set of parameters
that will affect the command context. In this case, the command writer should make a clone of the original command context.
The command writer should then call the setRequestProperties()
method on the clone with the new sets of RequestProperties
.
Examples of parameters that affect the command context are the user id and store id.setCommandContext
in interface ECCommand
aCommandContext
- This is a CommandContext
object.public final void setCommandIfName(java.lang.String name)
setCommandIfName
in interface ECCommand
name
- This is the command interface name.public final void setDefaultProperties(TypedProperty value)
ECCommand
. Default properties are defined in the URL
configuration. This method is called by the CommandFactory
object during command
creation to set the default properties for this command.setDefaultProperties
in interface ECCommand
value
- This is a TypedProperty
object.public void validateParameters() throws ECException
checkParameters()
method from version 5.1.validateParameters
in interface ECCommand
ECException
public void createCommandExecutionEvent(com.ibm.commerce.command.event.CommandExecutionTrigger trigger) throws ECException
createCommandExecutionEvent
in interface ECCommand
trigger
- This is a command execution trigger.ECException
public java.util.Map getPreInvokeParameters(java.lang.String event)
getPreInvokeParameters
in interface ECCommand
event
- This is the event type.public java.util.Map getPostInvokeParameters(java.lang.String event)
getPostInvokeParameters
in interface ECCommand
event
- This is the event type.public java.util.Map getExceptionInvokeParameters(java.lang.String event)
getExceptionInvokeParameters
in interface ECCommand
event
- This is the event type.