Liferay 7.0-ce-b4

com.liferay.portlet.exportimport.lar
Class BasePortletDataHandler

java.lang.Object
  extended by com.liferay.portlet.exportimport.lar.BasePortletDataHandler
All Implemented Interfaces:
PortletDataHandler
Direct Known Subclasses:
DefaultConfigurationPortletDataHandler

public abstract class BasePortletDataHandler
extends Object
implements PortletDataHandler


Constructor Summary
BasePortletDataHandler()
           
 
Method Summary
 PortletPreferences addDefaultData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences)
          Returns the portlet's preferences with default data added.
protected  Element addExportDataRootElement(PortletDataContext portletDataContext)
           
protected  Element addImportDataRootElement(PortletDataContext portletDataContext, String data)
           
protected  void addUncheckedModelAdditionCount(PortletDataContext portletDataContext, PortletDataHandlerControl portletDataHandlerControl)
           
 PortletPreferences deleteData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences)
          Deletes the data created by the portlet.
protected  PortletPreferences doAddDefaultData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences)
           
protected  PortletPreferences doDeleteData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences)
           
protected  String doExportData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences)
           
protected  PortletPreferences doImportData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences, String data)
           
protected  void doPrepareManifestSummary(PortletDataContext portletDataContext, PortletPreferences portletPreferences)
           
protected  PortletPreferences doProcessExportPortletPreferences(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences)
           
protected  PortletPreferences doProcessImportPortletPreferences(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences)
           
protected  boolean doValidateSchemaVersion(String schemaVersion)
           
 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.
protected  String getExportDataRootElementString(Element rootElement)
           
 PortletDataHandlerControl[] getExportMetadataControls()
          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.
protected  long getExportModelCount(ManifestSummary manifestSummary, PortletDataHandlerControl[] portletDataHandlerControls)
           
 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()
           
 int getRank()
           
 String getSchemaVersion()
           
 String getServiceName()
           
 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 isDataAlwaysStaged()
           
 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 isRollbackOnException()
          Returns true if the data handler stops operations and rolls back their transactions on operations throwing exceptions.
 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)
           
protected  void setAlwaysExportable(boolean alwaysExportable)
          Deprecated. As of 6.2.0
protected  void setAlwaysStaged(boolean alwaysStaged)
          Deprecated. As of 6.2.0
protected  void setDataAlwaysStaged(boolean dataAlwaysStaged)
           
protected  void setDataLevel(DataLevel dataLevel)
           
protected  void setDataLocalized(boolean dataLocalized)
           
protected  void setDataPortletPreferences(String... dataPortletPreferences)
           
protected  void setDeletionSystemEventStagedModelTypes(StagedModelType... deletionSystemEventStagedModelTypes)
           
protected  void setExportControls(PortletDataHandlerControl... exportControls)
           
protected  void setExportMetadataControls(PortletDataHandlerControl... exportMetadataControls)
           
protected  void setImportControls(PortletDataHandlerControl... importControls)
           
protected  void setImportMetadataControls(PortletDataHandlerControl... importMetadataControls)
           
 void setPortletId(String portletId)
           
protected  void setPublishToLiveByDefault(boolean publishToLiveByDefault)
           
 void setRank(int rank)
           
protected  void setSupportsDataStrategyCopyAsNew(boolean supportsDataStrategyCopyAsNew)
           
 boolean validateSchemaVersion(String schemaVersion)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasePortletDataHandler

public BasePortletDataHandler()
Method Detail

addDefaultData

public PortletPreferences addDefaultData(PortletDataContext portletDataContext,
                                         String portletId,
                                         PortletPreferences portletPreferences)
                                  throws PortletDataException
Description copied from interface: PortletDataHandler
Returns the portlet's preferences with default data added.

Specified by:
addDefaultData in interface PortletDataHandler
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

public PortletPreferences deleteData(PortletDataContext portletDataContext,
                                     String portletId,
                                     PortletPreferences portletPreferences)
                              throws PortletDataException
Description copied from interface: PortletDataHandler
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.

Specified by:
deleteData in interface PortletDataHandler
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

public String exportData(PortletDataContext portletDataContext,
                         String portletId,
                         PortletPreferences portletPreferences)
                  throws PortletDataException
Description copied from interface: PortletDataHandler
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().

Specified by:
exportData in interface PortletDataHandler
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

getDataLevel

public DataLevel getDataLevel()
Specified by:
getDataLevel in interface PortletDataHandler

getDataPortletPreferences

public String[] getDataPortletPreferences()
Description copied from interface: PortletDataHandler
Returns an array of the portlet preferences that reference data. These preferences should only be updated if the referenced data is imported.

Specified by:
getDataPortletPreferences in interface PortletDataHandler
Returns:
an array of the portlet preferences that reference data

getDeletionSystemEventStagedModelTypes

public StagedModelType[] getDeletionSystemEventStagedModelTypes()
Specified by:
getDeletionSystemEventStagedModelTypes in interface PortletDataHandler

