Package com.portal.common
Class InfranetLocaleManager
java.lang.Object
com.portal.common.InfranetCachedData
com.portal.common.InfranetLocaleManager
-
Nested Class Summary
Nested classes/interfaces inherited from class com.portal.common.InfranetCachedData
InfranetCachedData.InstanceBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The specified locale must be an exact match of the Portal locale (i.e.static final int
First try to do an exact match.static final int
The language portion of specified locale can match any Portal locale that has the same language.Fields inherited from class com.portal.common.InfranetCachedData
m_Connection
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
InfranetLocaleManager
(PortalContext connection) Construct an Portal Locale Manager object. -
Method Summary
Modifier and TypeMethodDescriptionstatic InfranetLocaleManager
getInstance
(PortalContext connection) Get the one and only instance of this class.static InfranetLocaleManager
getInstance
(PortalContext connection, boolean rebuild) Get the one and only instance of this class.getLocaleData
(String infranetLocale, String infranetTextLocale, int matchType) Return the "locale data" for the specified Portal locale.getLocaleData
(String infranetLocale, Locale javaTextLocale, int matchType) Return the "locale data" for the specified Portal locale.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.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.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.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.int
Return the number of the locales supported by Portal.MapInfranetLocaleToJavaLocale
(String infranetLocale) Map the Portal locale string (language and country) to the corresponding Java locale string (language and country).MapJavaLocaleToInfranetLocale
(String javaLocale) Map the Java locale string (language and country) to the corresponding Portal locale string (language and country).Methods inherited from class com.portal.common.InfranetCachedData
buildKey, buildKeySimple, createDataManagers, getInstanceImpl, getInstanceImplSimple
-
Field Details
-
LocaleExactMatch
public static final int LocaleExactMatchThe specified locale must be an exact match of the Portal locale (i.e. "en_us")- See Also:
-
LocaleLangMatch
public static final int LocaleLangMatchThe 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 LocaleExactMatchThenLangMatchFirst try to do an exact match. If that fails then try to match the language of the specified locale.- See Also:
-
-
Constructor Details
-
InfranetLocaleManager
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
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
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
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
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
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
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
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
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.
-