Class InfranetLocaleManager

java.lang.Object
com.portal.common.InfranetCachedData
com.portal.common.InfranetLocaleManager

public class InfranetLocaleManager extends InfranetCachedData
  • Field Details

    • LocaleExactMatch

      public static final int LocaleExactMatch
      The specified locale must be an exact match of the Portal locale (i.e. "en_us")
      See Also:
    • LocaleLangMatch

      public static final int LocaleLangMatch
      The language portion of specified locale can match any Portal locale that has the same language. The look-up algorithm will stop at the match first match (doesn't do anything clever like try to match "en_uk" with "en_us")
      See Also:
    • LocaleExactMatchThenLangMatch

      public static final int LocaleExactMatchThenLangMatch
      First try to do an exact match. If that fails then try to match the language of the specified locale.
      See Also:
  • Constructor Details

    • InfranetLocaleManager

      protected InfranetLocaleManager(PortalContext connection)
      Construct an Portal Locale Manager object. Read the Portal Locale table from Portal and construct a lookup table of Portal Locale data objects.
      Parameters:
      connection - An active connection to Portal.
  • Method Details

    • getInstance

      public static InfranetLocaleManager getInstance(PortalContext connection)
      Get the one and only instance of this class. If the instance has not been created then create one.
      Parameters:
      connection - An active connection to Portal.
      Returns:
      The one and only instance of this class.
    • getInstance

      public static InfranetLocaleManager getInstance(PortalContext connection, boolean rebuild)
      Get the one and only instance of this class. If the instance has not been created then create one.
      Parameters:
      connection - An active connection to Portal.
      rebuild - If this flag is TRUE then the reference to the existing instance will be set to null and a new instance will be created. This will cause the data to be refreshed.
      Returns:
      The one and only instance of this class.
    • getLocales

      public Enumeration getLocales(String infranetTextLocale, int matchType)
      Return the list of all of the locales supported by Portal with the locale description text in the specified locale.
      Parameters:
      infranetTextLocale - The Portal locale to return the locale description strings in (English, French, etc.)
      matchType - Using the specified locale do an exact match, a match by language only, or an exact match followed by a match by language only. Can be one of the following constants: LocaleExactMatch, LocaleLangMatch, LocaleExactMatchThenLangMatch.
      Returns:
      The list of all of the locales supported by Portal. A null pointer will be returned if the text cannot be returned in the specified display locale.
    • getLocales

      public Enumeration getLocales(Locale javaLocale, int matchType)
      Return the list of all of the locales supported by Portal with the locale description text in the specified locale.
      Parameters:
      javaLocale - A Java locale object.
      matchType - Using the specified locale do an exact match, a match by language only, or an exact match followed by a match by language only. Can be one of the following constants: LocaleExactMatch, LocaleLangMatch, LocaleExactMatchThenLangMatch.
      Returns:
      The list of all of the locales supported by Portal. A null pointer will be returned in the text cannot be returned in the specified display locale.
    • getLocalesAsArray

      public InfranetLocaleData[] getLocalesAsArray(String infranetTextLocale, int matchType)
      Return the array of all of the locales supported by Portal with the locale description text in the specified locale.
      Parameters:
      infranetTextLocale - The Portal locale to return the locale description strings in (English, French, etc.)
      matchType - Using the specified locale do an exact match, a match by language only, or an exact match followed by a match by language only. Can be one of the following constants: LocaleExactMatch, LocaleLangMatch, LocaleExactMatchThenLangMatch.
      Returns:
      The arrau of all of the locales supported by Portal. A null pointer will be returned in the text cannot be returned in the specified display locale.
    • getLocalesAsArray

      public InfranetLocaleData[] getLocalesAsArray(Locale javaLocale, int matchType)
      Return the array of all of the locales supported by Portal with the locale description text in the specified locale.
      Parameters:
      javaLocale - The Java locale object which determines what language the locale descriptions will be returned,
      matchType - Using the specified locale do an exact match, a match by language only, or an exact match followed by a match by language only. Can be one of the following constants: LocaleExactMatch, LocaleLangMatch, LocaleExactMatchThenLangMatch.
      Returns:
      The arrau of all of the locales supported by Portal. A null pointer will be returned in the text cannot be returned in the specified display locale.
    • getLocaleData

      public InfranetLocaleData getLocaleData(String infranetLocale, String infranetTextLocale, int matchType)
      Return the "locale data" for the specified Portal locale. The match of the Portal locale string will be an "exact match".
      Parameters:
      infranetLocale - The Portal locale to return the Portal locale data for.
      infranetTextLocale - The Portal locale to return the locale description strings in (English, French, etc.)
      matchType - Using the specified "text" locale do an exact match, a match by language only, or an exact match followed by a match by language only. Can be one of the following constants: LocaleExactMatch, LocaleLangMatch, LocaleExactMatchThenLangMatch.
      Returns:
      the "locale data" for the specified Portal locale and return the locale description text in the specified display locale. A null pointer will be returned in the specified Portal locale is not found or the text cannot be returned in the specified display locale.
    • getLocaleData

      public InfranetLocaleData getLocaleData(String infranetLocale, Locale javaTextLocale, int matchType)
      Return the "locale data" for the specified Portal locale. The match of the Portal locale string will be an "exact match".
      Parameters:
      infranetLocale - The Portal locale to return the Portal locale data for.
      javaTextLocale - The locale to return the locale description strings in (English, French, etc.)
      matchType - Using the specified "text" locale do an exact match, a match by language only, or an exact match followed by a match by language only. Can be one of the following constants: LocaleExactMatch, LocaleLangMatch, LocaleExactMatchThenLangMatch.
      Returns:
      the "locale data" for the specified Portal locale and return the locale description text in the specified display locale. A null pointer will be returned in the specified Portal locale is not found or the text cannot be returned in the specified display locale.
    • getNumLocales

      public int getNumLocales()
      Return the number of the locales supported by Portal.
      Returns:
      the number of the locales supported by Portal.
    • MapJavaLocaleToInfranetLocale

      public String MapJavaLocaleToInfranetLocale(String javaLocale)
      Map the Java locale string (language and country) to the corresponding Portal locale string (language and country). At present these two locales should be identical.
      Parameters:
      javaLocale - The Java locale string to find the corresponding Portal locale string for.
      Returns:
      the Portal locale string that corresponds to the specified Java locale string. A null pointer will be returned if there is no corresponding Portal locale.
    • MapInfranetLocaleToJavaLocale

      public String MapInfranetLocaleToJavaLocale(String infranetLocale)
      Map the Portal locale string (language and country) to the corresponding Java locale string (language and country). At present these two locales should be identical.
      Parameters:
      infranetLocale - The Portal locale string to find the corresponding Java locale string for.
      Returns:
      the Java locale string that corresponds to the specified Portal locale string. A null pointer will be returned if there is no corresponding Java locale.