Clearspace API (2.5.22) Core Javadocs

com.jivesoftware.community.action
Class JiveActionSupport

java.lang.Object
  extended by com.opensymphony.xwork2.ActionSupport
      extended by com.jivesoftware.community.action.JiveActionSupport
All Implemented Interfaces:
com.opensymphony.xwork2.Action, com.opensymphony.xwork2.interceptor.ParameterNameAware, com.opensymphony.xwork2.LocaleProvider, com.opensymphony.xwork2.TextProvider, com.opensymphony.xwork2.Validateable, com.opensymphony.xwork2.ValidationAware, Serializable, org.apache.struts2.interceptor.ServletRequestAware, org.apache.struts2.interceptor.ServletResponseAware, org.apache.struts2.interceptor.SessionAware

public class JiveActionSupport
extends com.opensymphony.xwork2.ActionSupport
implements org.apache.struts2.interceptor.SessionAware, org.apache.struts2.interceptor.ServletRequestAware, org.apache.struts2.interceptor.ServletResponseAware, com.opensymphony.xwork2.interceptor.ParameterNameAware

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.

See Also:
Serialized Form

Field Summary
protected  AuthenticationProvider authProvider
           
protected  BanManager banManager
           
static String CANCEL
          An action return type that indicates the user wants to cancel the current process.
static String DISABLED
          An action return type that indicates that a given feature has been disabled and is not available to the end user.
protected  WikiConversionAction dwrWikiConversionBean
           
protected  JiveObjectLoader jiveObjectLoader
           
static String NOTFOUND
          An action return type that indicates that the resource being requested doesn't exist.
protected  ProjectManager projectManager
           
protected  RegistrationManager registrationManager
           
protected  HttpServletRequest request
           
protected  HttpServletResponse response
           
protected  Map<String,Object> session
           
protected static String SESSION_REFERRER_KEY
           
protected  SocialGroupManager socialGroupManager
           
static String UNAUTHENTICATED
          Action return indicating that an authentication failure has prevented the user from proceeding.
static String UNAUTHORIZED
          An action return type that indicates the user is not authorized to what they requested.
protected  UserManager userManager
           
protected  UserRelationshipManager userRelationshipManager
           
 
Fields inherited from class com.opensymphony.xwork2.ActionSupport
LOG
 
Fields inherited from interface com.opensymphony.xwork2.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
JiveActionSupport()
           
 
Method Summary
 boolean acceptableParameterName(String parameterName)
          [CSSEC-38] Do not allow parameters that could access methods, such as ?
static void addI18nEditionKeys(Map<String,String> newKeys)
          Allows additional i18n edition keys to be added after initialization (eg. when the chat plugin is loaded).
 String cancel()
           
 String convertToWikiSyntax(JiveContentObject object)
           
 String execute()
           
protected  void filterDocument(Document doc)
           
 String getActionMappingName()
          Returns the current struts context's action mapping name as defined in the struts configuration file.
 IMService getAIMIMService()
           
 AuthenticationProvider getAuthenticationProvider()
           
 AuthToken getAuthToken()
           
 String getCalendarFileName()
          Returns the name of the localized javascript filename for the current locale for use within the datetime picker.
 String getCalendarOverrideFormat()
          Returns the name of the localized javascript override filename for the current locale for use within the datetime picker.
 boolean getCanCreateSocialGroup()
           
static String getDefaultBaseURL()
          Returns the base URL of this Jive installation - usually:

http://[yoursite]/[webapp-path]

This uses the Jive property of jiveURL which is settable through the config file or admin console.

 RenderManager getGlobalRenderManager()
           
protected  String getGuestProperty(String name)
          Returns a guest property.
 JiveImageUrlBuilder getImageUrlBuilder()
           
 JiveContext getJiveContext()
           
 JiveLinkBuilder getJiveLinkBuilder()
           
 JiveObjectLoader getJiveObjectLoader()
           
 List<Locale> getLocales()
          Returns a list of available locales as a sorted list of Locale objects.
 String getPageURL()
          Returns the URL of the current page as a string.
 String getPreferredEditorMode()
           
 org.xmpp.packet.Presence getPresence(User user)
           
