Class SequenceBuilder
java.lang.Object
io.goobi.viewer.model.iiif.presentation.v2.builder.AbstractBuilder
io.goobi.viewer.model.iiif.presentation.v2.builder.SequenceBuilder
Builds the Sequence and Canvas resources within a IIIF Presentation API v2 Manifest.
- Author:
- Florian Alpers
-
Field Summary
FieldsFields inherited from class io.goobi.viewer.model.iiif.presentation.v2.builder.AbstractBuilder
config, REQUIRED_SOLR_FIELDS, urls -
Constructor Summary
ConstructorsConstructorDescriptionSequenceBuilder(AbstractApiUrlManager apiUrlManager) Creates a new SequenceBuilder instance. -
Method Summary
Modifier and TypeMethodDescriptionMap<de.intranda.api.iiif.presentation.enums.AnnotationType, List<de.intranda.api.iiif.presentation.v2.AnnotationList>> addBaseSequence(de.intranda.api.iiif.presentation.v2.Manifest2 manifest, StructElement doc, String manifestId, List<Integer> pagesToInclude, HttpServletRequest request) Creates a sequence from all pages within the given doc and appends it to manifest.List<de.intranda.api.iiif.presentation.v2.AnnotationList> addComments(Map<Integer, de.intranda.api.iiif.presentation.v2.Canvas2> canvases, String pi, boolean populate) Adds a comment annotation to all cavases which contain comments.Map<de.intranda.api.iiif.presentation.enums.AnnotationType, de.intranda.api.iiif.presentation.v2.AnnotationList> addOtherContent(StructElement doc, PhysicalElement page, de.intranda.api.iiif.presentation.v2.Canvas2 canvas, boolean populate) addOtherContent.voidaddRenderings(PhysicalElement page, de.intranda.api.iiif.presentation.v2.Canvas2 canvas) voidaddSeeAlsos(de.intranda.api.iiif.presentation.v2.Canvas2 canvas, PhysicalElement page) addSeeAlsos.de.intranda.api.iiif.presentation.v2.Canvas2generateCanvas(String pi, PhysicalElement page) generateCanvas.Getter for the fieldbuildMode.getPage(StructElement doc, int order) getPage.Getter for the fieldpreferredView.voidmerge(Map<de.intranda.api.iiif.presentation.enums.AnnotationType, List<de.intranda.api.iiif.presentation.v2.AnnotationList>> annotationMap, Map<de.intranda.api.iiif.presentation.enums.AnnotationType, de.intranda.api.iiif.presentation.v2.AnnotationList> content) merge.setBuildMode(BuildMode buildMode) Setter for the fieldbuildMode.setPreferedView(PageType preferredView) Setter for the fieldpreferredView.Methods inherited from class io.goobi.viewer.model.iiif.presentation.v2.builder.AbstractBuilder
absolutize, absolutize, addCrowdourcingAnnotations, addEventMetadataToWorkElement, addLanguageFields, addMetadata, addRendering, addSeeAlso, contained, getAnnotationListURI, getAnnotationListURI, getAnnotationURI, getAnnotationURI, getAttributions, getAutoCompleteServiceURI, getAutoSuggestURI, getCanvasURI, getCollectionURI, getCommentAnnotationURI, getDescription, getDocument, getDocumentWithChildren, getEventFields, getExternalManifestURI, getImageAnnotationURI, getLabel, getLabel, getLabelIfExists, getLayerURI, getLidoResolverUrl, getLocale, getManifestURI, getManifestURI, getMetsResolverUrl, getPageManifestURI, getPageOrderFromCanvasURI, getPIFromCanvasURI, getRangeURI, getRenderings, getSearchServiceURI, getSearchURI, getSeeAlsos, getSequenceURI, getSolrFieldList, getViewUrl
-
Field Details
-
imageDelivery
-
-
Constructor Details
-
SequenceBuilder
Creates a new SequenceBuilder instance.- Parameters:
apiUrlManager- API URL manager for building IIIF resource URIs
-
-
Method Details
-
addBaseSequence
public Map<de.intranda.api.iiif.presentation.enums.AnnotationType,List<de.intranda.api.iiif.presentation.v2.AnnotationList>> addBaseSequence(de.intranda.api.iiif.presentation.v2.Manifest2 manifest, StructElement doc, String manifestId, List<Integer> pagesToInclude, HttpServletRequest request) throws URISyntaxException, PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException Creates a sequence from all pages within the given doc and appends it to manifest.- Parameters:
manifest- The manifest to include the sequence. May be nulldoc- structure element of the record whose pages are sequencedmanifestId- URI string identifying the manifest this sequence belongs topagesToInclude- list of physical page orders to include; empty means all pagesrequest- the current HTTP servlet request, used for crowdsourcing annotation lookup- Returns:
- a map of annotation type to lists of annotation lists collected while building the sequence
- Throws:
URISyntaxException- if any.PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
addSeeAlsos
public void addSeeAlsos(de.intranda.api.iiif.presentation.v2.Canvas2 canvas, PhysicalElement page) throws URISyntaxException, ViewerConfigurationException addSeeAlsos.- Parameters:
canvas- IIIF canvas to attach seeAlso links topage- physical page whose file names are used to resolve seeAlso URIs- Throws:
URISyntaxException- if any.ViewerConfigurationException- if any.
-
addRenderings
public void addRenderings(PhysicalElement page, de.intranda.api.iiif.presentation.v2.Canvas2 canvas) - Parameters:
page- the physical page whose file info is used to resolve rendering URIscanvas- the canvas to add rendering links to
-
addComments
public List<de.intranda.api.iiif.presentation.v2.AnnotationList> addComments(Map<Integer, de.intranda.api.iiif.presentation.v2.Canvas2> canvases, String pi, boolean populate) throws DAOException, URISyntaxException, ViewerConfigurationExceptionAdds a comment annotation to all cavases which contain comments.- Parameters:
canvases- All canvases which may get comments, mapped by their page orderpi- The pi of the work containing the pagespopulate- if true, the actual annotations will be included in the resources property- Returns:
- a map with the list of all annotationlists (one list per page)
- Throws:
DAOException- if any.URISyntaxException- if any.ViewerConfigurationException- if any.
-
merge
public void merge(Map<de.intranda.api.iiif.presentation.enums.AnnotationType, List<de.intranda.api.iiif.presentation.v2.AnnotationList>> annotationMap, Map<de.intranda.api.iiif.presentation.enums.AnnotationType, de.intranda.api.iiif.presentation.v2.AnnotationList> content) merge.- Parameters:
annotationMap- accumulator map to merge content intocontent- single-canvas annotation map to merge into annotationMap
-
getPage
public PhysicalElement getPage(StructElement doc, int order) throws IndexUnreachableException, DAOException, PresentationException getPage.- Parameters:
doc- structure element that provides the record context for the loaderorder- physical page order number to retrieve- Returns:
- the PhysicalElement at the given page order, or null if not found
- Throws:
IndexUnreachableException- if any.DAOException- if any.PresentationException
-
generateCanvas
public de.intranda.api.iiif.presentation.v2.Canvas2 generateCanvas(String pi, PhysicalElement page) throws URISyntaxException, ViewerConfigurationException, IndexUnreachableException, PresentationException, DAOException generateCanvas.- Parameters:
pi- Record identifierpage- physical page to generate the canvas from- Returns:
- the IIIF Canvas for the given page, or null if pi or page is null
- Throws:
URISyntaxException- if any.ViewerConfigurationException- if any.IndexUnreachableException- if any.PresentationException- if any.DAOException
-
addOtherContent
public Map<de.intranda.api.iiif.presentation.enums.AnnotationType,de.intranda.api.iiif.presentation.v2.AnnotationList> addOtherContent(StructElement doc, PhysicalElement page, de.intranda.api.iiif.presentation.v2.Canvas2 canvas, boolean populate) throws URISyntaxException, IndexUnreachableException, ViewerConfigurationException addOtherContent.- Parameters:
doc- structure element providing the record PI for text lookupspage- physical page whose full-text, audio, and video resources are addedcanvas- IIIF canvas to attach annotation lists topopulate- if true, annotation bodies are fully resolved; otherwise only list stubs are created- Returns:
- a map of annotation type to annotation list for all content types found on the given page
- Throws:
URISyntaxException- if any.IndexUnreachableException- if any.ViewerConfigurationException- if any.
-
getBuildMode
Getter for the fieldbuildMode.- Returns:
- the build mode controlling whether full IIIF or thumbnail-only canvases are built
-
setBuildMode
Setter for the fieldbuildMode.- Parameters:
buildMode- controls whether full IIIF or thumbnail-only canvases are built- Returns:
- this SequenceBuilder instance for method chaining
-
getPreferedView
Getter for the fieldpreferredView.- Returns:
- the page type used when constructing viewer links for canvas renderings
-
setPreferedView
Setter for the fieldpreferredView.- Parameters:
preferredView- page type used when constructing viewer links for canvas renderings- Returns:
- this SequenceBuilder instance for method chaining
-