DLESE Tools
v1.6.0

org.dlese.dpc.vocab
Class MetadataVocabOPML

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

public class MetadataVocabOPML
extends Object
implements MetadataVocab, Serializable

MetadataVocabOPML is an implementation of MetadataVocab that uses an OPML-based framework to provide a set of methods for accessing mappings between metadata vocabulary encoded IDs and their term names, as well as rendering groups of controlled vocabularies in a variety of ways (such as simple HTML checkboxes, or dHTML flyouts).

UI renderings and mapping lookups are keyed in one of two ways:

NOTE: the version parameter is optional, as most methods have a version that does not take it. In these instances, the current , or most recently loaded version is assumed.

Instances of this class are loaded via LoadMetadataOPML and are placed into application scope via MetadataVocabServlet as an attribute named according to the context parameter "metadataVocabInstanceAttributeName".

Author:
Ryan Deardorff
See Also:
Serialized Form

Field Summary
static String OPML_GROUPS_NAMESPACE
           
static String OPML_NAMESPACE_PREFIX
           
static String OPML_VERSION
           
 
Constructor Summary
MetadataVocabOPML(boolean debug, String loaderFile, ServletContext servletContext)
          Constructor for the MetadataVocabOPML 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 doneLoading()
          Invoked when all OPML files have been loaded
 void endDocument()
          (SAX) Invoked at the end of parsing.
 void endElement(String namespaceURI, String lName, String qName)
          (SAX) Invoked upon closing tag of an XML element
 void endPrefixMapping(String prefix)
          (SAX) Required by SAX, but not used here
 String errorDisplay(String err, String method)
          Display vocab error as HTML
 VocabNode findVocabNode(String system, String fieldName, String valueName)
          Description of the Method
 ArrayList getCacheValuesInOrder(String system, String group, Map cache)
          Gets the cacheValuesInOrder attribute of the MetadataVocabOPML object
 org.dlese.dpc.gui.OPMLTree getCurrentTree()
          Gets the currentTree attribute of the MetadataVocabOPML object
 String getCurrentVersion(String metaFormat)
          Get the most recently loaded metadata format version number
