Package com.portal.pcm
Class LocalizedStringTable
java.lang.Object
com.portal.pcm.LocalizedStringTable
The LocalizedStringTable class is used to access server side localized
message strings. This class will maintain a cache of read data, so the
database is not hit repeatedly for multiple requests.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Simple data class that represents an entry in the '/strings' database table. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetEntriesFor
(PortalContext ctx, String domain, String locale, Integer version, Integer id) Do a database search for Stringtable Entries matching the specified criteria.static LocalizedStringTable
Get a shared instance of the LocalizedStringTable.lookupEntriesFor
(PortalContext ctx, String domain, String locale) Gen an array of StringTabe Entries for a specified Domain and Locale This method looks in the cache before going to the database, and caches the results.lookupEntry
(PortalContext ctx, String domain, String locale, int id, int version) Gen an individual StringTabe Entry for a specified Domain and Locale This method uses the chache.lookupLatestEntryByID
(PortalContext ctx, String domain, String locale, int id) Gen an individual StringTabe Entry for a specified Domain and Locale This method uses the chache.lookupLatestEntryByMessage
(PortalContext ctx, String domain, String locale, String message) Gen an individual StringTabe Entry for a specified Domain and Locale This method uses the chache.
-
Constructor Details
-
LocalizedStringTable
public LocalizedStringTable()Create an instance of the LocalizedStringTable class
-
-
Method Details
-
getInstance
Get a shared instance of the LocalizedStringTable. This maximizes the sharing of cached data.- Returns:
- An instance of the LocalizedStringTable
-
lookupEntry
public LocalizedStringTable.Entry lookupEntry(PortalContext ctx, String domain, String locale, int id, int version) Gen an individual StringTabe Entry for a specified Domain and Locale This method uses the chache.- Parameters:
ctx
- A PortalContext. This is needed to get data from the database, if the cache doesn't have it.domain
- The Domain of strings to look in. Examples are: 'Errors' or 'ReasonCodes'locale
- The Locale to get message for. This should follow the Un*x / Java standardid
- The actual message ID to get string info forversion
- the version of the entry to get.- Returns:
- A LocalizedStringTable.Entry containing the message, help text (if any), and other information
-
lookupLatestEntryByID
public LocalizedStringTable.Entry lookupLatestEntryByID(PortalContext ctx, String domain, String locale, int id) Gen an individual StringTabe Entry for a specified Domain and Locale This method uses the chache. Returns the latest version of the string.- Parameters:
ctx
- A PortalContext. This is needed to get data from the database, if the cache doesn't have it.domain
- The Domain of strings to look in. Examples are: 'Errors' or 'ReasonCodes'locale
- The Locale to get message for. This should follow the Un*x / Java standardid
- The actual message ID to get string info for- Returns:
- A LocalizedStringTable.Entry containing the message, help text (if any), and other information. Returns null if not found.
-
lookupLatestEntryByMessage
public LocalizedStringTable.Entry lookupLatestEntryByMessage(PortalContext ctx, String domain, String locale, String message) Gen an individual StringTabe Entry for a specified Domain and Locale This method uses the chache. Returns the latest version of the string.- Parameters:
ctx
- A PortalContext. This is needed to get data from the database, if the cache doesn't have it.domain
- The Domain of strings to look in. Examples are: 'Errors' or 'ReasonCodes'locale
- The Locale to get message for. This should follow the Un*x / Java standardmessage
- The message string to find.- Returns:
- A LocalizedStringTable.Entry containing the message, help text (if any), and other information. Returns null if not found.
-
lookupEntriesFor
public LocalizedStringTable.Entry[] lookupEntriesFor(PortalContext ctx, String domain, String locale) Gen an array of StringTabe Entries for a specified Domain and Locale This method looks in the cache before going to the database, and caches the results.- Parameters:
ctx
- A PortalContext. This is needed to get data from the database, if the cache doesn't have it.domain
- The Domain of strings to look in. Examples are: 'Errors' or 'ReasonCodes'locale
- The Locale to get message for. This should follow the Un*x / Java standard- Returns:
- An array of LocalizedStringTable.Entry containing the message, help text (if any), and other information
-
getEntriesFor
public LocalizedStringTable.Entry[] getEntriesFor(PortalContext ctx, String domain, String locale, Integer version, Integer id) Do a database search for Stringtable Entries matching the specified criteria. This method does not look in the cache. If null is specified for a parameter, that parameter is not used in the search.- Parameters:
ctx
- A PortalContext. This is needed to get data from the database, if the cache doesn't have it.domain
- The Domain of strings to look in. Examples are: 'Errors' or 'ReasonCodes'. Can contain SQL wildcardlocale
- The Locale to get message for. This should follow the Un*x / Java standard Can contain SQL wildcardversion
- The message version to look for.id
- A specific ID to look for.- Returns:
- An array of LocalizedStringTable.Entry containing the message, help text (if any), and other information
-