当前位置: 首页>>代码示例>>Java>>正文


Java Group.getMembers方法代码示例

本文整理汇总了Java中org.jivesoftware.openfire.group.Group.getMembers方法的典型用法代码示例。如果您正苦于以下问题:Java Group.getMembers方法的具体用法?Java Group.getMembers怎么用?Java Group.getMembers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.openfire.group.Group的用法示例。


在下文中一共展示了Group.getMembers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: memberAdded

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
@Override
public void memberAdded(Group group, Map params) {
    JID addedUser = new JID((String) params.get("member"));
    // Do nothing if the user was an admin that became a member
    if (group.getAdmins().contains(addedUser)) {
        return;
    }
    if (!isSharedGroup(group)) {
        for (Group visibleGroup : getVisibleGroups(group)) {
            // Get the list of affected users
            Collection<JID> users = new HashSet<>(visibleGroup.getMembers());
            users.addAll(visibleGroup.getAdmins());
            groupUserAdded(visibleGroup, users, addedUser);
        }
    }
    else {
        groupUserAdded(group, addedUser);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:20,代码来源:RosterManager.java

示例2: memberRemoved

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
@Override
public void memberRemoved(Group group, Map params) {
    String member = (String) params.get("member");
    if (member == null) {
        return;
    }
    JID deletedUser = new JID(member);
    // Do nothing if the user is still an admin
    if (group.getAdmins().contains(deletedUser)) {
        return;
    }
    if (!isSharedGroup(group)) {
        for (Group visibleGroup : getVisibleGroups(group)) {
            // Get the list of affected users
            Collection<JID> users = new HashSet<>(visibleGroup.getMembers());
            users.addAll(visibleGroup.getAdmins());
            groupUserDeleted(visibleGroup, users, deletedUser);
        }
    }
    else {
        groupUserDeleted(group, deletedUser);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:24,代码来源:RosterManager.java

示例3: adminRemoved

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
@Override
public void adminRemoved(Group group, Map params) {
    JID deletedUser = new JID((String) params.get("admin"));
    // Do nothing if the user is still a member
    if (group.getMembers().contains(deletedUser)) {
        return;
    }
    // Do nothing if the group is not being shown in group members' rosters
    if (!isSharedGroup(group)) {
        for (Group visibleGroup : getVisibleGroups(group)) {
            // Get the list of affected users
            Collection<JID> users = new HashSet<>(visibleGroup.getMembers());
            users.addAll(visibleGroup.getAdmins());
            groupUserDeleted(visibleGroup, users, deletedUser);
        }
    }
    else {
        groupUserDeleted(group, deletedUser);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:21,代码来源:RosterManager.java

示例4: getAgents

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
/**
 * Returns all agents belonging to a Shared Group.
 *
 * @param group the shared group.
 * @return the collection of agents.
 */
public Collection<Agent> getAgents(Group group) {
    final Set<Agent> set = new HashSet<Agent>();
    for (JID jid : group.getMembers()) {
        Agent agent;
        try {
            agent = getAgent(jid);
        }
        catch (AgentNotFoundException e) {
            agent = createAgent(jid);
        }
        set.add(agent);
    }

    return set;
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:22,代码来源:AgentManager.java

示例5: memberRemoved

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
public void memberRemoved(Group group, Map params) {
    String member = (String) params.get("member");
    if (member == null) {
        return;
    }
    JID deletedUser = new JID(member);
    // Do nothing if the user is still an admin
    if (group.getAdmins().contains(deletedUser)) {
        return;
    }
    if (!isSharedGroup(group)) {
        for (Group visibleGroup : getVisibleGroups(group)) {
            // Get the list of affected users
            Collection<JID> users = new HashSet<JID>(visibleGroup.getMembers());
            users.addAll(visibleGroup.getAdmins());
            groupUserDeleted(visibleGroup, users, deletedUser);
        }
    }
    else {
        groupUserDeleted(group, deletedUser);
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:23,代码来源:RosterManager.java

示例6: memberAdded

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
public void memberAdded(Group group, Map params) {
    JID addedUser = new JID((String) params.get("member"));
    // Do nothing if the user was an admin that became a member
    if (group.getAdmins().contains(addedUser)) {
        return;
    }
    if (!isSharedGroup(group)) {
        for (Group visibleGroup : getVisibleGroups(group)) {
            // Get the list of affected users
            Collection<JID> users = new HashSet<JID>(visibleGroup.getMembers());
            users.addAll(visibleGroup.getAdmins());
            groupUserAdded(visibleGroup, users, addedUser);
        }
    }
    else {
        groupUserAdded(group, addedUser);
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:19,代码来源:RosterManager.java

示例7: groupDeleting

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
@Override
public void groupDeleting(Group group, Map params) {
    // Get group members
    Collection<JID> users = new HashSet<>(group.getMembers());
    users.addAll(group.getAdmins());
    // Get users whose roster will be updated
    Collection<JID> affectedUsers = getAffectedUsers(group);
    // Iterate on group members and update rosters of affected users
    for (JID deletedUser : users) {
        groupUserDeleted(group, affectedUsers, deletedUser);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:13,代码来源:RosterManager.java

示例8: userCreated

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
/**
 * A new user has been created so members of public shared groups need to have
 * their rosters updated. Members of public shared groups need to have a roster
 * item with subscription FROM for the new user since the new user can see them.
 *
 * @param newUser the newly created user.
 * @param params event parameters.
 */
@Override
public void userCreated(User newUser, Map<String,Object> params) {
    JID newUserJID = server.createJID(newUser.getUsername(), null);
    // Shared public groups that are public should have a presence subscription
    // of type FROM for the new user
    for (Group group : getPublicSharedGroups()) {
        // Get group members of public group
        Collection<JID> users = new HashSet<>(group.getMembers());
        users.addAll(group.getAdmins());
        // Update the roster of each group member to include a subscription of type FROM
        for (JID userToUpdate : users) {
            // Get the roster to update
            Roster roster = null;
            if (server.isLocal(userToUpdate)) {
                // Get the roster. If the user does not exist then continue with the next user
                try {
                    roster = getRoster(userToUpdate.getNode());
                }
                catch (UserNotFoundException e) {
                    continue;
                }
            }
            // Update roster
            roster.addSharedUser(group, newUserJID);

            if (!server.isLocal(userToUpdate)) {
                // Susbcribe to the presence of the remote user. This is only necessary for
                // remote users and may only work with remote users that **automatically**
                // accept presence subscription requests
                sendSubscribeRequest(newUserJID, userToUpdate, true);
            }
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:43,代码来源:RosterManager.java

示例9: userDeleting

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
@Override
public void userDeleting(User user, Map<String,Object> params) {
    // Shared public groups that have a presence subscription of type FROM
    // for the deleted user should no longer have a reference to the deleted user
    JID userJID = server.createJID(user.getUsername(), null);
    // Shared public groups that are public should have a presence subscription
    // of type FROM for the new user
    for (Group group : getPublicSharedGroups()) {
        // Get group members of public group
        Collection<JID> users = new HashSet<>(group.getMembers());
        users.addAll(group.getAdmins());
        // Update the roster of each group member to include a subscription of type FROM
        for (JID userToUpdate : users) {
            // Get the roster to update
            Roster roster = null;
            if (server.isLocal(userToUpdate)) {
                // Get the roster. If the user does not exist then continue with the next user
                try {
                    roster = getRoster(userToUpdate.getNode());
                }
                catch (UserNotFoundException e) {
                    continue;
                }
            }
            // Update roster
            roster.deleteSharedUser(group, userJID);

            if (!server.isLocal(userToUpdate)) {
                // Unsusbcribe from the presence of the remote user. This is only necessary for
                // remote users and may only work with remote users that **automatically**
                // accept presence subscription requests
                sendSubscribeRequest(userJID, userToUpdate, false);
            }
        }
    }

    deleteRoster(userJID);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:39,代码来源:RosterManager.java

示例10: getSharedUsersForRoster

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
Collection<JID> getSharedUsersForRoster(Group group, Roster roster) {
    String showInRoster = group.getProperties().get("sharedRoster.showInRoster");
    String groupNames = group.getProperties().get("sharedRoster.groupList");

    // Answer an empty collection if the group is not being shown in users' rosters
    if (!"onlyGroup".equals(showInRoster) && !"everybody".equals(showInRoster)) {
        return new ArrayList<JID>();
    }

    // Add the users of the group
    Collection<JID> users = new HashSet<JID>(group.getMembers());
    users.addAll(group.getAdmins());

    // If the user of the roster belongs to the shared group then we should return
    // users that need to be in the roster with subscription "from"
    if (group.isUser(roster.getUsername())) {
        // Check if anyone can see this shared group
        if ("everybody".equals(showInRoster)) {
            // Add all users in the system
            for (String username : UserManager.getInstance().getUsernames()) {
                users.add(server.createJID(username, null, true));
            }
        }
        else {
            // Add the users that may see the group
            Collection<Group> groupList = parseGroups(groupNames);
            for (Group groupInList : groupList) {
                users.addAll(groupInList.getMembers());
                users.addAll(groupInList.getAdmins());
            }
        }
    }
    return users;
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:35,代码来源:RosterManager.java

示例11: getSharedUsersForRoster

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
Collection<JID> getSharedUsersForRoster(Group group, Roster roster) {
    String showInRoster = group.getProperties().get("sharedRoster.showInRoster");
    String groupNames = group.getProperties().get("sharedRoster.groupList");

    // Answer an empty collection if the group is not being shown in users' rosters
    if (!"onlyGroup".equals(showInRoster) && !"everybody".equals(showInRoster)) {
        return new ArrayList<>();
    }

    // Add the users of the group
    Collection<JID> users = new HashSet<>(group.getMembers());
    users.addAll(group.getAdmins());

    // If the user of the roster belongs to the shared group then we should return
    // users that need to be in the roster with subscription "from"
    if (group.isUser(roster.getUsername())) {
        // Check if anyone can see this shared group
        if ("everybody".equals(showInRoster)) {
            // Add all users in the system
            for (String username : UserManager.getInstance().getUsernames()) {
                users.add(server.createJID(username, null, true));
            }
        }
        else {
            // Add the users that may see the group
            Collection<Group> groupList = parseGroups(groupNames);
            for (Group groupInList : groupList) {
                users.addAll(groupInList.getMembers());
                users.addAll(groupInList.getAdmins());
            }
        }
    }
    return users;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:35,代码来源:RosterManager.java

示例12: getAffectedUsers

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
/**
 * This method is similar to {@link #getAffectedUsers(Group)} except that it receives
 * some group properties. The group properties are passed as parameters since the called of this
 * method may want to obtain the related users of the group based in some properties values.
 *
 * This is useful when the group is being edited and some properties has changed and we need to
 * obtain the related users of the group based on the previous group state.
 */
private Collection<JID> getAffectedUsers(Group group, String showInRoster, String groupNames) {
    // Answer an empty collection if the group is not being shown in users' rosters
    if (!"onlyGroup".equals(showInRoster) && !"everybody".equals(showInRoster)) {
        return new ArrayList<JID>();
    }
    // Add the users of the group
    Collection<JID> users = new HashSet<JID>(group.getMembers());
    users.addAll(group.getAdmins());
    // Check if anyone can see this shared group
    if ("everybody".equals(showInRoster)) {
        // Add all users in the system
        for (String username : UserManager.getInstance().getUsernames()) {
            users.add(server.createJID(username, null, true));
        }
        // Add all logged users. We don't need to add all users in the system since only the
        // logged ones will be affected.
        //users.addAll(SessionManager.getInstance().getSessionUsers());
    }
    else {
        // Add the users that may see the group
        Collection<Group> groupList = parseGroups(groupNames);
        for (Group groupInList : groupList) {
            users.addAll(groupInList.getMembers());
            users.addAll(groupInList.getAdmins());
        }
    }
    return users;
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:37,代码来源:RosterManager.java

示例13: userCreated

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
/**
 * A new user has been created so members of public shared groups need to have
 * their rosters updated. Members of public shared groups need to have a roster
 * item with subscription FROM for the new user since the new user can see them.
 *
 * @param newUser the newly created user.
 * @param params event parameters.
 */
public void userCreated(User newUser, Map<String,Object> params) {
    JID newUserJID = server.createJID(newUser.getUsername(), null);
    // Shared public groups that are public should have a presence subscription
    // of type FROM for the new user
    for (Group group : getPublicSharedGroups()) {
        // Get group members of public group
        Collection<JID> users = new HashSet<JID>(group.getMembers());
        users.addAll(group.getAdmins());
        // Update the roster of each group member to include a subscription of type FROM
        for (JID userToUpdate : users) {
            // Get the roster to update
            Roster roster = null;
            if (server.isLocal(userToUpdate)) {
                // Check that the user exists, if not then continue with the next user
                try {
                    UserManager.getInstance().getUser(userToUpdate.getNode());
                }
                catch (UserNotFoundException e) {
                    continue;
                }
                roster = rosterCache.get(userToUpdate.getNode());
            }
            // Only update rosters in memory
            if (roster != null) {
                roster.addSharedUser(group, newUserJID);
            }
            if (!server.isLocal(userToUpdate)) {
                // Susbcribe to the presence of the remote user. This is only necessary for
                // remote users and may only work with remote users that **automatically**
                // accept presence subscription requests
                sendSubscribeRequest(newUserJID, userToUpdate, true);
            }
        }
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:44,代码来源:RosterManager.java

示例14: userDeleting

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
public void userDeleting(User user, Map<String,Object> params) {
    // Shared public groups that have a presence subscription of type FROM
    // for the deleted user should no longer have a reference to the deleted user
    JID userJID = server.createJID(user.getUsername(), null);
    // Shared public groups that are public should have a presence subscription
    // of type FROM for the new user
    for (Group group : getPublicSharedGroups()) {
        // Get group members of public group
        Collection<JID> users = new HashSet<JID>(group.getMembers());
        users.addAll(group.getAdmins());
        // Update the roster of each group member to include a subscription of type FROM
        for (JID userToUpdate : users) {
            // Get the roster to update
            Roster roster = null;
            if (server.isLocal(userToUpdate)) {
                // Check that the user exists, if not then continue with the next user
                try {
                    UserManager.getInstance().getUser(userToUpdate.getNode());
                }
                catch (UserNotFoundException e) {
                    continue;
                }
                roster = rosterCache.get(userToUpdate.getNode());
            }
            // Only update rosters in memory
            if (roster != null) {
                roster.deleteSharedUser(group, userJID);
            }
            if (!server.isLocal(userToUpdate)) {
                // Unsusbcribe from the presence of the remote user. This is only necessary for
                // remote users and may only work with remote users that **automatically**
                // accept presence subscription requests
                sendSubscribeRequest(userJID, userToUpdate, false);
            }
        }
    }

    deleteRoster(userJID);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:40,代码来源:RosterManager.java

示例15: groupDeleting

import org.jivesoftware.openfire.group.Group; //导入方法依赖的package包/类
public void groupDeleting(Group group, Map params) {
    // Get group members
    Collection<JID> users = new HashSet<JID>(group.getMembers());
    users.addAll(group.getAdmins());
    // Get users whose roster will be updated
    Collection<JID> affectedUsers = getAffectedUsers(group);
    // Iterate on group members and update rosters of affected users
    for (JID deletedUser : users) {
        groupUserDeleted(group, affectedUsers, deletedUser);
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:12,代码来源:RosterManager.java


注:本文中的org.jivesoftware.openfire.group.Group.getMembers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。