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 AdminPortletModel.

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

Since:
6.0.1

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

Method Detail

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:
PortletModelProvider.getPortletModel(com.ibm.portal.content.ContentPage, javax.servlet.ServletRequest, javax.servlet.ServletResponse)

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

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

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

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

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

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

getPreferencesHierarchy

PortletPreferences<java.util.Map.Entry<java.lang.String,java.lang.String>> 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

getPreferencesHierarchy

PortletPreferences<java.util.Map.Entry<java.lang.String,java.lang.String>> 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