|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.forum.ResultFilter
public class ResultFilter
Filters and sorts lists of threads and messages. This allows for a very rich set of possible queries that can be run on forum data. Some examples are: "Show all messages posted in the forum during the last year by a certain user" or "Show all threads in the forum, sorted by their modification date".
The class also supports pagination of results with the setStartIndex(int) and setNumResults(int) methods. If the start index is not set, it will begin at index 0 (the start of results). If the number of results is not set, it will be unbounded and return as many results as available.
By default, result filters will obey the moderation rules as they are set for each forum. You can override this behavior by setting a moderation range.
Factory methods to create common queries are provided for convenience.
Forum.getThreads(ResultFilter)
,
Forum.getMessages(ResultFilter)
,
ForumThread.getMessages(ResultFilter)
Field Summary | |
---|---|
static int |
AND_MODE
'AND' mode. |
static int |
ASCENDING
Ascending sort (ie 3, 4, 5...). |
static int |
CONTAINS_MATCH
Contains match. |
static int |
DESCENDING
Descending sort (ie 3, 2, 1...). |
static int |
EXACT_MATCH
Exact match. |
static int |
NULL_INT
An integer value that represents NULL. |
static int |
OR_MODE
'OR' mode; |
Constructor Summary | |
---|---|
ResultFilter()
|
Method Summary | |
---|---|
void |
addProperty(java.lang.String name,
java.lang.String value)
Adds a property to the list of properties that will be filtered on. |
void |
addResolutionState(com.jivesoftware.forum.Question.State resolutionState)
Adds a resolution state to the set of states that will be included in filtered results. |
void |
addTag(ContentTag tag)
Adds a ContentTag to the list of tags to filter on. |
void |
clearResolutionStates()
Removes all resolution states from the set of states that will be included in filtered results. |
java.lang.Object |
clone()
Clones a ResultFilter |
static ResultFilter |
createDefaultContentFilter()
Creates a default ResultFilter: no filtering with results sorted on the modification date. |
static ResultFilter |
createDefaultForumFilter()
Creates a default forum ResultFilter: no filtering with results sorted on the category index value. |
static ResultFilter |
createDefaultMessageFilter()
Creates a default message ResultFilter: no filtering with results sorted on the message creation date in ascending order. |
static ResultFilter |
createDefaultThreadFilter()
Creates a default thread ResultFilter: no filtering with results sorted on the thread modification date. |
static ResultFilter |
createDefaultUserMessagesFilter()
Creates a default user messages ResultFilter: no filtering with results sorted on the message creation date descending (newest messages appear first). |
boolean |
equals(java.lang.Object o)
|
java.util.Date |
getCreationDateRangeMax()
Returns a date that represents the upper boundry for messages or threads to be selected by the result filter. |
java.util.Date |
getCreationDateRangeMin()
Returns the creation date that represents the lower boundary for messages or threads to be filtered on. |
int |
getModerationRangeMax()
Returns the moderation value that represents the upper bound for messages or threads to be selected by the result filter. |
int |
getModerationRangeMin()
Returns the moderation value that represents the lower boundry for messages or threads to be selected by the result filter. |
java.util.Date |
getModificationDateRangeMax()
Returns a date that represents the upper boundry for messages or threads to be selected by the result filter. |
java.util.Date |
getModificationDateRangeMin()
Returns a date that represents the lower boundary for messages or threads to be selected by the result filter. |
int |
getNumResults()
Returns the max number of results that should be returned. |
int |
getPropertyCount()
Returns the number of properties that results will be filtered on. |
int |
getPropertyMatchType(int index)
Returns the value of the property at the specified index in the list of properties. |
int |
getPropertyMode()
Returns the mode that will be used to select results if multiple properties have been specified. |
java.lang.String |
getPropertyName(int index)
Returns the name of the property at the specified index in the list of properties to be filtered on. |
java.lang.String |
getPropertyValue(int index)
Returns the value of the property at the specified index in the list of properties to be filtered on. |
java.lang.String |
getPropertyValueString(int index)
Returns the value of the property at the specified index in the list of properties to be filtered on. |
int |
getResolutionDateRangeMax()
Returns a date that represents the upper boundry for the resolution date of questions to be selected by the result filter. |
int |
getResolutionDateRangeMin()
Returns a date that represents the lower boundary for the resolution date of questions to be selected by the result filter. |
java.util.Set |
getResolutionStates()
Returns the set resolution states that will be included in filtered results. |
int |
getSortField()
Returns the currently selected sort field. |
int |
getSortOrder()
Returns the sort order, which will be ResultFilter.ASCENDING for ascending sorting, or ResultFilter.DESCENDING for descending sorting. |
java.lang.String |
getSortPropertyName()
Returns the name of the extended property that will be sorted on. |
int |
getStartIndex()
Returns the index of the first result to return. |
java.util.Collection |
getTags()
Returns the the ContentTag s to filter on. |
long |
getUserID()
Returns the userID that results will be filtered on. |
int |
hashCode()
|
boolean |
isAllTagsRequired()
Returns true if the content must be tagged with every tag contained in getTags(). |
boolean |
isRecursive()
If true, the result filter will return content from all sub-communities of specified community, including content from sub-communities of sub-communities, etc. |
void |
removeResolutionState(com.jivesoftware.forum.Question.State resolutionState)
Removes a resolution state from the set of states that will be included in filtered results. |
static java.util.Date |
roundDate(java.util.Date date,
int seconds)
|
static long |
roundDate(long date,
int seconds)
|
void |
setAllTagsRequired(boolean allTagsRequired)
Sets whether or not the content must be tagged with every tag contained in getTags(). |
void |
setCreationDateRangeMax(java.util.Date creationDateRangeMax)
Sets a date that represents the upper boundry for messages or threads to be selected by the result filter. |
void |
setCreationDateRangeMin(java.util.Date creationDateRangeMin)
Sets the date that represents the lower boundary for messages or threads to be selected by the result filter. |
void |
setModerationRangeMax(int moderationRangeMax)
Sets the upper bound for the moderation value that will pass the result filter. |
void |
setModerationRangeMin(int moderationRangeMin)
Sets the moderation value that represents the lower bound for messages or threads to be selected by the result filter. |
void |
setModificationDateRangeMax(java.util.Date modificationDateRangeMax)
Sets a date that represents the upper boundry for messages or threads to be selected by the result filter. |
void |
setModificationDateRangeMin(java.util.Date modificationDateRangeMin)
Sets a date that represents the lower boundary for messages or threads to be selected by the result filter. |
void |
setNumResults(int numResults)
Sets the limit on the number of results to be returned. |
void |
setPropertyMode(int propertyMode)
Sets the mode that will be used to select results if multiple properties have been specified. |
void |
setRecursive(boolean recursive)
Sets the recursive value of queries. |
void |
setResolutionDateRangeMax(int resolutionnDateRangeMax)
Sets a date that represents the upper boundry for the resolution date of questions to be selected by the result filter. |
void |
setResolutionDateRangeMin(int resolutionDateRangeMin)
Sets a date that represents the lower boundary for messages or threads to be selected by the result filter. |
void |
setSortField(int sortField)
Sets the sort field to use. |
void |
setSortOrder(int sortOrder)
Sets the sort type. |
void |
setSortPropertyName(java.lang.String sortPropertyName)
Sets the property name to sort on. |
void |
setStartIndex(int startIndex)
Sets the index of the first result to return. |
void |
setTags(java.util.Collection tags)
Sets the ContentTag s to filter on. |
void |
setUserID(long userID)
Sets the userID that results will be filtered on. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DESCENDING
public static final int ASCENDING
public static final int EXACT_MATCH
public static final int CONTAINS_MATCH
public static final int AND_MODE
public static final int OR_MODE
public static final int NULL_INT
Constructor Detail |
---|
public ResultFilter()
Method Detail |
---|
public static ResultFilter createDefaultForumFilter()
public static ResultFilter createDefaultThreadFilter()
public static ResultFilter createDefaultMessageFilter()
public static ResultFilter createDefaultUserMessagesFilter()
public long getUserID()
public void setUserID(long userID)
userID
- the user ID to filter on.public void addProperty(java.lang.String name, java.lang.String value)
name
- the name of the property to filter on.value
- the value of the property that results must match.public int getPropertyMode()
AND_MODE
which specifies that all properties
must match for the object to be selected. OR_MODE
is useful if you want objects
to be returned if any of the properties match.
public void setPropertyMode(int propertyMode)
AND_MODE
(the default) specifies that all properties
must match for the object to be selected. OR_MODE
is useful if you want objects
to be returned if any of the properties match.
propertyMode
- the mode that will be used to select results if multiple properties have been
specified.public int getPropertyCount()
public java.lang.String getPropertyName(int index)
public java.lang.String getPropertyValue(int index)
public java.lang.String getPropertyValueString(int index)
If multiple properties are added in OR_MODE
with the same name and match type, the first value in
the list of values at that index will be returned.
index
- the index of the property in the property list
public int getPropertyMatchType(int index)
EXACT_MATCH
will be returned.
index
- the index of the property in the properties list
public void addTag(ContentTag tag)
ContentTag
to the list of tags to filter on. If any tags have been added to the list, only
results with at least one of the tags will be returned.
tag
- the ContentTag
to filter on.public void setTags(java.util.Collection tags)
ContentTag
s to filter on. Only results with at least one of the tags will be returned.
tags
- the ContentTag
s to filter on.public java.util.Collection getTags()
ContentTag
s to filter on.
ContentTag
s to filter on.public boolean isAllTagsRequired()
public void setAllTagsRequired(boolean allTagsRequired)
allTagsRequired
- true if the content must be tagged with every tag contained in getTags().public java.util.Date getCreationDateRangeMin()
public void setCreationDateRangeMin(java.util.Date creationDateRangeMin)
Setting a date range for a ResultFilter is a potential performance bottleneck. For example, if the argument for the date range is "new Date()" then the corresponding database query will map to an accuracy of a particular millesecond in time. This means that the results can't be cached. A better solution is to round dates to the nearest minute, hour, etc (whatever accuracy you need).
creationDateRangeMin
- Date representing the filter lowest value of
the creation date to be selected.public java.util.Date getCreationDateRangeMax()
public void setCreationDateRangeMax(java.util.Date creationDateRangeMax)
creationDateRangeMax
- Date representing the filter lowest value of
the creation date range.public java.util.Date getModificationDateRangeMin()
public void setModificationDateRangeMin(java.util.Date modificationDateRangeMin)
modificationDateRangeMin
- Date representing the filter lowest value of
the modified date to be selected.public java.util.Date getModificationDateRangeMax()
public void setModificationDateRangeMax(java.util.Date modificationDateRangeMax)
modificationDateRangeMax
- Date representing the filter lowest value of
the modified date range.public int getSortField()
setSortPropertyName(String)
.Valid sort fields for object types are as follows:
public void setSortField(int sortField)
setSortPropertyName(String)
.Valid sort fields for object types are as follows:
sortField
- the field that will be used for sorting.public java.lang.String getSortPropertyName()
public void setSortPropertyName(java.lang.String sortPropertyName)
sortPropertyName
- the name of the extended property to sort on.public int getSortOrder()
public void setSortOrder(int sortOrder)
sortOrder
- the order that results will be sorted in.public int getNumResults()
setStartIndex(int)
public void setNumResults(int numResults)
numResults
- the number of results to return.public int getStartIndex()
public void setStartIndex(int startIndex)
startIndex
- the index of the first result to return.public int getModerationRangeMin()
public void setModerationRangeMin(int moderationRangeMin)
moderationRangeMin
- int representing the lowest value of
the moderation value range to be selected by the result filter.public int getModerationRangeMax()
public void setModerationRangeMax(int moderationRangeMax)
moderationRangeMax
- the max value of the moderation value range.public java.util.Set getResolutionStates()
public void addResolutionState(com.jivesoftware.forum.Question.State resolutionState)
resolutionState
- resolution state.public void removeResolutionState(com.jivesoftware.forum.Question.State resolutionState)
resolutionState
- resolution state.public void clearResolutionStates()
public int getResolutionDateRangeMin()
public void setResolutionDateRangeMin(int resolutionDateRangeMin)
resolutionDateRangeMin
- the lowest value of the resolution date to be
selected by the filter.public int getResolutionDateRangeMax()
public void setResolutionDateRangeMax(int resolutionnDateRangeMax)
resolutionnDateRangeMax
- the highest value of the resolution date to be
selected by the filter.public static java.util.Date roundDate(java.util.Date date, int seconds)
DateUtils.roundDate(Date, int)
public static long roundDate(long date, int seconds)
DateUtils.roundDate(long, int)
public java.lang.Object clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean isRecursive()
The default value of this is false which means that queries will be done in a non-recursive manner.
public void setRecursive(boolean recursive)
The default value of this is false which means only one community (and not its children) will be considered in results.
recursive
- true if this result filter should return recursive content, false otherwise.public static ResultFilter createDefaultContentFilter()
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |