Package io.goobi.viewer.model.viewer
Class StructElement
- java.lang.Object
-
- io.goobi.viewer.model.viewer.StructElementStub
-
- io.goobi.viewer.model.viewer.StructElement
-
- All Implemented Interfaces:
Serializable
,Comparable<StructElementStub>
public class StructElement extends StructElementStub implements Comparable<StructElementStub>, Serializable
Each instance of this class represents a structure element. This class extendsStructElementStub
and contains additional memory-intensive members such as the corresponding Solr document, references to parent and child StructElements and full-text.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
StructElement.ShapeMetadata
Shape metadata for docstructs that represent only a portion of a page (or several pages).
-
Field Summary
-
Fields inherited from class io.goobi.viewer.model.viewer.StructElementStub
anchor, dataRepository, docStructType, docType, imageNumber, label, logid, luceneId, metadataFields, numVolumes, partnerId, pi, sourceDocFormat, volume, volumeNo, volumeNoSort, work
-
-
Constructor Summary
Constructors Constructor Description StructElement()
Empty constructor for unit tests.StructElement(long luceneId)
Constructor for StructElement.StructElement(long luceneId, org.apache.solr.common.SolrDocument doc)
Constructor for StructElement.StructElement(long luceneId, org.apache.solr.common.SolrDocument doc, org.apache.solr.common.SolrDocument docToMerge)
Constructor for StructElement.StructElement(org.apache.solr.common.SolrDocument doc)
LikeStructElement(long, SolrDocument)
, but get the lucene Id from the SolrDocument
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static StructElement
create(org.apache.solr.common.SolrDocument solrDoc)
StructElementStub
createStub()
Returns a stub representation of this object that only contains simple members to conserve memory.List<EventElement>
generateEventElements(Locale locale, boolean forSearchHit)
generateEventElements.Map<String,String>
getAncestors()
Getter for the fieldancestors
.String
getCollection()
getCollection.List<String>
getCollections()
getCollections.String
getFirstPageFieldValue(String field)
getFirstPageFieldValue.StructElement
getFirstVolume(List<String> fields)
getFirstVolume.String
getFirstVolumeFieldValue(String field)
getFirstVolumeFieldValue.String
getGroupIdField()
Returns the group field name of a group document.String
getGroupLabel(String groupIdentifier, String altValue)
Returns the label for the group with the given identifier.Map<String,String>
getGroupMemberships()
Getter for the fieldgroupMemberships
.int
getImageNumber()
Getter for the fieldimageNumber
.String
getImageUrl(int width, int height)
getImageUrl.de.intranda.metadata.multilanguage.IMetadataValue
getMultiLanguageDisplayLabel()
getMultiLanguageDisplayLabel.int
getNumPages()
Returns the number of pages (for the entire record, not a particular docstruct).StructElement
getParent()
Loads and returns the immediate parent StructElement of this element.Long
getParentLuceneId()
String
getPi()
Getter for the fieldpi
.List<StructElement.ShapeMetadata>
getShapeMetadata()
String
getTitle()
Deprecated.StructElement
getTopStruct()
Returns a StructElement that represents the top non-anchor element of the hierarchy (ISWORK=true).boolean
hasShapeMetadata()
boolean
isAccessPermissionDownloadMetadata()
boolean
isAccessPermissionGenerateIiifManifest()
boolean
isAltoAvailable()
Returns true if the record has any ALTO documents indexed in its pages; false otherwise.boolean
isAnchorChild()
isAnchorChild.boolean
isDeleted()
isDeleted.boolean
isExists()
isExists.boolean
isFulltextAvailable()
isFulltextAvailable.boolean
isGroupMember()
isGroupMember.boolean
isHasChildren()
Checks whether the Solr document represented by this StructElement has child elements in the index.boolean
isHasParent()
isHasParent.boolean
isHasParentOrChildren()
isHasParentOrChildren.boolean
isNerAvailable()
Returns true if the record has any NE_* tags indexed in its pages; false otherwise.boolean
isRtl()
void
setFulltextAvailable(boolean fulltextAvailable)
Setter for the fieldfulltextAvailable
.void
setRtl(boolean rtl)
void
setShapeMetadata(List<StructElement.ShapeMetadata> shapeMetadata)
void
setTopStruct(StructElement topStruct)
-
Methods inherited from class io.goobi.viewer.model.viewer.StructElementStub
compareTo, generateContextObject, getDataRepository, getDisplayLabel, getDocStructType, getDocType, getKEVForField, getLabel, getLabel, getLogid, getLuceneId, getMetadataFields, getMetadataUrl, getMetadataValue, getMetadataValueForLanguage, getMetadataValues, getMultiLanguageMetadataValue, getNumVolumes, getPartnerId, getSourceDocFormat, getUrl, getUrl, getUrl, getVolumeNo, getVolumeNoSort, isAnchor, isGroup, isHasImages, isLidoRecord, isVolume, isWork, setAnchor, setDataRepository, setDocStructType, setDocType, setImageNumber, setLabel, setLogid, setMetadataFields, setPartnerId, setPi, setSourceDocFormat, setVolume, setVolumeNo, setVolumeNoSort, setWork
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Constructor Detail
-
StructElement
public StructElement()
Empty constructor for unit tests.
-
StructElement
public StructElement(long luceneId) throws IndexUnreachableException
Constructor for StructElement.
- Parameters:
luceneId
-Long
- Throws:
IndexUnreachableException
- if any.
-
StructElement
public StructElement(long luceneId, org.apache.solr.common.SolrDocument doc) throws IndexUnreachableException
Constructor for StructElement.
- Parameters:
luceneId
- a long.doc
- aSolrDocument
object.- Throws:
IndexUnreachableException
- if any.
-
StructElement
public StructElement(org.apache.solr.common.SolrDocument doc) throws IndexUnreachableException
LikeStructElement(long, SolrDocument)
, but get the lucene Id from the SolrDocument- Parameters:
doc
-- Throws:
IndexUnreachableException
-
StructElement
public StructElement(long luceneId, org.apache.solr.common.SolrDocument doc, org.apache.solr.common.SolrDocument docToMerge) throws IndexUnreachableException
Constructor for StructElement.
- Parameters:
luceneId
- a long.doc
- aSolrDocument
object.docToMerge
- aSolrDocument
object.- Throws:
IndexUnreachableException
- if any.
-
-
Method Detail
-
isHasParentOrChildren
public boolean isHasParentOrChildren() throws PresentationException, IndexUnreachableException
isHasParentOrChildren.
- Returns:
- a boolean.
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
isHasParent
public boolean isHasParent()
isHasParent.
- Returns:
- a boolean.
-
getNumPages
public int getNumPages()
Description copied from class:StructElementStub
Returns the number of pages (for the entire record, not a particular docstruct).- Overrides:
getNumPages
in classStructElementStub
- Returns:
- a int.
-
getParent
public StructElement getParent() throws IndexUnreachableException
Loads and returns the immediate parent StructElement of this element.- Returns:
StructElement
- Throws:
IndexUnreachableException
- if any.
-
getParentLuceneId
public Long getParentLuceneId()
- Returns:
-
isHasChildren
public boolean isHasChildren() throws IndexUnreachableException, PresentationException
Checks whether the Solr document represented by this StructElement has child elements in the index.- Returns:
- a boolean.
- Throws:
IndexUnreachableException
- if any.PresentationException
- if any.
-
getTopStruct
public StructElement getTopStruct() throws PresentationException, IndexUnreachableException
Returns a StructElement that represents the top non-anchor element of the hierarchy (ISWORK=true). If the element itself is an anchor, itself will be returned. If no topStruct element is found because no metadataSolrConstants.IDDOC_TOPSTRUCT
is found or because it could not be resolved, null is returned- Returns:
- a
StructElement
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
setTopStruct
public void setTopStruct(StructElement topStruct)
-
isGroupMember
public boolean isGroupMember()
isGroupMember.
- Returns:
- a boolean.
-
getGroupLabel
public String getGroupLabel(String groupIdentifier, String altValue) throws IndexUnreachableException
Returns the label for the group with the given identifier.- Parameters:
groupIdentifier
- Group record identifieraltValue
- Message key to return if no label was found- Returns:
- label value for the group record; given message key if none found
- Throws:
IndexUnreachableException
- if any.
-
isExists
public boolean isExists()
isExists.
- Returns:
- the exists
-
isDeleted
public boolean isDeleted()
isDeleted.
- Returns:
- a boolean.
-
getPi
public String getPi()
Getter for the field
pi
.- Overrides:
getPi
in classStructElementStub
- Returns:
- the pi
-
getImageNumber
public int getImageNumber()
Getter for the field
imageNumber
.- Overrides:
getImageNumber
in classStructElementStub
- Returns:
- the imageNumber
-
getImageUrl
public String getImageUrl(int width, int height) throws ViewerConfigurationException
getImageUrl.
- Parameters:
width
- a int.height
- a int.- Returns:
- Image URL
- Throws:
ViewerConfigurationException
- if any.
-
generateEventElements
public List<EventElement> generateEventElements(Locale locale, boolean forSearchHit) throws IndexUnreachableException
generateEventElements.
- Parameters:
locale
- aLocale
object.forSearchHit
- If true, only search hit metadata will be populated in the event; if false main and sidebar metadata- Returns:
- a
List
object. - Throws:
IndexUnreachableException
- if any.
-
isAnchorChild
public boolean isAnchorChild() throws IndexUnreachableException
isAnchorChild.
- Returns:
- a boolean.
- Throws:
IndexUnreachableException
- if any.
-
isFulltextAvailable
public boolean isFulltextAvailable()
isFulltextAvailable.
- Returns:
- the fulltextAvailable
-
setFulltextAvailable
public void setFulltextAvailable(boolean fulltextAvailable)
Setter for the field
fulltextAvailable
.- Parameters:
fulltextAvailable
- the fulltextAvailable to set
-
isAltoAvailable
public boolean isAltoAvailable() throws IndexUnreachableException, PresentationException
Returns true if the record has any ALTO documents indexed in its pages; false otherwise.- Returns:
- the altoAvailable
- Throws:
IndexUnreachableException
- if any.PresentationException
- if any.
-
isNerAvailable
public boolean isNerAvailable() throws IndexUnreachableException, PresentationException
Returns true if the record has any NE_* tags indexed in its pages; false otherwise.- Returns:
- the nerAvailable
- Throws:
IndexUnreachableException
- if any.PresentationException
- if any.
-
isAccessPermissionDownloadMetadata
public boolean isAccessPermissionDownloadMetadata() throws IndexUnreachableException, DAOException
- Returns:
- Throws:
IndexUnreachableException
DAOException
RecordNotFoundException
-
isAccessPermissionGenerateIiifManifest
public boolean isAccessPermissionGenerateIiifManifest() throws IndexUnreachableException, DAOException
- Returns:
- Throws:
IndexUnreachableException
DAOException
RecordNotFoundException
-
getTitle
@Deprecated public String getTitle()
Deprecated.getTitle.
- Returns:
- a
String
object.
-
createStub
public StructElementStub createStub()
Returns a stub representation of this object that only contains simple members to conserve memory.- Returns:
- a
StructElementStub
object.
-
getAncestors
public Map<String,String> getAncestors()
Getter for the field
ancestors
.- Returns:
- the ancestors
-
getGroupMemberships
public Map<String,String> getGroupMemberships()
Getter for the field
groupMemberships
.- Returns:
- the groupMemberships
-
getMultiLanguageDisplayLabel
public de.intranda.metadata.multilanguage.IMetadataValue getMultiLanguageDisplayLabel()
getMultiLanguageDisplayLabel.
- Returns:
- a
IMetadataValue
object.
-
getGroupIdField
public String getGroupIdField()
Returns the group field name of a group document.- Returns:
- a
String
object.
-
getFirstVolumeFieldValue
public String getFirstVolumeFieldValue(String field) throws PresentationException, IndexUnreachableException
getFirstVolumeFieldValue.
- Parameters:
field
- aString
object.- Returns:
- a
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getFirstVolume
public StructElement getFirstVolume(List<String> fields) throws PresentationException, IndexUnreachableException
getFirstVolume.
- Parameters:
fields
- aList
object.- Returns:
- a
StructElement
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getFirstPageFieldValue
public String getFirstPageFieldValue(String field) throws PresentationException, IndexUnreachableException
getFirstPageFieldValue.
- Parameters:
field
- aString
object.- Returns:
- a
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getShapeMetadata
public List<StructElement.ShapeMetadata> getShapeMetadata()
- Returns:
- the shapeMetadata
-
hasShapeMetadata
public boolean hasShapeMetadata()
-
setShapeMetadata
public void setShapeMetadata(List<StructElement.ShapeMetadata> shapeMetadata)
- Parameters:
shapeMetadata
- the shapeMetadata to set
-
isRtl
public boolean isRtl()
- Returns:
- the rtl
-
setRtl
public void setRtl(boolean rtl)
- Parameters:
rtl
- the rtl to set
-
create
public static StructElement create(org.apache.solr.common.SolrDocument solrDoc)
-
-