Package org.opencms.search.galleries
Class CmsGallerySearchResult
- java.lang.Object
-
- org.opencms.search.galleries.CmsGallerySearchResult
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Comparable<CmsGallerySearchResult>
public class CmsGallerySearchResult extends java.lang.Object implements java.lang.Comparable<CmsGallerySearchResult>, java.lang.Cloneable
-
-
Field Summary
Fields Modifier and Type Field Description static org.apache.commons.logging.Log
LOG
The logger instance for this class.protected java.lang.String
m_additonalInfo
The additional information for the gallery search index.protected java.util.List<java.lang.String>
m_containerTypes
The supported container types of this search result.protected java.util.Date
m_dateCreated
The creation date of this search result.protected java.util.Date
m_dateExpired
The expiration date of this search result.protected java.util.Date
m_dateLastModified
The last modification date of this search result.protected java.util.Date
m_dateReleased
The release date of this search result.protected java.lang.String
m_description
The description of this search result.protected java.lang.String
m_excerpt
The excerpt of this search result.protected int
m_length
The length of the search result.protected java.util.List<java.lang.String>
m_locales
The locales in which the content is available.protected java.lang.String
m_path
The resource path of this search result.protected java.lang.String
m_resourceType
The resource type of the search result.protected int
m_score
The score of this search result.protected int
m_state
The state of the search result.protected java.lang.String
m_structureId
The structure UUID of the resource.protected java.lang.String
m_title
The title of this search result.protected java.lang.String
m_userCreated
The user who created the search result resource.protected java.lang.String
m_userLastModified
The user who last modified the search result resource.
-
Constructor Summary
Constructors Constructor Description CmsGallerySearchResult(CmsObject cms, CmsResource res, java.lang.String title)
Creates a fake gallery search result by reading the necessary data from a VFS resource.CmsGallerySearchResult(I_CmsSearchDocument doc, CmsObject cms, int score, java.util.Locale locale)
Creates a new gallery search result.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(CmsGallerySearchResult other)
Compares two search results based on the score of the result.boolean
equals(java.lang.Object obj)
java.lang.String
getAdditonalInfo()
Returns the additional information stored for this search result in the gallery search index.java.util.List<java.lang.String>
getContainerTypes()
Returns the containers supported by this resource.java.util.Date
getDateCreated()
Returns the date created.java.util.Date
getDateExpired()
Returns the date the resource expires.java.util.Date
getDateLastModified()
Returns the date last modified.java.util.Date
getDateReleased()
Returns the date the resource is released.java.lang.String
getDescription()
Returns the description.java.lang.String
getExcerpt()
Returns the excerpt.int
getLength()
Returns the length of the resource.java.util.List<java.lang.String>
getLocales()
Returns the list of locales this search result is available for.java.lang.String
getPath()
Returns the resource root path.static java.lang.String[]
getRequiredSolrFields()
Returns the list of Solr fields a search result must have to initialize the gallery search result correctly.java.lang.String
getResourceType()
Returns the resource type of the search result document.int
getScore()
Returns the Lucene search score for this result.int
getState()
Returns the state of the resource.java.lang.String
getStructureId()
Returns the structure id of the resource.java.lang.String
getTitle()
Returns the title of the resource.java.lang.String
getUserCreated()
Returns the name of the user who created the resource.java.lang.String
getUserLastModified()
Returns the name of the user who last modified the resource.int
hashCode()
protected void
initializeMissingFieldsFromVfs(CmsObject cms, CmsUUID structureId)
Initializes missing fields by reading the information from the VFS.boolean
isReleaseAndNotExpired(CmsObject cms)
Returns if the related resource is released and not expired.CmsGallerySearchResult
withTitle(java.lang.String title)
Returns a shallow copy of this result, with a changed title.
-
-
-
Field Detail
-
LOG
public static final org.apache.commons.logging.Log LOG
The logger instance for this class.
-
m_additonalInfo
protected java.lang.String m_additonalInfo
The additional information for the gallery search index.
-
m_containerTypes
protected java.util.List<java.lang.String> m_containerTypes
The supported container types of this search result.
-
m_dateCreated
protected java.util.Date m_dateCreated
The creation date of this search result.
-
m_dateExpired
protected java.util.Date m_dateExpired
The expiration date of this search result.
-
m_dateLastModified
protected java.util.Date m_dateLastModified
The last modification date of this search result.
-
m_dateReleased
protected java.util.Date m_dateReleased
The release date of this search result.
-
m_description
protected java.lang.String m_description
The description of this search result.
-
m_excerpt
protected java.lang.String m_excerpt
The excerpt of this search result.
-
m_length
protected int m_length
The length of the search result.
-
m_locales
protected java.util.List<java.lang.String> m_locales
The locales in which the content is available.
-
m_path
protected java.lang.String m_path
The resource path of this search result.
-
m_resourceType
protected java.lang.String m_resourceType
The resource type of the search result.
-
m_score
protected int m_score
The score of this search result.
-
m_state
protected int m_state
The state of the search result.
-
m_structureId
protected java.lang.String m_structureId
The structure UUID of the resource.
-
m_title
protected java.lang.String m_title
The title of this search result.
-
m_userCreated
protected java.lang.String m_userCreated
The user who created the search result resource.
-
m_userLastModified
protected java.lang.String m_userLastModified
The user who last modified the search result resource.
-
-
Constructor Detail
-
CmsGallerySearchResult
public CmsGallerySearchResult(CmsObject cms, CmsResource res, java.lang.String title)
Creates a fake gallery search result by reading the necessary data from a VFS resource.- Parameters:
cms
- the current CMS contextres
- the resource from which the data should be readtitle
- optional value that can be used to override the title (if null, the title is not overridden)
-
CmsGallerySearchResult
public CmsGallerySearchResult(I_CmsSearchDocument doc, CmsObject cms, int score, java.util.Locale locale)
Creates a new gallery search result.- Parameters:
cms
- the current CMS context (used for reading information missing from the index)doc
- the I_CmsSearchResult document to extract information from.score
- the score of this search resultlocale
- the locale to create the result for
-
-
Method Detail
-
getRequiredSolrFields
public static final java.lang.String[] getRequiredSolrFields()
Returns the list of Solr fields a search result must have to initialize the gallery search result correctly.- Returns:
- the list of Solr fields.
-
compareTo
public int compareTo(CmsGallerySearchResult other)
Compares two search results based on the score of the result.- Specified by:
compareTo
in interfacejava.lang.Comparable<CmsGallerySearchResult>
- Parameters:
other
- the result to compare this result with- Returns:
- the comparison result
- See Also:
Comparable.compareTo(java.lang.Object)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
getAdditonalInfo
public java.lang.String getAdditonalInfo()
Returns the additional information stored for this search result in the gallery search index.- Returns:
- the additional information stored for this search result in the gallery search index
-
getContainerTypes
public java.util.List<java.lang.String> getContainerTypes()
Returns the containers supported by this resource.- Returns:
- the containers supported by this resource
-
getDateCreated
public java.util.Date getDateCreated()
Returns the date created.- Returns:
- the date created
-
getDateExpired
public java.util.Date getDateExpired()
Returns the date the resource expires.- Returns:
- the date the resource expires
- See Also:
CmsResource.getDateExpired()
-
getDateLastModified
public java.util.Date getDateLastModified()
Returns the date last modified.- Returns:
- the date last modified
-
getDateReleased
public java.util.Date getDateReleased()
Returns the date the resource is released.- Returns:
- the date the resource is released
- See Also:
CmsResource.getDateReleased()
-
getDescription
public java.lang.String getDescription()
Returns the description.- Returns:
- the description
-
getExcerpt
public java.lang.String getExcerpt()
Returns the excerpt.- Returns:
- the excerpt
-
getLength
public int getLength()
Returns the length of the resource.- Returns:
- the length of the resource
- See Also:
CmsResource.getLength()
-
getLocales
public java.util.List<java.lang.String> getLocales()
Returns the list of locales this search result is available for.- Returns:
- the list of locales this search result is available for
-
getPath
public java.lang.String getPath()
Returns the resource root path.- Returns:
- the resource root path
- See Also:
CmsResource.getRootPath()
-
getResourceType
public java.lang.String getResourceType()
Returns the resource type of the search result document.- Returns:
- the resource type of the search result document
- See Also:
CmsResourceManager.getResourceType(String)
-
getScore
public int getScore()
Returns the Lucene search score for this result.- Returns:
- the Lucene search score for this result
-
getState
public int getState()
Returns the state of the resource.- Returns:
- the state of the resource
- See Also:
CmsResource.getState()
-
getStructureId
public java.lang.String getStructureId()
Returns the structure id of the resource.- Returns:
- the structure id of the resource
-
getTitle
public java.lang.String getTitle()
Returns the title of the resource.- Returns:
- the title of the resource
-
getUserCreated
public java.lang.String getUserCreated()
Returns the name of the user who created the resource.- Returns:
- the name of the user who created the resource
- See Also:
CmsResource.getUserCreated()
-
getUserLastModified
public java.lang.String getUserLastModified()
Returns the name of the user who last modified the resource.- Returns:
- the name of the user who last modified the resource
- See Also:
CmsResource.getUserLastModified()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
isReleaseAndNotExpired
public boolean isReleaseAndNotExpired(CmsObject cms)
Returns if the related resource is released and not expired.- Parameters:
cms
- the cms context- Returns:
true
if the related resource is released and not expired
-
withTitle
public CmsGallerySearchResult withTitle(java.lang.String title)
Returns a shallow copy of this result, with a changed title.- Parameters:
title
- the new title- Returns:
- the shallow copy with the changed title
-
initializeMissingFieldsFromVfs
protected void initializeMissingFieldsFromVfs(CmsObject cms, CmsUUID structureId)
Initializes missing fields by reading the information from the VFS.- Parameters:
cms
- the current CMS contextstructureId
- the current structure id
-
-