public class BaseFacesPreferencesBean extends BaseFacesSessionBean
Smart preferences bean. Preferences for portlets may be coming from following sources:
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.
fExpireWithPageFlow
DATA_BINDING_CLIENTS, OUTCOME_ERROR, OUTCOME_OK, resourcesProviders
Constructor and Description |
---|
BaseFacesPreferencesBean()
Default constructor.
|
BaseFacesPreferencesBean(String[] prefNames)
Constrcutor that takes list of preference names.
|
Modifier and Type | Method and Description |
---|---|
protected javax.portlet.PortletConfig |
getPortletConfig()
Returns portlet config object
|
IContentProvider |
getPortletResources()
Deprecated.
|
ResourceBundleContentProvider |
getPortletResourcesProvider()
Returns
ResourceBundleContentProvider for the associated portlet
for the current locale. |
String |
getPortletURI()
Get the URI of the current portlet instance.
|
protected javax.portlet.PortletPreferences |
getPreferences()
Returns instance of the Portlet Preferences for the current portlet
|
Map |
getPreferencesMap()
Returns all the preferences as modifiable map
|
protected Object |
getPreferenceValue(String preferenceName,
Class preferenceClass)
Returns portlet preference value and converts it to the target class.
|
String |
getProxyThingID()
Returns MWS proxyThingID for portlets used as 'pseudo portlet renderers'
|
protected void |
initPreferences()
Initializes preferences from the request parameters.
|
void |
initPreferencesForRequest()
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 |
updatePreferences()
Copies any new preference values into the underlying PortletPreferences
storage.
|
getExpireWithPageFlow, setExpireWithPageFlow, valueBound, valueUnbound
createMethodBinding, createValueBinding, error, error, error, error, error, getBean, getFacesContext, getLocale, getResourceInputStream, getResources, getResourcesProvider, getRootCause, getStackTrace, getTreeAttribute, isUserInRole, log, log, log, putTreeAttribute, resetDataBindingClients, resolveDataBinding, resolveDataBinding, resolveExpression, setValue
public BaseFacesPreferencesBean()
PREFERENCES_NAMES
field in this class.public BaseFacesPreferencesBean(String[] prefNames)
prefNames
- names of the portlet preferencesprotected void release()
BaseFacesSessionBean
release
in class BaseFacesSessionBean
public void initPreferencesForRequest()
protected void initPreferences() throws Exception
Exception
- if call is made outside of the PortletContextpublic String getProxyThingID() throws Exception
Exception
protected void updatePreferences() throws Exception
Exception
protected Object getPreferenceValue(String preferenceName, Class preferenceClass) throws Exception
preferenceName
- portlet preference namepreferenceClass
- target value classException
protected void setPreferenceValue(String preferenceName, Object preferenceValue) throws Exception
preferenceName
- portlet preference namepreferenceValue
- preference valueException
public IContentProvider getPortletResources()
public ResourceBundleContentProvider getPortletResourcesProvider()
ResourceBundleContentProvider
for the associated portlet
for the current locale. The locale is specified by
UIViewRoot.getLocale()
. The resource bundle
base name is specified in
PortletConfig.getResourceBundle(java.util.Locale)
. If resource
bundle cannot be loaded the returned provider is empty.public Map getPreferencesMap()
Map<String, Object>
of all the preferences.public String getPortletURI()
String
.protected javax.portlet.PortletConfig getPortletConfig()