Interface PortletDataHandler
- All Known Implementing Classes:
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.- Author:
- Raymond Augé, Joel Kozikowski, Bruno Farache
-
Method Summary
Modifier and TypeMethodDescriptionaddDefaultData
(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences) Returns the portlet's preferences with default data added.deleteData
(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences) Deletes the data created by the portlet.exportData
(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences) Returns a string of data to be placed in the <portlet-data> section of the LAR file.default String[]
String[]
Returns an array of the portlet preferences that reference data.getExportConfigurationControls
(long companyId, long groupId, Portlet portlet, boolean privateLayout) getExportConfigurationControls
(long companyId, long groupId, Portlet portlet, long plid, boolean privateLayout) Returns an array of the controls defined for this data handler.Returns an array of the metadata controls defined for this data handler.long
getExportModelCount
(ManifestSummary manifestSummary) Returns the number of entities defined for this data handler that are available for export according to the provided manifest summary, or-1
if no entities are included in the manifest summary.getImportConfigurationControls
(Portlet portlet, ManifestSummary manifestSummary) getImportConfigurationControls
(String[] configurationPortletOptions) Returns an array of the controls defined for this data handler.Returns an array of the metadata controls defined for this data handler.default String
getName()
default String
int
getRank()
Returns the schema version for this data handler, which represents the staging and export/import aspect of a component.default PortletDataHandlerControl[]
Returns an array of the controls defined for this data handler.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.default boolean
default boolean
boolean
boolean
boolean
boolean
boolean
boolean
default boolean
isEnabled
(long companyId) boolean
Returns whether the data exported by this handler should be included by default when publishing to live.boolean
Returnstrue
if the data handler stops operations and rolls back their transactions on operations throwing exceptions.default boolean
isStaged()
default boolean
default boolean
void
prepareManifestSummary
(PortletDataContext portletDataContext) void
prepareManifestSummary
(PortletDataContext portletDataContext, PortletPreferences portletPreferences) void
setPortletId
(String portletId) void
setRank
(int rank) boolean
validateSchemaVersion
(String schemaVersion)
-
Method Details
-
addDefaultData
PortletPreferences addDefaultData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences) throws PortletDataException Returns the portlet's preferences with default data added.- Parameters:
portletDataContext
- the context of the data additionportletId
- the portlet ID of the portletportletPreferences
- the portlet preferences of the portlet- Returns:
- a modified version of the portlet preferences that should be
saved, or
null
if the data handler made no changes to the portlet preferences - Throws:
PortletDataException
- if a portlet data exception occurred
-
deleteData
PortletPreferences deleteData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences) throws PortletDataException Deletes the data created by the portlet. It can optionally return a modified version of the portlet preferences if it contains references to data that no longer exists.- Parameters:
portletDataContext
- the context of the data deletionportletId
- the portlet ID of the portletportletPreferences
- the portlet preferences of the portlet- Returns:
- a modified version of the portlet preferences that should be
saved, or
null
if the data handler made no changes to the portlet preferences - 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 thedata
parameter ofimportData()
.- Parameters:
portletDataContext
- the context of the data exportportletId
- the portlet ID of the portletportletPreferences
- the portlet preferences of the portlet- Returns:
- a string of data to be placed in the LAR, which can be, but not
limited to XML, or
null
if no portlet data is to be written out - Throws:
PortletDataException
- if a portlet data exception occurred
-
getClassNames
-
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:
- an array of the portlet preferences that reference data
-
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
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 the controls defined for this data handler
- Throws:
PortletDataException
- if a portlet data exception occurred
-
getExportMetadataControls
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 the metadata controls defined for this data handler
- Throws:
PortletDataException
- if a portlet data exception occurred
-
getExportModelCount
Returns the number of entities defined for this data handler that are available for export according to the provided manifest summary, or-1
if no entities are included in the manifest summary.- Parameters:
manifestSummary
- the manifest summary listing the number of exportable entities- Returns:
- the number of entities that are available for export according to
the manifest summary, or
-1
if no entities are included in the manifest summary
-
getImportConfigurationControls
PortletDataHandlerControl[] getImportConfigurationControls(Portlet portlet, ManifestSummary manifestSummary) -
getImportConfigurationControls
-
getImportControls
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 the controls defined for this data handler
- Throws:
PortletDataException
- if a portlet data exception occurred
-
getImportMetadataControls
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 the metadata controls defined for this data handler
- Throws:
PortletDataException
- if a portlet data exception occurred
-
getName
-
getNamespace
-
getPortletId
String getPortletId() -
getRank
int getRank() -
getResourceName
String getResourceName() -
getSchemaVersion
String getSchemaVersion()Returns the schema version for this data handler, which represents the staging and export/import aspect of a component. The schema version is used to perform component related validation before importing data. Validating the schema version avoids broken data when importing, which is typically caused by import failures due to data schema inconsistency.Schema versions follow the semantic versioning format
major.minor.bugfix
. The schema version is added to the LAR file for each application being processed. During import, the current schema version in an environment is compared to the schema version in the LAR file. The generic semantic versioning rules apply during this comparison:- The major version has to be an exact match
- The minor version is backwards compatible for the same major version
- The bug fix is always compatible in the context of the two other version numbers
Examples:
- Importing 2.0.0 into 3.0.0 is not compatible
- Importing 3.0.0 into 3.0.0 is compatible
- Importing 4.6.2 into 4.9.0 is compatible
- Importing 2.1.3 into 2.1.6 is compatible
- Returns:
- the portlet data handler's schema version
-
getServiceName
String getServiceName() -
getStagingControls
Returns an array of the controls defined for this data handler. These controls enable the developer to create fine grained controls over staging publication behavior. The controls are rendered in the publish UI.- Returns:
- an array of the controls defined for this data handler
-
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 ofpreferences
to be saved in the new portlet.- Parameters:
portletDataContext
- the context of the data importportletId
- the portlet ID of the portletportletPreferences
- the portlet preferences of the portletdata
- the string data that was returned byexportData()
- Returns:
- a modified version of the portlet preferences that should be
saved, or
null
if the data handler made no changes to the portlet preferences - Throws:
PortletDataException
- if a portlet data exception occurred
-
isCompany
default boolean isCompany() -
isConfigurationEnabled
default boolean isConfigurationEnabled() -
isDataAlwaysStaged
boolean isDataAlwaysStaged() -
isDataLocalized
boolean isDataLocalized() -
isDataPortalLevel
boolean isDataPortalLevel() -
isDataPortletInstanceLevel
boolean isDataPortletInstanceLevel() -
isDataSiteLevel
boolean isDataSiteLevel() -
isDisplayPortlet
boolean isDisplayPortlet() -
isEnabled
default boolean isEnabled(long companyId) -
isPublishToLiveByDefault
boolean isPublishToLiveByDefault()Returns whether the data exported by this handler should be included by default when publishing to live. This should only betrue
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
if the data exported by this handler should be included by default when publishing to live;false
otherwise
-
isRollbackOnException
boolean isRollbackOnException()Returnstrue
if the data handler stops operations and rolls back their transactions on operations throwing exceptions.- Returns:
true
if the data handler stops operations and rolls back their transactions on operations throwing exceptions;false
otherwise
-
isStaged
default boolean isStaged() -
isSupportsDataStrategyCopyAsNew
default boolean isSupportsDataStrategyCopyAsNew() -
isSupportsDataStrategyMirrorWithOverwriting
default boolean isSupportsDataStrategyMirrorWithOverwriting() -
prepareManifestSummary
- Throws:
PortletDataException
-
prepareManifestSummary
void prepareManifestSummary(PortletDataContext portletDataContext, PortletPreferences portletPreferences) throws PortletDataException - Throws:
PortletDataException
-
setPortletId
-
setRank
void setRank(int rank) -
validateSchemaVersion
-