DLESE Tools
v1.6.0

org.dlese.dpc.vocab
Class MetadataVocabTermsGroups

java.lang.Object
  extended by org.dlese.dpc.vocab.MetadataVocabTermsGroups
All Implemented Interfaces:
Serializable, MetadataVocab, ContentHandler

public class MetadataVocabTermsGroups
extends Object
implements MetadataVocab, ContentHandler, Serializable

Facilitates interface representation of metadata vocabulary.

Controlled vocabulary is stored in XML files and read into the hierarchical class data structure via a SAX reader. Various methods are provided for representing the vocabulary through a Web interface (HTML/Javascript) using JSP scriptlet calls or custom tags (see org.dlese.dpc.vocab.tags).

Methods that might be usefull outside of any particular UI are as follows:

Method descriptions often use the following terms:

The last two terms are often used in combination with the first two. For example, "Encoded field Id" refers to the unique system Id of a vocabulary field.

Most public methods take an initial parameter called "system", which is a period-seperated trio that corresponds to the system/interface/language attributes of the XML files. To retreive values associated with the english language version of the default DDS interface, for example, one would pass the string "dds.default.en-us".

Almost all of the public methods that produce lists for UI display take a parameter named "group". This is a colon-seperated identifier of the spot within the vocabulary hierarchy which is being requested for display. Passing "topic:geography" would return a representation of only the metadata entries that fall under the "geography" sub-heading in the "topic" category. The colon is not always necessary, however--passing simply "topic" will return a represenation of all entries in the "topic" category.

Author:
Ryan Deardorff
See Also:
Serialized Form

Field Summary
protected  VocabList vocab
           
 MetadataVocabOPML vocabCompare
           
 
Constructor Summary
MetadataVocabTermsGroups()
          Constructor for the MetadataVocab object
MetadataVocabTermsGroups(String sqlDriver, String sqlURL, String sqlUser, String sqlPassword, String vocabTextFile)
          Constructor for the MetadataVocab object
 
