|
DLESE Tools v1.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.vocab.MetadataVocab
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.
Constructor Summary | |
---|---|
MetadataVocab(String sqlDriver,
String sqlURL,
String sqlUser,
String sqlPassword)
Constructor for the MetadataVocab object |
Method Summary | |
---|---|
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 |
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 |
getMetaNameOfId(String system,
String fieldId,
String valueId)
Gets the metadata value or field name of the given encoded field and value Ids. |
String |
getTopLevelAbbrevLabelOf(String system,
String metadataField,
String systemFieldId,
String systemValueId)
Gets the topLevelAbbrevLabelOf attribute of the MetadataVocab object |
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 |
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 |
getVocabCheckbox(String groupTop,
String value,
String label,
PageContext page)
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,
PageContext page)
Returns an HTML TABLE of CHECKBOX inputs of the specified part of the vocabulary. |
String |
getVocabCheckboxesAllClearLinks(String system,
String group,
int numCheckboxes,
HttpSession session)
Returns HTML code that displays the "All | Clear" links for checkboxes. |
String |
getVocabHiddenInputs(String system,
String group,
PageContext page)
Generates HTML HIDDEN inputs of the specified part of the vocabulary. |
String |
getVocabHistogram(String system,
String group,
PageContext page,
String addQuery,
String imgPrefix,
String tableWidth)
Generates an HTML "histogram" view of the specified part of the vocabulary. |
ArrayList |
getVocabNodes(String system,
String group)
Gets the vocabNodes attribute of the MetadataVocab object |
String |
getVocabSelectList(String system,
String group,
int size,
PageContext page)
Returns an HTML SELECT list of the specified part of the vocabulary. |
String |
getVocabTreeMenu(String system,
String language,
String group,
String x,
String y,
PageContext page)
Generates a Javascript Tree Menu (collapsable hierarchy) of the specified part of the vocabulary |
boolean |
hasSubtotalsGreaterThanZero(VocabList list,
String topMetaName,
HashMap histogramTotals)
Does this list have values (or sub-values) that total > 0? If not, sub-headers don't render. |
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 |
resetJSCount(HttpSession session)
Reset the counter that keeps track of how many checkboxes have been rendered so far by getVocabCheckboxes(). |
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 |
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 |
setVocabHistogramHighestCountFromGroup(String system,
String group,
LuceneIndex index,
String addQuery,
PageContext page,
boolean onlyIfGreaterThanCurrent)
Gets the highest total count within the given vocab group, for use in the histogram generation |
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MetadataVocab(String sqlDriver, String sqlURL, String sqlUser, String sqlPassword)
sqlDriver
- sqlURL
- sqlUser
- sqlPassword
- Method Detail |
public ArrayList getMessages()
public ArrayList getErrors()
public String getMetaNameOfId(String system, String fieldId, String valueId)
system
- Vocabulary system/interface/language trio, i.e.
"dds.default.en-us"fieldId
- Encoded vocabulary field IdvalueId
- Encoded vocabulary value Id
public boolean getFieldValueIdPairExists(String fieldId, String valueId)
fieldId
- Encoded vocabulary field IdvalueId
- Encoded vocabulary value Id
public String getFieldValueSystemId(String field, String value) throws Exception
field
- Metadata field namevalue
- Metadata value name
Exception
public String getFieldSystemId(String field) throws Exception
field
- Metadata field name
Exception
public String getUiLabelOf(String system, String metadataField, String metadataValue, boolean abbreviated)
system
- Vocabulary system/interface/language trio, i.e.
"dds.default.en-us"metadataField
- Metadata field namemetadataValue
- Metadata value nameabbreviated
- Return the abbreviated form of the UI label?
public String getUiLabelOf(String system, String metadataField, String metadataValue)
system
- Vocabulary system/interface/language trio, i.e.
"dds.default.en-us"metadataField
- Metadata field namemetadataValue
- Metadata value name
public String getUiLabelOfSystemIds(String system, String systemFieldId, String systemValueId, boolean abbreviated)
system
- Vocabulary system/interface/language trio, i.e.
"dds.default.en-us"systemFieldId
- Encoded field IdsystemValueId
- Encoded value Idabbreviated
- Return the abbreviated form of the UI label?
public String getUiLabelOfSystemIds(String system, String systemFieldId, String systemValueId)
system
- Vocabulary system/interface/language trio, i.e.
"dds.default.en-us"systemFieldId
- Encoded field IdsystemValueId
- Encoded value Id
public String getTopLevelAbbrevLabelOf(String system, String metadataField, String systemFieldId, String systemValueId)
system
- metadataField
- systemFieldId
- systemValueId
-
public ArrayList getVocabNodes(String system, String group)
system
- group
-
public String getVocabSelectList(String system, String group, int size, PageContext page)
group
- colon-seperated specifier of the part of the vocab hierarchy
which is to be displayedsize
- size (height) of the SELECT listpage
- JSP PageContextsystem
-
public String getVocabCheckboxes(String system, String group, int size, String tdWidth, boolean skipTopRow, PageContext page)
group
- colon-seperated specifier of the part of the vocab
hierarchy which is to be displayedsize
- how many inputs to display before starting a new column
in the tabletdWidth
- value inserted into the width param of the TD tagskipTopRow
- Should the top row of checkboxes (next to All | Clear)
be skipped?page
- JSP PageContextsystem
-
public String getVocabCheckbox(String groupTop, String value, String label, PageContext page)
groupTop
- Top-level vocab groupvalue
- vocab valuelabel
- UI labelpage
- JSP PageContext
public String getVocabCheckboxesAllClearLinks(String system, String group, int numCheckboxes, HttpSession session)
group
- colon-seperated specifier of the part of the vocab
hierarchy which is to be displayednumCheckboxes
- number of checkboxes that will be rendered
individuallysession
- JSP Sessionsystem
-
public String resetJSCount(HttpSession session)
session
- JSP Session
public String getVocabHistogram(String system, String group, PageContext page, String addQuery, String imgPrefix, String tableWidth)
group
- colon-seperated specifier of the part of the vocab
hierarchy which is to be displayedaddQuery
- query of metadata selected thus far (for "drill-down",
not currently used)page
- JSP PageContextimgPrefix
- location of histogram imagessystem
- tableWidth
-
public boolean hasSubtotalsGreaterThanZero(VocabList list, String topMetaName, HashMap histogramTotals)
list
- topMetaName
- histogramTotals
-
public void setVocabHistogramHighestCountFromGroup(String system, String group, LuceneIndex index, String addQuery, PageContext page, boolean onlyIfGreaterThanCurrent)
group
- colon-seperated specifier of the part of
the vocab hierarchy which is to be displayedindex
- object that returns resource totals via
index.numDocs()addQuery
- query of metadata selected thus faronlyIfGreaterThanCurrent
- set the value only if it ends up being
greater than the current valuepage
- JSP PageContextsystem
- The new
vocabHistogramHighestCountFromGroup valuepublic String getVocabTreeMenu(String system, String language, String group, String x, String y, PageContext page)
group
- colon-seperated specifier of the part of the vocab
hierarchy which is to be displayedsystem
- x
- y
- page
- language
-
public String getVocabHiddenInputs(String system, String group, PageContext page)
group
- colon-seperated specifier of the part of the vocab hierarchy
which is to be displayedpage
- JSP PageContextsystem
-
public void doneLoading()
public void setParsingDefinitions(boolean bool)
bool
- The new parsingDefinitions valuepublic void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
locator
- The new saxLocator valuepublic void startDocument() throws SAXException
startDocument
in interface ContentHandler
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
SAXException
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
namespaceURI
- localName
- qName
- atts
-
SAXException
public void startElementDefinition(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
namespaceURI
- localName
- qName
- atts
-
SAXException
public void startElementUI(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
namespaceURI
- XML namespacelocalName
- local tag nameqName
- fully qualified tag nameatts
- tag attributes
SAXException
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
namespaceURI
- XML namespacelocalName
- local tag nameqName
- fully qualified tag name
SAXException
public void endElementDefinition(String namespaceURI, String localName, String qName) throws SAXException
namespaceURI
- localName
- qName
-
SAXException
public void endElementUI(String namespaceURI, String localName, String qName) throws SAXException
namespaceURI
- localName
- qName
-
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
ch
- start
- length
-
SAXException
public void charactersDefinition(char[] ch, int start, int length) throws SAXException
ch
- start
- length
-
SAXException
public void charactersUI(char[] ch, int start, int length) throws SAXException
ch
- character arraystart
- starting index of character datalength
- length of character data
SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ignorableWhitespace
in interface ContentHandler
ch
- start
- length
-
SAXException
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
prefix
- uri
-
SAXException
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
prefix
-
SAXException
public void processingInstruction(String target, String data) throws SAXException
processingInstruction
in interface ContentHandler
target
- data
-
SAXException
public void skippedEntity(String name) throws SAXException
skippedEntity
in interface ContentHandler
name
-
SAXException
public void reportMessage(String msg)
msg
- public void reportError(String err)
err
-
|
DLESE Tools v1.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |