Jive API (3.0.13) Core Javadocs

com.jivesoftware.community.search
Class BaseIndexInfoProvider

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.jdbc.core.support.JdbcDaoSupport
          extended by com.jivesoftware.community.search.BaseIndexInfoProvider
All Implemented Interfaces:
IndexInfoProvider, org.springframework.beans.factory.InitializingBean

public abstract class BaseIndexInfoProvider
extends org.springframework.jdbc.core.support.JdbcDaoSupport
implements IndexInfoProvider

Base class that captures the most common implementation of IndexInfoProvider and offers subclasses a very easy way to implement IndexInfoProvider. Basically you just need to return 4 SQL statements and a description on how to index your content object.

If you need a complex implementation of IndexInfoProvider and this absrtaction is not enough for you then you can still go ahead and create your class that implements IndexInfoProvider.


Field Summary
protected static org.apache.log4j.Logger log
           
protected  TagManager tagManager
           
protected static SearchTypeProviderUtil util
           
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
BaseIndexInfoProvider()
           
 
Method Summary
 boolean getCanViewObject(JiveObject jiveObject)
          Returns true if the current user can view this JiveObject in Jive SBS or not.
 boolean getCanViewType()
          Returns true if the current user can view this type in Jive SBS or not.
 IndexInfo getContent(long id)
          Returns the indexable content for a given ID
 List<IndexInfo> getContent(long minID, long maxID, Date minDate, Date maxDate)
          Returns a list of IDs where minID <= ID <= maxID and create/publish date was after min date
 long getCount(Date max)
          Returns the count of objects that were created before the given max date.
protected abstract  String getCountSQL()
          Returns the SQL that calculates how many objects were modified after a given date.
 List<EntityDescriptor> getIDs(long minID, long maxID, Date minDate, Date maxDate)
          Returns a list of IDs where minID <= ID <= maxID and create/publish date was after min date
protected abstract  String getIDsSQL()
          Returns the SQL that returns the ID of the objects that were modified within a date rante and whose IDs are also within a given range.
protected abstract  Map<IndexField,String> getIndexFields(long id)
          Returns a map that describes how to index a given object so that it can be searchable.
protected abstract  String getLanguage(long id)
          Returns the language that determines the org.apache.lucene.analysis.Analyzer to use by Lucene.
 long getMaxID(Date max)
          Returns the highest id for a give object type that was created before the given max date.
protected abstract  String getMaxIDSQL()
          Returns the SQL that calculates the biggest ID of the objects modified after a given date.
 long getMinID(Date min)
          Returns the smallest id for a give object type that was created after the given min date.
protected abstract  String getMinIDSQL()
          Returns the SQL that calculates the smallest ID of the objects modified after a given date.
protected abstract  int getObjectTypeID()
          Returns the ID that identifies the object type.
 void setTagManager(TagManager tagManager)
           
 
Methods inherited from class org.springframework.jdbc.core.support.JdbcDaoSupport
checkDaoConfig, createJdbcTemplate, getConnection, getDataSource, getExceptionTranslator, getJdbcTemplate, initTemplateConfig, releaseConnection, setDataSource, setJdbcTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jivesoftware.community.search.IndexInfoProvider
isIndexable
 

Field Detail

log

protected static final org.apache.log4j.Logger log

util

protected static final SearchTypeProviderUtil util

tagManager

protected TagManager tagManager
Constructor Detail

BaseIndexInfoProvider

public BaseIndexInfoProvider()
Method Detail

getObjectTypeID

protected abstract int getObjectTypeID()
Returns the ID that identifies the object type. The value must be the same as com.jivesoftware.community.objecttype.JiveObjectType#getID().

Returns:
the ID that identifies the object type.

getCountSQL

protected abstract String getCountSQL()
Returns the SQL that calculates how many objects were modified after a given date. E.g.: SELECT count(*) FROM jiveMemo WHERE modificationDate <= ?

Returns:
the SQL that calculates how many objects were modified after a given date.

getMaxIDSQL

protected abstract String getMaxIDSQL()
Returns the SQL that calculates the biggest ID of the objects modified after a given date. E.g.: SELECT MAX(memoID) FROM jiveMemo WHERE modificationDate <= ?

Returns:
the SQL that calculates the biggest ID of the objects modified after a given date.

getMinIDSQL