Method Summary
 void addError(String err)
          Adds a feature to the Error attribute of the MetadataVocabOPML object
 void addMessage(String msg)
          Adds a feature to the Message attribute of the MetadataVocabOPML object
 void characters(char[] ch, int start, int length)
          (SAX) Element data (characters between tags)
 void charactersDefinition(char[] ch, int start, int length)
          (SAX) Element data for definitions
 void charactersUI(char[] ch, int start, int length)
          (SAX) Element data for UIs
 void doneLoading()
          When all vocabs are loaded, generate the Lucene queries, register all current UI labels into the database, and close any database connection
 void endDocument()
          (SAX) Invoked at the end of parsing.
 void endElement(String namespaceURI, String localName, String qName)
          (SAX) Invoked upon closing tag of an XML element
 void endElementDefinition(String namespaceURI, String localName, String qName)
          (SAX) End element for definitions
 void endElementUI(String namespaceURI, String localName, String qName)
          (SAX) End element for UIs
 void endPrefixMapping(String prefix)
          (SAX) Required by SAX, but not used here
 VocabNode findVocabNode(String system, String fieldName, String valueName)
          Within a given system (system.interface.language), find the node that contains the given value for its 'name' attribute.
 ArrayList getCacheValuesInOrder(String system, String group, Map cache)
          Given a cache (Map) of vocab values, this method returns a list of those values in the order that they are defined in their groups file.
 String getCurrentVersion(String metaFramework)
          Gets the currentVersion attribute of the MetadataVocabTermsGroups object
 ArrayList getErrors()
          Gets the errors attribute of the MetadataVocab object
 String getFieldSystemId(String field)
          Gets the encoded field Id of the given metadata field
 boolean getFieldValueIdPairExists(String fieldId, String valueId)
          Does a vocabulary definition exist for the given encoded field/value Ids?
 String getFieldValueSystemId(String field, String value)
          Gets the encoded value Id of the given metadata field/value pair
 ArrayList getMessages()
          Gets the messages attribute of the MetadataVocab object
 String getMetaFormatOfField(String field)
          Gets the metaFormatOfField attribute of the MetadataVocabTermsGroups object
 String getMetaNameOfId(String system, String fieldId, String valueId)
          Gets the metadata value or field name of the given encoded field and value Ids.
 String getOPML(String metaFormat, String audience, String language, String field)
          Gets the oPML attribute of the MetadataVocabTermsGroups object
 String getOPML(String metaFormat, String audience, String language, String field, boolean includeXmlDeclaration)
          Gets the oPML attribute of the MetadataVocabTermsGroups object
 String getOPML(String metaFormat, String metaVersion, String audience, String language, String field)
          Gets the OPML for a given format/version/audience/language
 String getOPML(String metaFormat, String metaVersion, String audience, String language, String field, boolean includeXmlDeclaration)
          Gets the oPML attribute of the MetadataVocabTermsGroups object
 String getResponseOPML(PageContext context)
          Gets the responseGroup attribute of the MetadataVocabOPML object
 String getTopLevelAbbrevLabelOf(String system, String metadataField, String systemFieldId, String systemValueId)
          Gets the topLevelAbbrevLabelOf attribute of the MetadataVocab object
 String getTranslatedField(String metaFormat, String field)
          Gets the translatedField attribute of the MetadataVocabTermsGroups object
 String getTranslatedField(String metaFormat, String metaVersion, String field)
          Gets the translated FIELD NAME/ID of the given FIELD+VALUE NAMEs/IDs
 String getTranslatedFieldPath(String metaFormat, String field)
          Gets the translatedFieldPath attribute of the MetadataVocabTermsGroups object
 String getTranslatedFieldPath(String metaFormat, String metaVersion, String field)
          Gets the translatedFieldPath attribute of the MetadataVocabTermsGroups object
 String getTranslatedValue(String metaFormat, String field, String value)
          Gets the translatedValue attribute of the MetadataVocabTermsGroups object
 String getTranslatedValue(String metaFormat, String metaVersion, String field, String value)
          Gets the translated VALUE NAME/ID of the given FIELD NAME/ID
 String getUiFieldLabel(String audience, String language, String field, boolean abbrev)
          Gets the uiFieldLabel attribute of the MetadataVocabTermsGroups object
 String getUiFieldLabel(String metaFormat, String audience, String language, String field, boolean abbrev)
          Gets the UI label associated with the given FIELD NAME/ID, using the current or most recently loaded metadata format version number
 String getUiFieldLabel(String metaFormat, String metaVersion, String audience, String language, String field)
          Gets the non-abbreviated UI label associated with the given FIELD NAME/ID
 String getUiFieldLabel(String metaFormat, String metaVersion, String audience, String language, String field, boolean abbrev)
          Gets the UI label associated with the given FIELD NAME/ID
 String getUiLabelOf(String system, String metadataField, String metadataValue)
           Gets the full (non-abbreviated) UI label of the given metadata field/value pair
 String getUiLabelOf(String system, String metadataField, String metadataValue, boolean abbreviated)
          Gets the UI label of the given metadata field/value pair
 String getUiLabelOfFieldId(String fieldId)
          Gets the uiLabelOfFieldId attribute of the MetadataVocab object
 String getUiLabelOfSystemIds(String system, String systemFieldId, String systemValueId)
          Gets the full (non-abbreviated) UI label of the given encoded field/value Id pair
 String getUiLabelOfSystemIds(String system, String systemFieldId, String systemValueId, boolean abbreviated)
          Gets the UI label of the given encoded field/value Id pair
 String getUiValueDisplay(String metaFormat, String audience, String language, String field, String value)
          Gets the "display" attribute value for the given field/value vocab using the CURRENT metadata framework version
 String getUiValueDisplay(String metaFormat, String metaVersion, String audience, String language, String field, String value)
          Gets the "display" attribute value for the given field/value vocab
 String getUiValueLabel(String audience, String language, String field, String value, boolean abbrev)
          Gets the uiValueLabel attribute of the MetadataVocabTermsGroups object
 String getUiValueLabel(String metaFormat, String audience, String language, String field, String value, boolean abbrev)
          Gets the UI label associated with the given FIELD+VALUE NAMES/IDS, using the current or most recently loaded metadata format version number
 String getUiValueLabel(String metaFormat, String metaVersion, String audience, String language, String field, String value)
          Gets the non-abbreviated UI label associated with the given FIELD+VALUE NAMES/IDS
 String getUiValueLabel(String metaFormat, String metaVersion, String audience, String language, String field, String value, boolean abbrev)
          Gets the UI label associated with the given FIELD+VALUE NAMES/IDS
 String getVocabCheckbox(String groupTop, String value, String label, MetadataVocabInputState inputState)
          Returns a SINGLE HTML CHECKBOX input of the specified part of the vocabulary.
 String getVocabCheckboxes(String system, String group, int size, String tdWidth, boolean skipTopRow, MetadataVocabInputState inputState)
          Returns an HTML TABLE of CHECKBOX inputs of the specified part of the vocabulary.
 ArrayList getVocabFieldIds()
          Gets the vocabFieldIds attribute of the MetadataVocab object
 String getVocabHiddenInputs(String system, String group, MetadataVocabInputState inputState)
          Generates HTML HIDDEN inputs of the specified part of the vocabulary.
 VocabNode getVocabNode(String metaFormat, String audience, String language, String fieldName, String valueName)
          Gets the vocabNode attribute of the MetadataVocabTermsGroups object
 ArrayList getVocabNodes(String system, String group)
          Gets the vocabNodes attribute of the MetadataVocab object
 ArrayList getVocabNodes(String metaFormat, String audience, String language, String field)
          Gets the vocabNodes attribute of the MetadataVocabTermsGroups object
 ArrayList getVocabNodes(String metaFormat, String audience, String language, String field, String group)
          Gets the vocabNodes attribute of the MetadataVocabTermsGroups object
 String getVocabSelectList(String system, String group, int size, MetadataVocabInputState inputState)
          Returns an HTML SELECT list of the specified part of the vocabulary.
 Set getVocabSystemInterfaces()
          Gets the set of UI system interfaces (i.e., "dds.descr.en-us") that this vocabulary is defined for
 String getVocabTreeMenu(String system, String language, String group, PageContext page)
          Generates a Javascript Tree Menu (collapsable hierarchy) of the specified part of the vocabulary
 void ignorableWhitespace(char[] ch, int start, int length)
          (SAX) Reports any whitespace that is ignored because it falls outside of the DTD or schema definition--usefull for re-generating the file with indents intact.
 String nonWrappedLabel(String label)
          Replaces "||" in label values with spaces
 void processingInstruction(String target, String data)
          (SAX) Required by SAX, but not used here
 void reportError(String err)
          Log an error
 void reportMessage(String msg)
          Log a message
 void setDocumentLocator(Locator locator)
          (SAX) Sets the SAX locator, which indicates the current position of the parser within the document (line number, column number).
