Class PhysicalElement

java.lang.Object
io.goobi.viewer.model.viewer.PhysicalElement
All Implemented Interfaces:
Serializable, Comparable<PhysicalElement>

public class PhysicalElement extends Object implements Comparable<PhysicalElement>, Serializable
Physical element (page) containing an image, video or audio.
See Also:
  • Field Details

    • WATERMARK_TEXT_TYPE_URN

      public static final String WATERMARK_TEXT_TYPE_URN
      Constant WATERMARK_TEXT_TYPE_URN="URN"
      See Also:
    • WATERMARK_TEXT_TYPE_PURL

      public static final String WATERMARK_TEXT_TYPE_PURL
      Constant WATERMARK_TEXT_TYPE_PURL="PURL"
      See Also:
    • WATERMARK_TEXT_TYPE_SOLR

      public static final String WATERMARK_TEXT_TYPE_SOLR
      Constant WATERMARK_TEXT_TYPE_SOLR="SOLR:"
      See Also:
  • Method Details

    • determineFileName

      protected static String determineFileName(String filePath)

      determineFileName.

      Parameters:
      filePath - a String object.
      Returns:
      a String object.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(PhysicalElement o)
      Specified by:
      compareTo in interface Comparable<PhysicalElement>
    • getUrl

      getUrl.

      Returns:
      the url to the media content of the page, for example the
      Throws:
      IndexUnreachableException - if any.
      ViewerConfigurationException - if any.
    • getSandboxedUrl

      public String getSandboxedUrl()

      getSandboxedUrl.

      Returns:
      a String object.
    • getWatermarkText

      public String getWatermarkText()

      getWatermarkText.

      Returns:
      a String object.
    • getThumbnailUrl

      public String getThumbnailUrl() throws ViewerConfigurationException

      getThumbnailUrl.

      Returns:
      String
      Throws:
      ViewerConfigurationException - if any.
    • getThumbnailUrl

      public String getThumbnailUrl(int width, int height)

      getThumbnailUrl.

      Parameters:
      width - a int.
      height - a int.
      Returns:
      a String object.
    • getId

      public String getId()

      getId.

      Returns:
      a String object.
    • getFilepath

      public String getFilepath()

      getFilepath.

      Returns:
      String Path zu Image Datei.
    • getOrder

      public int getOrder()

      Getter for the field order.

      Returns:
      a int.
    • getOrderLabel

      public String getOrderLabel()

      Getter for the field orderLabel.

      Returns:
      a String object.
    • getUrn

      public String getUrn()

      Getter for the field urn.

      Returns:
      the urn
    • setPurlPart

      public void setPurlPart(String purlPart)

      Setter for the field purlPart.

      Parameters:
      purlPart - the purlPart to set
    • getPurlPart

      public String getPurlPart()

      Getter for the field purlPart.

      Returns:
      the purlPart
    • getDisplayMimeType

      public String getDisplayMimeType()
      For images, this returns the full mime-type as image/X, with X being the format which should be used for image display. This is png for png-images and jpeg for all other types.
      Returns:
      a String object.
    • getFullMimeType

      public static String getFullMimeType(String mimeType, String fileName)

      getFullMimeType.

      Parameters:
      mimeType - a String object.
      fileName - a String object.
      Returns:
      a String object.
    • getBaseMimeType

      public String getBaseMimeType()
      Returns:
      First part of the mime type
    • getMimeType

      public String getMimeType()

      Getter for the field mimeType.

      Returns:
      the mimeType
    • setMimeType

      public void setMimeType(String mimeType)

      Setter for the field mimeType.

      Parameters:
      mimeType - the mimeType to set
    • setWidth

      public void setWidth(int width)

      Setter for the field width.

      Parameters:
      width - the width to set
    • setHeight

      public void setHeight(int height)

      Setter for the field height.

      Parameters:
      height - the height to set
    • getFileIdRoot

      public String getFileIdRoot()

      Getter for the field fileIdRoot.

      Returns:
      the fileIdRoot
    • setFileIdRoot

      public void setFileIdRoot(String fileIdRoot)

      Setter for the field fileIdRoot.

      Parameters:
      fileIdRoot - the fileIdRoot to set
    • isDisplayImage

      public boolean isDisplayImage() throws IndexUnreachableException, DAOException
      Returns:
      true if page has an indexed image file name and user has access permission; false otherwise
      Throws:
      DAOException
      IndexUnreachableException
    • isHasImage

      public boolean isHasImage()
      Returns:
      the hasImage
    • setHasImage

      public void setHasImage(boolean hasImage)
      Parameters:
      hasImage - the hasImage to set
    • isDoubleImage

      public boolean isDoubleImage()
      Returns:
      the doubleImage
    • setDoubleImage

      public void setDoubleImage(boolean doubleImage)
      Parameters:
      doubleImage - the doubleImage to set
    • isFlipRectoVerso

      public boolean isFlipRectoVerso()
      Returns:
      the flipRectoVerso
    • setFlipRectoVerso

      public void setFlipRectoVerso(boolean flipRectoVerso)
      Parameters:
      flipRectoVerso - the flipRectoVerso to set
    • isDisplayFulltext

      public boolean isDisplayFulltext() throws IndexUnreachableException, DAOException

      isFulltextAvailableForPage.

      Returns:
      a boolean.
      Throws:
      IndexUnreachableException - if any.
      DAOException - if any.
    • isFulltextAvailable

      public boolean isFulltextAvailable()

      isFulltextAvailable.

      Returns:
      the fulltextAvailable
    • isFulltextAccessPermission

      public Boolean isFulltextAccessPermission()
      Returns:
      the fulltextAccessPermission
      Throws:
      ViewerConfigurationException
    • setFulltextAvailable

      public void setFulltextAvailable(boolean fulltextAvailable)

      Setter for the field fulltextAvailable.

      Parameters:
      fulltextAvailable - the fulltextAvailable to set
    • isAltoAvailable

      public boolean isAltoAvailable()

      isAltoAvailableForPage.

      Returns:
      a boolean.
      Throws:
      IndexUnreachableException - if any.
      DAOException - if any.
    • isTeiAvailable

      public boolean isTeiAvailable() throws IndexUnreachableException, DAOException

      isTeiAvailableForPage.

      Returns:
      a boolean.
      Throws:
      IndexUnreachableException - if any.
      DAOException - if any.
    • getFulltextFileName

      public String getFulltextFileName()

      Getter for the field fulltextFileName.

      Returns:
      the fulltextFileName
    • setFulltextFileName

      public void setFulltextFileName(String fulltextFileName)

      Setter for the field fulltextFileName.

      Parameters:
      fulltextFileName - the fulltextFileName to set
    • getAltoFileName

      public String getAltoFileName()

      Getter for the field altoFileName.

      Returns:
      the altoFileName
    • setAltoFileName

      public void setAltoFileName(String altoFileName)

      Setter for the field altoFileName.

      Parameters:
      altoFileName - the altoFileName to set
    • getFullText

      public String getFullText() throws ViewerConfigurationException

      Getter for the field fullText.

      Returns:
      the fullText
      Throws:
      ViewerConfigurationException - if any.
    • getFulltextMimeType

      public String getFulltextMimeType() throws ViewerConfigurationException
      Returns:
      The probable mimeType of the fulltext. If the fulltext is not yet loaded, it is loaded first
      Throws:
      ViewerConfigurationException
    • setFullText

      public void setFullText(String fullText)

      Setter for the field fullText.

      Parameters:
      fullText - the fullText to set
    • getWordCoords

      public List<String> getWordCoords(Set<String> searchTerms) throws ViewerConfigurationException

      getWordCoords.

      Parameters:
      searchTerms - a Set object.
      Returns:
      a List object.
      Throws:
      ViewerConfigurationException - if any.
    • getWordCoords

      public List<String> getWordCoords(Set<String> searchTerms, int proximitySearchDistance, int rotation) throws ViewerConfigurationException
      Returns word coordinates for words that start with any of the given search terms.
      Parameters:
      searchTerms - a Set object.
      proximitySearchDistance -
      rotation - a int.
      Returns:
      a List object.
      Throws:
      ViewerConfigurationException - if any.
    • loadAlto

      Loads ALTO data for this page via the REST service, if not yet loaded.
      Returns:
      StringPair(ALTO,charset)
      Throws:
      AccessDeniedException - if any.
      org.jdom2.JDOMException - if any.
      IOException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • getFileNames

      public Map<String,String> getFileNames()

      Getter for the field fileNames.

      Returns:
      the fileNames
    • setFileNames

      public void setFileNames(Map<String,String> fileNames)

      Setter for the field fileNames.

      Parameters:
      fileNames - the fileNames to set
    • getFirstFileName

      public String getFirstFileName()
      Returns The first matching media filename for this page
      Returns:
      The first matching media filename for this page
    • getFileName

      public String getFileName()
      Returns the fileName alone, if io.goobi.viewer.model.viewer.PhysicalElement#getFilePath() is a local file, or the entire filePath otherwise
      Returns:
      a String object.
    • getFileNameBase

      public String getFileNameBase()

      getFileNameBase.

      Returns:
      a String object.
    • getFileNameExtension

      public String getFileNameExtension()

      getFileNameExtension.

      Returns:
      a String object.
    • getFileNameForFormat

      public String getFileNameForFormat(String format)

      getFileNameForFormat.

      Parameters:
      format - a String object.
      Returns:
      a String object.
    • getImageToPdfUrl

      public String getImageToPdfUrl() throws IndexUnreachableException

      getImageToPdfUrl.

      Returns:
      a String object.
      Throws:
      IndexUnreachableException - if any.
    • getMediaUrl

      public String getMediaUrl(String format) throws IndexUnreachableException
      Returns a "RESTful" URL for a media (audio or video) file in the given format.
      Parameters:
      format - a String object.
      Returns:
      a String object.
      Throws:
      IndexUnreachableException - if any.
    • getVideoWidth

      public int getVideoWidth()

      getVideoWidth.

      Returns:
      a int.
    • getVideoHeight

      public int getVideoHeight()

      getVideoHeight.

      Returns:
      a int.
    • getImageWidth

      public int getImageWidth()
      Returns the actual image width, if available. Otherwise the default width.
      Returns:
      a int.
    • getImageHeight

      public int getImageHeight()
      Returns the actual image height, if available. Otherwise the default height.
      Returns:
      a int.
    • getPhysicalImageHeight

      public int getPhysicalImageHeight()

      getPhysicalImageHeight.

      Returns:
      a int.
    • getImageZoomFactor

      public int getImageZoomFactor()
      Return the zoom factor for this image depending on its actual size.
      Returns:
      a int.
    • getImageUrl

      public String getImageUrl()

      getImageUrl.

      Returns:
      a String object.
    • getImageUrl

      public String getImageUrl(int size)

      getImageUrl.

      Parameters:
      size - a int.
      Returns:
      a String object.
    • getMixWidth

      public int getMixWidth()
      Return the bare width as read from the index (0 if none available).
      Returns:
      a int.
    • getPhysicalImageWidth

      public int getPhysicalImageWidth()

      getPhysicalImageWidth.

      Returns:
      a int.
    • getPi

      public String getPi()

      Getter for the field pi.

      Returns:
      the pi
    • getAccessConditions

      public Set<String> getAccessConditions()

      Getter for the field accessConditions.

      Returns:
      the accessConditions
    • setAccessConditions

      public void setAccessConditions(Set<String> accessConditions)

      Setter for the field accessConditions.

      Parameters:
      accessConditions - the accessConditions to set
    • getPageLinkLabel

      public String getPageLinkLabel()

      getPageLinkLabel.

      Returns:
      a String object.
    • isAccessPermission3DObject

      public boolean isAccessPermission3DObject() throws IndexUnreachableException, DAOException
      Checks if the media type is displayable as a 3d object and access is granted for viewing it
      Returns:
      a boolean.
      Throws:
      IndexUnreachableException - if any.
      DAOException - if any.
    • isAccessPermissionImage

      public boolean isAccessPermissionImage() throws IndexUnreachableException, DAOException
      Checks if the media type is displayable as an image and access is granted for viewing an image
      Returns:
      a boolean.
      Throws:
      IndexUnreachableException - if any.
      DAOException - if any.
    • isAccessPermissionObject

      public boolean isAccessPermissionObject() throws IndexUnreachableException, DAOException
      Remnant from when image access had to be checked for each tile. Still used for OpenSeaDragon, so it just redirects to the access permission check.
      Returns:
      a boolean.
      Throws:
      IndexUnreachableException - if any.
      DAOException - if any.
    • isAccessPermissionImageZoom

      public boolean isAccessPermissionImageZoom() throws IndexUnreachableException, DAOException
      checks if the user has the privilege IPrivilegeHolder.PRIV_ZOOM_IMAGES If the check fails and Configuration.getUnzoomedImageAccessMaxWidth() is greater than 0, false is returned
      Returns:
      true exactly if the user is allowed to zoom images. false otherwise
      Throws:
      IndexUnreachableException
      DAOException
    • isAccessPermissionImageDownload

      public boolean isAccessPermissionImageDownload() throws IndexUnreachableException, DAOException
      Returns:
      true if user has access permission; false otherwise
      Throws:
      IndexUnreachableException
      DAOException
    • isAccessPermissionPdf

      public boolean isAccessPermissionPdf()

      isAccessPermissionPdf.

      Returns:
      true if PDF download is allowed for this page; false otherwise
    • isAccessPermissionBornDigital

      public boolean isAccessPermissionBornDigital() throws IndexUnreachableException, DAOException

      isAccessPermissionBornDigital.

      Returns:
      true if access is allowed for born digital files; false otherwise
      Throws:
      IndexUnreachableException - if any.
      DAOException - if any.
    • isBornDigitalDownloadTicketRequired

      public boolean isBornDigitalDownloadTicketRequired() throws IndexUnreachableException, DAOException
      Returns:
      true if a download ticket requirement is present and not yet satisfied; false otherwise
      Throws:
      IndexUnreachableException
      DAOException
    • isAccessPermissionFulltext

      public boolean isAccessPermissionFulltext() throws IndexUnreachableException, DAOException
      Returns:
      true if user has access permission; false otherwise
      Throws:
      IndexUnreachableException
      DAOException
    • getFooterHeight

      public int getFooterHeight() throws ViewerConfigurationException

      getFooterHeight.

      Returns:
      a int.
      Throws:
      ViewerConfigurationException - if any.
    • getFooterHeight

      public int getFooterHeight(String pageType) throws ViewerConfigurationException

      getFooterHeight.

      Parameters:
      pageType - a String object.
      Returns:
      a int.
      Throws:
      ViewerConfigurationException - if any.
    • getComments

      public List<CrowdsourcingAnnotation> getComments() throws DAOException

      getComments.

      Returns:
      a List object.
      Throws:
      DAOException - if any.
    • deleteCommentAction

      public void deleteCommentAction(Comment comment) throws DAOException

      deleteCommentAction.

      Parameters:
      comment - a Comment object.
      Throws:
      DAOException - if any.
    • hasIndividualSize

      public boolean hasIndividualSize()
      return true if this image has its own width/height measurements, and does not rely on default width/height
      Returns:
      a boolean.
    • getAltoText

      public String getAltoText()

      Getter for the field altoText.

      Returns:
      the altoText
    • getAltoText

      public String getAltoText(boolean load) throws ViewerConfigurationException
      Parameters:
      load - If true, ALTO will be loaded if altoText is null
      Returns:
      ALTO document for this page
      Throws:
      ViewerConfigurationException
    • getAltoCharset

      public String getAltoCharset()
      Returns:
      the altoCharset
    • getWordCoordsFormat

      public PhysicalElement.CoordsFormat getWordCoordsFormat()

      Getter for the field wordCoordsFormat.

      Returns:
      the wordCoordsFormat
    • getDataRepository

      public String getDataRepository()

      Getter for the field dataRepository.

      Returns:
      the dataRepository
    • getFileSize

      public long getFileSize()

      Getter for the field fileSize.

      Returns:
      the fileSize
    • setFileSize

      public void setFileSize(long fileSize)

      Setter for the field fileSize.

      Parameters:
      fileSize - the fileSize to set
    • getFileSizeAsString

      public String getFileSizeAsString()

      getFileSizeAsString.

      Returns:
      a String object.
    • getImageType

      public de.unigoettingen.sub.commons.contentlib.imagelib.ImageType getImageType()

      getImageType.

      Returns:
      a ImageType object.
    • getFileName

      public String getFileName(String extension)
      Gets the filename but with its extension replaced by the given extension If the extension is an empty String, the filename without any extension is returned If the extension is null, getFileName() is returned
      Parameters:
      extension - a String object.
      Returns:
      a String object.
    • isDisplayPagePdfLink

      public boolean isDisplayPagePdfLink()

      isDisplayPagePdfLink.

      Returns:
      true if page pdf link is allowed in configuration and no access conditions prevent PDF download; false otherwise
    • isAdaptImageViewHeight

      public boolean isAdaptImageViewHeight()

      isAdaptImageViewHeight.

      Returns:
      false if Configuration.isLimitImageHeight() returns true and the image side ratio (width/height) is below the lower or above the upper threshold Otherwise return true
    • getContainedStructElements

      public List<StructElement> getContainedStructElements() throws PresentationException, IndexUnreachableException
      List of struct elements that start on this page. For example, if a page contains multiple elements that only cover a certain area of the page (using coordinates), this method can be used to get all shape coordinates for these elemets for visualization.
      Returns:
      List of /StructElements
      Throws:
      IndexUnreachableException
      PresentationException
    • getContainedStructElementsAsJson

      public String getContainedStructElementsAsJson() throws PresentationException, IndexUnreachableException, com.fasterxml.jackson.core.JsonProcessingException
      Returns:
      String
      Throws:
      PresentationException
      IndexUnreachableException
      com.fasterxml.jackson.core.JsonProcessingException
    • toString

      public String toString()
      Overrides:
      toString in class Object