getExportConfigurationControls

public PortletDataHandlerControl[] getExportConfigurationControls(long companyId,
                                                                  long groupId,
                                                                  Portlet portlet,
                                                                  boolean privateLayout)
                                                           throws Exception
Specified by:
getExportConfigurationControls in interface PortletDataHandler
Throws:
Exception

getExportConfigurationControls

public PortletDataHandlerControl[] getExportConfigurationControls(long companyId,
                                                                  long groupId,
                                                                  Portlet portlet,
                                                                  long plid,
                                                                  boolean privateLayout)
                                                           throws Exception
Specified by:
getExportConfigurationControls in interface PortletDataHandler
Throws:
Exception

getExportControls

public PortletDataHandlerControl[] getExportControls()
Description copied from interface: PortletDataHandler
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.

Specified by:
getExportControls in interface PortletDataHandler
Returns:
an array of the controls defined for this data handler

getExportMetadataControls

public PortletDataHandlerControl[] getExportMetadataControls()
Description copied from interface: PortletDataHandler
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.

Specified by:
getExportMetadataControls in interface PortletDataHandler
Returns:
an array of the metadata controls defined for this data handler

getExportModelCount

public long getExportModelCount(ManifestSummary manifestSummary)
Description copied from interface: PortletDataHandler
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.

Specified by:
getExportModelCount in interface PortletDataHandler
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

public PortletDataHandlerControl[] getImportConfigurationControls(Portlet portlet,
                                                                  ManifestSummary manifestSummary)
Specified by:
getImportConfigurationControls in interface PortletDataHandler

getImportConfigurationControls

public PortletDataHandlerControl[] getImportConfigurationControls(String[] configurationPortletOptions)
Specified by:
getImportConfigurationControls in interface PortletDataHandler

getImportControls

public PortletDataHandlerControl[] getImportControls()
Description copied from interface: PortletDataHandler
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.

Specified by:
getImportControls in interface PortletDataHandler
Returns:
an array of the controls defined for this data handler

getImportMetadataControls

public PortletDataHandlerControl[] getImportMetadataControls()
Description copied from interface: PortletDataHandler
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.

Specified by:
getImportMetadataControls in interface PortletDataHandler
Returns:
an array of the metadata controls defined for this data handler

getPortletId

public String getPortletId()
Specified by:
getPortletId in interface PortletDataHandler

getRank

public int getRank()
Specified by:
getRank in interface PortletDataHandler

getSchemaVersion

public String getSchemaVersion()
Specified by:
getSchemaVersion in interface PortletDataHandler

getServiceName

public String getServiceName()
Specified by:
getServiceName in interface PortletDataHandler

importData

public PortletPreferences importData(PortletDataContext portletDataContext,
                                     String portletId,
                                     PortletPreferences portletPreferences,
                                     String data)
                              throws PortletDataException
Description copied from interface: PortletDataHandler
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.

Specified by:
importData in interface PortletDataHandler
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

isDataAlwaysStaged

public boolean isDataAlwaysStaged()
Specified by:
isDataAlwaysStaged in interface PortletDataHandler

isDataLocalized

public boolean isDataLocalized()
Specified by:
isDataLocalized in interface PortletDataHandler

isDataPortalLevel

public boolean isDataPortalLevel()
Specified by:
isDataPortalLevel in interface PortletDataHandler

isDataPortletInstanceLevel

public boolean isDataPortletInstanceLevel()
Specified by:
isDataPortletInstanceLevel in interface PortletDataHandler

isDataSiteLevel

public boolean isDataSiteLevel()
Specified by:
isDataSiteLevel in interface PortletDataHandler

isDisplayPortlet

public boolean isDisplayPortlet()
Specified by:
isDisplayPortlet in interface PortletDataHandler

isPublishToLiveByDefault

public boolean isPublishToLiveByDefault()
Description copied from interface: PortletDataHandler
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.

Specified by:
isPublishToLiveByDefault in interface PortletDataHandler
Returns:
true if the data exported by this handler should be included by default when publishing to live; false otherwise

isRollbackOnException

public boolean isRollbackOnException()
Description copied from interface: PortletDataHandler
Returns true if the data handler stops operations and rolls back their transactions on operations throwing exceptions.

Specified by:
isRollbackOnException in interface PortletDataHandler
Returns:
true if the data handler stops operations and rolls back their transactions on operations throwing exceptions; false otherwise

isSupportsDataStrategyCopyAsNew

public boolean isSupportsDataStrategyCopyAsNew()
Specified by:
isSupportsDataStrategyCopyAsNew in interface PortletDataHandler

prepareManifestSummary

public void prepareManifestSummary(PortletDataContext portletDataContext)
                            throws PortletDataException
Specified by:
prepareManifestSummary in interface PortletDataHandler
Throws:
PortletDataException

prepareManifestSummary

public void prepareManifestSummary(PortletDataContext portletDataContext,
                                   PortletPreferences portletPreferences)
                            throws PortletDataException