protected  void setNodesIsLastInSubList(VocabList list, boolean topList)
          Sets the isLastInSubList attribute of each vocab node
 void setParsingDefinitions(boolean bool)
          (SAX) Not strictly part of the SAX interface, but we use this to figure out which type of XML we're parsing (definitions/terms vs.
 void setResponseGroup(PageContext context, String metaFormat, String audience, String language, String field)
          Initiate the re-ordering/grouping/labeling of a flat list of metadata values in a search response (Services or otherwise) by indicating an audience grouping (OPML tree) sans version
 void setResponseGroup(PageContext context, String metaFramework, String metaVersion, String audience, String language, String field)
          Gets the responseGroup attribute of the MetadataVocabOPML object
 void setResponseList(ArrayList values, PageContext context)
          Adds an ArrayList of metadata values to the re-ordering/grouping/labeling cache
 void setResponseList(String[] values, PageContext context)
          Adds an ArrayList of metadata values to the re-ordering/grouping/labeling cache
 void setResponseValue(String value, PageContext context)
          Caches a response value for rendering within proper order/grouping
 void skippedEntity(String name)
          (SAX) Required by SAX, but not used here
 void startDocument()
          (SAX) Invoked at the start of any document parse
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
          (SAX) Invoked upon opening tag of an XML element
 void startElementDefinition(String namespaceURI, String localName, String qName, Attributes atts)
          (SAX) Invoked upon opening tag of a definitions XML element
 void startElementUI(String namespaceURI, String localName, String qName, Attributes atts)
          (SAX) Start element for the UI files
 void startPrefixMapping(String prefix, String uri)
          (SAX) Required by SAX, but not used here
 String wrappedLabel(String label)
          Replaces "||" in label values with <br>&nbsp;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vocab

protected VocabList vocab

vocabCompare

public MetadataVocabOPML vocabCompare
Constructor Detail

MetadataVocabTermsGroups

public MetadataVocabTermsGroups(String sqlDriver,
                                String sqlURL,
                                String sqlUser,
                                String sqlPassword,
                                String vocabTextFile)
Constructor for the MetadataVocab object

Parameters:
sqlDriver -
sqlURL -
sqlUser -
sqlPassword -
vocabTextFile -

MetadataVocabTermsGroups

public MetadataVocabTermsGroups()
Constructor for the MetadataVocab object

Method Detail

addError

public void addError(String err)
Adds a feature to the Error attribute of the MetadataVocabOPML object

Specified by:
addError in interface MetadataVocab
Parameters:
err - The feature to be added to the Error attribute

addMessage

public void addMessage(String msg)
Adds a feature to the Message attribute of the MetadataVocabOPML object

Specified by:
addMessage in interface MetadataVocab
Parameters:
msg - The feature to be added to the Message attribute

getMessages

public ArrayList getMessages()
Gets the messages attribute of the MetadataVocab object

Specified by:
getMessages in interface MetadataVocab
Returns:
The messages value

getErrors

public ArrayList getErrors()
Gets the errors attribute of the MetadataVocab object

Specified by:
getErrors in interface MetadataVocab
Returns:
The errors value

getVocabSystemInterfaces

public Set getVocabSystemInterfaces()
Gets the set of UI system interfaces (i.e., "dds.descr.en-us") that this vocabulary is defined for

Specified by:
getVocabSystemInterfaces in interface MetadataVocab
Returns:
The vocabSystemInterfaces value

getMetaNameOfId

public String getMetaNameOfId(String system,
                              String fieldId,
                              String valueId)
Gets the metadata value or field name of the given encoded field and value Ids. Pass "" (empty string) for valueId to have it return the metadata field name (instead of value).

Specified by:
getMetaNameOfId in interface MetadataVocab
Parameters:
system - Vocabulary system/interface/language trio, i.e. "dds.default.en-us"
fieldId - Encoded vocabulary field Id
valueId - Encoded vocabulary value Id
Returns:
The metaNameOfId value
See Also:
MetadataVocab#getTranslatedField(String,String,String,String,String), MetadataVocab#getTranslatedValue(String,String,String,String,String,String)

getFieldValueIdPairExists

public boolean getFieldValueIdPairExists(String fieldId,
                                         String valueId)
Does a vocabulary definition exist for the given encoded field/value Ids?

Specified by:
getFieldValueIdPairExists in interface MetadataVocab
Parameters:
fieldId - Encoded vocabulary field Id
valueId - Encoded vocabulary value Id
Returns:
The fieldValueIdPairExists value

getFieldValueSystemId

public String getFieldValueSystemId(String field,
                                    String value)
                             throws Exception
Gets the encoded value Id of the given metadata field/value pair

Specified by:
getFieldValueSystemId in interface MetadataVocab
Parameters:
field - Metadata field name
value - Metadata value name
Returns:
The encoded value Id
Throws:
Exception

getFieldSystemId

public String getFieldSystemId(String field)
                        throws Exception
Gets the encoded field Id of the given metadata field

Specified by:
getFieldSystemId in interface MetadataVocab
Parameters:
field - Metadata field name
Returns:
The encoded field Id
Throws:
Exception

