Class BaseFacesBean
- Direct Known Subclasses:
BaseApplicationBean
,BaseEventHandlerBean
,BaseFacesSessionBean
,BaseMaintenancePage
,BaseTaskRuleContext
,EncodersBean
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
TheString
key for storing the map of data binding clients.static final com.webmethods.caf.faces.bean.BaseFacesBean.EmptyResourceBundleContentProvider
protected static final String
Deprecated.With JSF2, the outcome of an action is generally expected to be null or the name of the page to redirect to.protected static final String
Deprecated.With JSF2, the outcome of an action is generally expected to be null or the name of the page to redirect to.protected Map<Locale,
ResourceBundleContentProvider> Map
of resource providers withLocale
as the keys. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MethodBinding
createMethodBinding
(String expression, Class<?>[] args) Deprecated.protected MethodExpression
createMethodExpression
(String expression, Class<?> expectedReturnType, Class<?>[] expectedParamTypes) Shortcut method for creating a method expressionprotected ValueBinding
createValueBinding
(String expression) Deprecated.protected ValueExpression
createValueExpression
(String expression) Shortcut method for creating a value expressionprotected ValueExpression
createValueExpression
(String expression, Class<?> expectedType) Shortcut method for creating a value expressionprotected void
Adds an error message to the faces context.protected void
Adds an error message to the faces context.protected void
Adds an error message to the faces context.protected void
Adds an error message to the faces context.protected void
error
(FacesMessage.Severity severity, String message, String details) Adds an error message to the faces context.protected Object
Returns reference to the managed bean with the given nameprotected FacesContext
Returns current faces contextprotected Locale
Returns locale for the current request/response.protected static InputStream
getResourceInputStream
(String relPath) Returns an InputStream for a resource at the given pathprotected IContentProvider
getResources
(String baseName) Deprecated.protected ResourceBundleContentProvider
getResourcesProvider
(String baseName) ReturnsResourceBundleContentProvider
for the current locale and baseName.Returns root expception for the given exceptionprotected String
Returns stack trace of the given exceptionprotected Object
getTreeAttribute
(String key) Retrieves an Object from the tree's attribute map.protected boolean
isUserInRole
(String roleName) Checks if the current user is in specified local/logical role.protected void
Logs a messageprotected void
Logs an exceptionprotected void
Logs an exceptionprotected void
putTreeAttribute
(String key, Object value) Places an Object on the tree's attribute map.protected void
Resets data binding flags for the current request.protected boolean
resolveDataBinding
(String[][] bindingExpressions, Object bean, String varName) Shortcut methodprotected boolean
resolveDataBinding
(String[][] bindingExpressions, Object bean, String varName, boolean forceResolve, boolean cacheRightValues) Data Flow execution.protected Object
resolveExpression
(String expression) Return the result of the resolved value binding expression.protected boolean
Sets value using given JSF value binding expression.
-
Field Details
-
OUTCOME_OK
Deprecated.With JSF2, the outcome of an action is generally expected to be null or the name of the page to redirect to.Outcome for successful action- See Also:
-
OUTCOME_ERROR
Deprecated.With JSF2, the outcome of an action is generally expected to be null or the name of the page to redirect to.Outcome for failed action- See Also:
-
resourcesProviders
Map
of resource providers withLocale
as the keys. -
DATA_BINDING_CLIENTS
TheString
key for storing the map of data binding clients.- See Also:
-
EMPTY_RESOURCES
public static final com.webmethods.caf.faces.bean.BaseFacesBean.EmptyResourceBundleContentProvider EMPTY_RESOURCES
-
-
Constructor Details
-
BaseFacesBean
public BaseFacesBean()Default constructor
-
-
Method Details
-
createValueExpression
Shortcut method for creating a value expression- Parameters:
expression
- value binding expression- Returns:
- value binding for the given expression
-
createValueExpression
Shortcut method for creating a value expression- Parameters:
expression
- value binding expressionexpectedType
- the expected valye type- Returns:
- value binding for the given expression
-
createMethodExpression
protected MethodExpression createMethodExpression(String expression, Class<?> expectedReturnType, Class<?>[] expectedParamTypes) Shortcut method for creating a method expression- Parameters:
expression
- method binding expressionexpectedReturnType
- the expected type to be returned by the methodexpectedParamTypes
- method argument types- Returns:
- MethodExpression for the given expression
-
createValueBinding
Deprecated.Shortcut method forgetFacesContext().getApplication().createValueBinding(expression)
- Parameters:
expression
- value binding expression- Returns:
- value binding for the given expression
-
createMethodBinding
Deprecated.Shortcut method forgetFacesContext().getApplication().createMethodBinding(expression, args)
- Parameters:
expression
- method binding expressionargs
- method argument types- Returns:
- method binding for the given expression
-
resolveExpression
Return the result of the resolved value binding expression.getFacesContext()
must return a valid context for the current thread.- Parameters:
expression
- JSF value binding expression- Returns:
- result of the expression, can be null
-
setValue
Sets value using given JSF value binding expression. Tries to convert the given value parameter to the target type of the value binding expression.- Parameters:
expression
- JSF value binding expressionvalue
- new value to assign- Returns:
- true if the new value is different from the previous value
-
putTreeAttribute
Places an Object on the tree's attribute map. The values persisted as long as the tree is persisted.- Parameters:
key
- attribute keyvalue
- attribute value
-
getTreeAttribute
Retrieves an Object from the tree's attribute map.- Parameters:
key
- the attribute key- Returns:
- previously set attribute value or null if not found
-
resolveDataBinding
Shortcut method -
resolveDataBinding
protected boolean resolveDataBinding(String[][] bindingExpressions, Object bean, String varName, boolean forceResolve, boolean cacheRightValues) Data Flow execution. The flow is a set of data assigments and action calls.
- #{left expression} = #{right expression}
- #{method expression}
The
varName
parameter can be used to access java bean specified asbean
parameter. For example, if varName=this, then binding expression can use "#{this.myproperty}" to access myproperty on thebean
instance.If the bean implements
IRefreshableContentProvider
andIRefreshable.isAutoRefresh()
istrue
then it automatically callsIRefreshable.refresh()
method if any of the right expressions differ from the values previously set on the bean.By default bindings are evaluted once per request (action or render). Specifying
forceResolve
parameters as true will force the resolution.If right expression returns
null
the previously cached value of that expression will be used, ifcacheRightValues
parameter is true. If null is a valid value, then use false forcacheRightValues
- Parameters:
bindingExpressions
- two dimentional array of left expression=right expression, or method expression.bean
- java bean instance, can be a managed bean instance, can be null.varName
- optional variable name that will point to the bean instance. Can be null.forceResolve
- set to true to force the resolution. If false it only happens once per request (action or render)cacheRightValues
- set to true if want cache non-null right expressions values and use them whenever right expression returns null. Set to false, if null is a valid value.- Returns:
- true if data bindings have changed and the provider have not been auto-refreshed, i.e. it should be refreshed manually.
-
resetDataBindingClients
protected void resetDataBindingClients()Resets data binding flags for the current request. -
getBean
Returns reference to the managed bean with the given name- Parameters:
beanName
- the name of the managed bean- Returns:
- null if the bean cannot be found
-
getResourceInputStream
Returns an InputStream for a resource at the given path- Parameters:
relPath
- relative to the web application root path to the resource- Returns:
- input stream opened for this resource or null if resource is not found
-
log
Logs an exception- Parameters:
throwable
- the exception
-
log
Logs an exception- Parameters:
message
- the messagethrowable
- the exception
-
log
Logs a message- Parameters:
message
- the message
-
getStackTrace
Returns stack trace of the given exception- Parameters:
t
- the exception- Returns:
- its stack trace
-
error
Adds an error message to the faces context. This message can be display using Message control.- Parameters:
severity
- severity of the messagemessage
- the messagedetails
- the details for the message
-
error
Adds an error message to the faces context. This message can be display using Message control.- Parameters:
message
- the messagedetails
- the details for the message
-
error
Adds an error message to the faces context. This message can be display using Message control.- Parameters:
message
- the message
-
error
Adds an error message to the faces context. This message can be display using Message control.- Parameters:
throwable
- the error exception
-
error
Adds an error message to the faces context. This message can be display using Message control.- Parameters:
message
- the messagethrowable
- the error exception
-
getRootCause
Returns root expception for the given exception- Parameters:
ex
- the exception- Returns:
- root exception or the exception itself
-
getFacesContext
Returns current faces context- Returns:
- null if faces context is not available for the current thread
-
isUserInRole
Checks if the current user is in specified local/logical role.- Parameters:
roleName
- local/logical role name defined in this web or portlet application- Returns:
- true if the current user belongs to this role.
-
getResources
Deprecated. -
getResourcesProvider
ReturnsResourceBundleContentProvider
for the current locale and baseName. The locale is specified byUIViewRoot.getLocale()
. If message bundle is not specified or cannot be loaded the returned provider is empty.- Parameters:
baseName
- resource bundle base name- Returns:
- instance of ResourceBundleContentProvider for application resource bundle.
-
getLocale
Returns locale for the current request/response.- Returns:
- locale
-