protected abstract String getMinIDSQL()
Returns the SQL that calculates the smallest ID of the objects modified after a given date. E.g.: SELECT MIN(memoID) FROM jiveMemo WHERE modificationDate >= ?

Returns:
the SQL that calculates the smallest ID of the objects modified after a given date.

getIDsSQL

protected abstract String getIDsSQL()
Returns the SQL that returns the ID of the objects that were modified within a date rante and whose IDs are also within a given range. E.g.: SELECT memoID FROM jiveMemo WHERE " + "memoID >= ? " + "AND memoID <= ? " + "AND modificationDate >= ? " + "AND modificationDate <= ?

Returns:
the SQL that returns the ID of the objects that were modified within a date rante and whose IDs are also within a given range.

getIndexFields

protected abstract Map<IndexField,String> getIndexFields(long id)
Returns a map that describes how to index a given object so that it can be searchable. The returned map is composed by a key IndexField and the associated value based on the specified object.

Parameters:
id - the ID of the object that is being indexed.
Returns:
a map that describes how to index a given object so that it can be searchable.

getLanguage

protected abstract String getLanguage(long id)
Returns the language that determines the org.apache.lucene.analysis.Analyzer to use by Lucene. Valid languages are the ones defined by com.jivesoftware.community.LanguageConfiguration#getAllowedLanguages().

Parameters:
id - the ID of the object that is being indexed.
Returns:
the language that determines the Analyzer to use by Lucene or null if there is no defined language for the specified object.

setTagManager

public void setTagManager(TagManager tagManager)

getCount

public long getCount(Date max)
Description copied from interface: IndexInfoProvider
Returns the count of objects that were created before the given max date.

Specified by:
getCount in interface IndexInfoProvider
Parameters:
max - date before which the content was created
Returns:
id highest id

getMaxID

public long getMaxID(Date max)
Description copied from interface: IndexInfoProvider
Returns the highest id for a give object type that was created before the given max date.

Specified by:
getMaxID in interface IndexInfoProvider
Parameters:
max - date before which the content was created
Returns:
id highest id

getMinID

public long getMinID(Date min)
Description copied from interface: IndexInfoProvider
Returns the smallest id for a give object type that was created after the given min date.

Specified by:
getMinID in interface IndexInfoProvider
Parameters:
min - date after which the content was created
Returns:
id smallest id

getContent

public List<IndexInfo> getContent(long minID,
                                  long maxID,
                                  Date minDate,
                                  Date maxDate)
Description copied from interface: IndexInfoProvider
Returns a list of IDs where minID <= ID <= maxID and create/publish date was after min date

Specified by:
getContent in interface IndexInfoProvider
Parameters:
minID - lower bound on the ID
maxID - upper bound on the ID
minDate - date before which the document was published
maxDate - latest date for which the document was published
Returns:
list of ids

getIDs

public List<EntityDescriptor> getIDs(long minID,
                                     long maxID,
                                     Date minDate,
                                     Date maxDate)
Description copied from interface: IndexInfoProvider
Returns a list of IDs where minID <= ID <= maxID and create/publish date was after min date

Specified by:
getIDs in interface IndexInfoProvider
Parameters:
minID - lower bound on the ID
maxID - upper bound on the ID
minDate - date before which the document was published
maxDate - latest date for which the document was published
Returns:
list of ids

getContent

public IndexInfo getContent(long id)
Description copied from interface: IndexInfoProvider
Returns the indexable content for a given ID

Specified by:
getContent in interface IndexInfoProvider
Parameters:
id - content id
Returns:
indexable content

getCanViewType

public boolean getCanViewType()
Description copied from interface: IndexInfoProvider
Returns true if the current user can view this type in Jive SBS or not. This method is related to a global permission in Jive SBS, and not just a permission for a community.

Specified by:
getCanViewType in interface IndexInfoProvider
Returns:
true if the user can see the content type in Jive SBS.

getCanViewObject

public boolean getCanViewObject(JiveObject jiveObject)
Description copied from interface: IndexInfoProvider
Returns true if the current user can view this JiveObject in Jive SBS or not.

Specified by:
getCanViewObject in interface IndexInfoProvider
Parameters:
jiveObject - to determine visibility of
Returns:
true if the user can see the JiveObject.

Jive Product Page

Copyright © 1999-2007 Jive Software.