getUiLabelOf

public String getUiLabelOf(String system,
                           String metadataField,
                           String metadataValue,
                           boolean abbreviated)
Gets the UI label of the given metadata field/value pair

Specified by:
getUiLabelOf in interface MetadataVocab
Parameters:
system - Vocabulary system/interface/language trio, i.e. "dds.default.en-us"
metadataField - Metadata field name
metadataValue - Metadata value name
abbreviated - Return the abbreviated form of the UI label?
Returns:
The user interface label associated with the given vocabulary value

getUiLabelOf

public String getUiLabelOf(String system,
                           String metadataField,
                           String metadataValue)
Gets the full (non-abbreviated) UI label of the given metadata field/value pair

Specified by:
getUiLabelOf in interface MetadataVocab
Parameters:
system - Vocabulary system/interface/language trio, i.e. "dds.default.en-us"
metadataField - Metadata field name
metadataValue - Metadata value name
Returns:
The user interface label associated with the given vocabulary value

getUiLabelOfFieldId

public String getUiLabelOfFieldId(String fieldId)
Gets the uiLabelOfFieldId attribute of the MetadataVocab object

Specified by:
getUiLabelOfFieldId in interface MetadataVocab
Parameters:
fieldId - Description of the Parameter
Returns:
The uiLabelOfFieldId value

getUiLabelOfSystemIds

public String getUiLabelOfSystemIds(String system,
                                    String systemFieldId,
                                    String systemValueId,
                                    boolean abbreviated)
Gets the UI label of the given encoded field/value Id pair

Specified by:
getUiLabelOfSystemIds in interface MetadataVocab
Parameters:
system - Vocabulary system/interface/language trio, i.e. "dds.default.en-us"
systemFieldId - Encoded field Id
systemValueId - Encoded value Id
abbreviated - Return the abbreviated form of the UI label?
Returns:
The user interface label associated with the given vocabulary value

getUiLabelOfSystemIds

public String getUiLabelOfSystemIds(String system,
                                    String systemFieldId,
                                    String systemValueId)
Gets the full (non-abbreviated) UI label of the given encoded field/value Id pair

Specified by:
getUiLabelOfSystemIds in interface MetadataVocab
Parameters:
system - Vocabulary system/interface/language trio, i.e. "dds.default.en-us"
systemFieldId - Encoded field Id
systemValueId - Encoded value Id
Returns:
The user interface label associated with the given vocabulary value

getTopLevelAbbrevLabelOf

public String getTopLevelAbbrevLabelOf(String system,
                                       String metadataField,
                                       String systemFieldId,
                                       String systemValueId)
Gets the topLevelAbbrevLabelOf attribute of the MetadataVocab object

Specified by:
getTopLevelAbbrevLabelOf in interface MetadataVocab
Parameters:
system -
metadataField -
systemFieldId -
systemValueId -
Returns:
The topLevelAbbrevLabelOf value

getVocabNodes

public ArrayList getVocabNodes(String system,
                               String group)
Gets the vocabNodes attribute of the MetadataVocab object

Specified by:
getVocabNodes in interface MetadataVocab
Parameters:
system -
group -
Returns:
The vocabNodes value

getVocabNodes

public ArrayList getVocabNodes(String metaFormat,
                               String audience,
                               String language,
                               String field)
Gets the vocabNodes attribute of the MetadataVocabTermsGroups object

Specified by:
getVocabNodes in interface MetadataVocab
Parameters:
metaFormat -
audience -
language -
field -
Returns:
The vocabNodes value

getVocabNodes

public ArrayList getVocabNodes(String metaFormat,
                               String audience,
                               String language,
                               String field,
                               String group)
Gets the vocabNodes attribute of the MetadataVocabTermsGroups object

Specified by:
getVocabNodes in interface MetadataVocab
Parameters:
metaFormat -
audience -
language -
field -
group -
Returns:
The vocabNodes value

getVocabSelectList

public String getVocabSelectList(String system,
                                 String group,
                                 int size,
                                 MetadataVocabInputState inputState)
Returns an HTML SELECT list of the specified part of the vocabulary.

Specified by:
getVocabSelectList in interface MetadataVocab
Parameters:
group - colon-seperated specifier of the part of the vocab hierarchy which is to be displayed
size - size (height) of the SELECT list
system -
inputState -
Returns:
The vocabSelectList value

getVocabCheckboxes

public String getVocabCheckboxes(String system,
                                 String group,
                                 int size,
                                 String tdWidth,
                                 boolean skipTopRow,
                                 MetadataVocabInputState inputState)
Returns an HTML TABLE of CHECKBOX inputs of the specified part of the vocabulary.

Specified by:
getVocabCheckboxes in interface MetadataVocab
Parameters:
group - colon-seperated specifier of the part of the vocab hierarchy which is to be displayed
size - how many inputs to display before starting a new column in the table
tdWidth - value inserted into the width param of the TD tag
skipTopRow - Should the top row of checkboxes (next to All | Clear) be skipped?
system -
inputState -
Returns:
the HTML code

getVocabCheckbox

public String getVocabCheckbox(String groupTop,
                               String value,
                               String label,
                               MetadataVocabInputState inputState)
Returns a SINGLE HTML CHECKBOX input of the specified part of the vocabulary.

Specified by:
getVocabCheckbox in interface MetadataVocab
Parameters:
groupTop - Top-level vocab group
value - vocab value
label - UI label
inputState -
Returns:
the HTML code

