Package org.sakaiproject.search.api
Interface EntityContentProducer
-
public interface EntityContentProducerThis is a special class than handles ContentResources for the purposes of search. This must be implemented in a thread safe way. The aim is to map the content handler to the mime type- Author:
- ieb
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default booleancanRead(String reference)returns true if the current user can view the search resultdefault IntegergetAction(Event event)Get the search builder action associated with the event.default StringgetContainer(String ref)default StringgetContent(String reference)Get the content as a stringdefault ReadergetContentReader(String reference)Get a reader for the supplied content resourcedefault StringgetCreatorDisplayName(String reference)Get the display name of the resource creatordefault StringgetCreatorId(String reference)Get the user id of the resource creatordefault StringgetCreatorUserName(String reference)Get the user name of the resource creatordefault Map<String,?>getCustomProperties(String ref)Gets a map of custom document properties.default StringgetCustomRDF(String ref)At the moment this is a placeholder, but eventually It will return a block of Custom RDF, that the EntityContentProducer wants the search index to index.default StringgetId(String ref)default Iterator<String>getSiteContentIterator(String context)Get the site content as an iteratordefault StringgetSiteId(String reference)get the site ID from the resource Namedefault StringgetSubType(String ref)default StringgetTitle(String reference)get the title for the contentdefault StringgetTool()What is the name of the tool,default StringgetType(String ref)default StringgetUrl(String reference)Gets the url that displays the entitydefault StringgetUrl(String reference, Entity.UrlType urlType)Gets the url that displays the entity.default booleanisContentFromReader(String reference)Should the consumer use the reader or is it OK to use a memory copy of the contentdefault booleanisForIndex(String reference)If the reference should be indexed, return truedefault booleanmatches(String reference)If the reference matches this EntityContentProducer return truedefault booleanmatches(Event event)Is the event owned by this EntityContentProducer
-
-
-
Method Detail
-
isContentFromReader
default boolean isContentFromReader(String reference)
Should the consumer use the reader or is it OK to use a memory copy of the content- Parameters:
reference-- Returns:
-
getContentReader
default Reader getContentReader(String reference)
Get a reader for the supplied content resource- Parameters:
reference-- Returns:
-
getContent
default String getContent(String reference)
Get the content as a string- Parameters:
reference-- Returns:
- See Also:
SearchUtils.appendCleanString(String, StringBuilder)
-
getTitle
default String getTitle(String reference)
get the title for the content- Parameters:
reference-- Returns:
-
getUrl
default String getUrl(String reference)
Gets the url that displays the entity- Parameters:
reference-- Returns:
-
getUrl
default String getUrl(String reference, Entity.UrlType urlType)
Gets the url that displays the entity. You can specify a UrlType depending on what kind of link you want.- Parameters:
reference-EntityUrlType-- Returns:
- The url as a String
-
matches
default boolean matches(String reference)
If the reference matches this EntityContentProducer return true- Parameters:
reference-- Returns:
-
getAction
default Integer getAction(Event event)
Get the search builder action associated with the event.- Parameters:
event-- Returns:
- One of the
SearchBuilderItemconstants. - See Also:
SearchBuilderItem
-
matches
default boolean matches(Event event)
Is the event owned by this EntityContentProducer- Parameters:
event-- Returns:
-
getTool
default String getTool()
What is the name of the tool,- Returns:
-
getSiteId
default String getSiteId(String reference)
get the site ID from the resource Name- Parameters:
reference-- Returns:
- the site ID or
nullif a site ID is not present or this provider does not manage site-specific content
-
getCreatorDisplayName
default String getCreatorDisplayName(String reference)
Get the display name of the resource creator- Parameters:
reference-- Returns:
- the display name or "" if this provider does not support it
-
getCreatorId
default String getCreatorId(String reference)
Get the user id of the resource creator- Parameters:
reference-- Returns:
- the user id or "" if this provider does not support it
-
getCreatorUserName
default String getCreatorUserName(String reference)
Get the user name of the resource creator- Parameters:
reference-- Returns:
- the user name or "" if this provider does not support it
-
getSiteContentIterator
default Iterator<String> getSiteContentIterator(String context)
Get the site content as an iterator- Parameters:
context-- Returns:
- an iterator over all content associted with the given site ID, or an empty iterator if this provider does not manage site-specific content
-
isForIndex
default boolean isForIndex(String reference)
If the reference should be indexed, return true- Parameters:
reference-- Returns:
-
canRead
default boolean canRead(String reference)
returns true if the current user can view the search result- Parameters:
reference-- Returns:
-
getCustomProperties
default Map<String,?> getCustomProperties(String ref)
Gets a map of custom document properties. The names of the map map will contain the index name to which the value is added. The value is expected to be a String or String[], containing the value, values to be added. Before using this method in your entity producer, be certain that the value is not already in the index. ( See SearchService for list of Fields) If the key starts with a "T" then the index will be tokenized and the T removed to form the index name- Returns:
-
getCustomRDF
default String getCustomRDF(String ref)
At the moment this is a placeholder, but eventually It will return a block of Custom RDF, that the EntityContentProducer wants the search index to index. This is ontop of any RDF that the search index is already processing.- Returns:
-
-