Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.wps.portlets.struts
Class WpsStrutsViewCommand

    java.lang.Object
      com.ibm.wps.portlets.struts.WpsStrutsViewCommand

All Implemented Interfaces:
  IViewCommand, java.io.Serializable

Direct Known Subclasses:
  WpsStrutsFilteredViewCommand, WpsStrutsViewActionCommand, WpsStrutsViewErrorCommand, WpsStrutsViewJspCommand

    public abstract class WpsStrutsViewCommand

extends java.lang.Object
implements IViewCommand, java.io.Serializable

The `WpsStrutsViewCommand` class is a command pattern class used to provide a mechanism to encapsulate the information needed to redisplay a view. The WpsStrutsViewCommand is the base class for all commands in the Struts Portlet Framework. The base class provides the methods to save all the attributes that need to be saved with the command, and provides the methods to repopulate the request attributes.

Since:
  4.1
See Also:
  Serialized Form

Field Summary
`protected static java.lang.String` | `LAST_MODIFIED` Request attribute name for the last modified timestamp.
`protected static java.lang.String` | `PREFIX` Request attribute name for the module prefix.

Constructor Summary
`WpsStrutsViewCommand()` Default constructor for the WpsStrutsView command.
`WpsStrutsViewCommand(HttpServletRequest request)` Constructs the WpsStrutsViewCommand object.
`WpsStrutsViewCommand(PortletRequest request)` Constructs the WpsStrutsViewCommand object.

Method Summary
`protected static void` | `addAttribute(java.lang.Object attribute, java.util.List list)` Adds the attribute to the list.
`static void` | `addAttributeNameToSave(java.lang.String attributeName)` Adds the name of an attribute from the object request that needs to be saved if present for the execution of the IViewCommand in Portal's render phase
`static void` | `addAttributeTypeToSave(java.lang.Class attributeType)` Adds the class type of an attribute from the request that needs to be saved if present for the execution of the IViewCommand in ortal's render phase.
`static void` | `addParameterNameToSave(java.lang.String parameterName)` Adds the name of an parameter from the object request that needs to be saved if present for the execution of the IViewCommand in Portal's render phase
`void` | `execute(PortletRequest request, PortletResponse response, ViewCommandExecutionContext executionContext)` Executes the given command given the request and response objects.
`void` | `execute(PortletRequest request, ViewCommandExecutionContext executionContext)` Executes the given command given the request and response objects.
`long` | `getLastModified(PortletRequest request)` Returns the last modified time.
`java.lang.String` | `getPrefix(PortletRequest request)` Returns the prefix associated with this command.
`boolean` | `getRemoveOnModeChange()` Returns the state of removeOnModeChange.
`java.util.Map` | `getSavedAttributes()` Returns the saved attribute map.
`static IViewCommand` | `getSavedCommand(PortletRequest pRequest, ViewCommandExecutionContext context)` Gets the saved command from the Command Manager Factory.
`protected static void` | `removeAttribute(java.lang.Object attribute, java.util.List list)` Removes the attribute from the list.
`static void` | `removeAttributeNameToSave(java.lang.String attributeName)` Removes the name of an attribute from the list of attribute names to save.
`static void` | `removeAttributeTypeToSave(java.lang.Class attributeType)` Removes the class type of the request attribute from the list of attributes to save.
`static void` | `removeParameterNameToSave(java.lang.String parameterName)` Removes the name of an parameter from the list of parameter names to save.
`protected void` | `repopulateRequest(PortletRequest request)` Repopulates the given request from saved values.
`protected void` | `saveAsAttribute(java.lang.String name, java.lang.Object value)` Saves the given named object for later retrieval as an attribute for when the command is executed.
`protected void` | `saveAsParameter(java.lang.String name, java.lang.String value)` Saves the given named object for later retrieval as an parameter for when the command is executed.
`protected void` | `saveAttribute(HttpServletRequest request, java.lang.String name)` Saves the given request attribute for later retrieval when the command is executed.
`void` | `saveAttributes(HttpServletRequest request, ViewCommandExecutionContext context)` Saves attributes from the request by name for later retrieval when the command is executed.
`protected void` | `saveAttributes(HttpServletRequest request, ViewCommandExecutionContext context, java.util.List namesToSave, java.util.List typesToSave)` Saves attributes from the request by name for later retrieval when the command is executed.
`void` | `saveCommand(HttpServletRequest request)` Saves the current command using the Command Manager Factory.
`void` | `saveCommand(HttpServletRequest request, java.lang.String commandPrefix)` Saves the current command using the Command Manager Factory.
`protected void` | `saveParameter(HttpServletRequest request, java.lang.String name)` Saves the given request parameter for later retrieval when the command is executed.
`protected void` | `saveParameters(HttpServletRequest request, ViewCommandExecutionContext context, java.util.List namesToSave)` Saves parameters from the request by name for later retrieval when the command is executed.
`void` | `setLastModified(PortletRequest request, long lastModified)` Sets the last modified time.
`void` | `setPrefix(PortletRequest request, java.lang.String prefix)` Sets the prefix associated with this command.
`void` | `setRemoveOnModeChange(boolean value)` Allows setting a flag so that this command is removed when the user switches modes.
`void` | `setSavedAttributes(java.util.Map attributeMap)` Sets the saved attribute map.

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