getVocabTreeMenu

public String getVocabTreeMenu(String system,
                               String language,
                               String group,
                               PageContext page)
Generates a Javascript Tree Menu (collapsable hierarchy) of the specified part of the vocabulary

Specified by:
getVocabTreeMenu in interface MetadataVocab
Parameters:
group - colon-seperated specifier of the part of the vocab hierarchy which is to be displayed
system -
page -
language -
Returns:
the Javascript code defining the menu

wrappedLabel

public String wrappedLabel(String label)
Replaces "||" in label values with <br>&nbsp;

Parameters:
label -
Returns:

nonWrappedLabel

public String nonWrappedLabel(String label)
Replaces "||" in label values with spaces

Parameters:
label -
Returns:

getVocabHiddenInputs

public String getVocabHiddenInputs(String system,
                                   String group,
                                   MetadataVocabInputState inputState)
Generates HTML HIDDEN inputs of the specified part of the vocabulary.

Specified by:
getVocabHiddenInputs in interface MetadataVocab
Parameters:
group - colon-seperated specifier of the part of the vocab hierarchy which is to be displayed
system -
inputState -
Returns:
the HTML code

doneLoading

public void doneLoading()
When all vocabs are loaded, generate the Lucene queries, register all current UI labels into the database, and close any database connection

Specified by:
doneLoading in interface MetadataVocab

getCacheValuesInOrder

public ArrayList getCacheValuesInOrder(String system,
                                       String group,
                                       Map cache)
Given a cache (Map) of vocab values, this method returns a list of those values in the order that they are defined in their groups file.

Specified by:
getCacheValuesInOrder in interface MetadataVocab
Parameters:
cache -
system -
group -
Returns:
The orderedCacheValues value

getVocabFieldIds

public ArrayList getVocabFieldIds()
Gets the vocabFieldIds attribute of the MetadataVocab object

Specified by:
getVocabFieldIds in interface MetadataVocab
Returns:
The vocabFieldIds value

setParsingDefinitions

public void setParsingDefinitions(boolean bool)
(SAX) Not strictly part of the SAX interface, but we use this to figure out which type of XML we're parsing (definitions/terms vs. UI/groups)

Parameters:
bool - The new parsingDefinitions value

setDocumentLocator

public void setDocumentLocator(Locator locator)
(SAX) Sets the SAX locator, which indicates the current position of the parser within the document (line number, column number). Could be used to indicate the spot where an error occured.

Specified by:
setDocumentLocator in interface ContentHandler
Parameters:
locator - The new saxLocator value

startDocument

public void startDocument()
                   throws SAXException
(SAX) Invoked at the start of any document parse

Specified by:
startDocument in interface ContentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
(SAX) Invoked at the end of parsing. Rewrite the definitions XML if new Ids have been assigned.

Specified by:
endDocument in interface ContentHandler
Throws:
SAXException

setNodesIsLastInSubList

protected void setNodesIsLastInSubList(VocabList list,
                                       boolean topList)
Sets the isLastInSubList attribute of each vocab node

Parameters:
list - The new nodesIsLastInSubList value
topList - The new nodesIsLastInSubList value

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
(SAX) Invoked upon opening tag of an XML element

Specified by:
startElement in interface ContentHandler
Parameters:
namespaceURI -
localName -
qName -
atts -
Throws:
SAXException

startElementDefinition

public void startElementDefinition(String namespaceURI,
                                   String localName,
                                   String qName,
                                   Attributes atts)
                            throws SAXException
(SAX) Invoked upon opening tag of a definitions XML element

Parameters:
namespaceURI -
localName -
qName -
atts -
Throws:
SAXException

findVocabNode

public VocabNode findVocabNode(String system,
                               String fieldName,
                               String valueName)
Within a given system (system.interface.language), find the node that contains the given value for its 'name' attribute.

Specified by:
findVocabNode in interface MetadataVocab
Parameters:
system -
fieldName -
valueName - pass null if only the field node is desired
Returns:

startElementUI

public void startElementUI(String namespaceURI,
                           String localName,
                           String qName,
                           Attributes atts)
                    throws SAXException
(SAX) Start element for the UI files

Parameters:
namespaceURI - XML namespace
localName - local tag name
qName - fully qualified tag name
atts - tag attributes
Throws:
SAXException

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
(SAX) Invoked upon closing tag of an XML element

Specified by:
endElement in interface ContentHandler
Parameters:
namespaceURI - XML namespace
localName - local tag name
qName - fully qualified tag name
Throws:
SAXException

endElementDefinition

public void endElementDefinition(String namespaceURI,
                                 String localName,
                                 String qName)
                          throws SAXException
(SAX) End element for definitions

Parameters:
namespaceURI -
localName -
qName -
Throws:
SAXException

endElementUI

public void endElementUI(String namespaceURI,
                         String localName,
                         String qName)
                  throws SAXException
(SAX) End element for UIs

Parameters:
namespaceURI -
localName -
qName -
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
(SAX) Element data (characters between tags)

Specified by:
characters in interface ContentHandler
Parameters:
ch -
start -
length -
Throws:
SAXException

charactersDefinition

public void charactersDefinition(char[] ch,
                                 int start,
                                 int length)
                          throws SAXException
(SAX) Element data for definitions

Parameters:
ch -
start -
length -
Throws:
SAXException