static String getDateStamp()
          Return a string for the current time and date, sutiable for display in log files and output to standout:
 String getDescription(org.dlese.dpc.gui.OPMLTree.TreeNode node, PageContext page)
          Gets the description from HTTP request of SRC URL
 ArrayList getErrors()
          Gets the errors attribute of the MetadataUIManager 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
 String getFilenameOfFieldPath(String format, String version, String audience, String language, String fieldPath)
          Physical filename of the OPML that loaded the given vocabulary field XPath
 ArrayList getMessages()
          Gets the messages attribute of the MetadataVocabOPML object
 String getMetaFormatOfField(String field)
          Gets the metaFormatOfField attribute of the MetadataVocabOPML object
 String getMetaNameOfId(String system, String fieldId, String valueId)
          Deprecated. As of MetadataUI v1.0, replaced by getTranslatedValue OR getTranslatedField
 String getNameFromPath(String fieldPath)
          Gets the vocab field name by clipping from the end of a full xpath
 org.dlese.dpc.gui.OPMLTree getNewTree()
          Gets the newTree attribute of the MetadataVocabOPML object
 String getNodeId(org.dlese.dpc.gui.OPMLTree.TreeNode node)
          Gets the nodeId attribute of the MetadataVocabOPML object
 String getOPML(String metaFormat, String audience, String language, String field)
          Gets the OPML for a given format/audience/language using the current or most recently loaded version without the XML declaration tag
 String getOPML(String metaFormat, String audience, String language, String field, boolean includeXmlDeclaration)
          Gets the OPML for a given format/audience/language using the current or most recently loaded version
 String getOPML(String metaFormat, String metaVersion, String audience, String language, String field)
          Gets the OPML for a given format/version/audience/language without the XML declaration tag
 String getOPML(String metaFormat, String metaVersion, String audience, String language, String field, boolean includeXmlDeclaration)
          Gets the OPML for a given format/version/audience/language
 String getResponseOPML(PageContext context)
          Gets the re-ordered/grouped/labeled OPML tree of metadata values from the cache created by setResponseGroup()
 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 translated FIELD NAME/ID of the given FIELD NAME/ID using the current or most recently loaded metadata format version number
 String getTranslatedField(String metaFormat, String metaVersion, String field)
          Gets the translated FIELD NAME/ID of the given FIELD NAME/ID
 String getTranslatedFieldPath(String metaFormat, String field)
          Gets the translated FIELD XPATH of the given FIELD+VALUE NAMES/IDS using the current or most recently loaded metadata format version number
 String getTranslatedFieldPath(String metaFormat, String metaVersion, String field)
          Gets the translated FIELD XPATH of the given FIELD+VALUE NAMES/IDS
 String getTranslatedValue(String metaFormat, String field, String value)
          Gets the translated VALUE NAME/ID of the given FIELD+VALUE NAMES/IDS using the current or most recently loaded metadata format version number
 String getTranslatedValue(String metaFormat, String metaVersion, String field, String value)
          Gets the translated VALUE NAME/ID of the given FIELD+VALUE NAMES/IDS
 String getUiFieldLabel(String audience, String language, String field, boolean abbrev)
          Gets the uiFieldLabel attribute of the MetadataVocabOPML 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 uiLabelOf attribute of the MetadataVocabOPML object
 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 MetadataVocabOPML 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 MetadataVocabOPML 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
 ArrayList getVocabFieldPaths()
          Gets the vocabFieldPaths attribute of the MetadataVocabOPML 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 MetadataVocabOPML object
 VocabNode getVocabNode(String metaFormat, String metaVersion, String audience, String language, String fieldName, String valueName)
          Gets a VocabNode for the given field/value pair
 ArrayList getVocabNodes(String system, String group)
          Gets the vocabNodes attribute of the MetadataVocabOPML object
 ArrayList getVocabNodes(String metaFormat, String audience, String language, String field)
          Gets the vocabNodes attribute of the MetadataVocab object
 ArrayList getVocabNodes(String metaFormat, String audience, String language, String field, String group)
          Gets the vocabNodes attribute of the MetadataVocabOPML 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 vocabSystemInterfaces attribute of the MetadataUIManager object
 String getVocabTreeMenu(String system, String language, String group, PageContext page)
          Generates a Javascript Tree Menu (collapsable hierarchy) of the specified part of the vocabulary
 boolean hasValue(String metaFormat, String field, String value)
          Does the given field/value pair (in the CURRENT version of the given framework) exist in this MetadataVocab instance?
 boolean hasValue(String metaFormat, String metaVersion, String field, String value)
          Does the given field/value pair exist in this MetadataVocab instance?
 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.
 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
 String setCurrentTree(String key)
          Sets the currentTree OPMLTree using the system info.
 String setCurrentTree(String key, String subGroup)
          Sets currentTree using its key (framework/version/audience/language/id)
 void setDocumentLocator(Locator locator)
          (SAX) Sets the SAX locator, which indicates the current position of the parser within the document (line number, column number).
 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 metaFormat, String metaVersion, 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)
 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)
          Adds a single metadata value to the re-ordering/grouping/labeling cache
 void setTreeKey(String key)
          Sets the treeKey attribute of the MetadataVocabOPML object
 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 lName, String qName, Attributes atts)
          (SAX) Invoked upon opening tag of an XML element
 void startPrefixMapping(String prefix, String uri)
          (SAX) Required by SAX, but not used here
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPML_VERSION

public static final String OPML_VERSION
See Also:
Constant Field Values

OPML_GROUPS_NAMESPACE

public static final String OPML_GROUPS_NAMESPACE
See Also:
Constant Field Values

OPML_NAMESPACE_PREFIX

public static final String OPML_NAMESPACE_PREFIX
See Also:
Constant Field Values
Constructor Detail

MetadataVocabOPML

public MetadataVocabOPML(boolean debug,
                         String loaderFile,
                         ServletContext servletContext)
Constructor for the MetadataVocabOPML object

Parameters:
debug -
loaderFile -
servletContext -
Method Detail

getCurrentTree

public org.dlese.dpc.gui.OPMLTree getCurrentTree()
Gets the currentTree attribute of the MetadataVocabOPML object

Returns:
The currentTree value

setCurrentTree

public String setCurrentTree(String key,
                             String subGroup)
Sets currentTree using its key (framework/version/audience/language/id)

Parameters:
key - system (framework/version/audience/language/id) key
subGroup - The new currentTree value
Returns:
String containing just the metadata id

setCurrentTree

public String setCurrentTree(String key)
Sets the currentTree OPMLTree using the system info.

Parameters:
key - system (framework/version/audience/language/id) key
Returns:
metadata id

getNewTree

public org.dlese.dpc.gui.OPMLTree getNewTree()
Gets the newTree attribute of the MetadataVocabOPML object

Returns:
The newTree value

setTreeKey

public void setTreeKey(String key)
Sets the treeKey attribute of the MetadataVocabOPML object

Parameters:
key - The new treeKey value

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

getErrors

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

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

getVocabSystemInterfaces

