de.uplanet.lucy.server.portlet
Class PortletManager

java.lang.Object
  extended by de.uplanet.lucy.server.portlet.PortletManager

public final class PortletManager
extends java.lang.Object

Manages portlets on portals.

Users MUST call done() when finished using the portlet manager to ensure that all resources such as SQL statements are properly closed and freed.

Version:
$Revision: 76897 $

Field Summary
static de.uplanet.lucy.server.portlet.IPortletFilter FILTER_NONE
          A filter that actually does no filtering.
static de.uplanet.lucy.server.portlet.PositionComparator ORDER_BY_POSITION_ASC
          Ascending order by position.
static de.uplanet.lucy.server.portlet.PositionComparator ORDER_BY_POSITION_DESC
          Descending order by position.
 
Method Summary
 void _overridePortletSettings(java.lang.String p_strPortalId, java.lang.String p_strPortletId, java.lang.String p_strUserId, int p_iCol, int p_iPos, int p_iWidth, boolean p_bMandatory, int p_iFlags)
           
 void arrangePortlets(java.lang.String p_strList)
          Arrange portlets according to the given list.
 de.uplanet.lucy.server.portlet.Portlet at(int p_iIndex)
          Get the portlet at the given index in the filtered collection.
static PortletManager createInstance(de.uplanet.jdbc.JdbcConnection p_conn)
          Factory method to create a portlet manager.
 void done()
          Ensure that all resources are being freed after using the portlet manager.
 void filterPortlets(de.uplanet.lucy.server.portlet.IPortletFilter p_flt)
          Filter portlets using the specified filter.
 void filterRefinePortlets(de.uplanet.lucy.server.portlet.IPortletFilter p_flt)
          Filter the previously filtered portlets using the specified filter.
 de.uplanet.lucy.server.portlet.IPortletFilter getColumnsFilter(java.util.List<java.lang.Integer> p_cols)
          Factory method for creating column filters.
 de.uplanet.lucy.server.portlet.IPortletFilter getComplementFilter(de.uplanet.lucy.server.portlet.IPortletFilter p_filter)
          Convenience method to create a filter complementary to the given filter.
 de.uplanet.jdbc.JdbcConnection getConnection()
          The portlet manager's database connection.
 de.uplanet.lucy.server.portlet.PortletCreator getCreator()
          Create a PortletCreator that shares it's DatabaseContext with this PortletManager instance.
static java.lang.String getFileInHierarchy(java.lang.String p_strBasePath, java.lang.String p_strPortalId, java.lang.String p_strClassId, java.lang.String p_strPortletId, java.lang.String p_strFileName)
          Return a valid file path within a hierarchical portlet file system, starting with the given p_strBasePath, relative to the portal working directory.
 de.uplanet.lucy.server.portlet.IPortletFilter getIdentityFilter()
           
 de.uplanet.lucy.server.portlet.IPortletFilter getInstanceFilter(java.util.List<java.lang.String> p_ids)
          Factory method for creating an instance filter.
 java.lang.String getPortalId()
          The portal unique identifier.
 de.uplanet.lucy.server.portlet.Portlet getPortlet(java.lang.String p_strPortletId)
          Get a portlet by its unique identifier from the unfiltered collection.
 de.uplanet.lucy.server.portlet.Portlet[] getPortlets()
          Get an array containing the filtered and sorted portlets.
 boolean load(java.lang.String p_strPortalId, java.lang.String p_strUserId, java.lang.String p_strLanguageId)
          Loads all portlets according to the supplied parameters.
 boolean loadDefaults(java.lang.String p_strPortalId, java.lang.String p_strLanguageId)
          Loads all portlets with their default settings.
 void overridePortletSettings(java.lang.String p_strPortalId, java.lang.String p_strPortletId, java.lang.String p_strUserId, int p_iCol, int p_iPos, int p_iWidth, boolean p_bMandatory, int p_iFlags)
          Override the portlet settings for the given portal, portlet and user.
 void retractPortlets(int p_iSrcColumns, int p_iDstColumn)
          Fetch back portlets that reside in higher columns to the specified column.
 int size()
          Get the size of filtered collection.
 void sortPortlets(java.util.Comparator<? super de.uplanet.lucy.server.portlet.Portlet> p_order)
          Sort the portlets in the filtered portlets collection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILTER_NONE

public static final de.uplanet.lucy.server.portlet.IPortletFilter FILTER_NONE
A filter that actually does no filtering. All portlets will appear in the filtered collection.


ORDER_BY_POSITION_ASC

public static final de.uplanet.lucy.server.portlet.PositionComparator ORDER_BY_POSITION_ASC
Ascending order by position.


ORDER_BY_POSITION_DESC

public static final de.uplanet.lucy.server.portlet.PositionComparator ORDER_BY_POSITION_DESC
Descending order by position.

Method Detail

createInstance

public static PortletManager createInstance(de.uplanet.jdbc.JdbcConnection p_conn)
Factory method to create a portlet manager.

Returns:
A portlet manager instance.

getConnection

public de.uplanet.jdbc.JdbcConnection getConnection()
The portlet manager's database connection.

Returns:
The database connection.

getCreator

public de.uplanet.lucy.server.portlet.PortletCreator getCreator()
Create a PortletCreator that shares it's DatabaseContext with this PortletManager instance.

Returns:
A new portlet creator.

getPortalId

public java.lang.String getPortalId()
The portal unique identifier.

Returns:
The portal unique identifier.

load

public boolean load(java.lang.String p_strPortalId,
                    java.lang.String p_strUserId,
                    java.lang.String p_strLanguageId)
Loads all portlets according to the supplied parameters.

Parameters:
p_strPortalId - ID of the portal.
p_strUserId - ID of the user.
p_strLanguageId - The ISO-639 2-letter language identifier.
Returns:
true if loading the portlets succeeded, false otherwise.

