DLESE Tools
v1.2

org.dlese.dpc.vocab
Class DLESEMetadataVocabTracker

java.lang.Object
  extended byorg.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)
          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
 
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)
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
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

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

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 -

DLESE Tools
v1.2