DLESE Tools
v1.6.0

org.dlese.dpc.vocab
Class DLESEMetadataVocabTracker

java.lang.Object
  extended by org.dlese.dpc.vocab.DLESEMetadataVocabTracker
All Implemented Interfaces:
MetadataVocabTracker

public class DLESEMetadataVocabTracker
extends Object
implements MetadataVocabTracker

DLESE metadata vocabulary tracker (Id assignment, tracking of changes). This implementation uses an SQL database.

Author:
Ryan Deardorff

Constructor Summary
DLESEMetadataVocabTracker(MetadataVocab vocab, String sqlDriver, String sqlURL, String sqlUser, String sqlPassword, String vocabTextFile)
          Constructor for the DLESEMetadataVocabTracker object
 
Method Summary
 String assignNewSystemId(String metadataFieldId, String metadataValue)
          Assign a unique system Id for a new vocabulary value.
 void closeConnection()
          Close the connection to SQL database
 String getId(String metadataFieldId, String metadataValue)
          Does the current fieldId/value pair already exist in the database? If so, return the Id, if not, return "" (empty string).
 boolean isUsingDatabase()
          Is the system using this tracker connected to a database that handles ensuring Id consistency and UI label changes?
 void registerUiLabels(HashMap uiSystems, HashMap uiLabelOfSystemIds)
          Step through all of the current (non-retired) values in the vocab_values table and examine the UI labels, comparing what is in the DB with what was just loaded from the XML
 void writeDataAsTextFile()
          This method writes a text-based version of the entire vocabulary (even retired values!) that simply lists each field/value system ID, along with the metadataValue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DLESEMetadataVocabTracker

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

Parameters:
vocab - MetadataVocab instance using this tracker
sqlDriver - driver class for SQL DB
sqlURL - URL of SQL DB
sqlUser - SQL user
sqlPassword - SQL user password
vocabTextFile -
Method Detail

isUsingDatabase

public boolean isUsingDatabase()
Is the system using this tracker connected to a database that handles ensuring Id consistency and UI label changes?

Specified by:
isUsingDatabase in interface MetadataVocabTracker
Returns:
The usingDatabase value

closeConnection

public void closeConnection()
Close the connection to SQL database

Specified by:
closeConnection in interface MetadataVocabTracker

assignNewSystemId

public String assignNewSystemId(String metadataFieldId,
                                String metadataValue)
Assign a unique system Id for a new vocabulary value. ALL Ids will start with 0, so that Lucene * queries will be possible.

Specified by:
assignNewSystemId in interface MetadataVocabTracker
Parameters:
metadataFieldId - field encoded Id
metadataValue - metadata value name
Returns:
the new Id

getId

public String getId(String metadataFieldId,
                    String metadataValue)
Does the current fieldId/value pair already exist in the database? If so, return the Id, if not, return "" (empty string).

Specified by:
getId in interface MetadataVocabTracker
Parameters:
metadataFieldId - encoded field Id
metadataValue - metadata value name
Returns:
The id value

registerUiLabels

public void registerUiLabels(HashMap uiSystems,
                             HashMap uiLabelOfSystemIds)
Step through all of the current (non-retired) values in the vocab_values table and examine the UI labels, comparing what is in the DB with what was just loaded from the XML

Specified by:
registerUiLabels in interface MetadataVocabTracker
Parameters:
uiSystems -
uiLabelOfSystemIds -

writeDataAsTextFile

public void writeDataAsTextFile()
This method writes a text-based version of the entire vocabulary (even retired values!) that simply lists each field/value system ID, along with the metadataValue. This text file is used by the log analysis scripts to generate spreadsheet headers that are human-readable (i.e., instead of "gr=01" you get "gradeLevel=DLESE:Graduate or professional"). This was done to avoid having to connect the log analysis scripts to the database, and so that existing analysis code could still be used (the text format written is the same as used by V1 of the DDS).


DLESE Tools
v1.6.0