public Set getVocabSystemInterfaces()
Gets the vocabSystemInterfaces attribute of the MetadataUIManager object

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

getMetaNameOfId

public String getMetaNameOfId(String system,
                              String fieldId,
                              String valueId)
Deprecated. As of MetadataUI v1.0, replaced by getTranslatedValue OR getTranslatedField

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 framework/version/audience/language, i.e. "adn/0.6.50/community/en-us"
fieldId - Encoded vocabulary field Id
valueId - Encoded vocabulary value Id
Returns:
The metaNameOfId value
See Also:
#getTranslatedField(String,String,String,String,String), #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

getFilenameOfFieldPath

public String getFilenameOfFieldPath(String format,
                                     String version,
                                     String audience,
                                     String language,
                                     String fieldPath)
Physical filename of the OPML that loaded the given vocabulary field XPath

Parameters:
fieldPath - field XPath
format -
version -
audience -
language -
Returns:
XML filename

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 framework/version/audience/language key, i.e. "adn/0.6.50/community/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

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 metaFormat,
                               String audience,
                               String language,
                               String field)
Gets the vocabNodes attribute of the MetadataVocab 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 MetadataVocabOPML object

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

getVocabNodes

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

Specified by:
getVocabNodes in interface MetadataVocab
Parameters:
system -
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

getNodeId

public String getNodeId(org.dlese.dpc.gui.OPMLTree.TreeNode node)
Gets the nodeId attribute of the MetadataVocabOPML object

Parameters:
node -
Returns:
The nodeId value

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

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

getMetaFormatOfField

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

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

getVocabFieldIds

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

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

getVocabFieldPaths

public ArrayList getVocabFieldPaths()
Gets the vocabFieldPaths attribute of the MetadataVocabOPML object

Returns:
The vocabFieldPaths value

doneLoading

public void doneLoading()
Invoked when all OPML files have been loaded

Specified by:
doneLoading in interface MetadataVocab

getNameFromPath

public String getNameFromPath(String fieldPath)
Gets the vocab field name by clipping from the end of a full xpath

Parameters:
fieldPath -
Returns:
The nameFromPath value

findVocabNode

public VocabNode findVocabNode(String system,
                               String fieldName,
                               String valueName)
Description of the Method

Specified by:
findVocabNode in interface MetadataVocab
Parameters:
system -
fieldName -
valueName -
Returns:

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

startElement

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

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

endElement

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

Specified by:
endElement in interface ContentHandler
Parameters:
namespaceURI - XML namespace
lName - local tag name
qName - fully qualified tag name
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

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

errorDisplay

public String errorDisplay(String err,
                           String method)
Display vocab error as HTML

Parameters:
err -
method -
Returns:

getDescription

public String getDescription(org.dlese.dpc.gui.OPMLTree.TreeNode node,
                             PageContext page)
Gets the description from HTTP request of SRC URL

Parameters:
page -
node -
Returns:
The description value

getCurrentVersion

public String getCurrentVersion(String metaFormat)
Get the most recently loaded metadata format version number

Specified by:
getCurrentVersion in interface MetadataVocab
Parameters:
metaFormat - metadata format (i.e. "adn")
Returns:
The current (most recently loaded) version for the given format

getVocabNode

public VocabNode getVocabNode(String metaFormat,
                              String metaVersion,
                              String audience,
                              String language,
                              String fieldName,
                              String valueName)
Gets a VocabNode for the given field/value pair

Parameters:
metaFormat - metadata format (i.e. "adn")
audience - UI audience, i.e. "community" or "cataloger"
language - UI language, i.e. "en-us"
fieldName - vocab field
valueName - vocab value
metaVersion -
Returns:
VocabNode for the vocab

getVocabNode

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

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

getTranslatedField

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

Specified by:
getTranslatedField in interface MetadataVocab
Parameters:
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
metaFormat - metadata format (i.e. "adn")
metaVersion - metadata version (i.e. "0.6.50")
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 translated FIELD NAME/ID of the given FIELD NAME/ID using the current or most recently loaded metadata format version number

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

getTranslatedFieldPath

public String getTranslatedFieldPath(String metaFormat,
                                     String metaVersion,
                                     String field)
                              throws Exception
Gets the translated FIELD XPATH of the given FIELD+VALUE NAMES/IDS

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

getTranslatedFieldPath

public String getTranslatedFieldPath(String metaFormat,
                                     String field)
                              throws Exception
Gets the translated FIELD XPATH of the given FIELD+VALUE NAMES/IDS using the current or most recently loaded metadata format version number