charactersUI

public void charactersUI(char[] ch,
                         int start,
                         int length)
                  throws SAXException
(SAX) Element data for UIs

Parameters:
ch - character array
start - starting index of character data
length - length of character data
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
(SAX) Reports any whitespace that is ignored because it falls outside of the DTD or schema definition--usefull for re-generating the file with indents intact.

Specified by:
ignorableWhitespace in interface ContentHandler
Parameters:
ch -
start -
length -
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
(SAX) Required by SAX, but not used here

Specified by:
startPrefixMapping in interface ContentHandler
Parameters:
prefix -
uri -
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
(SAX) Required by SAX, but not used here

Specified by:
endPrefixMapping in interface ContentHandler
Parameters:
prefix -
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
(SAX) Required by SAX, but not used here

Specified by:
processingInstruction in interface ContentHandler
Parameters:
target -
data -
Throws:
SAXException

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
(SAX) Required by SAX, but not used here

Specified by:
skippedEntity in interface ContentHandler
Parameters:
name -
Throws:
SAXException

reportMessage

public void reportMessage(String msg)
Log a message

Specified by:
reportMessage in interface MetadataVocab
Parameters:
msg -

reportError

public void reportError(String err)
Log an error

Specified by:
reportError in interface MetadataVocab
Parameters:
err -

getCurrentVersion

public String getCurrentVersion(String metaFramework)
Gets the currentVersion attribute of the MetadataVocabTermsGroups object

Specified by:
getCurrentVersion in interface MetadataVocab
Parameters:
metaFramework -
Returns:
The currentVersion value

getTranslatedField

public String getTranslatedField(String metaFormat,
                                 String metaVersion,
                                 String field)
                          throws Exception
Gets the translated FIELD NAME/ID of the given FIELD+VALUE NAMEs/IDs

Specified by:
getTranslatedField in interface MetadataVocab
Parameters:
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
metaFormat -
metaVersion -
Returns:
The FIELD NAME/ID as translated from input FIELD NAME/ID
Throws:
Exception

getTranslatedField

public String getTranslatedField(String metaFormat,
                                 String field)
                          throws Exception
Gets the translatedField attribute of the MetadataVocabTermsGroups object

Specified by:
getTranslatedField in interface MetadataVocab
Parameters:
metaFormat -
field -
Returns:
The translatedField value
Throws:
Exception

getTranslatedFieldPath

public String getTranslatedFieldPath(String metaFormat,
                                     String metaVersion,
                                     String field)
                              throws Exception
Gets the translatedFieldPath attribute of the MetadataVocabTermsGroups object

Specified by:
getTranslatedFieldPath in interface MetadataVocab
Parameters:
metaFormat -
metaVersion -
field -
Returns:
The translatedFieldPath value
Throws:
Exception

getTranslatedFieldPath

public String getTranslatedFieldPath(String metaFormat,
                                     String field)
                              throws Exception
Gets the translatedFieldPath attribute of the MetadataVocabTermsGroups object

Specified by:
getTranslatedFieldPath in interface MetadataVocab
Parameters:
metaFormat -
field -
Returns:
The translatedFieldPath value
Throws:
Exception

getTranslatedValue

public String getTranslatedValue(String metaFormat,
                                 String metaVersion,
                                 String field,
                                 String value)
                          throws Exception
Gets the translated VALUE NAME/ID of the given FIELD NAME/ID

Specified by:
getTranslatedValue in interface MetadataVocab
Parameters:
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
value - metadata VALUE encoded ID (i.e. "04") or metadata NAME (i.e. "DLESE:Intermediate elementary")
metaFormat -
metaVersion -
Returns:
The VALUE NAME/ID as translated from input FIELD+VALUE NAMEs/IDs
Throws:
Exception

getTranslatedValue

public String getTranslatedValue(String metaFormat,
                                 String field,
                                 String value)
                          throws Exception
Gets the translatedValue attribute of the MetadataVocabTermsGroups object

Specified by:
getTranslatedValue in interface MetadataVocab
Parameters:
metaFormat -
field -
value -
Returns:
The translatedValue value
Throws:
Exception

getUiValueLabel

public String getUiValueLabel(String metaFormat,
                              String metaVersion,
                              String audience,
                              String language,
                              String field,
                              String value,
                              boolean abbrev)
Gets the UI label associated with the given FIELD+VALUE NAMES/IDS

Specified by:
getUiValueLabel in interface MetadataVocab
Parameters:
metaFormat - metadata format (i.e. "adn")
metaVersion - metadata version (i.e. "0.6.50")
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
value - metadata VALUE encoded ID (i.e. "04") or metadata NAME (i.e. "DLESE:Intermediate elementary")
abbrev - get the abbreviated version of the label?
audience - UI audience, i.e. "community" or "cataloger"
language - UI language, ie.e. "en-us"
Returns:
The user interface label associated with the given format/version/audience/language value

getUiValueLabel

public String getUiValueLabel(String metaFormat,
                              String metaVersion,
                              String audience,
                              String language,
                              String field,
                              String value)
Gets the non-abbreviated UI label associated with the given FIELD+VALUE NAMES/IDS

