Class ExportImportPathUtil

Object
com.liferay.exportimport.kernel.lar.ExportImportPathUtil

public class ExportImportPathUtil extends Object
Provides utility methods for generating paths for entities being serialized with the portal's export/import framework.
Since:
6.2
Author:
Máté Thurzó, Daniel Kocsis
  • Field Details

    • PATH_PREFIX_COMPANY

      public static final String PATH_PREFIX_COMPANY
      The company prefix used in generating paths.
      See Also:
    • PATH_PREFIX_GROUP

      public static final String PATH_PREFIX_GROUP
      The group prefix used in generating paths.
      See Also:
    • PATH_PREFIX_PORTLET

      public static final String PATH_PREFIX_PORTLET
      The portlet prefix used in generating paths.
      See Also:
    • PATH_PREFIX_SERVICE

      public static final String PATH_PREFIX_SERVICE
      The service prefix used in generating paths.
      See Also:
  • Constructor Details

    • ExportImportPathUtil

      public ExportImportPathUtil()
  • Method Details

    • getCompanyModelPath

      public static String getCompanyModelPath(long companyId, String className, long classPK)
    • getCompanyModelPath

      public static String getCompanyModelPath(long companyId, String className, Serializable classPK)
    • getExpandoPath

      public static String getExpandoPath(String path)
      Returns the expando-specific path for the entity path. The entity path must include an XML file.

      For example, if you had the entity path of /group/10184/com.liferay.dynamic.data.mapping.kernel.DDMStructure/10951.xml, the returned expando-specific path would be the following:

       
       /group/10184/com.liferay.dynamic.data.mapping.kernel.DDMStructure/10951-expando.xml
       
       

      Parameters:
      path - the previously generated entity path
      Returns:
      the expando-specific path for the entity path
    • getModelPath

      public static String getModelPath(long groupId, String className, long classPK)
    • getModelPath

      public static String getModelPath(long groupId, String className, Serializable classPK)
      Returns a model path based on the group ID, class name, and class PK.

      For example, a model path would resemble the following:

       
       /group/"groupId"/"className"/"classPK".xml
       
       

      Parameters:
      groupId - the group ID of the entity's group
      className - the entity's class name
      classPK - the primary key of the entity
      Returns:
      a model path based on the parameters
    • getModelPath

      public static String getModelPath(PortletDataContext portletDataContext, String className, long classPK)
      Returns a model path based on the group ID, class name, and class PK, where the group ID is queried from the portlet data context. This method uses the source group ID from the context.

      For example, a model path would resemble the following:

       
       /group/"queried groupId"/"className"/"classPK".xml
       
       

      Parameters:
      portletDataContext - the context of the current export/import process
      className - the entity's class name
      classPK - the primary key of the entity
      Returns:
      a model path based on the parameters
      See Also:
    • getModelPath

      public static String getModelPath(PortletDataContext portletDataContext, String className, long classPK, String dependentFileName)
      Returns a model path for the named file related to the entity, having the class name and class PK. The dependent object's file name is appended to the generated prefix.

      For example, a model path would resemble the following:

       
       /group/"queried groupId"/"className"/"classPK"/"dependentFileName"
       
       

      Parameters:
      portletDataContext - the context of the current export/import process
      className - the related entity's class name
      classPK - the primary key of the related entity
      dependentFileName - the dependent object's file name
      Returns:
      a model path for the entity's dependent object
    • getModelPath

      public static String getModelPath(StagedModel stagedModel)
      Returns a model path for the staged model. The group ID, class name, and class PK are queried from the staged model to generate the path.

      For example, a model path would resemble the following:

       
       /group/"queried groupId"/"queried className"/"queried classPK".xml
       
       

      Parameters:
      stagedModel - the staged model the path is needed for
      Returns:
      a model path for the staged model
      See Also:
    • getModelPath

      public static String getModelPath(StagedModel stagedModel, String dependentFileName)
      Returns a model path for the named file related to the staged model.

      This method is useful, for example, for generating the path for an image related to a web content article. The staged model's attributes are used to generate the first part of the path; then the dependent object's file name is attached to the end of the path.

      For example, a model path would resemble the following:

       
       /group/"queried groupId"/"queried className"/"queried classPK"/"dependentFileName"
       
       

      Parameters:
      stagedModel - the staged model the path is needed for
      dependentFileName - the dependent object's file name
      Returns:
      a model path for the staged model's dependent object
    • getPortletDataPath

      public static String getPortletDataPath(PortletDataContext portletDataContext)
    • getPortletDataPath

      public static String getPortletDataPath(PortletDataContext portletDataContext, String portletId, long plid)
    • getPortletPath

      public static String getPortletPath(PortletDataContext portletDataContext)
      Returns a portlet path for the portlet ID.

      For example, a portlet path would resemble the following:

       
       /group/"queried groupId"/portlet/"portletId"
       
       

      Parameters:
      portletDataContext - the context of the current export/import process
      Returns:
      a portlet path for the portlet ID
    • getPortletPath

      public static String getPortletPath(PortletDataContext portletDataContext, String portletId)
      Returns a portlet path for the portlet ID.

      For example, a portlet path would resemble the following:

       
       /group/"queried groupId"/portlet/"portletId"
       
       

      Parameters:
      portletDataContext - the context of the current export/import process
      portletId - the portlet ID the path is being generated for
      Returns:
      a portlet path for the portlet ID
    • getPortletPreferencesPath

      public static String getPortletPreferencesPath(PortletDataContext portletDataContext, String portletId, long ownerId, int ownerType, long plid)
    • getRootPath

      public static String getRootPath(PortletDataContext portletDataContext)
      Returns a root path, or fragment, of the model path based on the scope group ID from the portlet data context.

      For example, a root path would resemble the following:

       
       /group/"queried groupId"
       
       

      Parameters:
      portletDataContext - the context of the current export/import process
      Returns:
      a root path, or fragment, of the model path
      See Also:
    • getServicePortletPreferencesPath

      public static String getServicePortletPreferencesPath(PortletDataContext portletDataContext, String serviceName, long ownerId, int ownerType)
    • getSourceRootPath

      public static String getSourceRootPath(PortletDataContext portletDataContext)
      Returns a source root path, or fragment, of the model path. This method is called by the getRootPath(PortletDataContext) method. The fragment is generated with the source group ID from the portlet data context. This helper method is useful during the import process.

      For example, a source root path would resemble the following:

       
       /group/"queried groupId"
       
       

      Parameters:
      portletDataContext - the context of the current export/import process
      Returns:
      a path fragment
      See Also:
    • getModelPath

      protected static String getModelPath(String pathPrefix, long pathPrimaryKey, String className, Serializable primaryKeyObj, String dependentFileName)
    • getOwnerTypePath

      protected static String getOwnerTypePath(int ownerType)
    • getRootPath

      protected static String getRootPath(String pathPrefix, long pathPrimaryKey)