Field Detail

### PREFIX

    protected static final java.lang.String PREFIX

  Request attribute name for the module prefix.

  See Also:
    Constant Field Values

### LAST_MODIFIED

    protected static final java.lang.String LAST_MODIFIED

  Request attribute name for the last modified timestamp.

  See Also:
    Constant Field Values

Constructor Detail

### WpsStrutsViewCommand

    public WpsStrutsViewCommand()

  Default constructor for the WpsStrutsView command. If this constructor is used, the setPrefix method must be called to set the module prefix. Commands must save the module prefix so that the correct Struts module config can be set in the render phase of portal.

  Parameters:
    `request` - The request object to save context information from

### WpsStrutsViewCommand

    public WpsStrutsViewCommand(PortletRequest request)

  Constructs the WpsStrutsViewCommand object. The module prefix will be determined from the request object.

  Parameters:
    `request` - The request object to save context information from

### WpsStrutsViewCommand

    public WpsStrutsViewCommand(HttpServletRequest request)

  Constructs the WpsStrutsViewCommand object. The module prefix will be determined from the request object.

  Parameters:
    `request` - The request object to save context information from

Method Detail

### addAttributeNameToSave

    public static void addAttributeNameToSave(java.lang.String attributeName)

  Adds the name of an attribute from the object request that needs to be saved if present for the execution of the IViewCommand in Portal's render phase

  Parameters:
    `attributeName` - the name of the attribute

### removeAttributeNameToSave

    public static void removeAttributeNameToSave(java.lang.String attributeName)

  Removes the name of an attribute from the list of attribute names to save.

  Parameters:
    `attributeName` - the name of the attribute

### addAttributeTypeToSave

    public static void addAttributeTypeToSave(java.lang.Class attributeType)

  Adds the class type of an attribute from the request that needs to be saved if present for the execution of the IViewCommand in ortal's render phase.

  Parameters:
    `attributeType` - the attribute type

### removeAttributeTypeToSave

    public static void removeAttributeTypeToSave(java.lang.Class attributeType)

  Removes the class type of the request attribute from the list of attributes to save.

  Parameters:
    `attributeType` - the attribute type

### addParameterNameToSave

    public static void addParameterNameToSave(java.lang.String parameterName)

  Adds the name of an parameter from the object request that needs to be saved if present for the execution of the IViewCommand in Portal's render phase

  Parameters:
    `parameterName` - the name of the parameter

### removeParameterNameToSave

    public static void removeParameterNameToSave(java.lang.String parameterName)

  Removes the name of an parameter from the list of parameter names to save.

  Parameters:
    `parameterName` - the name of the parameter

### getSavedCommand

    public static IViewCommand getSavedCommand(PortletRequest pRequest,
                                               ViewCommandExecutionContext context)
                                        throws PortletException

  Gets the saved command from the Command Manager Factory.

  Parameters:
    `request` - the portlet request object
    `context` - the view command execution context
  Returns:
    returns the saved IViewCommand command
  Throws:
    `PortletException` - if the request cannot fulfilled

### saveCommand

    public void saveCommand(HttpServletRequest request)
                     throws PortletException

  Saves the current command using the Command Manager Factory.

  Parameters:
    `request` - The request object
  Throws:
    `PortletException`

### saveCommand

    public void saveCommand(HttpServletRequest request,
                            java.lang.String commandPrefix)
                     throws PortletException

  Saves the current command using the Command Manager Factory.

  Parameters:
    `request` - The request object
    `commandPrefix` - the prefix to store the command
  Throws:
    `PortletException` - if the request cannot fulfilled

### repopulateRequest

    protected void repopulateRequest(PortletRequest request)

  Repopulates the given request from saved values. The request attributes that were saved as part of the saveAttributes call are repopulated in the render phase of portal. This method should only be called from this class's execute method.

  Parameters:
    `request` - The request object to repopulate

### execute

    public void execute(PortletRequest request,
                        PortletResponse response,
                        ViewCommandExecutionContext executionContext)
                 throws PortletException

  Executes the given command given the request and response objects. This base implementation must be called by all subclasses. The request attributes are repopulated and the Struts module is selected.

  Specified by:
    `execute` in interface `IViewCommand`
  Parameters:
    `request` - The request object
    `request` - The response object
    `executionContext` - the execution context object
    `response` - The response object
  Throws:
    `PortletException` - if the request cannot fulfilled

