Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.nntp
Class NewsGroupFilter

java.lang.Object
  extended by com.jivesoftware.forum.nntp.NewsGroupFilter

public class NewsGroupFilter
extends java.lang.Object

Filters news group names according to those that match the patterns passed to the filter. A filter list looks like:

rec.sports.*,comp.*,!comp.linux.*,alt.sports.soccer

The astrisk (*) is used as a wildcard and is expanded to match any pattern (can be used with a name such as foo.*.wombat to match foo.test.wombat). A leading exclamation point (!) is used to negate the match (all group names matching that name do not match). Matches are applied in the order listed in the case of matches that change membership if applied in separate order. The filter also accepts distribution lists which specify the prefix a group name must contain in order to match:

foo.groups,boo

Note that distribution lists are equivalent to match names with a trailing .* added to the pattern. In the example above, it would have been the same as adding the filter list foo.groups.*,boo.* to the end of the list.


Field Summary
static NewsGroupFilter MATCH_ALL
          Static filter that matches all groups.
 
Constructor Summary
NewsGroupFilter()
           
 
Method Summary
 void addDistributionList(java.lang.String list)
          Add a ditribution list using standard RFC977 group distribution format (matches any dot prefix of a group name).
 void addFilterList(java.lang.String list)
          Add a new filter list using standard RFC977 group filter format (wildcards indicated with stars).
 long getGroupID()
          Obtains the group ID this filter matches if isSingleGroupFilter() returns true.
 int getNameFilterCount()
          Obtains the number of name matching patterns installed in this filter.
static NewsGroupFilter getSingleGroupByIDFilter(long id)
          Generate a filter for a single group ID.
 NNTPDate getStartDate()
          Returns the date all groups creation date must follow (NEWGROUPS command) or null if this is not a new group filter.
 boolean isSingleGroupFilter()
          Obtains a flag indicating if the filter is for a single group.
 boolean matches(java.lang.String name)
          Tests a group name to see if it matches this filter.
 void setStartDate(NNTPDate start)
          Sets the start date for NEWGROUPS matching.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MATCH_ALL

public static final NewsGroupFilter MATCH_ALL
Static filter that matches all groups. Used with place RFC977 LIST.

Constructor Detail

NewsGroupFilter

public NewsGroupFilter()
Method Detail

getSingleGroupByIDFilter

public static NewsGroupFilter getSingleGroupByIDFilter(long id)
Generate a filter for a single group ID. Filters created by this method isolate a generic article searh to a single newsgroup.

Parameters:
id - the ID of the group to locate.
Returns:
the filter that will only return the group.

isSingleGroupFilter

public boolean isSingleGroupFilter()
Obtains a flag indicating if the filter is for a single group.

Returns:
true if the filter only matches one group identified by groupID.

getGroupID

public long getGroupID()
Obtains the group ID this filter matches if isSingleGroupFilter() returns true.

Returns:
the ID of the group this filter matches.

setStartDate

public void setStartDate(NNTPDate start)
Sets the start date for NEWGROUPS matching. Set the value to null to indicate this is not a NEWGROUPS match.

Parameters:
start - the start date that the creation date of matching groups must follow or null if no date matching is required.

getStartDate

public NNTPDate getStartDate()
Returns the date all groups creation date must follow (NEWGROUPS command) or null if this is not a new group filter.

Returns:
the start date that the creation date of matching groups must follow or null if no date matching is required.

getNameFilterCount

public int getNameFilterCount()
Obtains the number of name matching patterns installed in this filter. The primary use is to determine if there is 0, 1 or more filters.

Returns:
the number of name matching patterns installed in this filter.

addFilterList

public void addFilterList(java.lang.String list)
Add a new filter list using standard RFC977 group filter format (wildcards indicated with stars).

Parameters:
list - the list of groups to filter by.

addDistributionList

public void addDistributionList(java.lang.String list)
Add a ditribution list using standard RFC977 group distribution format (matches any dot prefix of a group name).

Parameters:
list - the distribution list to filter by.

matches

public boolean matches(java.lang.String name)
Tests a group name to see if it matches this filter. Notice this is a name only test, if the filter matches by group ID or start date (NEWGROUPS), the behavior of this method is undefined.

Parameters:
name - the name of the group to check.
Returns:
true if the group name matches the filter criteria.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.