com.ibm.commerce.command
Class AbstractViewCommand

java.lang.Object
  |
  +--com.ibm.commerce.command.AbstractECCommand
        |
        +--com.ibm.commerce.command.AbstractViewCommand
All Implemented Interfaces:
AccCommand, ECCommand, Protectable, ViewCommand
Direct Known Subclasses:
AbstractDirectViewCommand, AbstractForwardViewCommand, AbstractIndirectViewCommand, AbstractRedirectViewCommand, RedirectViewCommandImpl

public abstract class AbstractViewCommand
extends AbstractECCommand
implements ViewCommand

The abstract base implementation of a view command. All view commands should extend from this class.


Field Summary
protected  TypedProperty requestProperties
           
protected  TypedProperty responseProperties
           
 
Fields inherited from class com.ibm.commerce.command.AbstractECCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.command.ViewCommand
COPYRIGHT
 
Fields inherited from interface com.ibm.commerce.command.ECCommand
defaultCommandClassName
 
Constructor Summary
AbstractViewCommand()
          AbstractViewCommand constructor.
 
Method Summary
 boolean fulfills(java.lang.Long member, java.lang.String relationship)
          Determines if a given member fulfills a given relationship with the resource.
 java.lang.Long getForUserId()
          Gets the user Id if command is to be executed by on behalf of a customer This method is for internal use only.
 java.lang.Long getOwner()
          Returns the owner of the protectable resource.
 TypedProperty getRequestProperties()
          Gets the request properties to this view command.
 java.lang.Long[] getResourceOwners()
          This method returns all the organization unit that owns the resources accessed by this command.It will return null if no resource is being accessed by this command.
 TypedProperty getResponseProperties()
          Returns the response properties returned by this view command.
 java.lang.String getViewName()
          Gets the view task name for this view command.
 TypedProperty mergeProperties(TypedProperty reqProp, TypedProperty resProp)
          The method merges 3 sets of properties passed to this view command: the resquest properties, the response properties and the default properties set in the VIEWREG For the default behaviour, this method first merges the request properties to the response properties.
abstract  void performExecute()
          The business logic for this view command
 void setForUserId(java.lang.Long value)
          Sets the forUserId for a customer agent command.
 void setOwner(java.lang.Long value)
          Sets the owner for this command.
 void setRequestProperties(TypedProperty viewParm)
          Sets request properties for for view command.
protected  void setResponseProperties(TypedProperty responseParm)
          Sets response properties for for view command.
 void setViewName(java.lang.String value)
          Sets the view task name for this view command.
 
Methods inherited from class com.ibm.commerce.command.AbstractECCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties, validateParameters
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, setAccCheck
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, execute, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties, validateParameters
 

Field Detail

requestProperties

protected TypedProperty requestProperties

responseProperties

protected TypedProperty responseProperties
Constructor Detail

AbstractViewCommand

public AbstractViewCommand()
AbstractViewCommand constructor.
Method Detail

fulfills

public boolean fulfills(java.lang.Long member,
                        java.lang.String relationship)
                 throws java.rmi.RemoteException,
                        java.lang.Exception
Determines if a given member fulfills a given relationship with the resource.
Specified by:
fulfills in interface Protectable
Parameters:
member - Member id of the member
relationship - The relationship the member has with respect to the resource
Returns:
true if the member fulfills the relationship with the resource

getForUserId

public java.lang.Long getForUserId()
Gets the user Id if command is to be executed by on behalf of a customer This method is for internal use only.

Specified by:
getForUserId in interface AccCommand
Returns:
(java.lang.Long) The for user Id.

getOwner

public java.lang.Long getOwner()
                        throws java.rmi.RemoteException,
                               java.lang.Exception
Returns the owner of the protectable resource. This method is part of the Protectable interface. This is required for command level access control where the command is the protectable resource.

Specified by:
getOwner in interface Protectable
Returns:
java.lang.Long
Throws:
java.rmi.RemoteException. -  
Exception. -  

getRequestProperties

public TypedProperty getRequestProperties()
Gets the request properties to this view command.
Specified by:
getRequestProperties in interface ViewCommand
Returns:
TypedProperties

getResourceOwners

public java.lang.Long[] getResourceOwners()
                                   throws ECException
This method returns all the organization unit that owns the resources accessed by this command.It will return null if no resource is being accessed by this command. This method was used in 5.1 for command level access control check. It is no longer required. It is kept for backward compatibility. The default implementation returns null.

Specified by:
getResourceOwners in interface AccCommand
Returns:
Long[] - an array of all organization unit reference numbers a site owner is representated by an organization unit value of -1

getResponseProperties

public TypedProperty getResponseProperties()
Returns the response properties returned by this view command. It is part of the command interface. This method will not be called for view commands.
Specified by:
getResponseProperties in interface ViewCommand
Returns:
TypedProperties

getViewName

public final java.lang.String getViewName()
Gets the view task name for this view command. This is an internal method used by the command framework.
Specified by:
getViewName in interface ViewCommand
Returns:
String - view name

mergeProperties

public TypedProperty mergeProperties(TypedProperty reqProp,
                                     TypedProperty resProp)
The method merges 3 sets of properties passed to this view command: the resquest properties, the response properties and the default properties set in the VIEWREG For the default behaviour, this method first merges the request properties to the response properties. and them merge the defaultProperties to the response properties. Priority is given to the response properties, the default properties in the VIEWREG has the lowest priority. For performance reasons, the original response properties object passed to this command will not be preserved but will contain the merged data. * Individual view command can overwrite this method if they need a different merging policy
Specified by:
mergeProperties in interface ViewCommand
Parameters:
reqProp - com.ibm.commerce.datatype.TypedProperty - this is the request properties passed to the controller command
resProp - com.ibm.commerce.datatype.TypedProperty - this is the response properties returned by the controller command
Returns:
com.ibm.commerce.datatype.TypedProperty - the merged properties to be used as input to this view command

performExecute

public abstract void performExecute()
                             throws ECException
The business logic for this view command
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

setForUserId

public void setForUserId(java.lang.Long value)
Sets the forUserId for a customer agent command.
Specified by:
setForUserId in interface AccCommand
Parameters:
value - Long - userID

setOwner

public void setOwner(java.lang.Long value)
Sets the owner for this command.

Specified by:
setOwner in interface AccCommand
Parameters:
owner - java.lang.Long

setRequestProperties

public void setRequestProperties(TypedProperty viewParm)
                          throws ECApplicationException
Sets request properties for for view command.
Specified by:
setRequestProperties in interface ViewCommand
Parameters:
viewParm - TypedProperties

setResponseProperties

protected void setResponseProperties(TypedProperty responseParm)
                              throws ECApplicationException
Sets response properties for for view command.
Parameters:
viewParm - TypedProperties

setViewName

public final void setViewName(java.lang.String value)
Sets the view task name for this view command. This is an internal method used by the command framework.
Specified by:
setViewName in interface ViewCommand
Parameters:
value - String - view name