|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.portal.struts.command.StrutsViewCommand
public abstract class StrutsViewCommand
Command pattern class used to provide a mechanism to encapsulate the information needed to redisplay a view. The StrutsViewCommand 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.
Field Summary | |
---|---|
protected static java.lang.String |
CONTENT_TYPE
Request attribute name for the content type. |
protected static MessageResources |
messages
The message resources for the Struts Portlet Framework. |
protected static java.lang.String |
PREFIX
Request attribute name for the prefix. |
Constructor Summary | |
---|---|
StrutsViewCommand()
Default constructor. |
|
StrutsViewCommand(PortletRequest request)
Constructs the StrutsViewCommand 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 object request that needs to be saved if present for the execution of the IViewCommand in Portal's render phase. |
void |
execute(RenderRequest request,
RenderResponse response,
ViewCommandExecutionContext executionContext)
Executes the given command given the request and response objects. |
java.lang.String |
getContentType(PortletRequest request)
Returns the content type associated with this command. |
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 attributes map. |
static IViewCommand |
getSavedCommand(PortletRequest request,
PortletResponse response,
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. |
protected void |
repopulateRequest(RenderRequest 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 restoral as an attribute for when the command is executed. |
protected void |
saveAttribute(PortletRequest request,
java.lang.String name)
Saves the given request attribute for later restoral when the command is executed. |
void |
saveAttributes(PortletRequest request,
ViewCommandExecutionContext context)
Saves attributes from the request by name for later restoral when the command is executed. |
protected void |
saveAttributes(PortletRequest request,
ViewCommandExecutionContext context,
java.util.List namesToSave,
java.util.List typesToSave)
Saves attributes from the request by name for later restoral when the command is executed. |
void |
saveCommand(PortletRequest request,
PortletResponse response)
Saves the current command using the Command Manager Factory. |
void |
saveCommand(PortletRequest request,
PortletResponse response,
java.lang.String commandPrefix)
Saves the current command using the Command Manager Factory. |
void |
setContentType(PortletRequest request)
Sets the content type. |
void |
setContentType(PortletRequest request,
java.lang.String contentType)
Sets the content type associated with this command. |
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 Portal mode changes. |
void |
setSavedAttributes(java.util.Map attributeMap)
Sets the saved attributes map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String CONTENT_TYPE
protected static final java.lang.String PREFIX
protected static MessageResources messages
Constructor Detail |
---|
public StrutsViewCommand()
public StrutsViewCommand(PortletRequest request)
StrutsViewCommand
is typically created in the action phase of Portal, so the interface
expects a PortletRequest.
request
- The request object to save context information fromMethod Detail |
---|
public static void addAttributeNameToSave(java.lang.String attributeName)
attributeName
- the name of the attributepublic static void removeAttributeNameToSave(java.lang.String attributeName)
attributeName
- the name of the attributepublic static void addAttributeTypeToSave(java.lang.Class attributeType)
attributeType
- the attribute typepublic static void removeAttributeTypeToSave(java.lang.Class attributeType)
attributeType
- the attribute typepublic static IViewCommand getSavedCommand(PortletRequest request, PortletResponse response, ViewCommandExecutionContext context) throws PortletException
request
- the portlet request objectresponse
- the portlet response objectcontext
- the view command execution context
PortletException
- if the request cannot fulfilledpublic void saveCommand(PortletRequest request, PortletResponse response) throws PortletException
request
- The request objectresponse
- the response object
PortletException
public void saveCommand(PortletRequest request, PortletResponse response, java.lang.String commandPrefix) throws PortletException
request
- The request objectresponse
- the response objectcommandPrefix
- the prefix to store the command
PortletException
public void setContentType(PortletRequest request)
request
- the portlet request objectprotected void repopulateRequest(RenderRequest request)
request
- The request object to repopulateprotected void saveAttributes(PortletRequest request, ViewCommandExecutionContext context, java.util.List namesToSave, java.util.List typesToSave)
request
- The request object to save attributes fromcontext
- the view command execution contextnamesToSave
- a list of the attribute names to savetypesToSave
- a list of the types to saveprotected void saveAttribute(PortletRequest request, java.lang.String name)
request
- the request object to get attribute fromname
- the name of the attribute to saveprotected void saveAsAttribute(java.lang.String name, java.lang.Object value)
name
- of attribute to savevalue
- the value to storepublic void saveAttributes(PortletRequest request, ViewCommandExecutionContext context)
request
- The request object to save attributes fromcontext
- the view command execution contextpublic java.util.Map getSavedAttributes()
public void setSavedAttributes(java.util.Map attributeMap)
attributeMap
- the map of attributes.public void setRemoveOnModeChange(boolean value)
value
- true will cause this command to get removedpublic boolean getRemoveOnModeChange()
public java.lang.String getPrefix(PortletRequest request)
request
- the request object
public void setPrefix(PortletRequest request, java.lang.String prefix)
request
- the request objectpublic java.lang.String getContentType(PortletRequest request)
request
- the portlet request
public void setContentType(PortletRequest request, java.lang.String contentType)
request
- the portlet requestcontentType
- the content typepublic void execute(RenderRequest request, RenderResponse response, ViewCommandExecutionContext executionContext) throws PortletException
execute
in interface IViewCommand
request
- The request objectrequest
- The response objectexecutionContext
- the execution context objectresponse
- the response object
PortletException
- if the request cannot be fulfilledprotected static void addAttribute(java.lang.Object attribute, java.util.List list)
attribute
- the attribute to add to the listlist
- the array list to updateprotected static void removeAttribute(java.lang.Object attribute, java.util.List list)
attribute
- the attributelist
- the array list to update
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |