org.alfresco.web.app
Class Application

java.lang.Object
  extended by org.alfresco.web.app.Application

public class Application
extends java.lang.Object

Utilities class


Field Summary
static java.lang.String BEAN_CONFIG_SERVICE
           
static java.lang.String BEAN_DATA_DICTIONARY
           
static java.lang.String BEAN_IMPORTER_BOOTSTRAP
           
static java.lang.String MESSAGE_BUNDLE
           
 
Method Summary
static java.util.ResourceBundle getBundle(javax.faces.context.FacesContext context)
          Get the specified the default message bundle for this user
static java.util.ResourceBundle getBundle(javax.servlet.http.HttpSession session)
          Get the specified the default message bundle for this user
static ClientConfigElement getClientConfig(javax.faces.context.FacesContext context)
          Helper to get the client config element from the config service
static ClientConfigElement getClientConfig(javax.servlet.ServletContext context)
          Helper to get the client config element from the config service
static java.lang.String getCompanyRootId()
          Deprecated. Replace with user-context-specific getCompanyRootId (e.g. could be tenant-specific)
static java.lang.String getCompanyRootId(javax.faces.context.FacesContext context)
           
static org.springframework.extensions.config.ConfigService getConfigService(javax.faces.context.FacesContext context)
          Helper to get the ConfigService instance
static org.springframework.extensions.config.ConfigService getConfigService(javax.servlet.ServletContext context)
          Helper to get the ConfigService instance
static java.lang.String getContentFormsFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getContentFormsFolderName(javax.servlet.ServletContext context)
           
static java.lang.String getContentTemplatesFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getContentTemplatesFolderName(javax.servlet.ServletContext context)
           
static User getCurrentUser(javax.faces.context.FacesContext context)
           
static User getCurrentUser(javax.servlet.http.HttpSession session)
           
static DashboardManager getDashboardManager()
          Retrieves the DashboardManager managed bean
static DialogManager getDialogManager()
          Retrieves the DialogManager managed bean
static java.lang.String getEmailTemplatesFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getEmailTemplatesFolderName(javax.servlet.ServletContext context)
           
static java.lang.String getErrorPage(org.springframework.context.ApplicationContext context)
          Retrieves the configured error page for the application
static java.lang.String getErrorPage(javax.servlet.ServletContext servletContext)
          Retrieves the configured error page for the application
static java.lang.String getGlossaryFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getGlossaryFolderName(javax.servlet.ServletContext context)
           
static java.lang.String getGuestHomeFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getGuestHomeFolderName(javax.servlet.ServletContext context)
           
static java.lang.String getInviteEmailTemplatesFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getInviteEmailTemplatesFolderName(javax.servlet.ServletContext context)
           
static java.util.Locale getLanguage(org.springframework.context.ApplicationContext ctx)
          Return the configured language Locale for the application context
static java.util.Locale getLanguage(javax.faces.context.FacesContext fc)
          Return the language Locale for the current user context
static java.util.Locale getLanguage(javax.servlet.http.HttpSession session, boolean useInterfaceLanguage)
          Return the language Locale for the current user Session.
static java.lang.String getLoginPage(org.springframework.context.ApplicationContext context)
          Retrieves the configured login page for the application
static java.lang.String getLoginPage(javax.servlet.ServletContext servletContext)
          Retrieves the configured login page for the application
static java.lang.String getMessage(javax.faces.context.FacesContext context, java.lang.String msg)
          Get the specified I18N message string from the default message bundle for this user
static java.lang.String getMessage(javax.servlet.http.HttpSession session, java.lang.String msg)
          Get the specified I18N message string from the default message bundle for this user
static java.lang.String getNotifyEmailTemplatesFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getNotifyEmailTemplatesFolderName(javax.servlet.ServletContext context)
           
static java.lang.String getProjectsFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getProjectsFolderName(javax.servlet.ServletContext context)
          <<<<<<< .working
