com.jaxfront.core.dom
Class CodeTables

java.lang.Object
  extended by com.jaxfront.core.dom.CodeTables

public class CodeTables
extends java.lang.Object

Holds all possible codesets defined in a XML file (codes.xsd) for a specific XMLSchema.Each codeset defines codes and according descriptions in different languages. A code in a codeset may be marked as 'invalid'. An invalid code will be marked as an error in its according view.

Version:
1.60
See Also:
XMLSchemaImpl.getCodeTables()

Constructor Summary
CodeTables(XMLSchema schema)
          Creates a CodeTable for a specific XMLSchema out of a String representing an URL.
 
Method Summary
static java.lang.String createCacheKey(XMLSchema schema, java.lang.String url, java.net.URL xuiURL)
           
static java.util.Hashtable createCodeTable(Type source, org.w3c.dom.Document dom)
          Builds a hashtable for all codesets in the passed document object model.
static java.lang.String createKey(boolean checkType, Type source, java.lang.String codeSetName, java.lang.String language)
           
static java.lang.String[] extractFromKey(java.lang.String key)
           
 java.util.Map getAllItems(Type source, java.lang.String codesetName, java.lang.String language)
           
 java.util.Hashtable getCachedURLs()
           
 java.lang.String[][] getCodeItems(Type source, java.lang.String codesetName)
          Returns all codes belonging to a codeset in the current language.
static java.net.URL getCodeSetHelpURL(java.net.URL codeSetURL, java.lang.String language, java.lang.String codeSetName, java.lang.String code)
           
 java.lang.String getCodeSetLabel(java.lang.String codeSetName, java.lang.String language)
           
static java.net.URL getCodeSetURL(XMLSchema schema, java.lang.String url)
           
 java.lang.String getEntryHelp(Type source, java.lang.String codesetName, java.lang.String id, java.lang.String language)
           
 java.lang.String getEntryParam(Type source, java.lang.String codesetName, java.lang.String id, java.lang.String language)
           
 java.lang.String getId(java.lang.String key, java.lang.String text)
          Returns the id (code) for a certain description within a codeset.
 java.lang.String getId(Type source, java.lang.String codesetName, java.lang.String text, java.lang.String language)
          Returns the id (code) for a certain description within a codeset.
 java.lang.String[] getItems(Type source, java.lang.String codesetName, java.lang.String language)
          Returns all codes belonging to a codeset in the current language.
 java.lang.String getText(java.lang.String key, java.lang.String id)
          Returns the description for an id in a certain codeset.
 java.lang.String getText(Type source, java.lang.String codesetName, java.lang.String id, java.lang.String language)
          Returns the description for an id in a certain codeset.
 java.lang.String[] getTextArray(Type source, java.lang.String name, java.lang.String[] id, java.lang.String language)
          Returns an array of descriptions for different id's.
 void initialize(org.w3c.dom.Document codeSetDocument)
          Initializes the codeset with a String representing the codeset file location.
 java.lang.String[] initialize(Type source, java.lang.String codeSetName, java.io.Reader reader)
          Initializes the codeset from an input stream (e.g. a class file that implements the codeset interface).
 java.lang.String[] initialize(Type source, java.lang.String classURL, java.lang.String codeSetName)
          Initializes the codeset from an input stream (e.g. a class file that implements the codeset interface).
 boolean initialize(XMLSchema schema, java.lang.String url)
           
 boolean initialize(XMLSchema schema, java.lang.String url, java.net.URL xuiURL)
          Initializes the codeset with a String representing the codeset file location.
 boolean isCached(java.lang.String aCodeSetUrl)
           
static boolean isValueInvalid(java.lang.String value, java.lang.String language)
          Returns true if the passed value is an invalid code description.
 void release()
          Release class
 void releaseCache()
           
 void releaseCodeSets()
          Releases all loaded codesets for this codetable.
 void setLanguage(java.lang.String language)
          Sets the current language for the code table.
 java.lang.String toXML()
           
static java.util.LinkedHashMap transformHashtablesForXMLSerialization(java.util.Hashtable codeSets)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeTables

public CodeTables(XMLSchema schema)
Creates a CodeTable for a specific XMLSchema out of a String representing an URL.

Parameters:
schema - the schema which holds this codeset
Method Detail

getId

public java.lang.String getId(Type source,
                              java.lang.String codesetName,
                              java.lang.String text,
                              java.lang.String language)
Returns the id (code) for a certain description within a codeset. Returns null if no description has been found.

Parameters:
codesetName - name of the codeset
text - description to looking for
language - language to lookup
Returns:
an id defined for a description

getId

public java.lang.String getId(java.lang.String key,
                              java.lang.String text)