protected static int getRecentContentMapSize()
           
 HttpServletRequest getRequest()
           
 HttpServletResponse getResponse()
           
 Map<String,Object> getSession()
           
 String getText(String key)
          Override the getText(..) in ActionSupport so that we can intercept keys that are specific to either the internal or external editions of Clearspace.
 String getText(String key, List args)
           
 String getText(String aTextName, String defaultValue)
           
 String getText(String key, String[] args)
           
 String getText(String key, String defaultValue, List args)
           
 String getText(String key, String defaultValue, List args, com.opensymphony.xwork2.util.ValueStack stack)
          Override the getText(..) in ActionSupport so that we can intercept keys that are specific to either the internal or external editions of Clearspace.
 String getText(String aTextName, String defaultValue, String obj)
           
 String getText(String key, String defaultValue, String[] args)
           
 String getText(String key, String defaultValue, String[] args, com.opensymphony.xwork2.util.OgnlValueStack stack)
           
 ResourceBundle getTexts()
           
 ResourceBundle getTexts(String aBundleName)
           
 TimeZone getTimeZone()
          Returns the page user's time zone.
 String[][] getTimeZones()
          Returns a list of time zones as a double String array.
 User getUser()
          NOTE: DO NOT call this method from a DWR-called method.
 Iterator<SocialGroup> getUserGroups()
           
 Iterator<Project> getUserTrackedProjects()
           
 WidgetContext getWidgetContext()
           
 IMService getXMPPIMService()
           
 String input()
           
 boolean isChatAvailable()
          Indicates whether chat plugin is installed and therefore chat functionality is available.
protected  boolean isFailedLookup(String name)
          Lookup cache - this should be used if you want to note and remember a lookup on a field.
 boolean isFriendingEnabled()
           
 boolean isFriendingReflexive()
           
 boolean isGuest()
          Returns true if the page user is a guest or false if they're logged in.
 boolean isNewAccountCreationEnabled()
           
 boolean isOrgChartingEnabled()
           
 boolean isProjectsEnabled()
           
 boolean isReadTrackingEnabled()
          Returns true if read tracking is enabled across the system.
 boolean isSocialGroupsEnabled()
           
 boolean isWatchable()
          Returns true if there is a logged in user and watches are enabled.
protected  boolean isWikiContentEmpty(String body)
           
 JiveContainer loadJiveContainer(int objectType, long objectID)
           
 List<ContentTag> loadTagList(String tags)
          Retuns a List of ContentTag objects from the given space or + delimited list of tags.
 String renderSubjectToHtml(JiveContentObject object)
           
 String renderSubjectToText(JiveContentObject object)
           
 String renderTagToHtml(ContentTag tag)
           
 String renderTagToHtml(String tag)
           
 String renderToHtml(JiveContentObject object)
           
 String renderToHtml(JiveContentObject object, int size)
           
 String renderToText(JiveContentObject object)
           
 void setAuthenticationProvider(AuthenticationProvider ap)
           
 void setAuthToken(AuthToken token)
          Deprecated. 
 void setBanManager(BanManager banManager)
           
 void setDwrWikiConversionBean(WikiConversionAction dwrWikiConversionBean)
           
 void setGlobalRenderManager(RenderManager globalRenderManager)
           
protected  void setGuestProperty(String name, String value)
          Sets a guest cookie.
 void setImageUrlBuilder(JiveImageUrlBuilder imageUrlBuilder)
           
 void setJiveContext(JiveContext jiveContext)
           
 void setJiveLinkBuilder(JiveLinkBuilder jiveLinkBuilder)
           
 void setJiveObjectLoader(JiveObjectLoader jiveObjectLoader)
           
 void setProjectManager(ProjectManager projectManager)
           
 void setRegistrationManager(RegistrationManager registrationManager)
           
 void setServletRequest(HttpServletRequest request)
           
 void setServletResponse(HttpServletResponse response)
           
 void setSession(Map session)
           
 void setSocialGroupManager(SocialGroupManager socialGroupManager)
           
 void setUserManager(UserManager userManager)
           
 void setUserRelationshipManager(UserRelationshipManager userRelationshipManager)
           
 String toHTMLEditorString(JiveContentObject object, Document d)
           
 String toRTEString(JiveContentObject object, Document d)
           
 Document unknownContentToJiveDoc(String rawText, JiveObject contentObject)
           
 