static org.alfresco.service.cmr.repository.StoreRef getRepositoryStoreRef(javax.faces.context.FacesContext context)
           
static org.alfresco.service.cmr.repository.StoreRef getRepositoryStoreRef(javax.servlet.ServletContext context)
           
static java.lang.String getRootPath(javax.faces.context.FacesContext context)
           
static java.lang.String getRootPath(javax.servlet.ServletContext context)
           
static java.lang.String getRSSTemplatesFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getRSSTemplatesFolderName(javax.servlet.ServletContext context)
           
static java.lang.String getSavedSearchesFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getSavedSearchesFolderName(javax.servlet.ServletContext context)
           
static java.lang.String getScriptsFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getScriptsFolderName(javax.servlet.ServletContext context)
           
static SidebarBean getSidebarBean()
          Retrieves the SidebarBean
static java.lang.String getSpaceTemplatesFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getSpaceTemplatesFolderName(javax.servlet.ServletContext context)
           
static java.lang.String getWebContentFormsFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getWebContentFormsFolderName(javax.servlet.ServletContext context)
           
static java.lang.String getWebsitesFolderName(javax.faces.context.FacesContext context)
           
static java.lang.String getWebsitesFolderName(javax.servlet.ServletContext context)
           
static WizardManager getWizardManager()
          Retrieves the WizardManager managed bean
static void handleServletError(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Throwable error, org.apache.commons.logging.Log logger, java.lang.String returnPage)
          Handles errors thrown from servlets
static void handleSystemError(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String messageKey, int statusCode, org.apache.commons.logging.Log logger)
          Handles error conditions detected by servlets.
static boolean inPortalServer()
          Determines whether the server is running in a portal
static boolean isDynamicConfig(javax.faces.context.FacesContext context)
           
static void logOut(javax.faces.context.FacesContext context)
          Invalidate Alfresco ticket and Web/Portlet session and clear the Security context for this thread.
static void setCompanyRootId(java.lang.String id)
          Deprecated. Replace with user-context-specific getCompanyRootId (e.g. could be tenant-specific)
static void setCurrentUser(javax.faces.context.FacesContext context, User user)
           
static void setInPortalServer(boolean inPortal)
          Sets whether this application is running inside a portal server
static void setLanguage(javax.faces.context.FacesContext context, java.lang.String code)
          Set the language locale for the current user context
static void setLanguage(javax.servlet.http.HttpSession session, java.lang.String code)
          Deprecated. 
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEAN_CONFIG_SERVICE

public static final java.lang.String BEAN_CONFIG_SERVICE
See Also:
Constant Field Values

BEAN_DATA_DICTIONARY

public static final java.lang.String BEAN_DATA_DICTIONARY
See Also:
Constant Field Values

BEAN_IMPORTER_BOOTSTRAP

public static final java.lang.String BEAN_IMPORTER_BOOTSTRAP
See Also:
Constant Field Values

MESSAGE_BUNDLE

public static final java.lang.String MESSAGE_BUNDLE
See Also:
Constant Field Values
Method Detail

setInPortalServer

public static void setInPortalServer(boolean inPortal)
Sets whether this application is running inside a portal server

Parameters:
inPortal - true to indicate the application is running as a portlet

inPortalServer

public static boolean inPortalServer()
Determines whether the server is running in a portal

Returns:
true if we are running inside a portal server

handleServletError

public static void handleServletError(javax.servlet.ServletContext servletContext,
                                      javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response,
                                      java.lang.Throwable error,
                                      org.apache.commons.logging.Log logger,
                                      java.lang.String returnPage)
                               throws java.io.IOException,
                                      javax.servlet.ServletException
Handles errors thrown from servlets

Parameters:
servletContext - The servlet context
request - The HTTP request
response - The HTTP response
error - The exception
logger - The logger
Throws:
java.io.IOException
javax.servlet.ServletException

handleSystemError

