Liferay 6.2-ce-ga5

com.liferay.portal.kernel.lar
Interface PortletDataHandler

All Known Subinterfaces:
PortletDataHandler
All Known Implementing Classes:
BasePortletDataHandler, BasePortletDataHandler, DefaultConfigurationPortletDataHandler

public interface PortletDataHandler

A PortletDataHandler is a special class capable of exporting and importing portlet specific data to a Liferay Archive file (LAR) when a site's layouts are exported or imported. PortletDataHandlers are defined by placing a portlet-data-handler-class element in the portlet section of the liferay-portlet.xml file.


Method Summary
 PortletPreferences deleteData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences)
          Deletes the data created by the portlet.
 String exportData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences)
          Returns a string of data to be placed in the <portlet-data> section of the LAR file.
 DataLevel getDataLevel()
           
 String[] getDataPortletPreferences()
          Returns an array of the portlet preferences that reference data.
 StagedModelType[] getDeletionSystemEventStagedModelTypes()
           
 PortletDataHandlerControl[] getExportConfigurationControls(long companyId, long groupId, Portlet portlet, boolean privateLayout)
           
 PortletDataHandlerControl[] getExportConfigurationControls(long companyId, long groupId, Portlet portlet, long plid, boolean privateLayout)
           
 PortletDataHandlerControl[] getExportControls()
          Returns an array of the controls defined for this data handler.
 PortletDataHandlerControl[] getExportMetadataControls()
          Returns an array of the metadata controls defined for this data handler.
 long getExportModelCount(ManifestSummary manifestSummary)
           
 PortletDataHandlerControl[] getImportConfigurationControls(Portlet portlet, ManifestSummary manifestSummary)
           
 PortletDataHandlerControl[] getImportConfigurationControls(String[] configurationPortletOptions)
           
 PortletDataHandlerControl[] getImportControls()
          Returns an array of the controls defined for this data handler.
 PortletDataHandlerControl[] getImportMetadataControls()
          Returns an array of the metadata controls defined for this data handler.
 String getPortletId()
           
 PortletPreferences importData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences, String data)
          Handles any special processing of the data when the portlet is imported into a new layout.
 boolean isDataLocalized()
           
 boolean isDataPortalLevel()
           
 boolean isDataPortletInstanceLevel()
           
 boolean isDataSiteLevel()
           
 boolean isDisplayPortlet()
           
 boolean isPublishToLiveByDefault()
          Returns whether the data exported by this handler should be included by default when publishing to live.
 boolean isSupportsDataStrategyCopyAsNew()
           
 void prepareManifestSummary(PortletDataContext portletDataContext)
           
 void prepareManifestSummary(PortletDataContext portletDataContext, PortletPreferences portletPreferences)
           
 PortletPreferences processExportPortletPreferences(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences)
           
 PortletPreferences processImportPortletPreferences(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences)
           
 void setPortletId(String portletId)
           
 

Method Detail

deleteData

PortletPreferences deleteData(PortletDataContext portletDataContext,
                              String portletId,
                              PortletPreferences portletPreferences)
                              throws PortletDataException
Deletes the data created by the portlet. Can optionally return a modified version of preferences if it contains reference to data that does not exist anymore.

Parameters:
portletDataContext - the context of the data deletion
portletId - the portlet ID of the portlet
portletPreferences - the portlet preferences of the portlet
Returns:
A modified version of portlet preferences that should be saved. Null if the portlet preferences were unmodified by this data handler.
Throws:
PortletDataException - if a portlet data exception occurred

exportData

String exportData(PortletDataContext portletDataContext,
                  String portletId,
                  PortletPreferences portletPreferences)
                  throws PortletDataException
Returns a string of data to be placed in the <portlet-data> section of the LAR file. This data will be passed as the data parameter of importData().

Parameters:
portletDataContext - the context of the data export
portletId - the portlet ID of the portlet
portletPreferences - the portlet preferences of the portlet
Returns:
A string of data to be placed in the LAR. It may be XML, but not necessarily. Null should be returned if no portlet data is to be written out.
Throws:
PortletDataException - if a portlet data exception occurred

getDataLevel

DataLevel getDataLevel()

getDataPortletPreferences

String[] getDataPortletPreferences()
Returns an array of the portlet preferences that reference data. These preferences should only be updated if the referenced data is imported.

Returns:
A String array

getDeletionSystemEventStagedModelTypes

StagedModelType[] getDeletionSystemEventStagedModelTypes()

getExportConfigurationControls