Methods inherited from class com.opensymphony.xwork2.ActionSupport
addActionError, addActionMessage, addFieldError, clearErrorsAndMessages, clone, doDefault, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getLocale, getText, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, pause, setActionErrors, setActionMessages, setFieldErrors, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userManager

protected UserManager userManager

projectManager

protected ProjectManager projectManager

socialGroupManager

protected SocialGroupManager socialGroupManager

userRelationshipManager

protected UserRelationshipManager userRelationshipManager

registrationManager

protected RegistrationManager registrationManager

CANCEL

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

See Also:
Constant Field Values

NOTFOUND

public static final String NOTFOUND
An action return type that indicates that the resource being requested doesn't exist.

See Also:
Constant Field Values

UNAUTHORIZED

public static final 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

DISABLED

public static final String DISABLED
An action return type that indicates that a given feature has been disabled and is not available to the end user.

See Also:
Constant Field Values

UNAUTHENTICATED

public static final String UNAUTHENTICATED
Action return indicating that an authentication failure has prevented the user from proceeding.

See Also:
Constant Field Values

SESSION_REFERRER_KEY

protected static final String SESSION_REFERRER_KEY
See Also:
Constant Field Values

session

protected Map<String,Object> session

request

protected HttpServletRequest request

response

protected HttpServletResponse response

authProvider

protected AuthenticationProvider authProvider

dwrWikiConversionBean

protected WikiConversionAction dwrWikiConversionBean

banManager

protected BanManager banManager

jiveObjectLoader

protected JiveObjectLoader jiveObjectLoader
Constructor Detail

JiveActionSupport

public JiveActionSupport()
Method Detail

setBanManager

public void setBanManager(BanManager banManager)

getJiveObjectLoader

public JiveObjectLoader getJiveObjectLoader()

setJiveObjectLoader

public final void setJiveObjectLoader(JiveObjectLoader jiveObjectLoader)

setJiveContext

public final void setJiveContext(JiveContext jiveContext)

setAuthenticationProvider

public final void setAuthenticationProvider(AuthenticationProvider ap)

setSession

public void setSession(Map session)
Specified by:
setSession in interface org.apache.struts2.interceptor.SessionAware

setServletRequest

public void setServletRequest(HttpServletRequest request)
Specified by:
setServletRequest in interface org.apache.struts2.interceptor.ServletRequestAware

setServletResponse

public void setServletResponse(HttpServletResponse response)
Specified by:
setServletResponse in interface org.apache.struts2.interceptor.ServletResponseAware

setAuthToken

@Deprecated
public void setAuthToken(AuthToken token)
Deprecated. 


getAuthToken

public AuthToken getAuthToken()

getAuthenticationProvider

public AuthenticationProvider getAuthenticationProvider()

setDwrWikiConversionBean

public void setDwrWikiConversionBean(WikiConversionAction dwrWikiConversionBean)

getPreferredEditorMode

public String getPreferredEditorMode()

getUser

public final User getUser()
NOTE: DO NOT call this method from a DWR-called method. Unless the DWR bean definition is prototype scope you will end up with an invalid 'user' reference between authentications.

Returns:
User the curent page user

getJiveContext

public JiveContext getJiveContext()

getSession

public Map<String,Object> getSession()

getRequest

public HttpServletRequest getRequest()

getResponse

public HttpServletResponse getResponse()

cancel

public String cancel()

input

public String input()
Overrides:
input in class com.opensymphony.xwork2.ActionSupport

execute

