public class RecordDataService
extends java.lang.Object
ItemFileIndexingWriter
to insert data into the
index for each record at index creation time.RecordData
,
Query
Modifier and Type | Field and Description |
---|---|
static int |
QUERY_BOTH
Use to query within both other and the same collection
|
static int |
QUERY_OTHER
Use to query within a other collection
|
static int |
QUERY_SAME
Use to query within a the same collection
|
Constructor and Description |
---|
RecordDataService(java.lang.String dbUrl,
MetadataVocab vocab,
java.lang.String collBaseDir,
java.lang.String annotationPathwaysSchemaUrl)
Constructor for a RecordDataService that has access to an MmdRec Query service.
|
Modifier and Type | Method and Description |
---|---|
void |
closeIdMapper()
Closes the local Query Object, releasing it's resources.
|
void |
closeIdMapperQueryObject(Query queryObject)
Closes an IDMapper Query object, releasing its resources.
|
java.lang.String |
getAccessionStatus(MmdRec[] mmdRecs)
Gets the accession status of the given records or, if multiple resources get all statuses separated by
spaces.
|
java.util.ArrayList |
getAnnoFormatsFromResultDocs(ResultDocList annoResultDocs)
Gets the annotation formats from the anno result docs.
|
java.util.ArrayList |
getAnnoPathwaysFromResultDocs(ResultDocList annoResultDocs)
Gets all annotation pathways in the given set of DleseAnnoDocReaders, or null if none exist.
|
java.util.ArrayList |
getAnnoStatusFromResultDocs(ResultDocList annoResultDocs)
Gets the annoStatusFromReaders attribute of the RecordDataService object
|
java.util.ArrayList |
getAnnoTypesFromResultDocs(ResultDocList annoResultDocs)
Gets all annotation types in the given set of DleseAnnoDocReaders, or null if none exist.
|
java.lang.String[] |
getAssociatedIDs(java.lang.String id,
MmdRec[] associatedMmdRecs)
Gets the IDs for records that catalog the same resource, not including the ID that is given.
|
MmdRec[] |
getAssociatedMMDRecs(int queryType,
java.lang.String IDs,
java.lang.String collectionKeys)
Gets the associated MMD records for the given IDs, records that catalog the same resource, or null if
none exist, using the local Query Object.
|
MmdRec[] |
getAssociatedMMDRecs(int queryType,
java.lang.String IDs,
java.lang.String collectionKeys,
Query qo)
Gets the associated MMD records for the given IDs, records that catalog the same resource, or null if
none exist, using the given Query Object.
|
java.lang.String |
getCollectCollectionID()
Returns the value of collectCollectionID.
|
java.util.ArrayList |
getCollectionKeysFromResultDocs(ResultDocList collectionResults)
Gets all collection keys encoded by Vocab Mgr, for example {06, 08}, for the given records.
|
java.util.ArrayList |
getCompletedAnnoCollectionKeysFromResultDocs(ResultDocList annoResultDocs)
Gets a list of keys, for example {06, 04}, for each of the annotation collections that have at least one
status completed record.
|
protected static java.lang.String |
getDateStamp()
Return a string for the current time and date, sutiable for display in log files and output to standout:
|
ResultDoc |
getDisplayableItemResultDoc(java.lang.String itemId)
Gets the ResultDoc for the given item level metata record id but only if it should be displayed in
discovery.
|
ResultDocList |
getDisplayableItemResultDocs(java.lang.String[] itemIds)
Gets the item result docs for each of the ids listed regardless, returning only those that should be
displayed in discovery.
|
ResultDocList |
getDleseAnnoResultDocs(java.lang.String[] ids)
Gets the DLESEAnno docs that annotate the given ids, or null if none.
|
java.io.File |
getFileForId(MmdRec rec)
Gets the fileForId attribute of the RecordDataService object
|
java.lang.String |
getFilePathForId(MmdRec rec)
Gets the filePathForId attribute of the RecordDataService object
|
java.lang.String[] |
getIdentifiedErrors(MmdRec[] mmdRecs)
Gets all errors identified by the ID mapper service for the given records, or null if none exist.
|
Query |
getIdMapperQueryObject()
Gets a IDMapper Query Object to use in
getMmdRec(String, String, Query) or getAssociatedMMDRecs(int, String, String, Query) . |
SimpleLuceneIndex |
getIndex()
Gets the index used by this RecordData service to retrieve data.
|
ResultDoc |
getItemResultDoc(java.lang.String itemId)
Gets the ResultDoc for the given item-level metata record id regardless of the records status, or null if
none exists.
|
ResultDocList |
getItemResultDocs(java.lang.String[] itemIds)
Gets the item result docs for each of the ids listed regardless of their status.
|
MmdRec |
getMmdRec(java.lang.String id,
java.lang.String collectionKey)
Gets the ID mapper record for the given ID using the local Query Object.
|
MmdRec |
getMmdRec(java.lang.String id,
java.lang.String collectionKey,
Query qo)
Gets the ID mapper record for the given ID using the given Query Object.
|
MetadataVocab |
getVocab()
Gets the vocab attribute of the RecordDataService object
|
static boolean |
hasDRCAnnotation(ResultDocList annoResultDocs)
Return true if there is an annotation present that is part of the DRC.
|
static boolean |
hasDRCItem(ResultDocList itemResultDocs)
Return true if there is an item present that is part of the DRC as determined by the items collection.
|
void |
init(RepositoryManager rm)
Initialize the RecordDataService.
|
void |
initIdMapper()
Initializes the local Query Object.
|
boolean |
isIdMapperDisabled()
Gets the idMapperDisabled attribute of the RecordDataService object
|
protected static void |
prtln(java.lang.String s)
Output a line of text to standard out, with datestamp, if debug is set to true.
|
protected static void |
prtlnErr(java.lang.String s)
Output a line of text to error out, with datestamp.
|
void |
setCollectCollectionID(java.lang.String collectCollectionID)
Sets the value of collectCollectionID.
|
static void |
setDebug(boolean db)
Sets the debug attribute of the object
|
void |
updateVocab(MetadataVocab newVocab)
Updates the MetadataVocab being used by this service.
|
public static int QUERY_OTHER
public static int QUERY_SAME
public static int QUERY_BOTH
public RecordDataService(java.lang.String dbUrl, MetadataVocab vocab, java.lang.String collBaseDir, java.lang.String annotationPathwaysSchemaUrl)
dbUrl
- URL of the database, or use the String "useRandomIds" to generate
random associated IDs, or null if not using the Query API.vocab
- The MetadataVocab to use, or null if not needed.collBaseDir
- Description of the ParameterannotationPathwaysSchemaUrl
- URL to the annotation pathways schemaQuery
public void updateVocab(MetadataVocab newVocab)
newVocab
- The new MetadataVocab that will be used.public void init(RepositoryManager rm)
rm
- The RepositoryManagerpublic SimpleLuceneIndex getIndex()
public java.lang.String getCollectCollectionID()
public void setCollectCollectionID(java.lang.String collectCollectionID)
collectCollectionID
- The value to assign collectCollectionID.public Query getIdMapperQueryObject()
getMmdRec(String, String, Query)
or getAssociatedMMDRecs(int, String, String, Query)
. The Query may be used multiple times. After use, the
caller must be sure to close the Query using the closeIdMapperQueryObject(Query)
.public void closeIdMapperQueryObject(Query queryObject)
queryObject
- The Query Object to closepublic void initIdMapper()
public void closeIdMapper()
public boolean isIdMapperDisabled()
public java.lang.String getFilePathForId(MmdRec rec)
rec
- Description of the Parameterpublic java.io.File getFileForId(MmdRec rec)
rec
- Description of the Parameterpublic java.lang.String[] getAssociatedIDs(java.lang.String id, MmdRec[] associatedMmdRecs)
id
- The id to the item-level record - will be ommitted from the list of
associatedIDsassociatedMmdRecs
- An array of MmdRecspublic java.lang.String[] getIdentifiedErrors(MmdRec[] mmdRecs)
mmdRecs
- An array of MmdRecordspublic MmdRec[] getAssociatedMMDRecs(int queryType, java.lang.String IDs, java.lang.String collectionKeys, Query qo)
IDs
- An ID(s) to an item-level resource, separated by spaces - the first is usedcollectionKeys
- The collection keys for the collection of files, for example "dcc" or "comet",
separated by spaces - the first is usedqueryType
- Specify to look in other or the same collectionqo
- The IDMapper Query Object to usepublic MmdRec[] getAssociatedMMDRecs(int queryType, java.lang.String IDs, java.lang.String collectionKeys)
IDs
- An ID(s) to an item-level resource, separated by spaces.collectionKeys
- The collection keys for the collection of files, for example "dcc" or "comet",
separated by spaces.queryType
- Specify to look in other or the same collectionpublic MmdRec getMmdRec(java.lang.String id, java.lang.String collectionKey, Query qo)
id
- The ID of a given record, for example DLESE-000-000-000-001.collectionKey
- The collection in which the given record resides, for example dcc.qo
- The Query Object to usepublic MmdRec getMmdRec(java.lang.String id, java.lang.String collectionKey)
id
- The ID of a given record, for example DLESE-000-000-000-001.collectionKey
- The collection in which the given record resides, for example dcc.public java.lang.String getAccessionStatus(MmdRec[] mmdRecs)
mmdRecs
- The MmdRecordspublic ResultDoc getDisplayableItemResultDoc(java.lang.String itemId)
itemId
- The ID to a given item-level record.public ResultDocList getDisplayableItemResultDocs(java.lang.String[] itemIds)
itemIds
- An array of IDs.public ResultDoc getItemResultDoc(java.lang.String itemId)
itemId
- The ID to a given item-level record.public ResultDocList getItemResultDocs(java.lang.String[] itemIds)
itemIds
- An array of IDs.public ResultDocList getDleseAnnoResultDocs(java.lang.String[] ids)
ids
- Ids for records in the repository.public java.util.ArrayList getAnnoTypesFromResultDocs(ResultDocList annoResultDocs)
annoResultDocs
- An array of ResultDocspublic java.util.ArrayList getAnnoStatusFromResultDocs(ResultDocList annoResultDocs)
annoResultDocs
- An array of ResultDocspublic java.util.ArrayList getAnnoFormatsFromResultDocs(ResultDocList annoResultDocs)
annoResultDocs
- An array of ResultDocspublic java.util.ArrayList getCompletedAnnoCollectionKeysFromResultDocs(ResultDocList annoResultDocs)
annoResultDocs
- An array of ResultDocs of annotation recordspublic java.util.ArrayList getAnnoPathwaysFromResultDocs(ResultDocList annoResultDocs)
annoResultDocs
- An array of ResultDocspublic static boolean hasDRCAnnotation(ResultDocList annoResultDocs)
annoResultDocs
- Annotation records.public static boolean hasDRCItem(ResultDocList itemResultDocs)
itemResultDocs
- Array of Item result docs.public java.util.ArrayList getCollectionKeysFromResultDocs(ResultDocList collectionResults)
collectionResults
- ResultDocs of recordspublic MetadataVocab getVocab()
protected static final java.lang.String getDateStamp()
protected static final void prtlnErr(java.lang.String s)
s
- The text that will be output to error out.protected static final void prtln(java.lang.String s)
s
- The String that will be output.public static void setDebug(boolean db)
db
- The new debug value