Specified by:
getTranslatedFieldPath in interface MetadataVocab
Parameters:
field - metadata FIELD encoded ID (i.e. "gr") or metadata NAME (i.e. "gradeRange")
metaFormat - metadata format (i.e. "adn")
Returns:
The FIELD XPATH as translated from input FIELD NAME/ID
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+VALUE NAMES/IDS

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 - metadata format (i.e. "adn")
metaVersion - metadata version (i.e. "0.6.50")
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 translated VALUE NAME/ID of the given FIELD+VALUE NAMES/IDS using the current or most recently loaded metadata format version number

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 - metadata format (i.e. "adn")
Returns:
The VALUE NAME/ID as translated from input FIELD+VALUE NAMEs/IDs
Throws:
Exception

hasValue

public boolean hasValue(String metaFormat,
                        String metaVersion,
                        String field,
                        String value)
Does the given field/value pair exist in this MetadataVocab instance?

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 - metadata format (i.e. "adn")
metaVersion - metadata version (i.e. "0.6.50")
Returns:
true if it exists

hasValue

public boolean hasValue(String metaFormat,
                        String field,
                        String value)
Does the given field/value pair (in the CURRENT version of the given framework) exist in this MetadataVocab instance?

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 - metadata format (i.e. "adn")
Returns:
true if it exists

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, i.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, i.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, i.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

getUiValueLabel

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

Specified by:
getUiValueLabel in interface MetadataVocab
Parameters:
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")
abbrev - return the "textAbbrev" version of the label?
value -
Returns:
The uiValueLabel value

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, i.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, i.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, i.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

getUiFieldLabel

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

Specified by:
getUiFieldLabel in interface MetadataVocab
Parameters:
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")
abbrev - return the "textAbbrev" version of the label?
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

setResponseGroup

public void setResponseGroup(PageContext context,
                             String metaFormat,
                             String metaVersion,
                             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)

Specified by:
setResponseGroup in interface MetadataVocab
Parameters:
context - JSP page context
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")
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)
Adds a single metadata value to the re-ordering/grouping/labeling cache

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

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.setResponseValue(String,PageContext), MetadataVocab.setResponseList(String[],PageContext), 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.setResponseValue(String,PageContext), MetadataVocab.setResponseList(ArrayList,PageContext), MetadataVocab.getResponseOPML(PageContext)

getResponseOPML

public String getResponseOPML(PageContext context)
Gets the re-ordered/grouped/labeled OPML tree of metadata values from the cache created by setResponseGroup()

Specified by:
getResponseOPML in interface MetadataVocab
Parameters:
context - JSP page context
Returns:
OPML for the group specified with setResponseGroup() and trimmed to the subset indicated by values passed into setResponse()
See Also:
MetadataVocab.setResponseValue(String,PageContext), MetadataVocab.setResponseList(String[],PageContext), MetadataVocab.setResponseList(ArrayList,PageContext), MetadataVocab.setResponseGroup(PageContext,String,String,String,String,String)

getOPML

public String getOPML(String metaFormat,
                      String metaVersion,
                      String audience,
                      String language,
                      String field,
                      boolean includeXmlDeclaration)
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")
includeXmlDeclaration -
Returns:
OPML for the given format/audience

getOPML

public String getOPML(String metaFormat,
                      String audience,
                      String language,
                      String field,
                      boolean includeXmlDeclaration)
Gets the OPML for a given format/audience/language using the current or most recently loaded version

Specified by:
getOPML in interface MetadataVocab
Parameters:
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")
includeXmlDeclaration -
Returns:
OPML for the given format/audience

getOPML

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

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 for a given format/audience/language using the current or most recently loaded version without the XML declaration tag

Specified by:
getOPML in interface MetadataVocab
Parameters:
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

getDateStamp

public static String getDateStamp()
Return a string for the current time and date, sutiable for display in log files and output to standout:

Returns:
The dateStamp value

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 -

getMessages

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

Specified by:
getMessages in interface MetadataVocab
Returns:
The messages 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

getUiLabelOfFieldId

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

Specified by:
getUiLabelOfFieldId in interface MetadataVocab
Parameters:
fieldId -
Returns:
The uiLabelOfFieldId value

getUiLabelOf

public String getUiLabelOf(String system,
                           String metadataField,
                           String metadataValue)
Gets the uiLabelOf attribute of the MetadataVocabOPML object

Specified by:
getUiLabelOf in interface MetadataVocab
Parameters:
system -
metadataField -
metadataValue -
Returns:
The uiLabelOf value

getCacheValuesInOrder

public ArrayList getCacheValuesInOrder(String system,
                                       String group,
                                       Map cache)
Gets the cacheValuesInOrder attribute of the MetadataVocabOPML object

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

DLESE Tools
v1.6.0