Search in sources :

Example 1 with RosterItemEntity

use of org.jivesoftware.openfire.plugin.rest.entity.RosterItemEntity in project Openfire by igniterealtime.

the class UserServiceController method getRosterEntities.

/**
	 * Gets the roster entities.
	 *
	 * @param username
	 *            the username
	 * @return the roster entities
	 * @throws ServiceException
	 *             the service exception
	 */
public RosterEntities getRosterEntities(String username) throws ServiceException {
    Roster roster = getUserRoster(username);
    List<RosterItemEntity> rosterEntities = new ArrayList<RosterItemEntity>();
    for (RosterItem rosterItem : roster.getRosterItems()) {
        RosterItemEntity rosterItemEntity = new RosterItemEntity(rosterItem.getJid().toBareJID(), rosterItem.getNickname(), rosterItem.getSubStatus().getValue());
        rosterItemEntity.setGroups(rosterItem.getGroups());
        rosterEntities.add(rosterItemEntity);
    }
    return new RosterEntities(rosterEntities);
}
Also used : RosterItem(org.jivesoftware.openfire.roster.RosterItem) Roster(org.jivesoftware.openfire.roster.Roster) RosterEntities(org.jivesoftware.openfire.plugin.rest.entity.RosterEntities) ArrayList(java.util.ArrayList) RosterItemEntity(org.jivesoftware.openfire.plugin.rest.entity.RosterItemEntity)

Aggregations

ArrayList (java.util.ArrayList)1 RosterEntities (org.jivesoftware.openfire.plugin.rest.entity.RosterEntities)1 RosterItemEntity (org.jivesoftware.openfire.plugin.rest.entity.RosterItemEntity)1 Roster (org.jivesoftware.openfire.roster.Roster)1 RosterItem (org.jivesoftware.openfire.roster.RosterItem)1