Specified by:
getUiValueLabel in interface MetadataVocab
Parameters:
metaFormat - metadata format (i.e. "adn")
metaVersion - metadata version (i.e. "0.6.50")
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
value - metadata VALUE encoded ID (i.e. "04") or metadata NAME (i.e. "DLESE:Intermediate elementary")
audience - UI audience, i.e. "community" or "cataloger"
language - UI language, ie.e. "en-us"
Returns:
The user interface label associated with the given format/version/audience/language value

getUiValueLabel

public String getUiValueLabel(String metaFormat,
                              String audience,
                              String language,
                              String field,
                              String value,
                              boolean abbrev)
Gets the UI label associated with the given FIELD+VALUE NAMES/IDS, using the current or most recently loaded metadata format version number

Specified by:
getUiValueLabel in interface MetadataVocab
Parameters:
metaFormat - metadata format (i.e. "adn")
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
value - metadata VALUE encoded ID (i.e. "04") or metadata NAME (i.e. "DLESE:Intermediate elementary")
audience - UI audience, i.e. "community" or "cataloger"
language - UI language, ie.e. "en-us"
abbrev - get the abbreviated version of the label?
Returns:
The user interface label associated with the given format/version/audience/language value

setResponseGroup

public void setResponseGroup(PageContext context,
                             String metaFramework,
                             String metaVersion,
                             String audience,
                             String language,
                             String field)
Gets the responseGroup attribute of the MetadataVocabOPML object

Specified by:
setResponseGroup in interface MetadataVocab
Parameters:
context -
metaFramework - The new responseGroup value
metaVersion - The new responseGroup value
audience - The new responseGroup value
language - The new responseGroup value
field - The new responseGroup value
See Also:
MetadataVocab.setResponseValue(String,PageContext), MetadataVocab.setResponseList(String[],PageContext), MetadataVocab.setResponseList(ArrayList,PageContext), MetadataVocab.getResponseOPML(PageContext)

setResponseGroup

public void setResponseGroup(PageContext context,
                             String metaFormat,
                             String audience,
                             String language,
                             String field)
Initiate the re-ordering/grouping/labeling of a flat list of metadata values in a search response (Services or otherwise) by indicating an audience grouping (OPML tree) sans version

Specified by:
setResponseGroup in interface MetadataVocab
Parameters:
context - JSP page context
audience - UI audience, i.e. "community" or "cataloger"
language - UI language, i.e. "en-us"
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
metaFormat - metadata format (i.e. "adn")
See Also:
MetadataVocab.setResponseValue(String,PageContext), MetadataVocab.setResponseList(String[],PageContext), MetadataVocab.setResponseList(ArrayList,PageContext), MetadataVocab.getResponseOPML(PageContext)

setResponseValue

public void setResponseValue(String value,
                             PageContext context)
Caches a response value for rendering within proper order/grouping

Specified by:
setResponseValue in interface MetadataVocab
Parameters:
value - the metadata vocab value, i.e. "DLESE:High school"
context - The new response value
See Also:
MetadataVocab.setResponseGroup(PageContext,String,String,String,String,String), MetadataVocab.setResponseList(String[],PageContext), MetadataVocab.setResponseList(ArrayList,PageContext), MetadataVocab.getResponseOPML(PageContext)

getResponseOPML

public String getResponseOPML(PageContext context)
Gets the responseGroup attribute of the MetadataVocabOPML object

Specified by:
getResponseOPML in interface MetadataVocab
Parameters:
context -
Returns:
The responseGroup value
See Also:
MetadataVocab.setResponseValue(String,PageContext), MetadataVocab.setResponseList(String[],PageContext), MetadataVocab.setResponseList(ArrayList,PageContext), MetadataVocab.setResponseGroup(PageContext,String,String,String,String,String)

getUiFieldLabel

public String getUiFieldLabel(String metaFormat,
                              String metaVersion,
                              String audience,
                              String language,
                              String field,
                              boolean abbrev)
Gets the UI label associated with the given FIELD NAME/ID

Specified by:
getUiFieldLabel in interface MetadataVocab
Parameters:
metaFormat - metadata format (i.e. "adn")
metaVersion - metadata version (i.e. "0.6.50")
abbrev - get the abbreviated version of the label?
audience - UI audience, i.e. "community" or "cataloger"
language - UI language, ie.e. "en-us"
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
Returns:
The user interface label associated with the given format/version/audience/language value

getUiFieldLabel

public String getUiFieldLabel(String metaFormat,
                              String metaVersion,
                              String audience,
                              String language,
                              String field)
Gets the non-abbreviated UI label associated with the given FIELD NAME/ID

Specified by:
getUiFieldLabel in interface MetadataVocab
Parameters:
metaFormat - metadata format (i.e. "adn")
metaVersion - metadata version (i.e. "0.6.50")
audience - UI audience, i.e. "community" or "cataloger"
language - UI language, ie.e. "en-us"
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
Returns:
The user interface label associated with the given format/version/audience/language value

getUiFieldLabel

public String getUiFieldLabel(String metaFormat,
                              String audience,
                              String language,
                              String field,
                              boolean abbrev)
Gets the UI label associated with the given FIELD NAME/ID, using the current or most recently loaded metadata format version number

Specified by:
getUiFieldLabel in interface MetadataVocab
Parameters:
metaFormat - metadata format (i.e. "adn")
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
audience - UI audience, i.e. "community" or "cataloger"
language - UI language, ie.e. "en-us"
abbrev - get the abbreviated version of the label?
Returns:
The user interface label associated with the given format/version/audience/language value

