@Override
    public void execute(@Nonnull final SessionData data, Element command) {
        final Locale preferredLocale = SessionManager.getInstance().getLocaleForSession(data.getOwner());

        Element note = command.addElement("note");
        // Get requested group
        Group group;
        try {
            group = GroupManager.getInstance().getGroup(data.getData().get("group").get(0));
        } catch (GroupNotFoundException e) {
            // Group not found
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.admin.group.updategroup.note.group-does-not-exist", preferredLocale));
            return;
        }

        List<String> desc = data.getData().get("desc");
        if (desc != null) {
            group.setDescription(desc.get(0));
        }

        String showInRoster = data.getData().get("showInRoster").get(0);
        String displayName;
        if (data.getData().get("displayName") != null && !data.getData().get("displayName").isEmpty()) {
            displayName = data.getData().get("displayName").get(0);
        } else {
            displayName = group.getSharedDisplayName();
        }
        List<String> groupList = data.getData().get("groupList");

        switch (showInRoster) {
            case "nobody":
                // New group is not a shared group
                group.shareWithNobody();
                break;

            case "everybody":
                if (displayName != null ) {
                    group.shareWithEverybody(displayName);
                }
                break;

            case "spefgroups":
                if (displayName != null ) {
                    group.shareWithUsersInGroups(groupList, displayName);
                }
                break;

            case "onlyGroup":
                if (displayName != null ) {
                    group.shareWithUsersInSameGroup(displayName);
                }
                break;
        }

        note.addAttribute("type", "info");
        note.setText(LocaleUtils.getLocalizedString("commands.global.operation.finished.success", preferredLocale));
    }
Command that allows to update a given group.

@author Gaston Dombiak
xmppserver/src/main/java/org/jivesoftware/openfire/commands/admin/group/UpdateGroup.java