public String execute()
Specified by:
execute in interface com.opensymphony.xwork2.Action
Overrides:
execute in class com.opensymphony.xwork2.ActionSupport

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.

getLocales

public List<Locale> 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.

getCalendarFileName

public String getCalendarFileName()
Returns the name of the localized javascript filename for the current locale for use within the datetime picker.

Returns:
the localized javascript filename

getCalendarOverrideFormat

public String getCalendarOverrideFormat()
Returns the name of the localized javascript override filename for the current locale for use within the datetime picker.

Returns:
the localized javascript override filename

getTimeZone

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

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

getTimeZones

public 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(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 String getGuestProperty(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(String name,
                                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.

getPresence

public org.xmpp.packet.Presence getPresence(User user)

getPageURL

public 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

isReadTrackingEnabled

public boolean isReadTrackingEnabled()
Returns true if read tracking is enabled across the system.

Returns:
true if read tracking is enabled across the system.

getText

public String getText(String key)
Override the getText(..) in ActionSupport so that we can intercept keys that are specific to either the internal or external editions of Clearspace.

See ActionSupport.getText(String).

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

getText

public String getText(String key,
                      String defaultValue,
                      List args,
                      com.opensymphony.xwork2.util.ValueStack stack)
Override the getText(..) in ActionSupport so that we can intercept keys that are specific to either the internal or external editions of Clearspace.

See ActionSupport.getText(String, String, java.util.List, com.opensymphony.xwork2.util.ValueStack).

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

getDefaultBaseURL

public static String getDefaultBaseURL()
Returns the base URL of this Jive installation - usually:

This uses the Jive property of jiveURL which is settable through the config file or admin console.

Returns:
the base URL of this Jive installation.
See Also:
com.jivesoftware.community.web.JiveResourceResolver#getDefaultBaseURL()

loadTagList

public List<ContentTag> loadTagList(String tags)
Retuns a List of ContentTag objects from the given space or + delimited list of tags.

Parameters:
tags - a space or plus (+) delimited list of tags to filter by
Returns:
a list of ContentTag objects from the given space or + delimited list of tags

getXMPPIMService

public IMService getXMPPIMService()

getAIMIMService

public IMService getAIMIMService()

isNewAccountCreationEnabled

public boolean isNewAccountCreationEnabled()

getWidgetContext

public WidgetContext getWidgetContext()

getUserTrackedProjects

public Iterator<Project> getUserTrackedProjects()

getUserGroups

public Iterator<SocialGroup> getUserGroups()

getText

public String getText(String aTextName,
                      String defaultValue)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider
Overrides:
getText in class com.opensymphony.xwork2.ActionSupport

getText

public String getText(String aTextName,
                      String defaultValue,
                      String obj)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider
Overrides:
getText in class com.opensymphony.xwork2.ActionSupport

getText

public String getText(String key,
                      List args)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider
Overrides:
getText in class com.opensymphony.xwork2.ActionSupport

getText

public String getText(String key,
                      String[] args)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider
Overrides:
getText in class com.opensymphony.xwork2.ActionSupport

getText

public String getText(String key,
                      String defaultValue,
                      List args)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider
Overrides:
getText in class com.opensymphony.xwork2.ActionSupport

getText

public String getText(String key,
                      String defaultValue,
                      String[] args)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider
Overrides:
getText in class com.opensymphony.xwork2.ActionSupport

getText

public String getText(String key,
                      String defaultValue,
                      String[] args,
                      com.opensymphony.xwork2.util.OgnlValueStack stack)

getTexts

public ResourceBundle getTexts()
Specified by:
getTexts in interface com.opensymphony.xwork2.TextProvider
Overrides:
getTexts in class com.opensymphony.xwork2.ActionSupport

getTexts

public ResourceBundle getTexts(String aBundleName)
Specified by:
getTexts in interface com.opensymphony.xwork2.TextProvider
Overrides:
getTexts in class com.opensymphony.xwork2.ActionSupport

isFriendingEnabled

public boolean isFriendingEnabled()

isFriendingReflexive

public boolean isFriendingReflexive()

isOrgChartingEnabled

public boolean isOrgChartingEnabled()

isProjectsEnabled

public boolean isProjectsEnabled()

isSocialGroupsEnabled

public boolean isSocialGroupsEnabled()

getCanCreateSocialGroup

public boolean getCanCreateSocialGroup()

isWatchable

public boolean isWatchable()
Returns true if there is a logged in user and watches are enabled.

Returns:
true if there is a logged in user and watches are enabled.

loadJiveContainer

public JiveContainer loadJiveContainer(int objectType,
                                       long objectID)
                                throws NotFoundException
Throws:
NotFoundException

filterDocument

protected void filterDocument(Document doc)

renderToText

public String renderToText(JiveContentObject object)

renderSubjectToText

public String renderSubjectToText(JiveContentObject object)

renderToHtml

public String renderToHtml(JiveContentObject object)

renderTagToHtml

public String renderTagToHtml(ContentTag tag)

renderTagToHtml

public String renderTagToHtml(String tag)

renderToHtml

public String renderToHtml(JiveContentObject object,
                           int size)

renderSubjectToHtml

public String renderSubjectToHtml(JiveContentObject object)

convertToWikiSyntax

public String convertToWikiSyntax(JiveContentObject object)

toRTEString

public String toRTEString(JiveContentObject object,
                          Document d)

toHTMLEditorString

public String toHTMLEditorString(JiveContentObject object,
                                 Document d)

unknownContentToJiveDoc

public Document unknownContentToJiveDoc(String rawText,
                                        JiveObject contentObject)

getGlobalRenderManager

public RenderManager getGlobalRenderManager()

setGlobalRenderManager

public final void setGlobalRenderManager(RenderManager globalRenderManager)

setUserManager

public final void setUserManager(UserManager userManager)

setProjectManager

public final void setProjectManager(ProjectManager projectManager)

setSocialGroupManager

public final void setSocialGroupManager(SocialGroupManager socialGroupManager)

setRegistrationManager

public final void setRegistrationManager(RegistrationManager registrationManager)

setUserRelationshipManager

public final void setUserRelationshipManager(UserRelationshipManager userRelationshipManager)

getImageUrlBuilder

public JiveImageUrlBuilder getImageUrlBuilder()

setImageUrlBuilder

public void setImageUrlBuilder(JiveImageUrlBuilder imageUrlBuilder)

getJiveLinkBuilder

public JiveLinkBuilder getJiveLinkBuilder()

setJiveLinkBuilder

public void setJiveLinkBuilder(JiveLinkBuilder jiveLinkBuilder)

getRecentContentMapSize

protected static int getRecentContentMapSize()

acceptableParameterName

public boolean acceptableParameterName(String parameterName)
[CSSEC-38] Do not allow parameters that could access methods, such as ?user.username. If the action needs to allow specific parameters with method accessors, you can override this method and be very specific about the parameter names allowed.

Specified by:
acceptableParameterName in interface com.opensymphony.xwork2.interceptor.ParameterNameAware
Parameters:
parameterName - the request parameter
Returns:
true if it is a valid parameter name

isChatAvailable

public boolean isChatAvailable()
Indicates whether chat plugin is installed and therefore chat functionality is available.

Returns:
true if chat plugin is installed.

getActionMappingName

public String getActionMappingName()
Returns the current struts context's action mapping name as defined in the struts configuration file.

Returns:
The current struts action mapping name.

addI18nEditionKeys

public static void addI18nEditionKeys(Map<String,String> newKeys)
Allows additional i18n edition keys to be added after initialization (eg. when the chat plugin is loaded). Such keys are used by the getText(...) method to magically provide an edition specific value ('Space' for the internal edition, 'Community' for the external edition).

Parameters:
newKeys - the new keys to add.

isWikiContentEmpty

protected boolean isWikiContentEmpty(String body)

Clearspace Project Page

Copyright © 1999-2007 Jive Software.