com.sage.orion.sdata.servlet.swtservice
Class UIContentCache

java.lang.Object
  extended by com.sage.orion.sdata.servlet.swtservice.UIContentCache

public final class UIContentCache
extends java.lang.Object

The class is used to cache the whole UIContent table.

Note: The cache is built based on the prerequisite that there is no "_" character inside the value for version,category,id fields in the UIContent table.


Method Summary
static void createUIContentCache(java.sql.Connection connection)
          Builds the cache for storing the data in the UIContent table.
static void creatUIContentCacheByMap(java.util.Map<java.lang.String,java.lang.String> content)
          Builds the cache for storing the data based upon provided content.
static java.lang.String getString(java.lang.String textID, java.lang.String languageCode)
          Gets the value for the key specified by the textID and the languageCode.
static java.lang.String getString(java.lang.String version, java.lang.String languageCode, java.lang.String category, java.lang.String id)
           Gets the value for the key specified by the lower-cased version, lower-cased languageCode, mixed-case category, and mixed-case id.
static void invalidate()
          Invalidates the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createUIContentCache

public static void createUIContentCache(java.sql.Connection connection)
Builds the cache for storing the data in the UIContent table.

Parameters:
connection - The Connection.

creatUIContentCacheByMap

public static void creatUIContentCacheByMap(java.util.Map<java.lang.String,java.lang.String> content)
Builds the cache for storing the data based upon provided content.

Parameters:
content - the map of content to use in the cache

getString

public static java.lang.String getString(java.lang.String textID,
                                         java.lang.String languageCode)
Gets the value for the key specified by the textID and the languageCode.

If the method can't find an item for the specified languageCode, it will try to return the value for the English version.

Parameters:
textID - The Combination of version, category and id. The possible formats for the textID are: version_category_id, or version_id, in which case the category equals "-". Note that version must already be lower-cased, but category and id may be mixed case.
languageCode - The lower-cased language code (for example, "eng").
Returns:
The UIContent string for the key, or null if that key wasn't found in the specified language or in English.

getString

public static java.lang.String getString(java.lang.String version,
                                         java.lang.String languageCode,
                                         java.lang.String category,
                                         java.lang.String id)

Gets the value for the key specified by the lower-cased version, lower-cased languageCode, mixed-case category, and mixed-case id.

If the method can't find an item for the specified languageCode, it will try to return the value for the English version.

Parameters:
version - The lower-cased trimmed version of the resource (for example, "ap60a").
languageCode - The lower-cased trimmed language code (for example, "eng").
category - The mixed-cased trimmed category that the resource belongs to (for example, "ap1200"), or "-" (which indicates the default category) if the resource is a version-wide resource.
id - The mixed-case trimmed id of the resource (for example, "titlForm").
Returns:
The UIContent string for the key, or null if that key wasn't found in the specified language or in English.

invalidate

public static void invalidate()
Invalidates the cache.



Copyright © 2011 Sage Software, Inc. All rights reserved.