Liferay 6.0.5

com.liferay.portal.kernel.lar
Interface PortletDataHandler

All Known Subinterfaces:
PortletDataHandler
All Known Implementing Classes:
BasePortletDataHandler, BasePortletDataHandler, BlogsPortletDataHandlerImpl, BookmarksPortletDataHandlerImpl, CalendarPortletDataHandlerImpl, DLDisplayPortletDataHandlerImpl, DLPortletDataHandlerImpl, IGPortletDataHandlerImpl, JournalContentPortletDataHandlerImpl, JournalPortletDataHandlerImpl, MBPortletDataHandlerImpl, PageCommentsPortletDataHandlerImpl, PageRatingsPortletDataHandlerImpl, PollsDisplayPortletDataHandlerImpl, PollsPortletDataHandlerImpl, WikiDisplayPortletDataHandlerImpl, WikiPortletDataHandlerImpl

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 community'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 context, String portletId, PortletPreferences preferences)
          Deletes the data created by the portlet.
 String exportData(PortletDataContext context, String portletId, PortletPreferences preferences)
          Returns a string of data to be placed in the <portlet-data> section of the LAR file.
 PortletDataHandlerControl[] getExportControls()
          Returns an array of the controls defined for this data handler.
 PortletDataHandlerControl[] getImportControls()
          Returns an array of the controls defined for this data handler.
 PortletPreferences importData(PortletDataContext context, String portletId, PortletPreferences preferences, String data)
          Handles any special processing of the data when the portlet is imported into a new layout.
 boolean isAlwaysExportable()
          Returns true to allow the user to export data for this portlet even though it may not belong to any pages.
 boolean isPublishToLiveByDefault()
          Returns whether the data exported by this handler should be included by default when publishing to live.
 

Method Detail

deleteData

PortletPreferences deleteData(PortletDataContext context,
                              String portletId,
                              PortletPreferences preferences)
                              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:
context - the context of the data deletion
portletId - the portlet id of the portlet
preferences - the portlet preferences of the portlet
Returns:
A modified version of preferences that should be saved. Null if the preferences were unmodified by this data handler.
Throws:
PortletDataException

exportData

String exportData(PortletDataContext context,
                  String portletId,
                  PortletPreferences preferences)
                  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:
context - the context of the data export
portletId - the portlet id of the portlet
preferences - 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

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

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

importData

PortletPreferences importData(PortletDataContext context,
                              String portletId,
                              PortletPreferences preferences,
                              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:
context - the context of the data import
portletId - the portlet id of the portlet
preferences - the portlet preferences of the portlet
data - the string data that was returned by exportData()
Returns:
A modified version of preferences that should be saved. Null if the preferences were unmodified by this data handler.
Throws:
PortletDataException

isAlwaysExportable

boolean isAlwaysExportable()
Returns true to allow the user to export data for this portlet even though it may not belong to any pages. See LPS-1624.

Returns:
true to allow the user to export data for this portlet even though it may not belong to any pages

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

Liferay 6.0.5