com.endeca.portal.util
Class ApplicationUtil

java.lang.Object
  extended by com.endeca.portal.util.ApplicationUtil

public class ApplicationUtil
extends java.lang.Object


Field Summary
static java.lang.String COMPONENT_CONTAINER_PORTLET_NAME
           
static java.lang.String TABBED_COMPONENT_CONTAINER_PORTLET_NAME
           
static java.lang.String UPDATE_APPLICATION_CONFIGURATION_INFO
           
 
Constructor Summary
ApplicationUtil()
           
 
Method Summary
static java.util.List<java.lang.String> getPortletIdList(com.liferay.portal.model.Layout layout, java.lang.String containerPortletId)
          Get the list of all portletIds present in the passed layout.
static boolean portletIsContainer(com.liferay.portal.model.Portlet portlet)
          Check if the portlet is a container portlet.
static void updateApplicationDataSourceBindings(com.liferay.portal.model.Group group)
          Wrapper for implementation above when setting all portlets to the same datasource.
static void updateApplicationDataSourceBindings(com.liferay.portal.model.Group group, boolean maintainPortletPreferences)
           
static void updateApplicationDataSourceBindings(com.liferay.portal.model.Layout layout, java.lang.String dataSourceId, java.lang.String dataSetId, boolean maintainPortletPreferences)
          Update the data source and/or data set for all portlets present on a given page.
static void updateApplicationDataSourceBindings(long applicationId, java.lang.String dataSourceId)
           
static void updateApplicationDataSourceBindings(long applicationId, java.lang.String dataSourceId, boolean maintainPortletPreferences)
          Update the dataSourceId for all portlets present in an application.
static void updateApplicationDataSourceBindings(long applicationId, java.lang.String dataSourceId, java.lang.String dataSetId, boolean maintainPortletPreferences)
          Update the data source and/or data set for all portlets present in an application.
static com.liferay.portal.model.Group updateGroup(javax.portlet.PortletRequest request)
           
static com.liferay.portal.model.Group updateGroup(javax.portlet.PortletRequest request, boolean resetPagesPermission)
           
static void validateAndRepairDataSourceBindings(long applicationId, boolean maintainPortletPreferences)
          This utility method will loop over all pages and portlets to make sure that the portlet datasource is in the family of the application's datasource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABBED_COMPONENT_CONTAINER_PORTLET_NAME

public static final java.lang.String TABBED_COMPONENT_CONTAINER_PORTLET_NAME
See Also:
Constant Field Values

COMPONENT_CONTAINER_PORTLET_NAME

public static final java.lang.String COMPONENT_CONTAINER_PORTLET_NAME
See Also:
Constant Field Values

UPDATE_APPLICATION_CONFIGURATION_INFO

public static final java.lang.String UPDATE_APPLICATION_CONFIGURATION_INFO
See Also:
Constant Field Values
Constructor Detail

ApplicationUtil

public ApplicationUtil()
Method Detail

updateApplicationDataSourceBindings

public static void updateApplicationDataSourceBindings(com.liferay.portal.model.Layout layout,
                                                       java.lang.String dataSourceId,
                                                       java.lang.String dataSetId,
                                                       boolean maintainPortletPreferences)
                                                throws com.liferay.portal.SystemException,
                                                       javax.portlet.ReadOnlyException,
                                                       javax.portlet.ValidatorException,
                                                       java.io.IOException
Update the data source and/or data set for all portlets present on a given page.

Parameters:
layout - the page containing the portlets to be updated
dataSourceId - the data source to which portlets should be updated
dataSetId - the data set to which portlets should be updated
maintainPortletPreferences - true if portlets should attempt to preserve some/all of their config
Throws:
com.liferay.portal.SystemException - on error inspecting the page or portlets
javax.portlet.ReadOnlyException - on error updating a portlet's preferences
javax.portlet.ValidatorException - on error saving a portlet's preferences
java.io.IOException - on error saving a portlet's preferences

updateApplicationDataSourceBindings

public static void updateApplicationDataSourceBindings(long applicationId,
                                                       java.lang.String dataSourceId,
                                                       java.lang.String dataSetId,
                                                       boolean maintainPortletPreferences)
                                                throws com.liferay.portal.SystemException,
                                                       javax.portlet.ReadOnlyException,
                                                       javax.portlet.ValidatorException,
                                                       java.io.IOException
Update the data source and/or data set for all portlets present in an application.

