Class MLTextHelper

java.lang.Object
fr.becpg.repo.helper.MLTextHelper

public class MLTextHelper extends Object

MLTextHelper class.

Version:
$Id: $Id
Author:
matthieu
  • Field Details

    • mlTextCache

      private static Map<String,org.alfresco.service.cmr.repository.MLText> mlTextCache
    • supportedLocales

      private static List<Locale> supportedLocales
    • supportedLocalesText

      private static String supportedLocalesText
    • logger

      private static final org.apache.commons.logging.Log logger
  • Constructor Details

    • MLTextHelper

      private MLTextHelper()

      Constructor for MLTextHelper.

  • Method Details

    • flushCache

      public static void flushCache()

      flushCache.

    • setSupportedLocales

      public static void setSupportedLocales(String supportedLocalesText)

      setSupportedLocalesInstance.

      Parameters:
      supportedLocalesText - a String object
    • useBrowserLocale

      private static boolean useBrowserLocale()
    • shouldExtractMLText

      public static boolean shouldExtractMLText()

      shouldExtractMLText.

      Returns:
      a boolean.
    • getSupportedLocales

      public static List<Locale> getSupportedLocales()

      Getter for the field supportedLocales.

      Returns:
      a List object.
    • getSupportedLocalesList

      public static List<String> getSupportedLocalesList()

      getSupportedLocalesList.

      Returns:
      a List object.
    • isDisabledMLTextField

      public static boolean isDisabledMLTextField(String propertyQNamePrexiString)

      isDisabledMLTextField.

      Parameters:
      propertyQNamePrexiString - a String object
      Returns:
      a boolean
    • getClosestValue

      public static String getClosestValue(org.alfresco.service.cmr.repository.MLText mltext, Locale locale)
      Try to find the best match for locale or try with default server local
      Parameters:
      mltext - a MLText object.
      locale - a Locale object.
      Returns:
      a String object.
    • isDefaultLocale

      public static boolean isDefaultLocale(Locale locale)

      isDefaultLocale.

      Parameters:
      locale - a Locale object.
      Returns:
      a boolean.
    • getNearestLocale

      public static Locale getNearestLocale(Locale locale)

      getNearestLocale.

      Parameters:
      locale - a Locale object.
      Returns:
      a Locale object.
    • getNearestLocale

      public static Locale getNearestLocale(Locale templateLocale, Set<Locale> options)

      getNearestLocale.

      Parameters:
      templateLocale - a Locale object.
      options - a Set object.
      Returns:
      a Locale object.
    • isSupportedLocale

      public static boolean isSupportedLocale(Locale contentLocale)

      isSupportedLocale.

      Parameters:
      contentLocale - a Locale object.
      Returns:
      a boolean.
    • replaceTextForLanguage

      public static void replaceTextForLanguage(Locale contentLocale, String updatedText, org.alfresco.service.cmr.repository.MLText mlText)
      Replace any text in mlText having the same language (but any variant) as contentLocale with updatedText keyed by the language of contentLocale. This ensures that the mlText will have no more than one entry for the particular language.
      Parameters:
      contentLocale - Locale
      updatedText - String
      mlText - MLText
    • parseLocale

      public static Locale parseLocale(String key)

      parseLocale.

      Parameters:
      key - a String object.
      Returns:
      a Locale object.
    • getValueOrDefault

      public static String getValueOrDefault(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName propCharactName)

      getValueOrDefault.

      Parameters:
      nodeService - a NodeService object.
      nodeRef - a NodeRef object.
      propCharactName - a QName object.
      Returns:
      a String object.
    • localeKey

      public static String localeKey(Locale locale)

      localeKey.

      Parameters:
      locale - a Locale object.
      Returns:
      a String object.
    • localeLabel

      public static String localeLabel(Locale locale)

      localeLabel.

      Parameters:
      locale - a Locale object.
      Returns:
      a String object.
    • isEmpty

      public static boolean isEmpty(org.alfresco.service.cmr.repository.MLText mlText)

      isEmpty.

      Parameters:
      mlText - a MLText object.
      Returns:
      a boolean.
    • extractLocales

      public static Set<Locale> extractLocales(List<String> locales)

      extractLocales.

      Parameters:
      locales - a List object.
      Returns:
      a Set object.
    • getI18NMessage

      public static org.alfresco.service.cmr.repository.MLText getI18NMessage(String messageKey, Object... variables)

      getI18NMessage.

      Parameters:
      messageKey - a String object.
      variables - a Object object.
      Returns:
      a MLText object.
    • internalI18NMessage

      private static org.alfresco.service.cmr.repository.MLText internalI18NMessage(String messageKey, Object... variables)
    • createMLTextI18N

      public static org.alfresco.service.cmr.repository.MLText createMLTextI18N(MLTextHelper.MLTextCallback callback)

      createMLTextI18N.

      Parameters:
      callback - a MLTextHelper.MLTextCallback object.
      Returns:
      a MLText object.
    • merge

      public static Serializable merge(org.alfresco.service.cmr.repository.MLText toMergeTo, org.alfresco.service.cmr.repository.MLText toMergeFrom)

      merge.

      Parameters:
      toMergeTo - a MLText object.
      toMergeFrom - a MLText object.
      Returns:
      a Serializable object.
    • getSupportedLocale

      public static Locale getSupportedLocale(Locale contentLocale)

      getSupportedLocale.

      Parameters:
      contentLocale - a Locale object
      Returns:
      if contentLocale is supported or language only locale
    • getUserLocale

      public static Locale getUserLocale(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.repository.NodeRef personNodeRef)

      getUserLocale.

      Parameters:
      nodeService - a NodeService object
      personNodeRef - a NodeRef object
      Returns:
      a Locale object
    • getUserContentLocale

      public static Locale getUserContentLocale(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.repository.NodeRef personNodeRef)

      getUserContentLocale.

      Parameters:
      personNodeRef - a NodeRef object.
      nodeService - a NodeService object
      Returns:
      a Locale object.