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
FieldsModifier and TypeFieldDescriptionprotected final Configurationprotected static final String[]ConstantREQUIRED_SOLR_FIELDSprotected final AbstractApiUrlManagerConstantUGC_SOLR_FIELDS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractBuilder(AbstractApiUrlManager apiUrlManager) Constructor for AbstractBuilder.protectedAbstractBuilder(AbstractApiUrlManager apiUrlManager, Configuration config) Constructor for AbstractBuilder. -
Method Summary
Modifier and TypeMethodDescriptionabsolutize(String uri) absolutize(URI uri) voidaddCrowdourcingAnnotations(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 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) voidaddMetadata(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 booleanReturn 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 fromApiUrlsgetAutoSuggestURI(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.IMetadataValueOptional<de.intranda.metadata.multilanguage.IMetadataValue> getLabelIfExists(org.apache.solr.common.SolrDocument solrDocument) Simple method to create a label for aSolrDocumentfromSolrConstants.LABEL,SolrConstants.TITLEorSolrConstants.DOCSTRCTgetLayerURI(String pi, de.intranda.api.iiif.presentation.enums.AnnotationType type) getLayerURI.getLidoResolverUrl.protected LocalegetLocale.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 fromApiUrlsgetSearchURI(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- aStructElementobject.- Returns:
- METS resolver link for the DFG Viewer
-
getLidoResolverUrl
getLidoResolverUrl.
- Parameters:
ele- aStructElementobject.- Returns:
- LIDO resolver link for the DFG Viewer
-
getViewUrl
getViewUrl.
- Parameters:
ele- aPhysicalElementobject.pageType- aPageTypeobject.- 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 aSolrDocumentfromSolrConstants.LABEL,SolrConstants.TITLEorSolrConstants.DOCSTRCT- Parameters:
solrDocument- aSolrDocumentobject.- Returns:
- a
Optionalobject.
-
addMetadata
public void addMetadata(de.intranda.api.iiif.presentation.v2.AbstractPresentationModelElement2 manifest, StructElement ele) addMetadata.
- Parameters:
manifest- aAbstractPresentationModelElement2object.ele- aStructElementobject.
-
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 aStructElementComparatorIf no hits are found, an empty list is returned.- Parameters:
pi- aStringobject.- 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
Mapobject.
-
getDocument
getDocument.
- Parameters:
pi- aStringobject.- Returns:
- a
StructElementobject. - Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getSolrFieldList
getSolrFieldList.
- Returns:
- a
Listobject.
-
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- aStructElementobject.- Returns:
- a
Optionalobject.
-
getLabel
getDescription.
- Parameters:
ele- aStructElementobject.- Returns:
- a
Optionalobject.
-
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
URIobject.
-
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- aURIobject.- 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
URIobject.
-
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- aStringobject.order- a int.type- aAnnotationTypeobject.annoNum- a int.- Returns:
- a
URIobject. - 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
-