Search in sources :

Example 1 with RosterEntities

use of org.jivesoftware.openfire.entity.RosterEntities in project Openfire by igniterealtime.

the class UserServicePluginNG 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.entity.RosterEntities) ArrayList(java.util.ArrayList) RosterItemEntity(org.jivesoftware.openfire.entity.RosterItemEntity)

Aggregations

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