public abstract class PortletIxHelper
extends java.lang.Object
PortletType
, using the
optional portlet type extension PortletType.EXTENSION_PORTLET_IX_HELPER_CLASS
. The ix
helper class can be registered along with the portlet type definition in
portlet-type-config.xml
(see that file for examples of this).
It is not required to implement a custom helper class for every portlet type. If a portlet type does not specify an ix helper class, portlets of that type will still be exported & imported correctly, but the portlet parameters will NOT be exported/imported. Not importing the parameters will result in the portlet being un-configured after it is imported in the target system (unless the portlet has no configuration in the first place or has a fallback configuration, such as the My Tasks portlet).
In order to enable the export & import of portlet parameters, there are 2 options:
DefaultPortletIxHelper
should be specified as the ix helper for that portlet type; this is all that's needed for
the portlet parameters to be exported & imported.
replaceIdsWithUuids(java.util.Map<java.lang.String, java.lang.Object>, com.appiancorp.suiteapi.ix.data.portlet.PortletIxHelper.ExportBinder)
and replaceUuidsWithIds(java.util.Map<java.lang.String, java.lang.Object>, com.appiancorp.suiteapi.ix.data.portlet.PortletIxHelper.ImportBinder)
.
Additionally, a custom portlet ix helper class can be implemented in order to export & import
custom portlet data (data that is not stored within the
portlet parameters map
). In that case, the custom helper needs
to implement these methods: exportExtraData(java.lang.Long, com.appiancorp.services.ServiceContext)
/exportResources(java.lang.Long, com.appiancorp.services.ServiceContext, com.appiancorp.suiteapi.ix.data.portlet.PortletIxHelper.ResourceExporter)
and
importExtraDataAndResources(java.lang.Long, java.util.Map<java.lang.String, java.lang.String>, com.appiancorp.services.ServiceContext, com.appiancorp.suiteapi.ix.data.portlet.PortletIxHelper.ResourceImporter)
. This can be used to enable import/export of binary files
and [String, String] key-value pairs.
Modifier and Type | Class and Description |
---|---|
static class |
PortletIxHelper.ExportBinder
Allows mapping local ids to UUIDs.
|
static class |
PortletIxHelper.ImportBinder
Allows mapping UUIDs to local ids.
|
static class |
PortletIxHelper.ResourceExporter |
static class |
PortletIxHelper.ResourceImporter |
Modifier | Constructor and Description |
---|---|
protected |
PortletIxHelper() |
Modifier and Type | Method and Description |
---|---|
protected void |
addDiagnosticMessage(com.appiancorp.ix.diagnostics.Diagnostic d)
Adds a message (such as a warning) that will be displayed to the
user after the overall export or import operation is complete.
|
java.util.Map<java.lang.String,java.lang.String> |
exportExtraData(java.lang.Long portletId,
ServiceContext sc)
Retrieves any custom portlet data to be exported.
|
void |
exportResources(java.lang.Long portletId,
ServiceContext sc,
PortletIxHelper.ResourceExporter re)
Exports portlet resources (such as binary files).
|
static PortletIxHelper |
getInstance(java.lang.Class<? extends PortletIxHelper> portletIxHelperClass,
com.appiancorp.ix.Operation op,
java.lang.Long portletId,
java.lang.String portletUuid,
com.appiancorp.ix.diagnostics.Diagnostics d)
|
static PortletIxHelper |
getInstance(java.lang.Class<? extends PortletIxHelper> portletIxHelperClass,
com.appiancorp.ix.Operation op,
java.lang.Long portletId,
java.lang.String portletUuid,
com.appiancorp.ix.diagnostics.Diagnostics d,
ServiceContext sc) |
protected ServiceContext |
getServiceContext()
Returns the current service context.
|
protected com.appiancorp.ix.TypedId<com.appiancorp.ix.data.PortletHaul,java.lang.Long,java.lang.String> |
getTypedId()
Returns the id of the portlet that this helper is processing.
|
void |
importExtraDataAndResources(java.lang.Long portletId,
java.util.Map<java.lang.String,java.lang.String> extraData,
ServiceContext sc,
PortletIxHelper.ResourceImporter ri)
Stores any custom portlet data exported using
exportExtraData(java.lang.Long, com.appiancorp.services.ServiceContext) and
exportResources(Long, ServiceContext, ResourceExporter) . |
abstract void |
replaceIdsWithUuids(java.util.Map<java.lang.String,java.lang.Object> portletParamsMap,
PortletIxHelper.ExportBinder b)
Replaces all local ids within the portlet parameters with UUIDs.
|
abstract void |
replaceUuidsWithIds(java.util.Map<java.lang.String,java.lang.Object> portletParamsMap,
PortletIxHelper.ImportBinder b)
Replaces all UUIDs within the portlet parameters with local ids.
|
@Deprecated public static PortletIxHelper getInstance(java.lang.Class<? extends PortletIxHelper> portletIxHelperClass, com.appiancorp.ix.Operation op, java.lang.Long portletId, java.lang.String portletUuid, com.appiancorp.ix.diagnostics.Diagnostics d)
public static PortletIxHelper getInstance(java.lang.Class<? extends PortletIxHelper> portletIxHelperClass, com.appiancorp.ix.Operation op, java.lang.Long portletId, java.lang.String portletUuid, com.appiancorp.ix.diagnostics.Diagnostics d, ServiceContext sc)
protected ServiceContext getServiceContext()
protected com.appiancorp.ix.TypedId<com.appiancorp.ix.data.PortletHaul,java.lang.Long,java.lang.String> getTypedId()
protected void addDiagnosticMessage(com.appiancorp.ix.diagnostics.Diagnostic d)
public abstract void replaceIdsWithUuids(java.util.Map<java.lang.String,java.lang.Object> portletParamsMap, PortletIxHelper.ExportBinder b) throws AppianException
PortletIxHelper.ExportBinder
.portletParamsMap
- The map of portlet parameters (see Portlet.getParameters()
).b
- API for mapping local ids to uuids.AppianException
- If the export of this portlet should be failed (the export driver
will automatically handle the exception: it will add the portlet to the failed list and
proceed with the export of other objects).public abstract void replaceUuidsWithIds(java.util.Map<java.lang.String,java.lang.Object> portletParamsMap, PortletIxHelper.ImportBinder b) throws AppianException
replaceIdsWithUuids(Map, ExportBinder)
. The local id
corresponding to each UUID should be retrieved using the provided PortletIxHelper.ImportBinder
.portletParamsMap
- The map of portlet parameters (see Portlet.getParameters()
).b
- API for mapping uuids to local ids.AppianException
- If the import of this portlet should be failed (the import driver
will automatically handle the exception: it will add the portlet to the failed list and
proceed with the import of other objects).public java.util.Map<java.lang.String,java.lang.String> exportExtraData(java.lang.Long portletId, ServiceContext sc) throws AppianException
portletId
- The id of the portlet being exported.sc
- The service context of the user performing the export.#importExtraData
during import of the portlet.AppianException
- If the export of this portlet should be failed (the export driver
will automatically handle the exception: it will add the portlet to the failed list and
proceed with the export of other objects).public void exportResources(java.lang.Long portletId, ServiceContext sc, PortletIxHelper.ResourceExporter re) throws AppianException
portletId
- The id of the portlet being exported.sc
- The service context of the user performing the export.re
- API for exporting resources.AppianException
- If the export of this portlet should be failed (the export driver
will automatically handle the exception: it will add the portlet to the failed list and
proceed with the export of other objects).public void importExtraDataAndResources(java.lang.Long portletId, java.util.Map<java.lang.String,java.lang.String> extraData, ServiceContext sc, PortletIxHelper.ResourceImporter ri) throws AppianException
exportExtraData(java.lang.Long, com.appiancorp.services.ServiceContext)
and
exportResources(Long, ServiceContext, ResourceExporter)
.portletId
- The id of the portlet being imported.extraData
- The map data exported using exportExtraData(java.lang.Long, com.appiancorp.services.ServiceContext)
.sc
- The service context of the user performing the import.ri
- API for importing resources.AppianException
- If the import of this portlet should be failed (the import driver
will automatically handle the exception: it will add the portlet to the failed list and
proceed with the import of other objects).Copyright © 2003-2024 Appian Corporation. All Rights Reserved.