Interface StagedModelDataHandler<T extends StagedModel>

All Known Implementing Classes:
BaseStagedModelDataHandler

public interface StagedModelDataHandler<T extends StagedModel>
Author:
Máté Thurzó, Daniel Kocsis, Zsolt Berentey
  • Method Details

    • deleteStagedModel

      void deleteStagedModel(String uuid, long groupId, String className, String extraData) throws PortalException
      Deletes the staged model matching the parameters. This method is called when deletions are imported.
      Parameters:
      uuid - the staged model's UUID
      groupId - the primary key of the entity's group
      className - the staged model's class name
      extraData - the extra data containing useful information about the staged model. This information makes the staged model easier to identify and fetch for deletion. It is populated when a deletion system event is added, usually in the *LocalServiceImpl class of the model.
      Throws:
      PortalException - if a portal exception occurred
    • deleteStagedModel

      void deleteStagedModel(T stagedModel) throws PortalException
      Deletes the staged model. This method is called when deletions are imported.
      Parameters:
      stagedModel - the staged model to delete
      Throws:
      PortalException - if a portal exception occurred
    • exportStagedModel

      void exportStagedModel(PortletDataContext portletDataContext, T stagedModel) throws PortletDataException
      Exports the staged model and its references. See the exportStagedModel(PortletDataContext, T) method for a reference implementation. Refrain from overriding this method; instead, override the BaseStagedModelDataHandler#doExportStagedModel(PortletDataContext, T) method.
      Parameters:
      portletDataContext - the portlet data context of the current process
      stagedModel - the staged model to export
      Throws:
      PortletDataException - if a portlet data exception occurred
    • fetchMissingReference

      T fetchMissingReference(String uuid, long groupId)
      Returns a reference of the staged model. This method is typically used in validation and import methods.
      Parameters:
      uuid - the reference's UUID
      groupId - the primary key of the group
      Returns:
      a reference of the staged model
    • fetchStagedModelByUuidAndGroupId

      T fetchStagedModelByUuidAndGroupId(String uuid, long groupId)
      Returns the staged model with the UUID and group. This method is used in cases with grouped models.
      Parameters:
      uuid - the staged model's UUID
      groupId - the primary key of the group
      Returns:
      the staged model with the UUID and group
    • fetchStagedModelsByUuidAndCompanyId

      List<T> fetchStagedModelsByUuidAndCompanyId(String uuid, long companyId)
      Returns the staged models with the UUID and company.
      Parameters:
      uuid - the staged model's UUID
      companyId - the primary key of the company
      Returns:
      the staged models with the UUID and company
    • getClassNames

      String[] getClassNames()
      Returns the class names of the models the data handler handles.
      Returns:
      the class names of the models the data handler handles
    • getDisplayName

      String getDisplayName(T stagedModel)
      Returns the staged model's display name. The display name is presented in the UI so users can follow the export/import process.
      Parameters:
      stagedModel - the staged model from which to extract the display name
      Returns:
      the staged model's display name
    • getExportableStatuses

      int[] getExportableStatuses()
      Returns the workflow statuses that are used as filters during the export process.
      Returns:
      the workflow statuses that are used as filters during the export process
    • getReferenceAttributes

      Map<String,String> getReferenceAttributes(PortletDataContext portletDataContext, T stagedModel)
      Returns the attributes that are automatically merged into the XML element of the staged model reference. These attributes are available during the import process in, for example, the importMissingReference(PortletDataContext, Element) and validateReference(PortletDataContext, Element) methods.
      Parameters:
      portletDataContext - the current process's portlet data context
      stagedModel - the staged model for which to get attributes
      Returns:
      the attributes for the staged model
    • importMissingReference

      void importMissingReference(PortletDataContext portletDataContext, Element referenceElement) throws PortletDataException
      Maps the ID of the existing staged model to the old ID in the reference element. When a reference is exported as missing, the Data Handler framework calls this method during the import process and updates the new primary key map in the portlet data context.
      Parameters:
      portletDataContext - the portlet data context of the current process
      referenceElement - the XML element that contains information about the staged model reference
      Throws:
      PortletDataException - if a portlet data exception occurred
    • importMissingReference

      void importMissingReference(PortletDataContext portletDataContext, String uuid, long groupId, long classPK) throws PortletDataException
      Maps the ID of the existing staged model to the old ID in the reference element. When the staged model data handler instance extends BaseStagedModelDataHandler, this method is called to override the BaseStagedModelDataHandler.importMissingReference(PortletDataContext, Element) and BaseStagedModelDataHandler.doImportMissingReference(PortletDataContext, Element) methods.
      Parameters:
      portletDataContext - the portlet data context of the current process
      uuid - the staged model's UUID from the reference element
      groupId - the primary key of the entity's group from the reference element
      classPK - the class primary key of the staged model from the reference element
      Throws:
      PortletDataException - if a portlet data exception occurred
      See Also:
    • importStagedModel

      void importStagedModel(PortletDataContext portletDataContext, T stagedModel) throws PortletDataException
      Imports the staged model. All the staged model's references must be imported before this method is called. See the BaseStagedModelDataHandler.importStagedModel(PortletDataContext, StagedModel) method for a reference implementation. Refrain from overriding this method; instead, override the BaseStagedModelDataHandler#doImportStagedModel(PortletDataContext, T) method.
      Parameters:
      portletDataContext - the portlet data context of the current process
      stagedModel - the staged model to import
      Throws:
      PortletDataException - if a portlet data exception occurred
    • isEnabled

      default boolean isEnabled(long companyId)
    • restoreStagedModel

      void restoreStagedModel(PortletDataContext portletDataContext, T stagedModel) throws PortletDataException
      Restores the staged model from the trash. This method is called during the import process to ensure the imported staged model is not in the trash. See the BaseStagedModelDataHandler.restoreStagedModel(PortletDataContext, StagedModel) method for a reference implementation. Refrain from overriding this method; instead, override the BaseStagedModelDataHandler.doRestoreStagedModel(PortletDataContext, StagedModel) method.
      Parameters:
      portletDataContext - the portlet data context of the current process
      stagedModel - the staged model to restore from the trash
      Throws:
      PortletDataException - if a portlet data exception occurred
    • validateReference

      boolean validateReference(PortletDataContext portletDataContext, Element referenceElement)
      Returns true if the staged model reference validation is successful.
      Parameters:
      portletDataContext - the portlet data context of the current process
      referenceElement - the XML element that contains information about the reference
      Returns:
      true if the reference validation is successful; false otherwise