Package de.xima.fc.helper
Class UserPortalContentTextResolver
- java.lang.Object
-
- de.xima.fc.helper.UserPortalContentTextResolver
-
public final class UserPortalContentTextResolver extends Object
Resolves the localized display texts (display name, description, short description) of user portal content source entities (seeIUserPortalContentLocalizationSource).This logic used to live directly on the entities
Projekt,MandantRessourceandTextbaustein. It was extracted here as it is conceptually logic for populating DTOs / view models / REST responses and should not be part of the persistent entities.- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringresolveDescription(IUserPortalContentLocalizationSource<?,?> source, Locale locale)Resolves the description for the given locale.static StringresolveDisplayName(IUserPortalContentLocalizationSource<?,?> source, Locale locale)Resolves the display name for the given locale: the localized display name, falling back to the display name in the default locale, and finally toIUserPortalContentLocalizationSource.displayNameFallback().static StringresolveShortDescription(IUserPortalContentLocalizationSource<?,?> source, Locale locale)Resolves the short description for the given locale, without considering any user portal specific fallback.static StringresolveShortDescriptionForPortal(IUserPortalContentLocalizationSource<?,?> source, Locale locale, UUID userPortalUuid)Resolves the short description for the given locale and a specific user portal context.
-
-
-
Method Detail
-
resolveDisplayName
public static String resolveDisplayName(IUserPortalContentLocalizationSource<?,?> source, Locale locale)
Resolves the display name for the given locale: the localized display name, falling back to the display name in the default locale, and finally toIUserPortalContentLocalizationSource.displayNameFallback().- Parameters:
source- The source entity.locale- The locale to resolve the display name for.- Returns:
- The resolved display name.
-
resolveDescription
public static String resolveDescription(IUserPortalContentLocalizationSource<?,?> source, Locale locale)
Resolves the description for the given locale.- Parameters:
source- The source entity.locale- The locale to resolve the description for.- Returns:
- The resolved (localized) description, or
nullif none is set.
-
resolveShortDescription
public static String resolveShortDescription(IUserPortalContentLocalizationSource<?,?> source, Locale locale)
Resolves the short description for the given locale, without considering any user portal specific fallback.- Parameters:
source- The source entity.locale- The locale to resolve the short description for.- Returns:
- The resolved short description, or
nullif none can be determined.
-
resolveShortDescriptionForPortal
public static String resolveShortDescriptionForPortal(IUserPortalContentLocalizationSource<?,?> source, Locale locale, UUID userPortalUuid)
Resolves the short description for the given locale and a specific user portal context. Whether the entity's own description may be used as a final fallback is determined by the portal'suseUserPortalContentEntityDescriptionAsFallbackflag.- Parameters:
source- The source entity.locale- The locale to resolve the short description for.userPortalUuid- The user portal UUID whose configuration should be applied, ornull.- Returns:
- The resolved short description, or
nullif none can be determined.
-
-