public static void handleSystemError(javax.servlet.ServletContext servletContext,
                                     javax.servlet.http.HttpServletRequest request,
                                     javax.servlet.http.HttpServletResponse response,
                                     java.lang.String messageKey,
                                     int statusCode,
                                     org.apache.commons.logging.Log logger)
                              throws java.io.IOException,
                                     javax.servlet.ServletException
Handles error conditions detected by servlets.

Parameters:
servletContext - The servlet context
request - The HTTP request
response - The HTTP response
messageKey - the resource bundle key for the error mesage
statusCode - the status code to set on the response
logger - The logger
Throws:
java.io.IOException - Signals that an I/O exception has occurred.
javax.servlet.ServletException - the servlet exception

getDialogManager

public static DialogManager getDialogManager()
Retrieves the DialogManager managed bean

Returns:
DialogManager bean

getWizardManager

public static WizardManager getWizardManager()
Retrieves the WizardManager managed bean

Returns:
WizardManager bean

getDashboardManager

public static DashboardManager getDashboardManager()
Retrieves the DashboardManager managed bean

Returns:
DashboardManager bean

getSidebarBean

public static SidebarBean getSidebarBean()
Retrieves the SidebarBean

Returns:
SidebarBean bean

getErrorPage

public static java.lang.String getErrorPage(javax.servlet.ServletContext servletContext)
Retrieves the configured error page for the application

Parameters:
servletContext - The servlet context
Returns:
The configured error page or null if the configuration is missing

getLoginPage

public static java.lang.String getLoginPage(javax.servlet.ServletContext servletContext)
Retrieves the configured login page for the application

Parameters:
servletContext - The servlet context
Returns:
The configured login page or null if the configuration is missing

getCurrentUser

public static User getCurrentUser(javax.servlet.http.HttpSession session)
Returns:
Returns the User object representing the currently logged in user

getCurrentUser

public static User getCurrentUser(javax.faces.context.FacesContext context)
Returns:
Returns the User object representing the currently logged in user

setCurrentUser

public static void setCurrentUser(javax.faces.context.FacesContext context,
                                  User user)

logOut

public static void logOut(javax.faces.context.FacesContext context)
Invalidate Alfresco ticket and Web/Portlet session and clear the Security context for this thread.

Parameters:
context -

getRepositoryStoreRef

public static org.alfresco.service.cmr.repository.StoreRef getRepositoryStoreRef(javax.servlet.ServletContext context)
Returns:
Returns the repository store URL (retrieved from config service)

getRepositoryStoreRef

public static org.alfresco.service.cmr.repository.StoreRef getRepositoryStoreRef(javax.faces.context.FacesContext context)
Returns:
Returns the repository store URL (retrieved from config service)

getCompanyRootId

public static java.lang.String getCompanyRootId()
Deprecated. Replace with user-context-specific getCompanyRootId (e.g. could be tenant-specific)

Returns:
Returns id of the company root

setCompanyRootId

public static void setCompanyRootId(java.lang.String id)
Deprecated. Replace with user-context-specific getCompanyRootId (e.g. could be tenant-specific)

Sets the company root id. This is setup by the ContextListener.

Parameters:
id - The company root id

getCompanyRootId

public static java.lang.String getCompanyRootId(javax.faces.context.FacesContext context)
Returns:
Returns id of the company root

getRootPath

public static java.lang.String getRootPath(javax.servlet.ServletContext context)
Returns:
Returns the root path for the application

getRootPath

public static java.lang.String getRootPath(javax.faces.context.FacesContext context)
Returns:
Returns the root path for the application

getGlossaryFolderName

public static java.lang.String getGlossaryFolderName(javax.servlet.ServletContext context)
Returns:
Returns the glossary folder name

getGlossaryFolderName

public static java.lang.String getGlossaryFolderName(javax.faces.context.FacesContext context)
Returns:
Returns the glossary folder name

getSpaceTemplatesFolderName

public static java.lang.String getSpaceTemplatesFolderName(javax.servlet.ServletContext context)
Returns:
Returns the Space templates folder name

getSpaceTemplatesFolderName

