Jive Messenger 2.2.2 Javadoc

org.jivesoftware.messenger.group
Class DefaultGroupProvider

java.lang.Object
  extended by org.jivesoftware.messenger.group.DefaultGroupProvider
All Implemented Interfaces:
GroupProvider

public class DefaultGroupProvider
extends Object
implements GroupProvider

Database implementation of the GroupManager interface.

Author:
Matt Tucker

Constructor Summary
DefaultGroupProvider()
           
 
Method Summary
 void addMember(String groupName, String username, boolean administrator)
          Adds a user to a group (optional operation).
 Group createGroup(String name)
          Creates a group with the given name (optional operation).
 void deleteGroup(String groupName)
          Deletes the group (optional operation).
 void deleteMember(String groupName, String username)
          Deletes a user from a group (optional operation).
 Group getGroup(String name)
          Returns a group based on it's name.
 int getGroupCount()
          Returns the number of groups in the system.
 Collection<Group> getGroups()
          Returns the Collection of all groups in the system.
 Collection<Group> getGroups(int startIndex, int numResults)
          Returns the Collection of all groups in the system.
 Collection<Group> getGroups(User user)
          Returns the Collection of Groups that a user belongs to.
 boolean isReadOnly()
          Returns true if this GroupProvider is read-only.
 void setDescription(String name, String description)
          Updates the group's description.
 void setName(String oldName, String newName)
          Sets the name of a group to a new name.
 void updateMember(String groupName, String username, boolean administrator)
          Updates the privileges of a user in a group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGroupProvider

public DefaultGroupProvider()
Method Detail

createGroup

public Group createGroup(String name)
                  throws GroupAlreadyExistsException
Description copied from interface: GroupProvider
Creates a group with the given name (optional operation).

The provider is responsible for setting the creation date and modification date to the current date/time.

Specified by:
createGroup in interface GroupProvider
Parameters:
name - name of the group.
Returns:
the newly created group.
Throws:
GroupAlreadyExistsException - if a group with the same name already exists.

getGroup

public Group getGroup(String name)
               throws GroupNotFoundException
Description copied from interface: GroupProvider
Returns a group based on it's name.

Specified by:
getGroup in interface GroupProvider
Parameters:
name - the name of the group.
Returns:
the group with the given name.
Throws:
GroupNotFoundException - If no group with that ID could be found

setDescription

public void setDescription(String name,
                           String description)
                    throws GroupNotFoundException
Description copied from interface: GroupProvider
Updates the group's description.

Specified by:
setDescription in interface GroupProvider
Parameters:
name - the group name.
description - the group description.
Throws:
GroupNotFoundException - if no existing group could be found to update.

setName

public void setName(String oldName,
                    String newName)
             throws UnsupportedOperationException,
                    GroupAlreadyExistsException
Description copied from interface: GroupProvider
Sets the name of a group to a new name.

Specified by:
setName in interface GroupProvider
Parameters:
oldName - the current name of the group.
newName - the desired new name of the group.
Throws:
UnsupportedOperationException - if the provider does not support the operation.
GroupAlreadyExistsException - if a group with the same name already exists.

deleteGroup

public void deleteGroup(String groupName)
Description copied from interface: GroupProvider
Deletes the group (optional operation).

Specified by:
deleteGroup in interface GroupProvider
Parameters:
groupName - the name of the group to delete.

getGroupCount

public int getGroupCount()
Description copied from interface: GroupProvider
Returns the number of groups in the system.

Specified by:
getGroupCount in interface GroupProvider
Returns:
the number of groups in the system.

getGroups

public Collection<Group> getGroups()
Description copied from interface: GroupProvider
Returns the Collection of all groups in the system.

Specified by:
getGroups in interface GroupProvider
Returns:
the Collection of all groups.

getGroups

public Collection<Group> getGroups(int startIndex,
                                   int numResults)
Description copied from interface: GroupProvider
Returns the Collection of all groups in the system.

Specified by:
getGroups in interface GroupProvider
Parameters:
startIndex - start index in results.
numResults - number of results to return.
Returns:
the Collection of all groups given the startIndex and numResults.

getGroups

public Collection<Group> getGroups(User user)
Description copied from interface: GroupProvider
Returns the Collection of Groups that a user belongs to.

Specified by:
getGroups in interface GroupProvider
Parameters:
user - the user.
Returns:
the Collection of groups that the user belongs to.

addMember

public void addMember(String groupName,
                      String username,
                      boolean administrator)
Description copied from interface: GroupProvider
Adds a user to a group (optional operation).

Specified by:
addMember in interface GroupProvider
Parameters:
groupName - the group to add the member to
username - the username to add
administrator - True if the member is an administrator of the group

updateMember

public void updateMember(String groupName,
                         String username,
                         boolean administrator)
Description copied from interface: GroupProvider
Updates the privileges of a user in a group.

Specified by:
updateMember in interface GroupProvider
Parameters:
groupName - the group where the change happened
username - the username to of the user with new privileges
administrator - True if the member is an administrator of the group

deleteMember

public void deleteMember(String groupName,
                         String username)
Description copied from interface: GroupProvider
Deletes a user from a group (optional operation).

Specified by:
deleteMember in interface GroupProvider
Parameters:
groupName - the group name.
username - the username.

isReadOnly

public boolean isReadOnly()
Description copied from interface: GroupProvider
Returns true if this GroupProvider is read-only. When read-only, groups can not be created, deleted, or modified.

Specified by:
isReadOnly in interface GroupProvider
Returns:
true if the user provider is read-only.

Jive Messenger 2.2.2 Javadoc

Copyright © 1999-2004 Jive Software.