com.ibm.portal.portletmodel
Interface PortletModel

All Known Subinterfaces:
PortletModelController

public interface PortletModel

This interface provides access to the model for the different levels of portlet configuration. The resulting model is scoped to a particular request and user context and contains only those resources that are visible in that context.

It expresses the linking between the different portlet-related resources; for example, to find the correct portlet entity for a portlet window in the scope of the current request (user), the appropriate portlet model for the current request must be queried.

In the current portal version, all instances of PortletDefinition, Portlet and WebApplication are global, therefore the objects of these types that are returned by this model must be instances that are available through the global com.ibm.portal.portletmodel.admin">AdminPortletModel.

Only objects returned from this API may be passed as arguments to the methods.

Since:
6.0.1

Method Summary
 PortletEntity com.ibm.portal.portletmodel.PortletEntity)">getParentPortletEntity(PortletEntity entity)
          Returns the parent portlet entity that provides defaults for preferences.
 Portlet com.ibm.portal.portletmodel.PortletDefinition)">getPortlet(PortletDefinition portletDefinition)
          Return the portlet that represents the deployed code unit for the given portlet definition.
 PortletDefinition com.ibm.portal.portletmodel.PortletEntity)">getPortletDefinition(PortletEntity entity)
          Return the portlet definition that defines administrative settings for the portlet configuration represented by this entity
 PortletDefinition com.ibm.portal.portletmodel.PortletWindow)">getPortletDefinition(PortletWindow window)
          Return the portlet definition that defines administrative settings for the portlet shown in the given window.
 PortletEntity com.ibm.portal.portletmodel.PortletWindow)">getPortletEntity(PortletWindow window)
          Return a portlet entity that defines preferences for this portlet in the context of the scope of this portlet model.
 PortletWindow com.ibm.portal.content.LayoutControl)">getPortletWindow(LayoutControl control)
          Return the portlet window that is associated with the given layout control.
 PortletPreferences com.ibm.portal.portletmodel.PortletDefinition)">getPreferencesHierarchy(PortletDefinition definition)
          Return an aggregated view of the preference layers associated with the given portlet definition.
 PortletPreferences com.ibm.portal.portletmodel.PortletEntity)">getPreferencesHierarchy(PortletEntity entity)
          Return an aggregated view of the preference layers associated with the given portlet entity.
 WebApplication com.ibm.portal.portletmodel.Portlet)">getWebApplication(Portlet portlet)
          Returns the web application that represents the deployment unit for the given portlet
 

Method Detail
com.ibm.portal.content.LayoutControl)">

getPortletWindow

PortletWindow getPortletWindow(LayoutControl control)
                               throws ModelException
Return the portlet window that is associated with the given layout control. The layout control must be part of the content model that was used to obtain this portlet model.

Parameters:
control - the layout control that defines the spot in the portal page where the requested portlet window is displayed.
Returns:
a PortletWindow or null.
Throws:
ModelException - in case the portlet window cannot be obtained
See Also:
com.ibm.portal.content.ContentPage, ServletRequest, ServletResponse)">PortletModelProvider.getPortletModel(com.ibm.portal.content.ContentPage, ServletRequest, ServletResponse)

com.ibm.portal.portletmodel.PortletWindow)">

getPortletEntity

PortletEntity getPortletEntity(PortletWindow window)
                               throws ModelException
Return a portlet entity that defines preferences for this portlet in the context of the scope of this portlet model. Note that the same portlet window may have different portlet entities associated in different portlet models, for example depending on the current user.

Returns:
a PortletEntity; never returns null.
Throws:
ModelException - in case the portlet entity cannot be obtained

com.ibm.portal.portletmodel.PortletEntity)">

getParentPortletEntity

PortletEntity getParentPortletEntity(PortletEntity entity)
                                     throws ModelException
Returns the parent portlet entity that provides defaults for preferences. May return null, if no parent portlet entity exists.

Portlet entities can form a hierarchy where a parent portlet entity provides default values for those preferences that are not explicitly set or overridden on a child portlet entity. In the current portal version, the hierarchy of portlet entities can be at most two levels deep: a portlet entity either has no parent or it is a personalized portlet entity for a particular user and its parent is a shared portlet entity that itself has no parent.

For JSR portlets that do not operate in a special compatibility mode, preferences that are set in EDIT or VIEW mode are stored in a personalized portlet entity, while preferences that are set in EDIT_DEFAULTS mode are stored in a shared portlet entity.

Parameters:
entity - entity for which the parent is requested
Returns:
a PortletEntity or null.
Throws:
ModelException - in case the portlet entity exists but cannot be obtained

com.ibm.portal.portletmodel.PortletWindow)">

getPortletDefinition

PortletDefinition getPortletDefinition(PortletWindow window)
                                       throws ModelException
Return the portlet definition that defines administrative settings for the portlet shown in the given window.

This method is more efficient but returns the same portlet definition as getPorletDefinition(getPortletEntity(window))

Returns:
a PortletDefinition; never returns null
Throws:
ModelException - in case the portlet definition cannot be obtained

com.ibm.portal.portletmodel.PortletEntity)">

getPortletDefinition

PortletDefinition getPortletDefinition(PortletEntity entity)
                                       throws ModelException
Return the portlet definition that defines administrative settings for the portlet configuration represented by this entity

Returns:
a PortletDefinition; never returns null
Throws:
ModelException - in case the portlet definition cannot be obtained

com.ibm.portal.portletmodel.PortletDefinition)">

getPortlet

Portlet getPortlet(PortletDefinition portletDefinition)
                   throws ModelException
Return the portlet that represents the deployed code unit for the given portlet definition.

Returns:
a Portlet; never returns null.
Throws:
ModelException - in case the portlet cannot be obtained

com.ibm.portal.portletmodel.Portlet)">

getWebApplication

WebApplication getWebApplication(Portlet portlet)
                                 throws ModelException
Returns the web application that represents the deployment unit for the given portlet

Returns:
the web application
Throws:
ModelException - in case the web application cannot be obtained

com.ibm.portal.portletmodel.PortletEntity)">

getPreferencesHierarchy

PortletPreferences getPreferencesHierarchy(PortletEntity entity)
                                           throws ModelException
Return an aggregated view of the preference layers associated with the given portlet entity.

Returns:
an instance of PortletPreferences
Throws:
ModelException - in case the hierarchy cannot be obtained

com.ibm.portal.portletmodel.PortletDefinition)">

getPreferencesHierarchy

PortletPreferences getPreferencesHierarchy(PortletDefinition definition)
                                           throws ModelException
Return an aggregated view of the preference layers associated with the given portlet definition.

Returns:
an instance of PortletPreferences
Throws:
ModelException - in case the hierarhy cannot be obtained