Package de.xima.fc.asset.ms.impl.impex
Class AssetImpexHelper
- java.lang.Object
-
- de.xima.fc.asset.ms.impl.impex.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcompoundKey(String fileKey, String languageTag)Creates a compound key for identifying localized files based on file key and language tag.static UUIDgenerateNewUuid()static voidmergeResourceFilesOnUpdate(MandantRessource existing, ResourceExportModel resourceExportModel, de.xima.fc.asset.ms.impl.impex.AssetImpexMapper.LocalizedFileDataContext localizedFileData)Merges the localized files of a resource on update.static voidmergeResourceLocalizationsOnUpdate(MandantRessource existing, ResourceExportModel resourceExportModel)Merges the localizations of a resource on update.static voidmergeTemplateFilesOnUpdate(Textbaustein existing, TemplateExportModel templateExportModel, de.xima.fc.asset.ms.impl.impex.AssetImpexMapper.LocalizedFileDataContext localizedFileData)Merges the localized files of a template on update.static voidmergeTemplateLocalizationsOnUpdate(Textbaustein existing, TemplateExportModel templateExportModel)Merges the localizations of a template on update.static voidreplaceResourceFilesOnUpdate(MandantRessource existing, ResourceExportModel resourceExportModel, de.xima.fc.asset.ms.impl.impex.AssetImpexMapper.LocalizedFileDataContext localizedFileData)Replaces the localized files of a resource on update.static voidreplaceTemplateFilesOnUpdate(Textbaustein existing, TemplateExportModel templateExportModel, de.xima.fc.asset.ms.impl.impex.AssetImpexMapper.LocalizedFileDataContext localizedFileData)Replaces the localized files of a template on update.static voidsetFileUuid(List<UUID> generatedUuids, AssetFileExportModel file)static voidsetResourceLocalizedFileData(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.static voidsetResourceMainFileData(AssetFileExportModel model, MandantRessourceDatei entity, de.xima.fc.asset.ms.impl.impex.AssetImpexMapper.ResourceFileDataContext resourceFileData)Replaces the file of a resource on update.static voidsetTemplateLocalizedFileData(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.
-
-
-
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 filelanguageTag- 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 updatedtemplateExportModel- the incoming TemplateExportModel containing the new state of the localized fileslocalizedFileData- 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 updatedresourceExportModel- the incoming ResourceExportModel containing the new state of the localized fileslocalizedFileData- 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 updatedtemplateExportModel- the incoming TemplateExportModel containing the new state of the localized fileslocalizedFileData- 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 metadataentity- the MandantRessourceDatei entity on which the data should be setresourceFileData- 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 updatedresourceExportModel- the incoming ResourceExportModel containing the new state of the localized fileslocalizedFileData- 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 updatedtemplateExportModel- 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 updatedresourceExportModel- 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 contextentity- the TenantTemplateLocalizedFile entity on which the data should be setlocalizedFileData- 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 contextentity- the TenantResourceLocalizedFile entity on which the data should be setlocalizedFileData- 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
-
setFileUuid
public static void setFileUuid(List<UUID> generatedUuids, AssetFileExportModel file)
-
-