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
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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.addLanguageFields
(List<String> displayFields, List<Locale> locales) getChildCollections
(String solrField, String collectionName) Get all collections which are direct children of the given collection along with the number of contained works and direct childrengetContainedRecords
(String solrField, String collectionName) Get all records directly belonging to the given collection, only the fields inCONTAINED_WORKS_QUERY_FIELDS
are returnedgetDocument
(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 aStructElementComparator
If no hits are found, an empty list is returned- Parameters:
pi
- aString
object.- 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
-- Returns:
- List
(immutable!) - Throws:
IndexUnreachableException
-
getChildCollections
public List<CollectionResult> getChildCollections(String solrField, String collectionName) throws IndexUnreachableException Get all collections which are direct children of the given collection along with the number of contained works and direct children- Parameters:
solrField
-collectionName
-- Returns:
- List
(immutable!) - Throws:
IndexUnreachableException
-
getContainedRecords
public List<StructElement> getContainedRecords(String solrField, String collectionName) throws IndexUnreachableException, PresentationException Get all records directly belonging to the given collection, only the fields inCONTAINED_WORKS_QUERY_FIELDS
are returned- Parameters:
solrField
-collectionName
-- Returns:
- List
(immutable!) - 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
object.
-
getDocument
getDocument.
- Parameters:
pi
- aString
object.- Returns:
- a
StructElement
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getSolrFieldList
getSolrFieldList.
- Returns:
- a
List
object.
-
addLanguageFields
- Parameters:
displayFields
-locales
-- Returns:
- List
(immutable!)
-