public abstract class RhnAction
extends org.apache.struts.action.Action
NOTE: RhnSetAction and RhnAction contain two duplicate methods -
getStrutsDelegate()
and createSuccessMessage()
. If another
method is added to these classes that is common to both we need to refactor the common
methods into a new class maybe called RhnActionDelegate
.
We cannot introduce a common base class because RhnSetAction and RhnAction fall into different inheritance hierarchies.
RhnSetAction
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SUBMITTED |
Constructor and Description |
---|
RhnAction() |
Modifier and Type | Method and Description |
---|---|
protected void |
addGlobalMessage(org.apache.struts.action.ActionMessages messages,
java.lang.String key)
Add a message to the set of ActionMessages.
|
protected void |
addGlobalMessage(org.apache.struts.action.ActionMessages messages,
java.lang.String key,
java.lang.String param0)
Add a message to the set of ActionMessages.
|
protected void |
addMessage(javax.servlet.http.HttpServletRequest req,
java.lang.String msgKey)
Add a success message to the request.
|
protected void |
createErrorMessage(javax.servlet.http.HttpServletRequest req,
java.lang.String beanKey,
java.lang.String param)
Add an error message to the request with 1 parameter:
Your System55 has NOT been updated
where System55 is the value placed in param.
|
protected void |
createErrorMessageWithMultipleArgs(javax.servlet.http.HttpServletRequest req,
java.lang.String beanKey,
java.lang.String[] args)
Add an error message to the request with argument array
|
protected java.util.List |
createLabelValueList(java.util.Iterator i,
java.lang.String nameMethod,
java.lang.String valueMethod)
Util method to use some reflection to invoke a method on a Iterator's
items to produce a List of LabelValue beans
|
protected void |
createMessage(javax.servlet.http.HttpServletRequest req,
java.lang.String msgKey,
java.lang.String[] params)
Add a success message to the request with any parameters.
|
protected void |
createSuccessMessage(javax.servlet.http.HttpServletRequest req,
java.lang.String msgKey,
java.lang.String param1)
Add a success message to the request with 1 parameter:
Your System55 has been updated
where System55 is the value placed in param1.
|
protected StrutsDelegate |
getStrutsDelegate()
Returns a StrutsDelegate object.
|
protected boolean |
isSubmitted(org.apache.struts.action.DynaActionForm form)
Simple util to check if the Form was submitted
|
protected java.lang.String |
l10n(java.lang.String key)
Take a key and return a localized (l10n) String
|
protected void |
localize(java.util.Collection lvList) |
protected static org.apache.struts.util.LabelValueBean |
lv(java.lang.String label,
java.lang.String value)
Construct a LabelValueBean with specified label and value
|
protected static LabelValueEnabledBean |
lve(java.lang.String label,
java.lang.String value,
boolean disabled)
Construct a LabelValueEnabledBean instance where the label is localized
using the LocalizationService.getMessage() method.
|
protected static LabelValueEnabledBean |
lvel10n(java.lang.String label,
java.lang.String value,
boolean disabled)
Construct a LabelValueEnabledBean instance where the label is localized
using the LocalizationService.getMessage() method.
|
protected static org.apache.struts.util.LabelValueBean |
lvl10n(java.lang.String label,
java.lang.String value)
Construct a LabelValueBean instance where the label is localized
using the LocalizationService.getMessage() method.
|
protected java.util.Map |
makeParamMap(javax.servlet.http.HttpServletRequest request)
Default param map for our actions.
|
void |
saveMessages(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionMessages messages) |
addErrors, addMessages, execute, execute, generateToken, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveToken, setLocale, setServlet
public static final java.lang.String SUBMITTED
protected StrutsDelegate getStrutsDelegate()
StrutsDelegate
protected java.util.List createLabelValueList(java.util.Iterator i, java.lang.String nameMethod, java.lang.String valueMethod)
i
- Iterator that contains the items you want to convert into label value beannameMethod
- to call on each object, something like 'Channel.getName()'. Must
return a String or will throw ClassCastExceptionvalueMethod
- method to call on each object to retrieve the desired value.protected static org.apache.struts.util.LabelValueBean lv(java.lang.String label, java.lang.String value)
label
- to usevalue
- value of selectionprotected static org.apache.struts.util.LabelValueBean lvl10n(java.lang.String label, java.lang.String value)
label
- to localizevalue
- value of selectionprotected static LabelValueEnabledBean lve(java.lang.String label, java.lang.String value, boolean disabled)
label
- to localizevalue
- value of selectiondisabled
- true if the bean renderer
should render as disabled, false otherwiseprotected static LabelValueEnabledBean lvel10n(java.lang.String label, java.lang.String value, boolean disabled)
label
- to localizevalue
- value of selectiondisabled
- true if the bean renderer
should render as disabled, false otherwisepublic void saveMessages(javax.servlet.http.HttpServletRequest request, org.apache.struts.action.ActionMessages messages)
saveMessages
in class org.apache.struts.action.Action
protected void createSuccessMessage(javax.servlet.http.HttpServletRequest req, java.lang.String msgKey, java.lang.String param1)
req
- to add the message tomsgKey
- resource key to lookupparam1
- String value to fill in for the first parameter.
(param1 is HTML escaped as well)protected void createMessage(javax.servlet.http.HttpServletRequest req, java.lang.String msgKey, java.lang.String[] params)
req
- to add the message tomsgKey
- resource key to lookupparams
- String values to fill inprotected void addMessage(javax.servlet.http.HttpServletRequest req, java.lang.String msgKey)
req
- to add the message tomsgKey
- resource key to lookupprotected void createErrorMessage(javax.servlet.http.HttpServletRequest req, java.lang.String beanKey, java.lang.String param)
req
- to add the message tobeanKey
- resource key to lookupparam
- String value to fill in for the first parameter.
(param is HTML escaped as well)protected void createErrorMessageWithMultipleArgs(javax.servlet.http.HttpServletRequest req, java.lang.String beanKey, java.lang.String[] args)
req
- to add the message tobeanKey
- resource key to lookupargs
- String array to fill in for the message parametersprotected void addGlobalMessage(org.apache.struts.action.ActionMessages messages, java.lang.String key)
messages
- set of ActionMessages we want to add an additional
ActionMessage to.key
- to the resource bundle that we want to fetch
the message from.protected void addGlobalMessage(org.apache.struts.action.ActionMessages messages, java.lang.String key, java.lang.String param0)
messages
- set of ActionMessages we want to add an additional
ActionMessage to.key
- to the resource bundle that we want to fetch
the message from.param0
- the first parameter to be substituted into the messageprotected boolean isSubmitted(org.apache.struts.action.DynaActionForm form)
form
- to checkprotected void localize(java.util.Collection lvList)
protected java.util.Map makeParamMap(javax.servlet.http.HttpServletRequest request)
request
- The request containing the params we wantprotected java.lang.String l10n(java.lang.String key)
key
- to lookup