PortletDataHandlerControl[] getExportConfigurationControls(long companyId,
                                                           long groupId,
                                                           Portlet portlet,
                                                           boolean privateLayout)
                                                           throws Exception
Throws:
Exception

getExportConfigurationControls

PortletDataHandlerControl[] getExportConfigurationControls(long companyId,
                                                           long groupId,
                                                           Portlet portlet,
                                                           long plid,
                                                           boolean privateLayout)
                                                           throws Exception
Throws:
Exception

getExportControls

PortletDataHandlerControl[] getExportControls()
                                              throws PortletDataException
Returns an array of the controls defined for this data handler. These controls enable the developer to create fine grained controls over export behavior. The controls are rendered in the export UI.

Returns:
an array of PortletDataHandlerControls
Throws:
PortletDataException - if a portlet data exception occurred

getExportMetadataControls

PortletDataHandlerControl[] getExportMetadataControls()
                                                      throws PortletDataException
Returns an array of the metadata controls defined for this data handler. These controls enable the developer to create fine grained controls over export behavior of metadata such as tags, categories, ratings or comments. The controls are rendered in the export UI.

Returns:
an array of PortletDataHandlerControls
Throws:
PortletDataException - if a portlet data exception occurred

getExportModelCount

long getExportModelCount(ManifestSummary manifestSummary)

getImportConfigurationControls

PortletDataHandlerControl[] getImportConfigurationControls(Portlet portlet,
                                                           ManifestSummary manifestSummary)

getImportConfigurationControls

PortletDataHandlerControl[] getImportConfigurationControls(String[] configurationPortletOptions)

getImportControls

PortletDataHandlerControl[] getImportControls()
                                              throws PortletDataException
Returns an array of the controls defined for this data handler. These controls enable the developer to create fine grained controls over import behavior. The controls are rendered in the import UI.

Returns:
An array of PortletDataHandlerControls
Throws:
PortletDataException - if a portlet data exception occurred

getImportMetadataControls

PortletDataHandlerControl[] getImportMetadataControls()
                                                      throws PortletDataException
Returns an array of the metadata controls defined for this data handler. These controls enable the developer to create fine grained controls over import behavior of metadata such as tags, categories, ratings or comments. The controls are rendered in the export UI.

Returns:
an array of PortletDataHandlerControls
Throws:
PortletDataException - if a portlet data exception occurred

getPortletId

String getPortletId()

importData

PortletPreferences importData(PortletDataContext portletDataContext,
                              String portletId,
                              PortletPreferences portletPreferences,
                              String data)
                              throws PortletDataException
Handles any special processing of the data when the portlet is imported into a new layout. Can optionally return a modified version of preferences to be saved in the new portlet.

Parameters:
portletDataContext - the context of the data import
portletId - the portlet ID of the portlet
portletPreferences - the portlet preferences of the portlet
data - the string data that was returned by exportData()
Returns:
A modified version of portlet preferences that should be saved. Null if the portlet preferences were unmodified by this data handler.
Throws:
PortletDataException - if a portlet data exception occurred

isDataLocalized

boolean isDataLocalized()

isDataPortalLevel

boolean isDataPortalLevel()

isDataPortletInstanceLevel

boolean isDataPortletInstanceLevel()

isDataSiteLevel

boolean isDataSiteLevel()

isDisplayPortlet

boolean isDisplayPortlet()

isPublishToLiveByDefault

boolean isPublishToLiveByDefault()
Returns whether the data exported by this handler should be included by default when publishing to live. This should only be true for data that is meant to be managed in an staging environment such as CMS content, but not for data meant to be input by users such as wiki pages or message board posts.

Returns:
true to publish to live by default

isSupportsDataStrategyCopyAsNew

boolean isSupportsDataStrategyCopyAsNew()

prepareManifestSummary

void prepareManifestSummary(PortletDataContext portletDataContext)
                            throws PortletDataException
Throws:
PortletDataException

prepareManifestSummary

void prepareManifestSummary(PortletDataContext portletDataContext,
                            PortletPreferences portletPreferences)
                            throws PortletDataException
Throws:
PortletDataException

processExportPortletPreferences

PortletPreferences processExportPortletPreferences(PortletDataContext portletDataContext,
                                                   String portletId,
                                                   PortletPreferences portletPreferences)
                                                   throws PortletDataException
Throws:
PortletDataException

processImportPortletPreferences

PortletPreferences processImportPortletPreferences(PortletDataContext portletDataContext,
                                                   String portletId,
                                                   PortletPreferences portletPreferences)
                                                   throws PortletDataException
Throws:
PortletDataException

setPortletId

void setPortletId(String portletId)

Liferay 6.2-ce-ga5