Class UserPortalContentTextResolver


  • public final class UserPortalContentTextResolver
    extends Object
    Resolves the localized display texts (display name, description, short description) of user portal content source entities (see IUserPortalContentLocalizationSource).

    This logic used to live directly on the entities Projekt, MandantRessource and Textbaustein. 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 Detail

      • 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 null if 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 null if 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's useUserPortalContentEntityDescriptionAsFallback flag.
        Parameters:
        source - The source entity.
        locale - The locale to resolve the short description for.
        userPortalUuid - The user portal UUID whose configuration should be applied, or null.
        Returns:
        The resolved short description, or null if none can be determined.