Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.4.4 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.openfire.group
Class GroupManager

    java.lang.Object
      org.jivesoftware.openfire.group.GroupManager

    public class GroupManager

extends Object

Manages groups.

Author:
  Matt Tucker
See Also:
  `Group`

Method Summary
`Group` | `createGroup(String name)` Factory method for creating a new Group.
`void` | `deleteGroup(Group group)` Deletes a group from the system.
`void` | `deleteUser(User user)` Deletes a user from all the groups where he/she belongs.
`Group` | `getGroup(String name)` Returns a Group by name.
`int` | `getGroupCount()` Returns the total number of groups in the system.
`Collection<Group>` | `getGroups()` Returns an unmodifiable Collection of all groups in the system.
`Collection<Group>` | `getGroups(int startIndex, int numResults)` Returns all groups given a start index and desired number of results.
`Collection<Group>` | `getGroups(JID user)` Returns an iterator for all groups that the entity with the specified JID is a member of.
`Collection<Group>` | `getGroups(User user)` Returns an iterator for all groups that the User is a member of.
`static GroupManager` | `getInstance()` Returns a singleton instance of GroupManager.
`GroupProvider` | `getProvider()` Returns the configured group provider.
`Collection<Group>` | `getSharedGroups()` Returns an unmodifiable Collection of all shared groups in the system.
`boolean` | `isReadOnly()` Returns true if groups are read-only.
`boolean` | `isSearchSupported()` Returns true if searching for groups is supported.
`Collection<Group>` | `search(String query)` Returns the groups that match the search.
`Collection<Group>` | `search(String query, int startIndex, int numResults)` Returns the groups that match the search given a start index and desired number of results.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getInstance

    public static GroupManager getInstance()

  Returns a singleton instance of GroupManager.

  Returns:
    a GroupManager instance.

### createGroup

    public Group createGroup(String name)
                      throws GroupAlreadyExistsException

  Factory method for creating a new Group. A unique name is the only required field.

  Parameters:
    `name` - the new and unique name for the group.
  Returns:
    a new Group.
  Throws:
    `GroupAlreadyExistsException` - if the group name already exists in the system.

### getGroup

    public Group getGroup(String name)
                   throws GroupNotFoundException

  Returns a Group by name.

  Parameters:
    `name` - The name of the group to retrieve
  Returns:
    The group corresponding to that name
  Throws:
    `GroupNotFoundException` - if the group does not exist.

### deleteGroup

    public void deleteGroup(Group group)

  Deletes a group from the system.

  Parameters:
    `group` - the group to delete.

### deleteUser

    public void deleteUser(User user)

  Deletes a user from all the groups where he/she belongs. The most probable cause for this request is that the user has been deleted from the system. TODO: remove this method and use events instead.

  Parameters:
    `user` - the deleted user from the system.

### getGroupCount

    public int getGroupCount()

  Returns the total number of groups in the system.

  Returns:
    the total number of groups.

### getGroups

    public Collection<Group> getGroups()

  Returns an unmodifiable Collection of all groups in the system.

  Returns:
    an unmodifiable Collection of all groups.

### getSharedGroups

    public Collection<Group> getSharedGroups()

  Returns an unmodifiable Collection of all shared groups in the system.

  Returns:
    an unmodifiable Collection of all shared groups.

### getGroups

    public Collection<Group> getGroups(int startIndex,
                                       int numResults)

  Returns all groups given a start index and desired number of results. This is useful to support pagination in a GUI where you may only want to display a certain number of results per page. It is possible that the number of results returned will be less than that specified by numResults if numResults is greater than the number of records left in the system to display.

  Parameters:
    `startIndex` - start index in results.
    `numResults` - number of results to return.
  Returns:
    an Iterator for all groups in the specified range.

### getGroups

    public Collection<Group> getGroups(User user)

  Returns an iterator for all groups that the User is a member of.

  Parameters:
    `user` - the user.
  Returns:
    all groups the user belongs to.

### getGroups

    public Collection<Group> getGroups(JID user)

  Returns an iterator for all groups that the entity with the specified JID is a member of.

  Parameters:
    `user` - the JID of the entity to get a list of groups for.
  Returns:
    all groups that an entity belongs to.

### isReadOnly

    public boolean isReadOnly()

  Returns true if groups are read-only.

  Returns:
    true if groups are read-only.

### isSearchSupported

    public boolean isSearchSupported()

  Returns true if searching for groups is supported.

  Returns:
    true if searching for groups are supported.

### search

    public Collection<Group> search(String query)

  Returns the groups that match the search. The search is over group names and implicitly uses wildcard matching (although the exact search semantics are left up to each provider implementation). For example, a search for "HR" should match the groups "HR", "HR Department", and "The HR People".

  Before searching or showing a search UI, use the `isSearchSupported()` method to ensure that searching is supported.

  Parameters:
    `query` - the search string for group names.
  Returns:
    all groups that match the search.

### search

    public Collection<Group> search(String query,
                                    int startIndex,
                                    int numResults)

  Returns the groups that match the search given a start index and desired number of results. The search is over group names and implicitly uses wildcard matching (although the exact search semantics are left up to each provider implementation). For example, a search for "HR" should match the groups "HR", "HR Department", and "The HR People".

  Before searching or showing a search UI, use the `isSearchSupported()` method to ensure that searching is supported.

  Parameters:
    `query` - the search string for group names.
  Returns:
    all groups that match the search.

### getProvider

    public GroupProvider getProvider()

  Returns the configured group provider. Note that this method has special access privileges since only a few certain classes need to access the provider directly.

  Returns:
    the group provider.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.4.4 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2007 Jive Software.