Package 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:
- Error checking, encoded Id assignment, and UI label change tracking are OPTIONAL, as reflected in the isUsingDatabase() method
- 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
- 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
Modifier and TypeMethodDescriptionassignNewSystemId(String metadataFieldId, String metadataValue) Assign a unique system Id for a new vocabulary value.voidIf a relational database is being used, this should be used to close its connection once the vocabulary has been loadedDoes 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? 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.voidregisterUiLabels(HashMap uiSystems, HashMap uiLabelOfSystemIds) Register the current state of UI labels in the database
-
Method Details
-
isUsingDatabase
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
Assign a unique system Id for a new vocabulary value. See rule #2 above.- Parameters:
metadataFieldId- encoded field 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).- Parameters:
metadataFieldId- encoded field IdmetadataValue- metadata value name
-
registerUiLabels
Register the current state of UI labels in the database- Parameters:
uiSystems- map whose keys indicate all the current ui_label "system" attributesuiLabelOfSystemIds- map encoded Ids to UI labels
-
closeConnection
void closeConnection()If a relational database is being used, this should be used to close its connection once the vocabulary has been loaded
-