Class DisplayUserGeneratedContent

java.lang.Object
io.goobi.viewer.model.crowdsourcing.DisplayUserGeneratedContent

public class DisplayUserGeneratedContent extends Object
UserGeneratedContent stub class for displaying contents generated by the crowdsourcing module.
  • Field Details

    • FORMAT

      public static final NumberFormat FORMAT
      Constant format.
  • Constructor Details

    • DisplayUserGeneratedContent

      public DisplayUserGeneratedContent()
      Default constructor (needed for persistence).
    • DisplayUserGeneratedContent

      public DisplayUserGeneratedContent(PersistentAnnotation a)
  • Method Details

    • getId

      public Long getId()
      Getter for the field id.
      Returns:
      the database primary key of this user-generated content entry, or null if not persisted
    • setId

      public void setId(Long id)
      Setter for the field id.
      Parameters:
      id - database primary key to set
    • getType

      Getter for the field type.
      Returns:
      the content type of this user-generated content entry
    • setType

      public void setType(DisplayUserGeneratedContent.ContentType type)
      Setter for the field type.
      Parameters:
      type - the content type of this user-generated content entry
    • getPi

      public String getPi()
      Getter for the field pi.
      Returns:
      the persistent identifier of the associated record
    • setPi

      public void setPi(String pi)
      Setter for the field pi.
      Parameters:
      pi - the persistent identifier of the associated record
    • getPage

      public Integer getPage()
      Getter for the field page.
      Returns:
      the page number within the record where the content is located
    • setPage

      public void setPage(Integer page)
      Setter for the field page.
      Parameters:
      page - the page number within the record where the content is located
    • getLabel

      public String getLabel()
      Getter for the field label.
      Returns:
      the display label for this user-generated content entry
    • setLabel

      public void setLabel(String label)
      Setter for the field label.
      Parameters:
      label - the display label for this user-generated content entry
    • getDisplayLabel

      public String getDisplayLabel()
      Returns the label, if set, otherwise pi.
      Returns:
      the display label for this user-generated content item, falling back to the PI if no label is set
    • getExtendendLabel

      public String getExtendendLabel()
    • setExtendendLabel

      public void setExtendendLabel(String extendendLabel)
    • getUpdatedBy

      public User getUpdatedBy()
      Getter for the field updatedBy.
      Returns:
      the user who last updated this content entry
    • setUpdatedBy

      public void setUpdatedBy(User updatedBy)
      Setter for the field updatedBy.
      Parameters:
      updatedBy - the user who last updated this content entry
    • getDateUpdated

      public LocalDateTime getDateUpdated()
      Getter for the field dateUpdated.
      Returns:
      the date and time when this content entry was last updated
    • getDateUpdatedAsString

      public String getDateUpdatedAsString()
      getDateUpdatedAsString.
      Returns:
      the last-updated date formatted as a German date string, or null if not set
    • getTimeUpdatedAsString

      public String getTimeUpdatedAsString()
      getTimeUpdatedAsString.
      Returns:
      the last-updated time formatted as an ISO 8601 time string, or null if not set
    • setDateUpdated

      public void setDateUpdated(LocalDateTime dateUpdated)
      Setter for the field dateUpdated.
      Parameters:
      dateUpdated - the date and time when this content entry was last updated
    • getAccessCondition

      public String getAccessCondition()
    • setAccessCondition

      public void setAccessCondition(String accessCondition)
    • getAreaString

      public String getAreaString()
      Getter for the field areaString.
      Returns:
      the string representation of the geographic or image area coordinates
    • setAreaString

      public void setAreaString(String areaString)
      Setter for the field areaString.
      Parameters:
      areaString - the string representation of the geographic or image area coordinates
    • hasArea

      public boolean hasArea()
      hasArea.
      Returns:
      true if this user-generated content item has a non-null, non-empty area string, false otherwise
    • mayHaveArea

      public boolean mayHaveArea()
      mayHaveArea.
      Returns:
      true if this type of user-generated content may potentially have an area annotation, false otherwise
    • convertToIntArray

      public static int[] convertToIntArray(double[] coordinates)
      convertToIntArray.
      Parameters:
      coordinates - int[]
      Returns:
      int[]
    • convertToDoubleArray

      public static double[] convertToDoubleArray(int[] coordinates)
      convertToDoubleArray.
      Parameters:
      coordinates - int[]
      Returns:
      double[]
    • getDisplayCoordinates

      public String getDisplayCoordinates()
      Getter for the field displayCoordinates.
      Returns:
      the coordinate string used for UI rendering of this content's region
    • setDisplayCoordinates

      public void setDisplayCoordinates(String displayCoordinates)
      Setter for the field displayCoordinates.
      Parameters:
      displayCoordinates - coordinate string for UI rendering
    • getDisplayPage

      public Integer getDisplayPage()
      Alias for getPage().
      Returns:
      the physical page order number on which this content is displayed, or null if not set
    • isEmpty

      public boolean isEmpty()
      Checks if the resource has either a label or an annotation body with a type.
      Returns:
      true if neither label nor annotation body exist
    • getTypeAsString

      public String getTypeAsString()
      getTypeAsString.
      Returns:
      the name of the content type as a string
    • getAnnotationBody

      public de.intranda.api.annotation.ITypedResource getAnnotationBody()
    • setAnnotationBody

      public void setAnnotationBody(de.intranda.api.annotation.ITypedResource annotationBody)
    • setAnnotationBody

      public boolean setAnnotationBody(String json)
    • createJsonFromFeatures

      public static String createJsonFromFeatures(Object value)
    • buildFromSolrDoc

      public static DisplayUserGeneratedContent buildFromSolrDoc(org.apache.solr.common.SolrDocument doc) throws IndexUnreachableException
      buildFromSolrDoc.
      Parameters:
      doc - Solr document containing UGC field values
      Returns:
      UserGeneratedContent generated from the given Solr document
      Throws:
      IndexUnreachableException - if any.
    • generateUgcLabel

      public static String generateUgcLabel(StructElement se)
      Builds label out of user-generated content metadata.
      Parameters:
      se - struct element containing UGC type and metadata fields
      Returns:
      the generated label
    • generateAddressLabel

      public static String generateAddressLabel(StructElement se, String text)
      Parameters:
      se - struct element containing address metadata fields
      text - fallback text used when no address fields are present
      Returns:
      String
    • generateCorporationLabel

      public static String generateCorporationLabel(StructElement se)
      Parameters:
      se - struct element containing corporation metadata fields
      Returns:
      String
    • generatePersonLabel

      public static String generatePersonLabel(StructElement se)
    • isOnThisPage

      public boolean isOnThisPage(PhysicalElement page)
    • isOnOtherPage

      public boolean isOnOtherPage(PhysicalElement page)
    • isOnAnyPage

      public boolean isOnAnyPage()
    • getIconName

      public String getIconName()
    • getPageUrl

      public String getPageUrl()
    • getPageUrl

      public String getPageUrl(PageType pageType)
      Parameters:
      pageType - the viewer page type used to build the URL prefix
      Returns:
      Generated URL
    • isCrowdsourcingModuleContent

      public boolean isCrowdsourcingModuleContent()
    • setCrowdsourcingModuleContent

      public void setCrowdsourcingModuleContent(boolean crowdsourcingModuleContent)