Parameters:
applicationId -
dataSourceId -
dataSetId -
maintainPortletPreferences -
Throws:
com.liferay.portal.SystemException
javax.portlet.ReadOnlyException
javax.portlet.ValidatorException
java.io.IOException

updateApplicationDataSourceBindings

public static void updateApplicationDataSourceBindings(long applicationId,
                                                       java.lang.String dataSourceId,
                                                       boolean maintainPortletPreferences)
                                                throws com.liferay.portal.SystemException,
                                                       javax.portlet.ReadOnlyException,
                                                       javax.portlet.ValidatorException,
                                                       java.io.IOException
Update the dataSourceId for all portlets present in an application.

Parameters:
groupId -
dataSourceId -
Throws:
com.liferay.portal.SystemException
javax.portlet.ReadOnlyException
java.io.IOException
javax.portlet.ValidatorException

updateApplicationDataSourceBindings

public static void updateApplicationDataSourceBindings(com.liferay.portal.model.Group group)
                                                throws com.liferay.portal.SystemException,
                                                       javax.portlet.ReadOnlyException,
                                                       javax.portlet.ValidatorException,
                                                       java.io.IOException
Wrapper for implementation above when setting all portlets to the same datasource.

Parameters:
group -
Throws:
com.liferay.portal.SystemException
javax.portlet.ReadOnlyException
javax.portlet.ValidatorException
java.io.IOException

updateApplicationDataSourceBindings

public static void updateApplicationDataSourceBindings(long applicationId,
                                                       java.lang.String dataSourceId)
                                                throws com.liferay.portal.SystemException,
                                                       javax.portlet.ReadOnlyException,
                                                       javax.portlet.ValidatorException,
                                                       java.io.IOException
Throws:
com.liferay.portal.SystemException
javax.portlet.ReadOnlyException
javax.portlet.ValidatorException
java.io.IOException

updateApplicationDataSourceBindings

public static void updateApplicationDataSourceBindings(com.liferay.portal.model.Group group,
                                                       boolean maintainPortletPreferences)
                                                throws com.liferay.portal.SystemException,
                                                       javax.portlet.ReadOnlyException,
                                                       javax.portlet.ValidatorException,
                                                       java.io.IOException
Throws:
com.liferay.portal.SystemException
javax.portlet.ReadOnlyException
javax.portlet.ValidatorException
java.io.IOException

getPortletIdList

public static java.util.List<java.lang.String> getPortletIdList(com.liferay.portal.model.Layout layout,
                                                                java.lang.String containerPortletId)
                                                         throws com.liferay.portal.SystemException
Get the list of all portletIds present in the passed layout. If containerPortletId is provided, then the list of portlets present inside the corresponding containerPortlet is returned.

Parameters:
layout -
containerPortletId - - PortletId of the container portlet. This value can be null.
Returns:
Throws:
com.liferay.portal.SystemException

portletIsContainer

public static boolean portletIsContainer(com.liferay.portal.model.Portlet portlet)
Check if the portlet is a container portlet.

Parameters:
portlet -
Returns:

updateGroup

public static com.liferay.portal.model.Group updateGroup(javax.portlet.PortletRequest request)
                                                  throws java.lang.Exception
Throws:
java.lang.Exception

updateGroup

public static com.liferay.portal.model.Group updateGroup(javax.portlet.PortletRequest request,
                                                         boolean resetPagesPermission)
                                                  throws java.lang.Exception
Throws:
java.lang.Exception

validateAndRepairDataSourceBindings

public static void validateAndRepairDataSourceBindings(long applicationId,
                                                       boolean maintainPortletPreferences)
                                                throws com.liferay.portal.SystemException,
                                                       javax.portlet.ReadOnlyException,
                                                       javax.portlet.ValidatorException,
                                                       java.io.IOException,
                                                       com.liferay.portal.PortalException
This utility method will loop over all pages and portlets to make sure that the portlet datasource is in the family of the application's datasource. This correction can be necessary when importing lars. If the portlet datasource is in the same family, nothing is changed. If the portlet data source is in a different family it is rebound to the default. A flag controls if the portlet preferences are wiped.

Parameters:
applicationId - - groupId or applicationId of the application to be corrected
maintainPortletPreferences - - should the portlet maintain configuration even if changing datasource binding.
Throws:
com.liferay.portal.SystemException
javax.portlet.ReadOnlyException
javax.portlet.ValidatorException
java.io.IOException
com.liferay.portal.PortalException