Package com.webmethods.caf.faces.bean
Class BaseFacesPreferencesBean
java.lang.Object
com.webmethods.caf.faces.bean.BaseFacesBean
com.webmethods.caf.faces.bean.BaseFacesSessionBean
com.webmethods.caf.faces.bean.BaseFacesPreferencesBean
- All Implemented Interfaces:
IPageFlowScopeAdapter
,EventListener
,HttpSessionBindingListener
Smart preferences bean. Preferences for portlets may be coming from following sources:
- from url (request parameters) when portlet is linked from another one
- wired to another portlet preference
- persisted preference
- transient value stored in the preferences bean
The preference value from the url always takes precendence over value stored on the bean or taken from wired source or persisted. Transient value, if explicitely set, should take precedence over wired or persisted value.
Client applications should subclass this base class for each portlet in a portlet application.
-
Field Summary
Fields inherited from class com.webmethods.caf.faces.bean.BaseFacesSessionBean
fExpireWithPageFlow
Fields inherited from class com.webmethods.caf.faces.bean.BaseFacesBean
DATA_BINDING_CLIENTS, EMPTY_RESOURCES, OUTCOME_ERROR, OUTCOME_OK, resourcesProviders
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.BaseFacesPreferencesBean
(String[] prefNames) Constrcutor that takes list of preference names. -
Method Summary
Modifier and TypeMethodDescriptionprotected javax.portlet.PortletConfig
Returns portlet config objectDeprecated.ReturnsResourceBundleContentProvider
for the associated portlet for the current locale.Get the URI of the current portlet instance.protected javax.portlet.PortletPreferences
Returns instance of the Portlet Preferences for the current portletReturns all the preferences as modifiable mapprotected Object
getPreferenceValue
(String preferenceName, Class<?> preferenceClass) Returns portlet preference value and converts it to the target class.Returns MWS proxyThingID for portlets used as 'pseudo portlet renderers'protected void
Initializes preferences from the request parameters.void
Initializes preferences from the request parameters.protected void
release()
Override this method to release any resources associated with this session.protected void
setPreferenceValue
(String preferenceName, Object preferenceValue) Sets new value of the portlet preference.protected void
Copies any new preference values into the underlying PortletPreferences storage.Methods inherited from class com.webmethods.caf.faces.bean.BaseFacesSessionBean
getExpireWithPageFlow, setExpireWithPageFlow, valueBound, valueUnbound
Methods inherited from class com.webmethods.caf.faces.bean.BaseFacesBean
createMethodBinding, createMethodExpression, createValueBinding, createValueExpression, createValueExpression, error, error, error, error, error, getBean, getFacesContext, getLocale, getResourceInputStream, getResources, getResourcesProvider, getRootCause, getStackTrace, getTreeAttribute, isUserInRole, log, log, log, putTreeAttribute, resetDataBindingClients, resolveDataBinding, resolveDataBinding, resolveExpression, setValue
-
Constructor Details
-
BaseFacesPreferencesBean
public BaseFacesPreferencesBean()Default constructor. Initiaizes list of preferences based on thePREFERENCES_NAMES
field in this class. -
BaseFacesPreferencesBean
Constrcutor that takes list of preference names.- Parameters:
prefNames
- names of the portlet preferences
-
-
Method Details
-
release
protected void release()Description copied from class:BaseFacesSessionBean
Override this method to release any resources associated with this session. Please note, the FacesContext is not valid for this function- Specified by:
release
in classBaseFacesSessionBean
-
initPreferencesForRequest
public void initPreferencesForRequest()Initializes preferences from the request parameters. This method gets called by ViewHandler tag handler while building the view component tree. -
initPreferences
Initializes preferences from the request parameters. This method gets called by JSF phase listener before portlet rendering.- Throws:
Exception
- if call is made outside of the PortletContext
-
getProxyThingID
Returns MWS proxyThingID for portlets used as 'pseudo portlet renderers'- Returns:
- null, if the portlet is not used as pseudo portlet renderer, otherwise the proxy thing id
- Throws:
Exception
- Since:
- 8.0
-
updatePreferences
Copies any new preference values into the underlying PortletPreferences storage. This gets called from JSF phase listener after portlet rendering.- Throws:
Exception
-
getPreferenceValue
protected Object getPreferenceValue(String preferenceName, Class<?> preferenceClass) throws Exception Returns portlet preference value and converts it to the target class.- Parameters:
preferenceName
- portlet preference namepreferenceClass
- target value class- Returns:
- the value of the portlet preference
- Throws:
Exception
-
setPreferenceValue
Sets new value of the portlet preference.- Parameters:
preferenceName
- portlet preference namepreferenceValue
- preference value- Throws:
Exception
-
getPortletResources
Deprecated. -
getPortletResourcesProvider
ReturnsResourceBundleContentProvider
for the associated portlet for the current locale. The locale is specified byUIViewRoot.getLocale()
. The resource bundle base name is specified inPortletConfig.getResourceBundle(java.util.Locale)
. If resource bundle cannot be loaded the returned provider is empty.- Returns:
- instance of ResourceBundleContentProvider for application resource bundle.
-
getPreferencesMap
Returns all the preferences as modifiable map- Returns:
Map<String, Object>
of all the preferences.
-
getPortletURI
Get the URI of the current portlet instance.- Returns:
- URI as a
String
.
-
getPortletConfig
protected javax.portlet.PortletConfig getPortletConfig()Returns portlet config object- Returns:
- portlet config or null if not available
-
getPreferences
Returns instance of the Portlet Preferences for the current portlet- Returns:
PortletPreferences
object- Throws:
Exception
- if this is made outside of the PortletContext
-