Package org.dlese.dpc.vocab
Class DLESEMetadataVocabTracker
java.lang.Object
org.dlese.dpc.vocab.DLESEMetadataVocabTracker
- All Implemented Interfaces:
MetadataVocabTracker
DLESE metadata vocabulary tracker (Id assignment, tracking of changes). This
implementation uses an SQL database.
- Author:
- Ryan Deardorff
-
Constructor Summary
ConstructorsConstructorDescriptionDLESEMetadataVocabTracker(MetadataVocab vocab, String sqlDriver, String sqlURL, String sqlUser, String sqlPassword, String vocabTextFile) Constructor for the DLESEMetadataVocabTracker object -
Method Summary
Modifier and TypeMethodDescriptionassignNewSystemId(String metadataFieldId, String metadataValue) Assign a unique system Id for a new vocabulary value.voidClose the connection to SQL databaseDoes the current fieldId/value pair already exist in the database? If so, return the Id, if not, return "" (empty string).booleanIs the system using this tracker connected to a database that handles ensuring Id consistency and UI label changes?voidregisterUiLabels(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 XMLvoidThis 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.
-
Constructor Details
-
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 trackersqlDriver- driver class for SQL DBsqlURL- URL of SQL DBsqlUser- SQL usersqlPassword- SQL user passwordvocabTextFile-
-
-
Method Details
-
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:
isUsingDatabasein interfaceMetadataVocabTracker- Returns:
- The usingDatabase value
-
closeConnection
public void closeConnection()Close the connection to SQL database- Specified by:
closeConnectionin interfaceMetadataVocabTracker
-
assignNewSystemId
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:
assignNewSystemIdin interfaceMetadataVocabTracker- Parameters:
metadataFieldId- field encoded IdmetadataValue- metadata value name- Returns:
- the new Id
-
getId
Does the current fieldId/value pair already exist in the database? If so, return the Id, if not, return "" (empty string).- Specified by:
getIdin interfaceMetadataVocabTracker- Parameters:
metadataFieldId- encoded field IdmetadataValue- metadata value name- Returns:
- The id value
-
registerUiLabels
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:
registerUiLabelsin interfaceMetadataVocabTracker- 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).
-