Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.action
Class JiveActionSupport

java.lang.Object
  extended by com.opensymphony.xwork.ActionSupport
      extended by com.jivesoftware.base.action.JiveActionSupport
All Implemented Interfaces:
AuthTokenAware, UserAware, com.opensymphony.webwork.interceptor.ServletRequestAware, com.opensymphony.webwork.interceptor.ServletResponseAware, com.opensymphony.xwork.Action, com.opensymphony.xwork.LocaleProvider, com.opensymphony.xwork.TextProvider, com.opensymphony.xwork.Validateable, com.opensymphony.xwork.ValidationAware, com.uwyn.rife.continuations.ContinuableObject, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
ForumActionSupport, LogoutAction

public abstract class JiveActionSupport
extends com.opensymphony.xwork.ActionSupport
implements AuthTokenAware, UserAware, com.opensymphony.webwork.interceptor.ServletRequestAware, com.opensymphony.webwork.interceptor.ServletResponseAware

A base action class that handles a set of common Jive code. This class extends the WebWork ActionSupport class which provides a lot of handy WebWork utilities.

This method has been declared abstract so it cannot be used directly. Action writers should extend the product-specific extension of this class, ie: ForumActionSupport (for Jive Forums) or KbActionSupport (for Jive Knowledge Base).

See Also:
Serialized Form

Field Summary
static java.lang.String CANCEL
          An action return type that indicates the user wants to cancel the current process.
static java.lang.String DISABLED
          An action return type that indicates the requested resource is disabled
static java.lang.String FATAL
          An action return type that indicates execution of the action suffered a fatal exception.
static java.lang.String NOTFOUND
          An action return type that indicates the requested resource was not found.
protected  User pageUser
           
protected  javax.servlet.http.HttpServletRequest request
           
protected  javax.servlet.http.HttpServletResponse response
           
static java.lang.String UNAUTHORIZED
          An action return type that indicates the user is not authorized to what they requested.
 
Fields inherited from class com.opensymphony.xwork.ActionSupport
LOG
 
Fields inherited from interface com.opensymphony.xwork.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
JiveActionSupport()
           
 
Method Summary
 java.lang.String execute()
           
 AuthToken getAuthToken()
           
protected  java.lang.String getGuestProperty(java.lang.String name)
          Returns a guest property.
 java.lang.String getJiveProperty(java.lang.String propName)
          Convenience method for looking up a jive property.
 java.util.List getLocales()
          Returns a list of available locales as a sorted list of Locale objects.
 java.lang.String getPageURL()
          Returns the URL of the current page as a string.
abstract  User getPageUser()
          Returns the current page user's User object, or null if the user is a guest.
 java.util.Map getSession()
          Convenience method to gain access to the session object
 java.lang.String getText(java.lang.String key)
          Override the ActionSupport getText(..) so that MessageFormat class is not used when i18n entries do not have parameters, e.g.
 java.lang.String getText(java.lang.String key, java.lang.String defaultValue, java.util.List args, com.opensymphony.xwork.util.OgnlValueStack stack)
          Override the ActionSupport getText(..) so that MessageFormat is not used when i18n entries do not have parameters, e.g.
 java.util.TimeZone getTimeZone()
          Returns the page user's time zone.
 java.lang.String[][] getTimeZones()
          Returns a list of time zones as a double String array.
protected  boolean isFailedLookup(java.lang.String name)
          Lookup cache - this should be used if you want to note and remember a lookup on a field.
 boolean isGuest()
          Returns true if the page user is a guest or false if they're logged in.
 void setAuthToken(AuthToken authToken)
           
protected  void setGuestProperty(java.lang.String name, java.lang.String value)
          Sets a guest cookie.
 void setLoginAttributes()
          Sets the attributes required for login.
protected  void setPageUser(User pageUser)
          Sets the page user to be used.
 void setServletRequest(javax.servlet.http.HttpServletRequest request)
           
 void setServletResponse(javax.servlet.http.HttpServletResponse response)
           
 void setUser(User user)
           
 
Methods inherited from class com.opensymphony.xwork.ActionSupport
addActionError, addActionMessage, addFieldError, clearErrorsAndMessages, clone, doDefault, doInput, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getLocale, getText, getText, getText, getText, getText, getText, getText, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, pause, setActionErrors, setActionMessages, setFieldErrors, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FATAL

public static final java.lang.String FATAL
An action return type that indicates execution of the action suffered a fatal exception.

See Also:
Constant Field Values

CANCEL

public static final java.lang.String CANCEL
An action return type that indicates the user wants to cancel the current process.

See Also:
Constant Field Values

UNAUTHORIZED