Returns the id (code) for a certain description within a codeset. Returns null if no description has been found.

Parameters:
key - codeset cache key
codesetName - name of the codeset
text - description to looking for
language - language to lookup
Returns:
an id defined for a description

getItems

public java.lang.String[] getItems(Type source,
                                   java.lang.String codesetName,
                                   java.lang.String language)
Returns all codes belonging to a codeset in the current language.

Parameters:
codesetName - name of a codeset
language - current language
Returns:
String[] with all the codes for a codeset or null

getAllItems

public java.util.Map getAllItems(Type source,
                                 java.lang.String codesetName,
                                 java.lang.String language)

getCodeSetLabel

public java.lang.String getCodeSetLabel(java.lang.String codeSetName,
                                        java.lang.String language)

getCodeItems

public java.lang.String[][] getCodeItems(Type source,
                                         java.lang.String codesetName)
Returns all codes belonging to a codeset in the current language.

Parameters:
codesetName - name of a codeset
Returns:
String[] with all the codes for a codeset or null

setLanguage

public void setLanguage(java.lang.String language)
Sets the current language for the code table.


getText

public java.lang.String getText(Type source,
                                java.lang.String codesetName,
                                java.lang.String id,
                                java.lang.String language)
Returns the description for an id in a certain codeset.

Parameters:
codesetName - name of the codeset
id - id to looking for
language - current language
Returns:
description text

getEntryHelp

public java.lang.String getEntryHelp(Type source,
                                     java.lang.String codesetName,
                                     java.lang.String id,
                                     java.lang.String language)

getEntryParam

public java.lang.String getEntryParam(Type source,
                                      java.lang.String codesetName,
                                      java.lang.String id,
                                      java.lang.String language)

getText

public java.lang.String getText(java.lang.String key,
                                java.lang.String id)
Returns the description for an id in a certain codeset.

Parameters:
key - codeset cache key
codesetName - name of the codeset
id - id to looking for
language - current language
Returns:
description text

getTextArray

public java.lang.String[] getTextArray(Type source,
                                       java.lang.String name,
                                       java.lang.String[] id,
                                       java.lang.String language)
Returns an array of descriptions for different id's.

Parameters:
codesetName - name of the codeset
id - id's to looking for
language - current language
Returns:
an array of descriptions

initialize

public boolean initialize(XMLSchema schema,
                          java.lang.String url)

initialize

public boolean initialize(XMLSchema schema,
                          java.lang.String url,
                          java.net.URL xuiURL)
Initializes the codeset with a String representing the codeset file location.

Returns:
boolean true if a codeset has been found and loaded for the given url

initialize

public void initialize(org.w3c.dom.Document codeSetDocument)
Initializes the codeset with a String representing the codeset file location.


getCodeSetHelpURL

public static java.net.URL getCodeSetHelpURL(java.net.URL codeSetURL,
                                             java.lang.String language,
                                             java.lang.String codeSetName,
                                             java.lang.String code)

initialize

public java.lang.String[] initialize(Type source,
                                     java.lang.String classURL,
                                     java.lang.String codeSetName)
Initializes the codeset from an input stream (e.g. a class file that implements the codeset interface).


initialize

public java.lang.String[] initialize(Type source,
                                     java.lang.String codeSetName,
                                     java.io.Reader reader)
Initializes the codeset from an input stream (e.g. a class file that implements the codeset interface).


createCacheKey

public static java.lang.String createCacheKey(XMLSchema schema,
                                              java.lang.String url,
                                              java.net.URL xuiURL)

getCodeSetURL

public static java.net.URL getCodeSetURL(XMLSchema schema,
                                         java.lang.String url)

createCodeTable

public static java.util.Hashtable createCodeTable(Type source,
                                                  org.w3c.dom.Document dom)
Builds a hashtable for all codesets in the passed document object model.


createKey

public static java.lang.String createKey(boolean checkType,
                                         Type source,
                                         java.lang.String codeSetName,
                                         java.lang.String language)

release

public void release()
Release class


releaseCodeSets

public void releaseCodeSets()
Releases all loaded codesets for this codetable.


isValueInvalid

public static boolean isValueInvalid(java.lang.String value,
                                     java.lang.String language)
Returns true if the passed value is an invalid code description.

Parameters:
value -

getCachedURLs

public java.util.Hashtable getCachedURLs()

releaseCache

public void releaseCache()

toXML

public java.lang.String toXML()

transformHashtablesForXMLSerialization

public static java.util.LinkedHashMap transformHashtablesForXMLSerialization(java.util.Hashtable codeSets)

extractFromKey

public static java.lang.String[] extractFromKey(java.lang.String key)

isCached

public boolean isCached(java.lang.String aCodeSetUrl)