org.bejug.javacareers.jobs.view.jsf.util
Class Utils

java.lang.Object
  extended byorg.bejug.javacareers.jobs.view.jsf.util.Utils
All Implemented Interfaces:
JSFConstants

public class Utils
extends java.lang.Object
implements JSFConstants

Version:
$Revision: 1.32 $ - $Date: 2005/12/20 15:36:47 $
Author:
Peter Symoens (last modified by $Author: shally $)

Field Summary
static java.lang.String ROLE_ADMIN
          String representing administrator role.
static java.lang.String ROLE_USER
          String representing user role.
static java.lang.String RSSFEEDER
          the organisation and username used by the RSS feeder.
 
Fields inherited from interface org.bejug.javacareers.common.view.jsf.constants.JSFConstants
COLLAPSE_COMMENTS, CURRENT_ITEM, ERROR_CONTROL_FLOW, GO_ERROR, GO_HOME, GO_ITEMS, GO_JOB_DETAILS, GO_JOBS
 
Constructor Summary
Utils()
           
 
Method Summary
static void createValueBinding(org.bejug.javacareers.jobs.model.Item item)
          Bind a item instance to a variable name
 org.bejug.javacareers.jobs.service.AdminService getAdminService()
           
static javax.faces.application.Application getApplication()
          Retrieve the current Faces application.
static java.lang.Object getBinding(java.lang.String scope, java.lang.String key)
          Get the value of a binding on a certain scope e.g.
 java.util.List getCountryItems()
          Retrieve the list of countries for display in a popup.
protected static java.lang.ClassLoader getCurrentClassLoader(java.lang.Object defaultObject)
           
static javax.faces.context.ExternalContext getExternalContext()
           
static javax.faces.context.FacesContext getFacesContext()
          Retrieve the current Faces context.
static java.lang.String getLocale()
          Retrieve the locale as string for the current view.
static java.util.Locale getLocaleByName(java.lang.String name)
          Retrieve the locale object by specifying the 2-letter ISO language code or the combination of the 2-letter ISO language code + 3-letter country code.
 java.util.List getLocations()
           
static java.lang.String getMessage(java.lang.String id)
           
 java.util.ResourceBundle getMessageBundle()
          Get the bundle as configured in the Faces configuration.
 java.util.List getRegionItems()
          Retrieve the list of region types for display in a popup.
 java.util.List getRoleItems()
           
 java.util.List getSalutationItems()
          Retrieve the list of salutations to use for this region of the world.
static java.lang.String getServletContextRoot()
           
static javax.servlet.http.HttpSession getSession()
           
 java.util.List getSupportedLocaleItems()
          Retrieve the list of locales supported by the Faces application.
 java.util.List getUserTypes()
           
static javax.faces.el.VariableResolver getVariableResolver()
           
static void redirectToLogin()
          redirect to the login page
static java.lang.Object resolveVariable(java.lang.String variable)
           
static void saveBinding(java.lang.String scope, java.lang.String key, java.lang.Object value)
          Store an object in a binding on a certain scope.
 void setAdminService(org.bejug.javacareers.jobs.service.AdminService adminService)
           
static void setDefaultTargetUrl(java.lang.String url)
          Change the default target url.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROLE_ADMIN

public static final java.lang.String ROLE_ADMIN
String representing administrator role.

See Also:
Constant Field Values

ROLE_USER

public static final java.lang.String ROLE_USER
String representing user role.

See Also:
Constant Field Values

RSSFEEDER

public static final java.lang.String RSSFEEDER
the organisation and username used by the RSS feeder.

See Also:
Constant Field Values
Constructor Detail

Utils

public Utils()
Method Detail

getMessageBundle

public java.util.ResourceBundle getMessageBundle()
Get the bundle as configured in the Faces configuration. In the absence of a context, revert to the default.

Returns:
the resource bundle to use.

getLocations

public java.util.List getLocations()
Returns:
Returns the locations.

getRegionItems

public java.util.List getRegionItems()
Retrieve the list of region types for display in a popup.

Returns:
list of menu items representing organisation types.

getCountryItems

public java.util.List getCountryItems()
Retrieve the list of countries for display in a popup.

Returns:
list of select items representing the available countries.

getUserTypes

public java.util.List getUserTypes()
Returns:
Returns the user profiles.

getSalutationItems

public java.util.List getSalutationItems()
Retrieve the list of salutations to use for this region of the world.

Returns:
list of strings

getSupportedLocaleItems

public java.util.List getSupportedLocaleItems()
Retrieve the list of locales supported by the Faces application.

Returns:
list of SelectItems representing the locale list.

getLocaleByName

public static java.util.Locale getLocaleByName(java.lang.String name)
Retrieve the locale object by specifying the 2-letter ISO language code or the combination of the 2-letter ISO language code + 3-letter country code.

Parameters:
name - the locale name
Returns:
loc Locale

getCurrentClassLoader

protected static java.lang.ClassLoader getCurrentClassLoader(java.lang.Object defaultObject)
Parameters:
defaultObject - Object.
Returns:
Returns the classLoader.

getSession

public static javax.servlet.http.HttpSession getSession()
Returns:
the HttpSession.

getFacesContext

public static javax.faces.context.FacesContext getFacesContext()
Retrieve the current Faces context.

Returns:
Returns the FacesContext.

getExternalContext

public static javax.faces.context.ExternalContext getExternalContext()
Returns:
Returns the ExternalContext

getApplication

public static javax.faces.application.Application getApplication()
Retrieve the current Faces application.

Returns:
the current application.

getLocale

public static java.lang.String getLocale()
Retrieve the locale as string for the current view.

Returns:
locale for current view.

getServletContextRoot

public static java.lang.String getServletContextRoot()
Returns:
ServletContextRoot

getMessage

public static java.lang.String getMessage(java.lang.String id)
Parameters:
id - String
Returns:
Returns the message.

getRoleItems

public java.util.List getRoleItems()
Returns:
list of possible roles for registered users.

createValueBinding

public static void createValueBinding(org.bejug.javacareers.jobs.model.Item item)
Bind a item instance to a variable name

Parameters:
item - The Item to bind

resolveVariable

public static java.lang.Object resolveVariable(java.lang.String variable)
Parameters:
variable - The variable to resolve
Returns:
the resolved object

setDefaultTargetUrl

public static void setDefaultTargetUrl(java.lang.String url)
Change the default target url.

Parameters:
url - The default target url

redirectToLogin

public static void redirectToLogin()
redirect to the login page


getVariableResolver

public static javax.faces.el.VariableResolver getVariableResolver()
Returns:
the VariableResolver.

getAdminService

public org.bejug.javacareers.jobs.service.AdminService getAdminService()
Returns:
Returns the adminservice.

setAdminService

public void setAdminService(org.bejug.javacareers.jobs.service.AdminService adminService)
Parameters:
adminService - The adminservice to set.

saveBinding

public static void saveBinding(java.lang.String scope,
                               java.lang.String key,
                               java.lang.Object value)
Store an object in a binding on a certain scope.

Parameters:
scope - the scope for the binding.
key - the key for the binding.
value - the object to store in the binding.

getBinding

public static java.lang.Object getBinding(java.lang.String scope,
                                          java.lang.String key)
Get the value of a binding on a certain scope e.g. sessionScope.

Parameters:
scope - the scope of the binding.
key - the key of the binding.
Returns:
the object stored at the binding.


Copyright © 2005-2006 BeJUG. All Rights Reserved.