public static final java.lang.String UNAUTHORIZED
An action return type that indicates the user is not authorized to what they requested. This is finer-grained than Action.LOGIN since the workflow in this case can be more specific to the error (ie, the user is presented with "Sorry, you don't have access to ..." instead of just pushing them to the login screen.

See Also:
Constant Field Values

NOTFOUND

public static final java.lang.String NOTFOUND
An action return type that indicates the requested resource was not found.

See Also:
Constant Field Values

DISABLED

public static final java.lang.String DISABLED
An action return type that indicates the requested resource is disabled

See Also:
Constant Field Values

pageUser

protected User pageUser

request

protected javax.servlet.http.HttpServletRequest request

response

protected javax.servlet.http.HttpServletResponse response
Constructor Detail

JiveActionSupport

public JiveActionSupport()
Method Detail

getPageUser

public abstract User getPageUser()
Returns the current page user's User object, or null if the user is a guest.

This method has been declared abstract because subclasses will need to load the page user from a product-specific factory (ie, ForumFactory or KbFactory) in order to get the correct permissions set on it.

Returns:
the current page user's User object.
See Also:
User

setPageUser

protected void setPageUser(User pageUser)
Sets the page user to be used. The page user is the user currently interacting with the Jive system. This method is only intended for base classes that wish to set the pageUser.

Parameters:
pageUser - sets the page user to use.

setUser

public void setUser(User user)
Specified by:
setUser in interface UserAware

setAuthToken

public void setAuthToken(AuthToken authToken)
Specified by:
setAuthToken in interface AuthTokenAware

getAuthToken

public AuthToken getAuthToken()

isGuest

public boolean isGuest()
Returns true if the page user is a guest or false if they're logged in.

Returns:
true if the page user is a guest, false otherwise.

getSession

public java.util.Map getSession()
Convenience method to gain access to the session object


getJiveProperty

public java.lang.String getJiveProperty(java.lang.String propName)
Convenience method for looking up a jive property.

Parameters:
propName - the property to lookup
Returns:
the value of the property

getLocales

public java.util.List getLocales()
Returns a list of available locales as a sorted list of Locale objects. The sorting is based upon the locales' display name.

Returns:
a list of available locales.

getTimeZone

public java.util.TimeZone getTimeZone()
Returns the page user's time zone.

Returns:
the page user's time zone.
See Also:
LocaleUtils.getTimeZone(javax.servlet.http.HttpServletRequest, User)

getTimeZones

public java.lang.String[][] getTimeZones()
Returns a list of time zones as a double String array. The first element is a unique time zone ID and the second is a human-readable version of the time zone.

Returns:
a list of available time zones.

isFailedLookup

protected boolean isFailedLookup(java.lang.String name)
Lookup cache - this should be used if you want to note and remember a lookup on a field. For example, say you have a field "username" which is initially null. The getter method, getUsername() will check if the username is null and if so, look it up (possibly expensive) and then if it's found save it to the username variable. If the lookup fails username will still be null. Because we check for null each time the lookup will fail each time - noting the failed lookup in this cache helps you remember a failed lookup.

Parameters:
name - The name to check for in the failed lookup cache
Returns:
true if the lookup for "name" failed, false otherwise.

getGuestProperty

protected java.lang.String getGuestProperty(java.lang.String name)
Returns a guest property. This abstracts all the code of getting cookies, retrieving values, etc.

Parameters:
name - the name of the property to retieve.
Returns:
the property value or null if the property is not found.

setGuestProperty

protected void setGuestProperty(java.lang.String name,
                                java.lang.String value)
Sets a guest cookie. This handles all the logic of setting a cookie.

Parameters:
name - the name of the property to set.
value - the property value.

getPageURL

public java.lang.String getPageURL()
Returns the URL of the current page as a string. This only returns the url and it's get parameters, not all the parameters of the action.

Returns:
the URL of the current page

setLoginAttributes

public void setLoginAttributes()
Sets the attributes required for login. This will set the success view to the current page url and the cancel view to the referer if it's available or "index.jsp" if not.


execute

public java.lang.String execute()
                         throws java.lang.Exception
Specified by:
execute in interface com.opensymphony.xwork.Action
Overrides:
execute in class com.opensymphony.xwork.ActionSupport
Throws:
java.lang.Exception

setServletRequest

public void setServletRequest(javax.servlet.http.HttpServletRequest request)
Specified by:
setServletRequest in interface com.opensymphony.webwork.interceptor.ServletRequestAware

setServletResponse

public void setServletResponse(javax.servlet.http.HttpServletResponse response)
Specified by:
setServletResponse in interface com.opensymphony.webwork.interceptor.ServletResponseAware

getText

public java.lang.String getText(java.lang.String key)
Override the ActionSupport getText(..) so that MessageFormat class is not used when i18n entries do not have parameters, e.g. {param}. Calling MessageFormat for all i18n entries enforces that all apostrophe's need to be escaped with another apostrophe. See ActionSupport.getText(String).

Specified by:
getText in interface com.opensymphony.xwork.TextProvider
Overrides:
getText in class com.opensymphony.xwork.ActionSupport

getText

public java.lang.String getText(java.lang.String key,
                                java.lang.String defaultValue,
                                java.util.List args,
                                com.opensymphony.xwork.util.OgnlValueStack stack)
Override the ActionSupport getText(..) so that MessageFormat is not used when i18n entries do not have parameters, e.g. {param}. Calling MessageFormat for all i18n entries enforces that all apostrophe's need to be escaped with another apostrophe. See ActionSupport.getText(String, String, java.util.List, com.opensymphony.xwork.util.OgnlValueStack).

Specified by:
getText in interface com.opensymphony.xwork.TextProvider
Overrides:
getText in class com.opensymphony.xwork.ActionSupport

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.