Class DefaultGroupProvider

  • All Implemented Interfaces:
    GroupProvider

    public class DefaultGroupProvider
    extends AbstractGroupProvider
    Database implementation of the GroupManager interface.
    Author:
    Matt Tucker
    • Constructor Detail

      • DefaultGroupProvider

        public DefaultGroupProvider()
    • Method Detail

      • createGroup

        public Group createGroup​(String name)
        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
        Overrides:
        createGroup in class AbstractGroupProvider
        Parameters:
        name - name of the group.
        Returns:
        the newly created group.
      • getGroupCount

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

        public Collection<String> getGroupNames()
        Description copied from interface: GroupProvider
        Returns the Collection of all group names in the system.
        Returns:
        the Collection of all groups.
      • getGroupNames

        public Collection<String> getGroupNames​(int startIndex,
                                                int numResults)
        Description copied from interface: GroupProvider
        Returns the Collection of all groups in the system.
        Parameters:
        startIndex - start index in results.
        numResults - number of results to return.
        Returns:
        the Collection of all group names given the startIndex and numResults.
      • getGroupNames

        public Collection<String> getGroupNames​(org.xmpp.packet.JID user)
        Description copied from interface: GroupProvider
        Returns the Collection of group names that an entity belongs to.
        Parameters:
        user - the JID of the entity.
        Returns:
        the Collection of group names that the user belongs to.
      • addMember

        public void addMember​(String groupName,
                              org.xmpp.packet.JID user,
                              boolean administrator)
        Description copied from interface: GroupProvider
        Adds an entity to a group (optional operation).
        Specified by:
        addMember in interface GroupProvider
        Overrides:
        addMember in class AbstractGroupProvider
        Parameters:
        groupName - the group to add the member to
        user - the JID of the entity to add
        administrator - True if the member is an administrator of the group
      • updateMember

        public void updateMember​(String groupName,
                                 org.xmpp.packet.JID user,
                                 boolean administrator)
        Description copied from interface: GroupProvider
        Updates the privileges of an entity in a group.
        Specified by:
        updateMember in interface GroupProvider
        Overrides:
        updateMember in class AbstractGroupProvider
        Parameters:
        groupName - the group where the change happened
        user - the JID of the entity with new privileges
        administrator - True if the member is an administrator of the group
      • deleteMember

        public void deleteMember​(String groupName,
                                 org.xmpp.packet.JID user)
        Description copied from interface: GroupProvider
        Deletes an entity from a group (optional operation).
        Specified by:
        deleteMember in interface GroupProvider
        Overrides:
        deleteMember in class AbstractGroupProvider
        Parameters:
        groupName - the group name.
        user - the JID of the entity to delete.
      • search

        public Collection<String> search​(String query,
                                         int startIndex,
                                         int numResults)
        Description copied from class: AbstractGroupProvider
        Returns a collection of group search results. This implementation returns an empty collection.
        Specified by:
        search in interface GroupProvider
        Overrides:
        search in class AbstractGroupProvider
        Parameters:
        query - the search string for group names.
        startIndex - start index in results.
        numResults - number of results to return.
        Returns:
        all groups that match the search.