Class AssetImpexHelper


  • public final class AssetImpexHelper
    extends Object
    Helper class for asset import/export related operations, especially merging of localized files and localizations on update.
    Since:
    8.6.0
    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • compoundKey

        public static String compoundKey​(String fileKey,
                                         String languageTag)
        Creates a compound key for identifying localized files based on file key and language tag.
        Parameters:
        fileKey - the file key of the localized file
        languageTag - the language tag of the localized file
        Returns:
        a compound key in the format "fileKey:languageTag"
      • generateNewUuid

        public static UUID generateNewUuid()
      • mergeTemplateFilesOnUpdate

        public static void mergeTemplateFilesOnUpdate​(Textbaustein existing,
                                                      TemplateExportModel templateExportModel,
                                                      de.xima.fc.asset.ms.impl.impex.AssetImpexMapper.LocalizedFileDataContext localizedFileData)
        Merges the localized files of a template on update. It updates existing files, adds new ones, and removes files that are no longer present in the incoming data.
        Parameters:
        existing - the existing Textbaustein entity to be updated
        templateExportModel - the incoming TemplateExportModel containing the new state of the localized files
        localizedFileData - the context containing the actual file data for the localized files, used for setting the data on new or updated files
      • mergeResourceFilesOnUpdate

        public static void mergeResourceFilesOnUpdate​(MandantRessource existing,
                                                      ResourceExportModel resourceExportModel,
                                                      de.xima.fc.asset.ms.impl.impex.AssetImpexMapper.LocalizedFileDataContext localizedFileData)
        Merges the localized files of a resource on update. It updates existing files, adds new ones, and removes files that are no longer present in the incoming data.
        Parameters:
        existing - the existing MandantRessource entity to be updated
        resourceExportModel - the incoming ResourceExportModel containing the new state of the localized files
        localizedFileData - the context containing the actual file data for the localized files, used for setting the data on new or updated files
      • replaceTemplateFilesOnUpdate

        public static void replaceTemplateFilesOnUpdate​(Textbaustein existing,
                                                        TemplateExportModel templateExportModel,
                                                        de.xima.fc.asset.ms.impl.impex.AssetImpexMapper.LocalizedFileDataContext localizedFileData)
        Replaces the localized files of a template on update. It creates new file entities for all incoming files and replaces the existing list with the new one. This is a more destructive approach compared to merging, as it does not preserve existing file entities.
        Parameters:
        existing - the existing Textbaustein entity to be updated
        templateExportModel - the incoming TemplateExportModel containing the new state of the localized files
        localizedFileData - the context containing the actual file data for the localized files, used for setting the data on new files
      • setResourceMainFileData

        public static void setResourceMainFileData​(AssetFileExportModel model,
                                                   MandantRessourceDatei entity,
                                                   de.xima.fc.asset.ms.impl.impex.AssetImpexMapper.ResourceFileDataContext resourceFileData)
        Replaces the file of a resource on update. It creates new file entities for all incoming files and replaces the existing list with the new one. This is a more destructive approach compared to merging, as it does not preserve existing file entities.
        Parameters:
        model - the AssetFileExportModel containing the UUID to identify the file data in the resourceFileData context and other file metadata
        entity - the MandantRessourceDatei entity on which the data should be set
        resourceFileData - the context containing the actual file data for the resource files, used for retrieving the data based on the UUID from the model and setting it on the entity
      • replaceResourceFilesOnUpdate

        public static void replaceResourceFilesOnUpdate​(MandantRessource existing,
                                                        ResourceExportModel resourceExportModel,
                                                        de.xima.fc.asset.ms.impl.impex.AssetImpexMapper.LocalizedFileDataContext localizedFileData)
        Replaces the localized files of a resource on update. It creates new file entities for all incoming files and replaces the existing list with the new one. This is a more destructive approach compared to merging, as it does not preserve existing file entities.
        Parameters:
        existing - the existing MandantRessource entity to be updated
        resourceExportModel - the incoming ResourceExportModel containing the new state of the localized files
        localizedFileData - the context containing the actual file data for the localized files, used for setting the data on new files
      • mergeTemplateLocalizationsOnUpdate

        public static void mergeTemplateLocalizationsOnUpdate​(Textbaustein existing,
                                                              TemplateExportModel templateExportModel)
        Merges the localizations of a template on update. It updates existing localizations, adds new ones, and removes localizations that are no longer present in the incoming data.
        Parameters:
        existing - the existing Textbaustein entity to be updated
        templateExportModel - the incoming TemplateExportModel containing the new state of the localizations
      • mergeResourceLocalizationsOnUpdate

        public static void mergeResourceLocalizationsOnUpdate​(MandantRessource existing,
                                                              ResourceExportModel resourceExportModel)
        Merges the localizations of a resource on update. It updates existing localizations, adds new ones, and removes localizations that are no longer present in the incoming data.
        Parameters:
        existing - the existing MandantRessource entity to be updated
        resourceExportModel - the incoming ResourceExportModel containing the new state of the localizations
      • setTemplateLocalizedFileData

        public static void setTemplateLocalizedFileData​(AssetLocalizedFileExportModel model,
                                                        TenantTemplateLocalizedFile entity,
                                                        de.xima.fc.asset.ms.impl.impex.AssetImpexMapper.LocalizedFileDataContext localizedFileData)
        Sets the data of a localized file entity based on the provided localized file data context. It retrieves the file data using the UUID from the model and sets it on the entity if available.
        Parameters:
        model - the AssetLocalizedFileExportModel containing the UUID to identify the file data in the localizedFileData context
        entity - the TenantTemplateLocalizedFile entity on which the data should be set
        localizedFileData - the context containing the actual file data for the localized files, used for retrieving the data based on the UUID from the model and setting it on the entity
      • setResourceLocalizedFileData

        public static void setResourceLocalizedFileData​(AssetLocalizedFileExportModel model,
                                                        TenantResourceLocalizedFile entity,
                                                        de.xima.fc.asset.ms.impl.impex.AssetImpexMapper.LocalizedFileDataContext localizedFileData)
        Sets the data of a localized file entity based on the provided localized file data context. It retrieves the file data using the UUID from the model and sets it on the entity if available.
        Parameters:
        model - the AssetLocalizedFileExportModel containing the UUID to identify the file data in the localizedFileData context
        entity - the TenantResourceLocalizedFile entity on which the data should be set
        localizedFileData - the context containing the actual file data for the localized files, used for retrieving the data based on the UUID from the model and setting it on the entity