private Element addAffiliationToResult(String affiliation, Element parent, JID jid) {
        Element result = parent.addElement("item", "http://jabber.org/protocol/muc#admin");
        result.addAttribute("affiliation", affiliation);
        result.addAttribute("jid", jid.toString());
        try {
            List<MUCOccupant> occupants = room.getOccupantsByBareJID(jid);
            MUCOccupant occupant = occupants.get(0);
            result.addAttribute("role", occupant.getRole().toString());
            result.addAttribute("nick", occupant.getNickname());
        }
        catch (UserNotFoundException e) {
            // the JID is not currently an occupant
        }
        return result;
    }
Handles packets that includes item elements. Depending on the item's attributes the
interpretation of the request may differ. For example, an item that only contains the
"affiliation" attribute is requesting the list of participants or members. Whilst if the item
contains the affiliation together with a jid means that the client is changing the
affiliation of the requested jid.

@param senderAffiliation   the room affiliation of the user that sent the request packet.
@param senderRole          the room orle of the user that sent the request packet.
@param itemsList           the list of items sent by the client.
@param reply               the iq packet that will be sent back as a reply to the client's request.
@throws ForbiddenException If the user is not allowed to perform his request.
@throws ConflictException  If the desired room nickname is already reserved for the room or if the room was going to lose all of its owners.
@throws NotAllowedException Thrown if trying to ban an owner or an administrator.
@throws CannotBeInvitedException If the user being invited as a result of being added to a members-only room still does not have permission
xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/IQAdminHandler.java