Specified by:
prepareManifestSummary in interface PortletDataHandler
Throws:
PortletDataException

processExportPortletPreferences

public PortletPreferences processExportPortletPreferences(PortletDataContext portletDataContext,
                                                          String portletId,
                                                          PortletPreferences portletPreferences)
                                                   throws PortletDataException
Specified by:
processExportPortletPreferences in interface PortletDataHandler
Throws:
PortletDataException

processImportPortletPreferences

public PortletPreferences processImportPortletPreferences(PortletDataContext portletDataContext,
                                                          String portletId,
                                                          PortletPreferences portletPreferences)
                                                   throws PortletDataException
Specified by:
processImportPortletPreferences in interface PortletDataHandler
Throws:
PortletDataException

setPortletId

public void setPortletId(String portletId)
Specified by:
setPortletId in interface PortletDataHandler

setRank

public void setRank(int rank)
Specified by:
setRank in interface PortletDataHandler

validateSchemaVersion

public boolean validateSchemaVersion(String schemaVersion)
Specified by:
validateSchemaVersion in interface PortletDataHandler

addExportDataRootElement

protected Element addExportDataRootElement(PortletDataContext portletDataContext)

addImportDataRootElement

protected Element addImportDataRootElement(PortletDataContext portletDataContext,
                                           String data)
                                    throws DocumentException
Throws:
DocumentException

addUncheckedModelAdditionCount

protected void addUncheckedModelAdditionCount(PortletDataContext portletDataContext,
                                              PortletDataHandlerControl portletDataHandlerControl)

doAddDefaultData

protected PortletPreferences doAddDefaultData(PortletDataContext portletDataContext,
                                              String portletId,
                                              PortletPreferences portletPreferences)
                                       throws Exception
Throws:
Exception

doDeleteData

protected PortletPreferences doDeleteData(PortletDataContext portletDataContext,
                                          String portletId,
                                          PortletPreferences portletPreferences)
                                   throws Exception
Throws:
Exception

doExportData

protected String doExportData(PortletDataContext portletDataContext,
                              String portletId,
                              PortletPreferences portletPreferences)
                       throws Exception
Throws:
Exception

doImportData

protected PortletPreferences doImportData(PortletDataContext portletDataContext,
                                          String portletId,
                                          PortletPreferences portletPreferences,
                                          String data)
                                   throws Exception
Throws:
Exception

doPrepareManifestSummary

protected void doPrepareManifestSummary(PortletDataContext portletDataContext,
                                        PortletPreferences portletPreferences)
                                 throws Exception
Throws:
Exception

doProcessExportPortletPreferences

protected PortletPreferences doProcessExportPortletPreferences(PortletDataContext portletDataContext,
                                                               String portletId,
                                                               PortletPreferences portletPreferences)
                                                        throws Exception
Throws:
Exception

doProcessImportPortletPreferences

protected PortletPreferences doProcessImportPortletPreferences(PortletDataContext portletDataContext,
                                                               String portletId,
                                                               PortletPreferences portletPreferences)
                                                        throws Exception
Throws:
Exception

doValidateSchemaVersion

protected boolean doValidateSchemaVersion(String schemaVersion)
                                   throws Exception
Throws:
Exception

getExportDataRootElementString

protected String getExportDataRootElementString(Element rootElement)

getExportModelCount

protected long getExportModelCount(ManifestSummary manifestSummary,
                                   PortletDataHandlerControl[] portletDataHandlerControls)

setAlwaysExportable

@Deprecated
protected void setAlwaysExportable(boolean alwaysExportable)
Deprecated. As of 6.2.0


setAlwaysStaged

@Deprecated
protected void setAlwaysStaged(boolean alwaysStaged)
Deprecated. As of 6.2.0


setDataAlwaysStaged

protected void setDataAlwaysStaged(boolean dataAlwaysStaged)

setDataLevel

protected void setDataLevel(DataLevel dataLevel)

setDataLocalized

protected void setDataLocalized(boolean dataLocalized)

setDataPortletPreferences

protected void setDataPortletPreferences(String... dataPortletPreferences)

setDeletionSystemEventStagedModelTypes

protected void setDeletionSystemEventStagedModelTypes(StagedModelType... deletionSystemEventStagedModelTypes)

setExportControls

protected void setExportControls(PortletDataHandlerControl... exportControls)

setExportMetadataControls

protected void setExportMetadataControls(PortletDataHandlerControl... exportMetadataControls)

setImportControls

protected void setImportControls(PortletDataHandlerControl... importControls)

setImportMetadataControls

protected void setImportMetadataControls(PortletDataHandlerControl... importMetadataControls)

setPublishToLiveByDefault

protected void setPublishToLiveByDefault(boolean publishToLiveByDefault)

setSupportsDataStrategyCopyAsNew

protected void setSupportsDataStrategyCopyAsNew(boolean supportsDataStrategyCopyAsNew)

Liferay 7.0-ce-b4