DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.vocab
Class FieldInfoReader

java.lang.Object
  extended by org.dlese.dpc.schemedit.vocab.FieldInfoReader

public class FieldInfoReader
extends Object

Provides access to infomormation (beyond that expressed in the metadata schema) about a metadata field, such as cataloging best practices and definitions of controlled vocabulary.

FieldInfoReader reads FieldInfo xml documents and is used by org.dlese.dpc.schemedit.autoform classes as well as MetaDataFramework instances.

Note: why doesn't this class extend the AbstractConfigReader class?

Author:
ostwald

Nested Class Summary
 class FieldInfoReader.OtherPractice
          Other practices have a header and a list of "practices".
 
Field Summary
 URI uri
          Description of the Field
 
Constructor Summary
FieldInfoReader(String path)
          Constructor for the FieldInfoReader object
FieldInfoReader(URI uri)
          Constructor for the FieldInfoReader object
 
Method Summary
static String applyMarkup(String text, String link, String url, String style)
          Apply specified markup (url, style) to the first occurrence of a substring (link ) of the provided text.
 void destroy()
          Description of the Method
 String getDefinition()
          Gets the definition for this field.
 Document getDocument()
          Gets the document attribute of the FieldInfoReader object
 List getDonts()
          Gets the donts attribute of the FieldInfoReader object
 List getDos()
          Gets the dos attribute of the FieldInfoReader object
static String getElementText(Element e)
          Return formatted contents for given Element, inserting hyperlink when "link" and "url" attributes are present
 List getExamples()
          Gets the examples attribute of the FieldInfoReader object
 String getFormat()
          Get the metadata format of the framework containing this field.
 String getName()
          Get the name of the field this file documents.
 List getOtherPractices()
          Get the list of otherPractices specified by this fields file.
 String getPath()
          Get the xpath to the field this file documents.
 List getPrompts()
          Gets the prompts for this field.
 String getSource()
          Returns URI (as String) of the source file for this FieldInfoReader
 List getTermAndDeftns(String term)
          Gets a List of TermAndDeftn instances for specified term (usually there is only one item in the list)
 List getTermList()
          Gets a sorted list of vocab Terms defined by this field.
 org.apache.struts.util.LabelValueBean[] getTermSelectOptions()
          Build an array of terms (represented as LabelValueBean instances) to be used in a html select object.
 Collection getVocabTerms()
          Gets the TermAndDeftn instances defined for this field.
static String replaceFirst(String in, String find, String replace)
          Replace first occurrance of exact match (case sensitive)
static void setDebug(boolean d)
          Sets the debug attribute of the FieldInfoReader class
 String toString()
          Debugging method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uri

public URI uri
Description of the Field

Constructor Detail

FieldInfoReader

public FieldInfoReader(String path)
                throws Exception
Constructor for the FieldInfoReader object

Parameters:
path - Description of the Parameter
Throws:
Exception - Description of the Exception

FieldInfoReader

public FieldInfoReader(URI uri)
                throws Exception
Constructor for the FieldInfoReader object

Parameters:
uri - Description of the Parameter
Throws:
Exception - Description of the Exception
Method Detail

getSource

public String getSource()
Returns URI (as String) of the source file for this FieldInfoReader


getDocument

public Document getDocument()
Gets the document attribute of the FieldInfoReader object

Returns:
The document value

setDebug

public static void setDebug(boolean d)
Sets the debug attribute of the FieldInfoReader class

Parameters:
d - The new debug value

getTermAndDeftns

public List getTermAndDeftns(String term)
Gets a List of TermAndDeftn instances for specified term (usually there is only one item in the list)

Parameters:
term - Description of the Parameter
Returns:
The termAndDeftn value

getVocabTerms

public Collection getVocabTerms()
Gets the TermAndDeftn instances defined for this field.

Returns:
The vocabTerms value

getTermList

public List getTermList()
Gets a sorted list of vocab Terms defined by this field.

Returns:
The termList value

getTermSelectOptions

public org.apache.struts.util.LabelValueBean[] getTermSelectOptions()
Build an array of terms (represented as LabelValueBean instances) to be used in a html select object.

Returns:
The termSelectOptions value as an array of

getPath

public String getPath()
               throws Exception
Get the xpath to the field this file documents.

Returns:
The path value
Throws:
Exception - Description of the Exception

getName

public String getName()
               throws Exception
Get the name of the field this file documents.

Returns:
The name value
Throws:
Exception - Description of the Exception

getFormat

public String getFormat()
                 throws Exception
Get the metadata format of the framework containing this field.

Returns:
The format value
Throws:
Exception - Description of the Exception

getDefinition

public String getDefinition()
Gets the definition for this field.

Returns:
The definition value

getPrompts

public List getPrompts()
Gets the prompts for this field.

Returns:
The definition value

getDos

public List getDos()
Gets the dos attribute of the FieldInfoReader object

Returns:
The dos value

getDonts

public List getDonts()
Gets the donts attribute of the FieldInfoReader object

Returns:
The donts value

getExamples

public List getExamples()
Gets the examples attribute of the FieldInfoReader object

Returns:
The examples value

getOtherPractices

public List getOtherPractices()
Get the list of otherPractices specified by this fields file.

Returns a list of OtherPractice instances, each of which has a header (e.g, "No title? Do this") and a set of "pratices".

Returns:
OtherPractices for this field.

applyMarkup

public static String applyMarkup(String text,
                                 String link,
                                 String url,
                                 String style)
Apply specified markup (url, style) to the first occurrence of a substring (link ) of the provided text.

Parameters:
text - A string of which a substring will receive formatting
link - the substring to recieve formatting
url - if present, provides destination for link (link becomes a hyperlink to url)
style - specifies the formatting to be applied to link (bold, italic, bold and italic)
Returns:
text containing a marked-up substring

getElementText

public static String getElementText(Element e)
Return formatted contents for given Element, inserting hyperlink when "link" and "url" attributes are present

Parameters:
e - Description of the Parameter
Returns:
The elementText value

replaceFirst

public static String replaceFirst(String in,
                                  String find,
                                  String replace)
Replace first occurrance of exact match (case sensitive)

needed to replace strings with regex pattern chars, which don't get replaced by String.replace

Parameters:
in - Description of the Parameter
find - Description of the Parameter
replace - Description of the Parameter
Returns:
Description of the Return Value

toString

public String toString()
Debugging method.

Overrides:
toString in class Object
Returns:
Description of the Return Value

destroy

public void destroy()
Description of the Method


DLESE Tools
v1.6.0