getOPML

public String getOPML(String metaFormat,
                      String metaVersion,
                      String audience,
                      String language,
                      String field)
Gets the OPML for a given format/version/audience/language

Specified by:
getOPML in interface MetadataVocab
Parameters:
metaVersion - metadata version (i.e. "0.6.50")
audience - UI audience, i.e. "community" or "cataloger"
language - UI language, i.e. "en-us"
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
metaFormat - metadata format (i.e. "adn")
Returns:
OPML for the given format/audience

getOPML

public String getOPML(String metaFormat,
                      String audience,
                      String language,
                      String field)
Gets the oPML attribute of the MetadataVocabTermsGroups object

Specified by:
getOPML in interface MetadataVocab
Parameters:
metaFormat -
audience -
language -
field -
Returns:
The oPML value

getOPML

public String getOPML(String metaFormat,
                      String metaVersion,
                      String audience,
                      String language,
                      String field,
                      boolean includeXmlDeclaration)
Gets the oPML attribute of the MetadataVocabTermsGroups object

Specified by:
getOPML in interface MetadataVocab
Parameters:
metaFormat -
metaVersion -
audience -
language -
field -
includeXmlDeclaration -
Returns:
The oPML value

getUiValueLabel

public String getUiValueLabel(String audience,
                              String language,
                              String field,
                              String value,
                              boolean abbrev)
Gets the uiValueLabel attribute of the MetadataVocabTermsGroups object

Specified by:
getUiValueLabel in interface MetadataVocab
Parameters:
audience -
language -
field -
value -
abbrev -
Returns:
The uiValueLabel value

getUiFieldLabel

public String getUiFieldLabel(String audience,
                              String language,
                              String field,
                              boolean abbrev)
Gets the uiFieldLabel attribute of the MetadataVocabTermsGroups object

Specified by:
getUiFieldLabel in interface MetadataVocab
Parameters:
audience -
language -
field -
abbrev -
Returns:
The uiFieldLabel value

getUiValueDisplay

public String getUiValueDisplay(String metaFormat,
                                String metaVersion,
                                String audience,
                                String language,
                                String field,
                                String value)
Gets the "display" attribute value for the given field/value vocab

Specified by:
getUiValueDisplay in interface MetadataVocab
Parameters:
metaFormat - metadata format (i.e. "adn")
metaVersion - metadata version (i.e. "0.6.50")
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
value - metadata VALUE encoded ID (i.e. "04") or metadata NAME (i.e. "DLESE:Intermediate elementary")
audience - UI audience, i.e. "community" or "cataloger"
language - UI language, i.e. "en-us"
Returns:
The uiValueDisplay value

getUiValueDisplay

public String getUiValueDisplay(String metaFormat,
                                String audience,
                                String language,
                                String field,
                                String value)
Gets the "display" attribute value for the given field/value vocab using the CURRENT metadata framework version

Specified by:
getUiValueDisplay in interface MetadataVocab
Parameters:
metaFormat - metadata format (i.e. "adn")
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
value - metadata VALUE encoded ID (i.e. "04") or metadata NAME (i.e. "DLESE:Intermediate elementary")
audience - UI audience, i.e. "community" or "cataloger"
language - UI language, i.e. "en-us"
Returns:
The uiValueDisplay value

getOPML

public String getOPML(String metaFormat,
                      String audience,
                      String language,
                      String field,
                      boolean includeXmlDeclaration)
Gets the oPML attribute of the MetadataVocabTermsGroups object

Specified by:
getOPML in interface MetadataVocab
Parameters:
metaFormat -
audience -
language -
field -
includeXmlDeclaration -
Returns:
The oPML value

getMetaFormatOfField

public String getMetaFormatOfField(String field)
Gets the metaFormatOfField attribute of the MetadataVocabTermsGroups object

Specified by:
getMetaFormatOfField in interface MetadataVocab
Parameters:
field -
Returns:
The metaFormatOfField value

getVocabNode

public VocabNode getVocabNode(String metaFormat,
                              String audience,
                              String language,
                              String fieldName,
                              String valueName)
Gets the vocabNode attribute of the MetadataVocabTermsGroups object

Specified by:
getVocabNode in interface MetadataVocab
Parameters:
metaFormat -
audience -
language -
fieldName -
valueName -
Returns:
The vocabNode value

setResponseList

public void setResponseList(ArrayList values,
                            PageContext context)
Adds an ArrayList of metadata values to the re-ordering/grouping/labeling cache

Specified by:
setResponseList in interface MetadataVocab
Parameters:
context - JSP page context
values - List of metadata VALUE encoded ID (i.e. "04") or metadata NAME (i.e. "DLESE:Intermediate elementary")
See Also:
MetadataVocab.setResponseGroup(PageContext,String,String,String,String,String), MetadataVocab.getResponseOPML(PageContext)

setResponseList

public void setResponseList(String[] values,
                            PageContext context)
Adds an ArrayList of metadata values to the re-ordering/grouping/labeling cache

Specified by:
setResponseList in interface MetadataVocab
Parameters:
context - JSP page context
values - List of metadata VALUE encoded ID (i.e. "04") or metadata NAME (i.e. "DLESE:Intermediate elementary")
See Also:
MetadataVocab.setResponseGroup(PageContext,String,String,String,String,String), MetadataVocab.getResponseOPML(PageContext)

DLESE Tools
v1.6.0