Class DataRetriever
java.lang.Object
io.goobi.viewer.model.iiif.presentation.v3.builder.DataRetriever
Responsible for retrieving data from Index to build any IIIF resources.
- Author:
- Florian Alpers
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddEventMetadataToWorkElement(List<StructElement> eles, List<org.apache.solr.common.SolrDocument> events) Adds all metadata from the given events to the first work document contained in eles.addLanguageFields(List<String> displayFields, List<Locale> locales) longcountContainedRecords(String solrField, String collectionName) getChildCollections(String solrField, String collectionName) Gets all collections which are direct children of the given collection along with the number of contained works and direct children.getContainedRecords(String solrField, String collectionName) Gets all records directly belonging to the given collection, only the fields inCONTAINED_WORKS_QUERY_FIELDSare returned.getDocument(String pi) getDocument.Queries all DocStructs which have the given PI as PI_TOPSTRUCT or anchor (or are the anchor themselves).getEventFields.getSolrFieldList.getTopLevelCollections(String solrField) Get all top level collections (i.e. those without splitting-char) along with the number of contained works and direct children
-
Field Details
-
CONTAINED_WORKS_QUERY_FIELDS
Required field to create manifest stubs for works in collection. -
REQUIRED_SOLR_FIELDS
Required fields to create manifests with structure.
-
-
Constructor Details
-
DataRetriever
public DataRetriever()
-
-
Method Details
-
getDocumentWithChildren
public List<StructElement> getDocumentWithChildren(String pi) throws PresentationException, IndexUnreachableException Queries all DocStructs which have the given PI as PI_TOPSTRUCT or anchor (or are the anchor themselves). Works are sorted by aStructElementComparatorIf no hits are found, an empty list is returned- Parameters:
pi- persistent identifier of the record to retrieve- Returns:
- A list of all docstructs with the given pi or children thereof. An empty list if no hits are found
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getTopLevelCollections
public List<CollectionResult> getTopLevelCollections(String solrField) throws IndexUnreachableException Get all top level collections (i.e. those without splitting-char) along with the number of contained works and direct children- Parameters:
solrField- Solr field used to store the collection hierarchy- Returns:
- List
(immutable!) - Throws:
IndexUnreachableException
-
getChildCollections
public List<CollectionResult> getChildCollections(String solrField, String collectionName) throws IndexUnreachableException Gets all collections which are direct children of the given collection along with the number of contained works and direct children.- Parameters:
solrField- Solr field used to store the collection hierarchycollectionName- name of the parent collection whose children to retrieve- Returns:
- List
(immutable!) - Throws:
IndexUnreachableException
-
getContainedRecords
public List<StructElement> getContainedRecords(String solrField, String collectionName) throws IndexUnreachableException, PresentationException Gets all records directly belonging to the given collection, only the fields inCONTAINED_WORKS_QUERY_FIELDSare returned.- Parameters:
solrField- Solr field used to store the collection hierarchycollectionName- name of the collection whose records to retrieve- Returns:
- List
(immutable!) - Throws:
IndexUnreachableExceptionPresentationException
-
countContainedRecords
public long countContainedRecords(String solrField, String collectionName) throws IndexUnreachableException, PresentationException -
addEventMetadataToWorkElement
protected void addEventMetadataToWorkElement(List<StructElement> eles, List<org.apache.solr.common.SolrDocument> events) Adds all metadata from the given events to the first work document contained in eles. All metadata will be attached twice, once in the form "/[fieldName]" and once in the form "[eventType]/[fieldName]"- Parameters:
eles- The list of StructElements from which to select the first work document. All metadata are attached to this documentevents- The list of event SolrDocuments from which to take the metadata
-
getEventFields
getEventFields.- Returns:
- a map of event type names to their associated Solr field names, as configured for IIIF
-
getDocument
getDocument.- Parameters:
pi- persistent identifier of the record to retrieve- Returns:
- the StructElement for the given PI, or null if the document was not found
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getSolrFieldList
getSolrFieldList.- Returns:
- a list of Solr field names required for IIIF presentation data retrieval
-
addLanguageFields
- Parameters:
displayFields- base list of Solr field names to expand with language variantslocales- locales for which to add language-specific field variants- Returns:
- List
(immutable!)
-