public static java.lang.String getSpaceTemplatesFolderName(javax.faces.context.FacesContext context)
Returns:
Returns the Space templates folder name

getContentTemplatesFolderName

public static java.lang.String getContentTemplatesFolderName(javax.servlet.ServletContext context)
Returns:
Returns the Content templates folder name

getContentTemplatesFolderName

public static java.lang.String getContentTemplatesFolderName(javax.faces.context.FacesContext context)
Returns:
Returns the Content templates folder name

getInviteEmailTemplatesFolderName

public static java.lang.String getInviteEmailTemplatesFolderName(javax.servlet.ServletContext context)
Returns:
Returns the Invite Email Templates folder name

getInviteEmailTemplatesFolderName

public static java.lang.String getInviteEmailTemplatesFolderName(javax.faces.context.FacesContext context)
Returns:
Returns the Invite Email Templates folder name

getNotifyEmailTemplatesFolderName

public static java.lang.String getNotifyEmailTemplatesFolderName(javax.servlet.ServletContext context)
Returns:
Returns the Notify Email Templates folder name

getNotifyEmailTemplatesFolderName

public static java.lang.String getNotifyEmailTemplatesFolderName(javax.faces.context.FacesContext context)
Returns:
Returns the Notify Email Templates folder name

getEmailTemplatesFolderName

public static java.lang.String getEmailTemplatesFolderName(javax.servlet.ServletContext context)
Returns:
Returns the Email templates folder name

getEmailTemplatesFolderName

public static java.lang.String getEmailTemplatesFolderName(javax.faces.context.FacesContext context)
Returns:
Returns the Email templates folder name

getRSSTemplatesFolderName

public static java.lang.String getRSSTemplatesFolderName(javax.servlet.ServletContext context)
Returns:
Returns the RSS templates folder name

getRSSTemplatesFolderName

public static java.lang.String getRSSTemplatesFolderName(javax.faces.context.FacesContext context)
Returns:
Returns the RSS templates folder name

getSavedSearchesFolderName

public static java.lang.String getSavedSearchesFolderName(javax.servlet.ServletContext context)
Returns:
Return the Saved Searches folder name

getSavedSearchesFolderName

public static java.lang.String getSavedSearchesFolderName(javax.faces.context.FacesContext context)
Returns:
Return the Saved Searches folder name

getScriptsFolderName

public static java.lang.String getScriptsFolderName(javax.servlet.ServletContext context)
Returns:
Return the JavaScript scripts folder name

getScriptsFolderName

public static java.lang.String getScriptsFolderName(javax.faces.context.FacesContext context)
Returns:
Return the JavaScript scripts folder name

getGuestHomeFolderName

public static java.lang.String getGuestHomeFolderName(javax.servlet.ServletContext context)
Returns:
Return the Guest Home folder name

getGuestHomeFolderName

public static java.lang.String getGuestHomeFolderName(javax.faces.context.FacesContext context)
Returns:
Return the Guest Home folder name

getWebsitesFolderName

public static java.lang.String getWebsitesFolderName(javax.servlet.ServletContext context)
Returns:
the Websites folder name

getWebsitesFolderName

public static java.lang.String getWebsitesFolderName(javax.faces.context.FacesContext context)
Returns:
the Websites folder name

getWebContentFormsFolderName

public static java.lang.String getWebContentFormsFolderName(javax.servlet.ServletContext context)
Returns:
the WCM Content Forms folder name

getWebContentFormsFolderName

public static java.lang.String getWebContentFormsFolderName(javax.faces.context.FacesContext context)
Returns:
the WCM Content Forms folder name

getContentFormsFolderName

public static java.lang.String getContentFormsFolderName(javax.servlet.ServletContext context)
Returns:
the Content Forms folder name

getContentFormsFolderName

public static java.lang.String getContentFormsFolderName(javax.faces.context.FacesContext context)
Returns:
the Content Forms folder name

getProjectsFolderName

