Class AbstractBuilder
java.lang.Object
io.goobi.viewer.model.iiif.presentation.v2.builder.AbstractBuilder
- Direct Known Subclasses:
CollectionBuilder
,LayerBuilder
,ManifestBuilder
,SequenceBuilder
,StructureBuilder
Abstract AbstractBuilder class.
- Author:
- Florian Alpers
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Configuration
protected static final String[]
ConstantREQUIRED_SOLR_FIELDS
protected final AbstractApiUrlManager
ConstantUGC_SOLR_FIELDS
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractBuilder
(AbstractApiUrlManager apiUrlManager) Constructor for AbstractBuilder.protected
AbstractBuilder
(AbstractApiUrlManager apiUrlManager, Configuration config) Constructor for AbstractBuilder. -
Method Summary
Modifier and TypeMethodDescriptionabsolutize
(String uri) absolutize
(URI uri) void
addCrowdourcingAnnotations
(List<de.intranda.api.iiif.presentation.v2.Canvas2> canvases, Map<Integer, List<de.intranda.api.annotation.oa.OpenAnnotation>> crowdsourcingAnnotations, Map<de.intranda.api.iiif.presentation.enums.AnnotationType, List<de.intranda.api.iiif.presentation.v2.AnnotationList>> annotationMap) Add the annotations from the crowdsourcingAnnotations map to the respective canvases in the canvases list as well as to the given annotationMapprotected 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) void
addMetadata
(de.intranda.api.iiif.presentation.v2.AbstractPresentationModelElement2 manifest, StructElement ele) addMetadata.addRendering
(LinkingProperty.LinkingTarget target, de.intranda.metadata.multilanguage.IMetadataValue label) addSeeAlso
(LinkingProperty.LinkingTarget target, de.intranda.metadata.multilanguage.IMetadataValue label) protected boolean
Return true if the field is contained in displayFields, accounting for wildcard charactersgetAnnotationListURI
(String pi, int pageNo, de.intranda.api.iiif.presentation.enums.AnnotationType type, boolean openAnnotation) getAnnotationListURI.getAnnotationListURI
(String pi, de.intranda.api.iiif.presentation.enums.AnnotationType type) getAnnotationListURI.getAnnotationURI.getAnnotationURI
(String pi, int order, de.intranda.api.iiif.presentation.enums.AnnotationType type, int annoNum) getAnnotationURI.protected List<de.intranda.metadata.multilanguage.IMetadataValue>
Gets the attribution text configured in webapi.iiif.attribution and returns all translations if any are found, or the configured string itself otherwiseGet URL to auto complete service fromApiUrls
getAutoSuggestURI
(String pi, String query, List<String> motivation) getAutoSuggestURI.getCanvasURI
(String pi, int pageNo) getCanvasURI.getCollectionURI
(String collectionField, String baseCollectionName) getCollectionURI.getCommentAnnotationURI
(long id) getCommentAnnotationURI.protected Optional<de.intranda.metadata.multilanguage.IMetadataValue>
getDescription.getDocument
(String pi) getDocument.Queries all DocStructs which have the given PI as PI_TOPSTRUCT or anchor (or are the anchor themselves).getEventFields.getImageAnnotationURI
(String pi, int order) getImageAnnotationURI.protected Optional<de.intranda.metadata.multilanguage.IMetadataValue>
getLabel
(StructElement ele) getDescription.protected de.intranda.metadata.multilanguage.IMetadataValue
Optional<de.intranda.metadata.multilanguage.IMetadataValue>
getLabelIfExists
(org.apache.solr.common.SolrDocument solrDocument) Simple method to create a label for aSolrDocument
fromSolrConstants.LABEL
,SolrConstants.TITLE
orSolrConstants.DOCSTRCT
getLayerURI
(String pi, de.intranda.api.iiif.presentation.enums.AnnotationType type) getLayerURI.getLidoResolverUrl.protected Locale
getLocale.getManifestURI
(String pi) getManifestURI.getManifestURI
(String pi, BuildMode mode) getManifestURI.getMetsResolverUrl.getPageManifestURI
(String pi, int pageNo) getManifestURI for pageGet the page order (1-based) from a canavs URI.getPIFromCanvasURI
(URI uri) Get the persistent identifier from a canvas URI.getRangeURI
(String pi, String logId) getRangeURI.Get URL to search service fromApiUrls
getSearchURI
(String pi, String query, List<String> motivation) getSearchURI.getSequenceURI
(String pi, String label) getSequenceURI.getSolrFieldList.getViewUrl
(PhysicalElement ele, PageType pageType) getViewUrl.
-
Field Details
-
REQUIRED_SOLR_FIELDS
ConstantREQUIRED_SOLR_FIELDS
-
urls
ConstantUGC_SOLR_FIELDS
-
config
-
-
Constructor Details
-
AbstractBuilder
Constructor for AbstractBuilder.
- Parameters:
apiUrlManager
-
-
AbstractBuilder
Constructor for AbstractBuilder.
- Parameters:
apiUrlManager
-config
-
-
-
Method Details
-
getLabel
- Parameters:
value
-- Returns:
IMetadataValue
-
absolutize
- Parameters:
uri
-- Returns:
URI
-
absolutize
-
getLocale
getLocale.
-
getMetsResolverUrl
getMetsResolverUrl.
- Parameters:
ele
- aStructElement
object.- Returns:
- METS resolver link for the DFG Viewer
-
getLidoResolverUrl
getLidoResolverUrl.
- Parameters:
ele
- aStructElement
object.- Returns:
- LIDO resolver link for the DFG Viewer
-
getViewUrl
getViewUrl.
- Parameters:
ele
- aPhysicalElement
object.pageType
- aPageType
object.- Returns:
- viewer url for the given page in the given
PageType
-
getLabelIfExists
public Optional<de.intranda.metadata.multilanguage.IMetadataValue> getLabelIfExists(org.apache.solr.common.SolrDocument solrDocument) Simple method to create a label for aSolrDocument
fromSolrConstants.LABEL
,SolrConstants.TITLE
orSolrConstants.DOCSTRCT
- Parameters:
solrDocument
- aSolrDocument
object.- Returns:
- a
Optional
object.
-
addMetadata
public void addMetadata(de.intranda.api.iiif.presentation.v2.AbstractPresentationModelElement2 manifest, StructElement ele) addMetadata.
- Parameters:
manifest
- aAbstractPresentationModelElement2
object.ele
- aStructElement
object.
-
addCrowdourcingAnnotations
public void addCrowdourcingAnnotations(List<de.intranda.api.iiif.presentation.v2.Canvas2> canvases, Map<Integer, List<de.intranda.api.annotation.oa.OpenAnnotation>> crowdsourcingAnnotations, Map<de.intranda.api.iiif.presentation.enums.AnnotationType, List<de.intranda.api.iiif.presentation.v2.AnnotationList>> annotationMap) Add the annotations from the crowdsourcingAnnotations map to the respective canvases in the canvases list as well as to the given annotationMap- Parameters:
canvases
- The list of canvases which should receive the annotations as otherContentcrowdsourcingAnnotations
- A map of annotations by page numberannotationMap
- A global annotation map for a whole manifest; may be null if not needed
-
contained
Return true if the field is contained in displayFields, accounting for wildcard characters- Parameters:
field
-displayFields
-- Returns:
- true if displayFields contains field; false otherwise
-
addLanguageFields
- Parameters:
displayFields
-locales
-- Returns:
- List
(immutable!)
-
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.
-
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.
-
getAttributions
Gets the attribution text configured in webapi.iiif.attribution and returns all translations if any are found, or the configured string itself otherwise- Returns:
- the configured attribution
-
getDescription
protected Optional<de.intranda.metadata.multilanguage.IMetadataValue> getDescription(StructElement ele) getDescription.
- Parameters:
ele
- aStructElement
object.- Returns:
- a
Optional
object.
-
getLabel
getDescription.
- Parameters:
ele
- aStructElement
object.- Returns:
- a
Optional
object.
-
getCollectionURI
getCollectionURI.
-
getManifestURI
getManifestURI.
-
getExternalManifestURI
-
getPageManifestURI
getManifestURI for page
- Parameters:
pi
- Persistent identifier of a recordpageNo
- 1-based page order within the record- Returns:
- a
URI
object.
-
getManifestURI
getManifestURI.
-
getRangeURI
getRangeURI.
-
getSequenceURI
getSequenceURI.
-
getCanvasURI
getCanvasURI.
-
getPageOrderFromCanvasURI
Get the page order (1-based) from a canavs URI. That is the number in the last path paramter after '/canvas/' If the URI doesn't match a canvas URI, null is returned -
getPIFromCanvasURI
Get the persistent identifier from a canvas URI. This is the URI path param between '/iiif/manifests/' and '/canvas/'- Parameters:
uri
- aURI
object.- Returns:
- The pi, or null if the URI doesn't match a iiif canvas URI
-
getAnnotationListURI
public URI getAnnotationListURI(String pi, int pageNo, de.intranda.api.iiif.presentation.enums.AnnotationType type, boolean openAnnotation) getAnnotationListURI.
-
getAnnotationListURI
public URI getAnnotationListURI(String pi, de.intranda.api.iiif.presentation.enums.AnnotationType type) getAnnotationListURI.
-
getCommentAnnotationURI
getCommentAnnotationURI.
- Parameters:
id
- a long.- Returns:
- a
URI
object.
-
getLayerURI
getLayerURI.
-
getImageAnnotationURI
getImageAnnotationURI.
-
getAnnotationURI
public URI getAnnotationURI(String pi, int order, de.intranda.api.iiif.presentation.enums.AnnotationType type, int annoNum) throws URISyntaxException getAnnotationURI.
- Parameters:
pi
- aString
object.order
- a int.type
- aAnnotationType
object.annoNum
- a int.- Returns:
- a
URI
object. - Throws:
URISyntaxException
- if any.
-
getAnnotationURI
getAnnotationURI.
-
getSearchServiceURI
Get URL to search service fromApiUrls
- Parameters:
pi
- The persistent identifier of the work to search- Returns:
- the service URI
-
getAutoCompleteServiceURI
Get URL to auto complete service fromApiUrls
- Parameters:
pi
- The persistent identifier of the work to search for autocomplete- Returns:
- the service URI
-
getSearchURI
getSearchURI.
-
getAutoSuggestURI
getAutoSuggestURI.
-
addSeeAlso
public AbstractBuilder addSeeAlso(LinkingProperty.LinkingTarget target, de.intranda.metadata.multilanguage.IMetadataValue label) -
addRendering
public AbstractBuilder addRendering(LinkingProperty.LinkingTarget target, de.intranda.metadata.multilanguage.IMetadataValue label) -
getSeeAlsos
-
getRenderings
-