Class DisplayUserGeneratedContent
java.lang.Object
io.goobi.viewer.model.crowdsourcing.DisplayUserGeneratedContent
UserGeneratedContent stub class for displaying contents generated by the crowdsourcing module.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumerates the semantic content types for user-generated annotations, such as person, address, comment, geolocation, or normdata.static class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor (needed for persistence). -
Method Summary
Modifier and TypeMethodDescriptionstatic DisplayUserGeneratedContentbuildFromSolrDoc(org.apache.solr.common.SolrDocument doc) buildFromSolrDoc.static double[]convertToDoubleArray(int[] coordinates) convertToDoubleArray.static int[]convertToIntArray(double[] coordinates) convertToIntArray.static StringcreateJsonFromFeatures(Object value) static StringgenerateAddressLabel(StructElement se, String text) static Stringstatic Stringstatic StringBuilds label out of user-generated content metadata.de.intranda.api.annotation.ITypedResourceGetter for the fieldareaString.Getter for the fielddateUpdated.getDateUpdatedAsString.Getter for the fielddisplayCoordinates.Returns thelabel, if set, otherwisepi.Alias forgetPage().getId()Getter for the fieldid.getLabel()Getter for the fieldlabel.getPage()Getter for the fieldpage.getPageUrl(PageType pageType) getPi()Getter for the fieldpi.getTimeUpdatedAsString.getType()Getter for the fieldtype.getTypeAsString.Getter for the fieldupdatedBy.booleanhasArea()hasArea.booleanbooleanisEmpty()Checks if the resource has either a label or an annotation body with a type.booleanbooleanisOnOtherPage(PhysicalElement page) booleanisOnThisPage(PhysicalElement page) booleanmayHaveArea.voidsetAccessCondition(String accessCondition) voidsetAnnotationBody(de.intranda.api.annotation.ITypedResource annotationBody) booleansetAnnotationBody(String json) voidsetAreaString(String areaString) Setter for the fieldareaString.voidsetCrowdsourcingModuleContent(boolean crowdsourcingModuleContent) voidsetDateUpdated(LocalDateTime dateUpdated) Setter for the fielddateUpdated.voidsetDisplayCoordinates(String displayCoordinates) Setter for the fielddisplayCoordinates.voidsetExtendendLabel(String extendendLabel) voidSetter for the fieldid.voidSetter for the fieldlabel.voidSetter for the fieldpage.voidSetter for the fieldpi.voidSetter for the fieldtype.voidsetUpdatedBy(User updatedBy) Setter for the fieldupdatedBy.
-
Field Details
-
FORMAT
Constantformat.
-
-
Constructor Details
-
DisplayUserGeneratedContent
public DisplayUserGeneratedContent()Default constructor (needed for persistence). -
DisplayUserGeneratedContent
-
-
Method Details
-
getId
Getter for the fieldid.- Returns:
- the database primary key of this user-generated content entry, or null if not persisted
-
setId
Setter for the fieldid.- Parameters:
id- database primary key to set
-
getType
Getter for the fieldtype.- Returns:
- the content type of this user-generated content entry
-
setType
Setter for the fieldtype.- Parameters:
type- the content type of this user-generated content entry
-
getPi
Getter for the fieldpi.- Returns:
- the persistent identifier of the associated record
-
setPi
Setter for the fieldpi.- Parameters:
pi- the persistent identifier of the associated record
-
getPage
Getter for the fieldpage.- Returns:
- the page number within the record where the content is located
-
setPage
Setter for the fieldpage.- Parameters:
page- the page number within the record where the content is located
-
getLabel
Getter for the fieldlabel.- Returns:
- the display label for this user-generated content entry
-
setLabel
Setter for the fieldlabel.- Parameters:
label- the display label for this user-generated content entry
-
getDisplayLabel
Returns thelabel, if set, otherwisepi.- Returns:
- the display label for this user-generated content item, falling back to the PI if no label is set
-
getExtendendLabel
-
setExtendendLabel
-
getUpdatedBy
Getter for the fieldupdatedBy.- Returns:
- the user who last updated this content entry
-
setUpdatedBy
Setter for the fieldupdatedBy.- Parameters:
updatedBy- the user who last updated this content entry
-
getDateUpdated
Getter for the fielddateUpdated.- Returns:
- the date and time when this content entry was last updated
-
getDateUpdatedAsString
getDateUpdatedAsString.- Returns:
- the last-updated date formatted as a German date string, or null if not set
-
getTimeUpdatedAsString
getTimeUpdatedAsString.- Returns:
- the last-updated time formatted as an ISO 8601 time string, or null if not set
-
setDateUpdated
Setter for the fielddateUpdated.- Parameters:
dateUpdated- the date and time when this content entry was last updated
-
getAccessCondition
-
setAccessCondition
-
getAreaString
Getter for the fieldareaString.- Returns:
- the string representation of the geographic or image area coordinates
-
setAreaString
Setter for the fieldareaString.- 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
Getter for the fielddisplayCoordinates.- Returns:
- the coordinate string used for UI rendering of this content's region
-
setDisplayCoordinates
Setter for the fielddisplayCoordinates.- Parameters:
displayCoordinates- coordinate string for UI rendering
-
getDisplayPage
Alias forgetPage().- 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
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
-
createJsonFromFeatures
-
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
Builds label out of user-generated content metadata.- Parameters:
se- struct element containing UGC type and metadata fields- Returns:
- the generated label
-
generateAddressLabel
- Parameters:
se- struct element containing address metadata fieldstext- fallback text used when no address fields are present- Returns:
String
-
generateCorporationLabel
- Parameters:
se- struct element containing corporation metadata fields- Returns:
String
-
generatePersonLabel
-
isOnThisPage
-
isOnOtherPage
-
isOnAnyPage
public boolean isOnAnyPage() -
getIconName
-
getPageUrl
-
getPageUrl
- 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)
-