public static java.lang.String getProjectsFolderName(javax.servlet.ServletContext context)
<<<<<<< .working

Returns:
the Projects folder name

getProjectsFolderName

public static java.lang.String getProjectsFolderName(javax.faces.context.FacesContext context)
Returns:
the Projects folder name

setLanguage

public static void setLanguage(javax.faces.context.FacesContext context,
                               java.lang.String code)
Set the language locale for the current user context

Parameters:
context - FacesContext for current user
code - The ISO locale code to set

setLanguage

@Deprecated
public static void setLanguage(javax.servlet.http.HttpSession session,
                                          java.lang.String code)
Deprecated. 

Set the language locale for the current user session.

Parameters:
session - HttpSession for current user
code - The ISO locale code to set

getLanguage

public static java.util.Locale getLanguage(javax.faces.context.FacesContext fc)
Return the language Locale for the current user context

Parameters:
context - FacesContext for the current user
Returns:
Current language Locale set or the VM default if none set - never null

getLanguage

public static java.util.Locale getLanguage(javax.servlet.http.HttpSession session,
                                           boolean useInterfaceLanguage)
Return the language Locale for the current user Session.

Parameters:
session - HttpSession for the current user
useInterfaceLanguage - If the session language hasn't been established yet, should we base it on user preferences?
Returns:
Current language Locale set or the VM default if none set - never null

getLanguage

public static java.util.Locale getLanguage(org.springframework.context.ApplicationContext ctx)
Return the configured language Locale for the application context

Parameters:
ctx - the application context
Returns:
Current language Locale set or the VM default if none set - never null

getMessage

public static java.lang.String getMessage(javax.faces.context.FacesContext context,
                                          java.lang.String msg)
Get the specified I18N message string from the default message bundle for this user

Parameters:
context - FacesContext
msg - Message ID
Returns:
String from message bundle or $$msg$$ if not found

getMessage

public static java.lang.String getMessage(javax.servlet.http.HttpSession session,
                                          java.lang.String msg)
Get the specified I18N message string from the default message bundle for this user

Parameters:
session - HttpSession
msg - Message ID
Returns:
String from message bundle or $$msg$$ if not found

getBundle

public static java.util.ResourceBundle getBundle(javax.servlet.http.HttpSession session)
Get the specified the default message bundle for this user

Parameters:
session - HttpSession
Returns:
ResourceBundle for this user

getBundle

public static java.util.ResourceBundle getBundle(javax.faces.context.FacesContext context)
Get the specified the default message bundle for this user

Parameters:
context - FacesContext
Returns:
ResourceBundle for this user

getConfigService

public static org.springframework.extensions.config.ConfigService getConfigService(javax.faces.context.FacesContext context)
Helper to get the ConfigService instance

Parameters:
context - FacesContext
Returns:
ConfigService

getConfigService

public static org.springframework.extensions.config.ConfigService getConfigService(javax.servlet.ServletContext context)
Helper to get the ConfigService instance

Parameters:
context - ServletContext
Returns:
ConfigService

getClientConfig

public static ClientConfigElement getClientConfig(javax.faces.context.FacesContext context)
Helper to get the client config element from the config service

Parameters:
context - FacesContext
Returns:
The ClientConfigElement

getClientConfig

public static ClientConfigElement getClientConfig(javax.servlet.ServletContext context)
Helper to get the client config element from the config service

Parameters:
context - ServletContext
Returns:
The ClientConfigElement

getErrorPage

public static java.lang.String getErrorPage(org.springframework.context.ApplicationContext context)
Retrieves the configured error page for the application

Parameters:
context - The Spring context
Returns:
The configured error page or null if the configuration is missing

getLoginPage

public static java.lang.String getLoginPage(org.springframework.context.ApplicationContext context)
Retrieves the configured login page for the application

Parameters:
context - The Spring contexr
Returns:
The configured login page or null if the configuration is missing

isDynamicConfig

public static boolean isDynamicConfig(javax.faces.context.FacesContext context)


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.