Interface ILocalizedScopedFilesProviding<TBase extends de.xima.cmn.dao.interfaces.IEntity<Long>,TMeta extends ILocalizedScopedFileMetaEntity<TBase,TData>,TData extends IFileDataEntity<TMeta>>
-
- Type Parameters:
TBase
- type of the base entity providing thelocalized files
.TMeta
- type of the entity holding the file metadata.TData
- type of the data entity holding the actual file data.
- All Superinterfaces:
Comparable<de.xima.cmn.dao.interfaces.IEntity<Long>>
,de.xima.cmn.dao.interfaces.IEntity<Long>
,Serializable
- All Known Implementing Classes:
ClientPortalConfig
,Projekt
,UserPortal
public interface ILocalizedScopedFilesProviding<TBase extends de.xima.cmn.dao.interfaces.IEntity<Long>,TMeta extends ILocalizedScopedFileMetaEntity<TBase,TData>,TData extends IFileDataEntity<TMeta>> extends de.xima.cmn.dao.interfaces.IEntity<Long>
Common interface for entities providinglocalized files
.- Since:
- 8.2.0
- Author:
- XIMA MEDIA GmbH
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTR_FILES
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
addFile(TMeta file)
Adds the given file to this base entity.Locale
getFallbackLocale()
Gets the default locale to use as a fallback when a localized file is missing for a locale.default TMeta
getFile(String fileKey, Locale locale)
Finds a file with a given file key for a given locale.default TMeta
getFile(String fileKey, Locale locale, Locale fallbackLocale)
Finds a file with a given file key for a given locale.default Set<String>
getFileKeys()
Gets all available file keys provided by this entity.default Map<String,Map<Locale,TMeta>>
getFileMapByKey()
Gets the files grouped by their file key first, then the locale.default Map<String,Map<Locale,TMeta>>
getFileMapByKey(Locale fallbackLocale)
Gets the files grouped by their file key first, then the locale.default Map<Locale,Map<String,TMeta>>
getFileMapByLocale()
Gets the files grouped by the locale first, then their file key.default Map<Locale,Map<String,TMeta>>
getFileMapByLocale(Locale fallbackLocale)
Gets the files grouped by the locale first, then their file key.List<TMeta>
getFiles()
Gets the file entities.default List<TMeta>
getFiles(Locale locale)
Gets the scoped files by language.default List<TMeta>
getFiles(Locale locale, Locale fallbackLocale)
Gets the scoped files by language, ordered by their file key.default void
removeFile(TMeta file)
Removes the given file from this base entity.void
setFiles(List<TMeta> files)
Sets the file entities.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Field Detail
-
ATTR_FILES
static final String ATTR_FILES
- See Also:
- Constant Field Values
-
-
Method Detail
-
setFiles
void setFiles(List<TMeta> files)
Sets the file entities.- Parameters:
files
- the file entities to set.
-
getFallbackLocale
Locale getFallbackLocale()
Gets the default locale to use as a fallback when a localized file is missing for a locale. May return null if the object does not provide a fallback locale.- Returns:
- the default locale to use as a fallback when a localization is missing for a locale
-
getFileMapByLocale
default Map<Locale,Map<String,TMeta>> getFileMapByLocale()
Gets the files grouped by the locale first, then their file key.- Returns:
- the files grouped by the locale (map key) as an immutable map.
-
getFileMapByKey
default Map<String,Map<Locale,TMeta>> getFileMapByKey()
Gets the files grouped by their file key first, then the locale.- Returns:
- the localizations grouped by the I18N name (map key) as an immutable map.
-
getFileKeys
default Set<String> getFileKeys()
Gets all available file keys provided by this entity.- Returns:
- the all available file keys provided by this entity.
-
getFiles
default List<TMeta> getFiles(Locale locale)
Gets the scoped files by language. For ordering seegetFiles()
.- Parameters:
locale
- providing the language to get the files for.- Returns:
- the scoped files by language.
-
getFiles
default List<TMeta> getFiles(Locale locale, Locale fallbackLocale)
Gets the scoped files by language, ordered by their file key.- Parameters:
locale
- providing the language to get the files for.- Returns:
- the scoped files by language.
-
getFileMapByLocale
default Map<Locale,Map<String,TMeta>> getFileMapByLocale(Locale fallbackLocale)
Gets the files grouped by the locale first, then their file key. Uses the files from the given fallback locale when a message is missing for the given locale.- Returns:
- the files grouped by the locale (map key) as an immutable map.
-
getFileMapByKey
default Map<String,Map<Locale,TMeta>> getFileMapByKey(Locale fallbackLocale)
Gets the files grouped by their file key first, then the locale. Uses the files from the given fallback locale when a message is missing for the given locale.- Returns:
- the localizations grouped by the I18N name (map key) as an immutable map.
-
getFile
default TMeta getFile(String fileKey, Locale locale)
Finds a file with a given file key for a given locale.- Parameters:
fileKey
- The file key to search for.locale
- The locale to search for.- Returns:
- The file with the given file key and locale, or null if no such file exists.
-
getFile
default TMeta getFile(String fileKey, Locale locale, Locale fallbackLocale)
Finds a file with a given file key for a given locale. Returns the file from the fallback locale if no file with the given locale exists.- Parameters:
fileKey
- The file key to search for.locale
- The locale to search for.fallbackLocale
- The fallback locale to search for.- Returns:
- The file with the given file key and locale, or null if no such file exists.
-
addFile
default void addFile(TMeta file)
Adds the given file to this base entity.- Parameters:
file
- to add
-
removeFile
default void removeFile(TMeta file)
Removes the given file from this base entity.- Parameters:
file
- to remove
-
-