### saveAttributes

    protected void saveAttributes(HttpServletRequest request,
                                  ViewCommandExecutionContext context,
                                  java.util.List namesToSave,
                                  java.util.List typesToSave)

  Saves attributes from the request by name for later retrieval when the command is executed. This method is used by subclasses that maintain their own list of attribute names and types to save. This convenience method saves the attributes so that they can be retrieved by the call to repopulateRequest.

  Parameters:
    `request` - The request object to save attributes from
    `context` - the view command execution context
    `namesToSave` - a list of the attribute names to save
    `typesToSave` - a list of the types to save

### saveAttribute

    protected void saveAttribute(HttpServletRequest request,
                                 java.lang.String name)

  Saves the given request attribute for later retrieval when the command is executed.

  Parameters:
    `request` - The request object to get attribute from
    `name` - of attribute to save

### saveAsAttribute

    protected void saveAsAttribute(java.lang.String name,
                                   java.lang.Object value)

  Saves the given named object for later retrieval as an attribute for when the command is executed.

  Parameters:
    `name` - of attribute to save
    `value` - the value to store

### saveParameters

    protected void saveParameters(HttpServletRequest request,
                                  ViewCommandExecutionContext context,
                                  java.util.List namesToSave)

  Saves parameters from the request by name for later retrieval when the command is executed. This method is used by subclasses that maintain their own list of parameters names to save. This convenience method saves the parameters so that they can be retrieved by the call to repopulateRequest.

  Parameters:
    `request` - The request object to save parameters from
    `context` - the view command execution context
    `namesToSave` - a list of the attribute names to save

### saveParameter

    protected void saveParameter(HttpServletRequest request,
                                 java.lang.String name)

  Saves the given request parameter for later retrieval when the command is executed.

  Parameters:
    `request` - The request object to get parameter from
    `name` - of parameter to save

### saveAsParameter

    protected void saveAsParameter(java.lang.String name,
                                   java.lang.String value)

  Saves the given named object for later retrieval as an parameter for when the command is executed.

  Parameters:
    `name` - of parameter to save
    `value` - the value to store

### saveAttributes

    public void saveAttributes(HttpServletRequest request,
                               ViewCommandExecutionContext context)

  Saves attributes from the request by name for later retrieval when the command is executed.

  Parameters:
    `request` - The request object to save attributes from
    `context` - the view command execution context

### getSavedAttributes

    public java.util.Map getSavedAttributes()

  Returns the saved attribute map. Should call saveAttributes before calling this method.

  Returns:
    returns the saved attributes.

### setSavedAttributes

    public void setSavedAttributes(java.util.Map attributeMap)

  Sets the saved attribute map. Can set the attributes before execute is called which will repopulate the request object with the saved attributes.

  Parameters:
    `attributeMap` - the map of attributes.

### setRemoveOnModeChange

    public void setRemoveOnModeChange(boolean value)

  Allows setting a flag so that this command is removed when the user switches modes.

  Parameters:
    `value` - true will cause this command to get removed

### getRemoveOnModeChange

    public boolean getRemoveOnModeChange()

  Returns the state of removeOnModeChange.

  Returns:
    returns true if commnad should be removed on mode change.

### getPrefix

    public java.lang.String getPrefix(PortletRequest request)

  Returns the prefix associated with this command.

  Returns:
    returns the prefix

### setPrefix

    public void setPrefix(PortletRequest request,
                          java.lang.String prefix)

  Sets the prefix associated with this command.

### execute

    public void execute(PortletRequest request,
                        ViewCommandExecutionContext executionContext)
                 throws PortletException

  Executes the given command given the request and response objects. This implementation should be called by all subclasses.

  Parameters:
    `request` - The request object
    `request` - The response object
    `executionContext` - the execution context object
  Throws:
    `PortletException` - if the request cannot fulfilled

### addAttribute

    protected static void addAttribute(java.lang.Object attribute,
                                       java.util.List list)

  Adds the attribute to the list. Caller is assumed to have synchronized the list.

  Parameters:
    `attribute` - the attribute to add to the list
    `list` - the array list to update

### removeAttribute

    protected static void removeAttribute(java.lang.Object attribute,
                                          java.util.List list)

  Removes the attribute from the list. Caller is assumed to have synchronized the list.

  Parameters:
    `attribute` - the attribute
    `list` - the array list to update

### getLastModified

    public long getLastModified(PortletRequest request)

  Returns the last modified time.

  Parameters:
    `request` - the request object
  Returns:
    returns the last modified time

### setLastModified

    public void setLastModified(PortletRequest request,
                                long lastModified)

  Sets the last modified time.

  Parameters:
    `request` - the request object
    `lastModified` - the last modified time

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD