DLESE Tools
v1.2

org.dlese.dpc.vocab
Interface MetadataVocabTracker

All Known Implementing Classes:
DLESEMetadataVocabTracker

public interface MetadataVocabTracker

Interface for creation of controlled vocabulary system Ids, tracking changes in metadata names and UI labels, and ensuring consistency of all three. Implementations should follow these rules:

  1. Error checking, encoded Id assignment, and UI label change tracking are OPTIONAL, as reflected in the isUsingDatabase() method
  2. Once an encoded Id has been assigned, it may never be re-used, but can only be retired when/if its vocab value is removed
  3. Only vocab VALUE encoded Ids are automatically assigned. FIELD Ids must be assigned manually, so a tracker will assume that they already exist.

Author:
Ryan Deardorff

Method Summary
 String assignNewSystemId(String metadataFieldId, String metadataValue)
          Assign a unique system Id for a new vocabulary value.
 void closeConnection()
          If a relational database is being used, this should be used to close its connection once the vocabulary has been loaded
 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? If not, no error checking will be performed, no new encoded system Ids can be assigned, and changes in UI labels will not be registered.
 void registerUiLabels(HashMap uiSystems, HashMap uiLabelOfSystemIds)
          Register the current state of UI labels in the database
 

Method Detail

isUsingDatabase

public boolean isUsingDatabase()
Is the system using this tracker connected to a database? If not, no error checking will be performed, no new encoded system Ids can be assigned, and changes in UI labels will not be registered.


assignNewSystemId

public String assignNewSystemId(String metadataFieldId,
                                String metadataValue)
Assign a unique system Id for a new vocabulary value. See rule #2 above.

Parameters:
metadataFieldId - encoded field 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).

Parameters:
metadataFieldId - encoded field Id
metadataValue - metadata value name

registerUiLabels

public void registerUiLabels(HashMap uiSystems,
                             HashMap uiLabelOfSystemIds)
Register the current state of UI labels in the database

Parameters:
uiSystems - map whose keys indicate all the current ui_label "system" attributes
uiLabelOfSystemIds - map encoded Ids to UI labels

closeConnection

public void closeConnection()
If a relational database is being used, this should be used to close its connection once the vocabulary has been loaded


DLESE Tools
v1.2