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 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 addition
      portletId - the portlet ID of the portlet
      portletPreferences - 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 deletion
      portletId - the portlet ID of the portlet
      portletPreferences - 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 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, 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

      default String[] 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

      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 the controls defined for this data handler
      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 the metadata controls defined for this data handler
      Throws:
      PortletDataException - if a portlet data exception occurred
    • getExportModelCount

      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.
      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

      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 the controls defined for this data handler
      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 the metadata controls defined for this data handler
      Throws:
      PortletDataException - if a portlet data exception occurred
    • getName

      default String getName()
    • getNamespace

      default String 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

      default PortletDataHandlerControl[] 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 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 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 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 if the data exported by this handler should be included by default when publishing to live; false otherwise
    • isRollbackOnException

      boolean isRollbackOnException()
      Returns true 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

      void prepareManifestSummary(PortletDataContext portletDataContext) throws PortletDataException
      Throws:
      PortletDataException
    • prepareManifestSummary

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

      void setPortletId(String portletId)
    • setRank

      void setRank(int rank)
    • validateSchemaVersion

      boolean validateSchemaVersion(String schemaVersion)