loadDefaults

public boolean loadDefaults(java.lang.String p_strPortalId,
                            java.lang.String p_strLanguageId)
Loads all portlets with their default settings.

Parameters:
p_strPortalId - ID of the portal.
p_strLanguageId - The ISO-639 2-letter language identifier.
Returns:
true for success, false otherwise.

getFileInHierarchy

public static java.lang.String getFileInHierarchy(java.lang.String p_strBasePath,
                                                  java.lang.String p_strPortalId,
                                                  java.lang.String p_strClassId,
                                                  java.lang.String p_strPortletId,
                                                  java.lang.String p_strFileName)
Return a valid file path within a hierarchical portlet file system, starting with the given p_strBasePath, relative to the portal working directory.

Parameters:
p_strBasePath - The base path, relative to the portal's working directory.
p_strPortalId - A unique portal identifier.
p_strClassId - A portlet class identifier.
p_strPortletId - A portlet identifier.
p_strFileName - The name of the file to be resolved.

done

public void done()
Ensure that all resources are being freed after using the portlet manager.

It is guaranteed that subsequent calls on this instance won't fail. However, anew calling done() is required in this case.

Note:
Don't forget to call this method!

filterPortlets

public void filterPortlets(de.uplanet.lucy.server.portlet.IPortletFilter p_flt)
Filter portlets using the specified filter.

The given filter operates on the collection of all loaded portlets. Previous filters are overwritten.

Parameters:
p_flt - The filter to apply.

filterRefinePortlets

public void filterRefinePortlets(de.uplanet.lucy.server.portlet.IPortletFilter p_flt)
Filter the previously filtered portlets using the specified filter.

The given filter operates on the collection of already filtered portlets.

Parameters:
p_flt - The filter to apply.

sortPortlets

public void sortPortlets(java.util.Comparator<? super de.uplanet.lucy.server.portlet.Portlet> p_order)
Sort the portlets in the filtered portlets collection.

Predefined sorting orders are are ORDER_BY_POSITION_ASC or ORDER_BY_POSITION_DESC.

Parameters:
p_order - The sorting order.

getPortlets

public de.uplanet.lucy.server.portlet.Portlet[] getPortlets()
Get an array containing the filtered and sorted portlets.

Returns:
The array of filtered and sorted portlets.

size

public int size()
Get the size of filtered collection.

Returns:
The size of the filtered collection.

at

public de.uplanet.lucy.server.portlet.Portlet at(int p_iIndex)
Get the portlet at the given index in the filtered collection.

Parameters:
p_iIndex - The index of the portlet to retrieve.
Returns:
The portlet at the given index.

getPortlet

public de.uplanet.lucy.server.portlet.Portlet getPortlet(java.lang.String p_strPortletId)
Get a portlet by its unique identifier from the unfiltered collection.

Parameters:
p_strPortletId - The ID of the portlet to retrieve.
Returns:
The specified portlet or null if it does not exist or the user is not granted access to it.

retractPortlets

public void retractPortlets(int p_iSrcColumns,
                            int p_iDstColumn)
Fetch back portlets that reside in higher columns to the specified column.

Parameters:
p_iSrcColumns - Portlets on this or higer columns will be moved to p_iDstColumn
p_iDstColumn - Column to which the portlets should be moved.

getIdentityFilter

public de.uplanet.lucy.server.portlet.IPortletFilter getIdentityFilter()
Returns:
A filter that accepts all portlets.

getColumnsFilter

public de.uplanet.lucy.server.portlet.IPortletFilter getColumnsFilter(java.util.List<java.lang.Integer> p_cols)
Factory method for creating column filters.

Parameters:
p_cols - The columns that sould be filtered for.
Returns:
The desired columns filter.

getInstanceFilter

public de.uplanet.lucy.server.portlet.IPortletFilter getInstanceFilter(java.util.List<java.lang.String> p_ids)
Factory method for creating an instance filter.

Parameters:
An - array of unique identifiers that are accepted by the resulting filter.
Returns:
The desired instance filter.

getComplementFilter

public de.uplanet.lucy.server.portlet.IPortletFilter getComplementFilter(de.uplanet.lucy.server.portlet.IPortletFilter p_filter)
Convenience method to create a filter complementary to the given filter.

Parameters:
p_filter - The filter to create a complement for.
Returns:
The given filter's complementary filter.

arrangePortlets

public void arrangePortlets(java.lang.String p_strList)
Arrange portlets according to the given list.

An arrange-list obeys the production rule
(portlet-id,column,position,width)*.

Parameters:
p_strList - The arrange-list.

overridePortletSettings

public void overridePortletSettings(java.lang.String p_strPortalId,
                                    java.lang.String p_strPortletId,
                                    java.lang.String p_strUserId,
                                    int p_iCol,
                                    int p_iPos,
                                    int p_iWidth,
                                    boolean p_bMandatory,
                                    int p_iFlags)
Override the portlet settings for the given portal, portlet and user.

Parameters:
p_strPortalId - ID of the portal.
p_strPortletId - ID of the portlet instance.
p_strUserId - The ID of the user.
p_iCol - The column to be set.
p_iPos - The position to be set.
p_iWidth - The portlet's width.
p_bMandatory - The mandatory flag.
p_iFlags - Portlet flags to be set.

_overridePortletSettings

public void _overridePortletSettings(java.lang.String p_strPortalId,
                                     java.lang.String p_strPortletId,
                                     java.lang.String p_strUserId,
                                     int p_iCol,
                                     int p_iPos,
                                     int p_iWidth,
                                     boolean p_bMandatory,
                                     int p_iFlags)


Last updated: 2011-01-27
Copyright 2000-2010 United Planet. All Rights Reserved.