Search in sources :

Example 1 with UserEntities

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

the class UserServiceController method getUserEntitiesByProperty.

/**
	 * Gets the user entities by property key and or value.
	 *
	 * @param propertyKey
	 *            the property key
	 * @param propertyValue
	 *            the property value (can be null)
	 * @return the user entities by property
	 * @throws ServiceException
	 *             the service exception
	 */
public UserEntities getUserEntitiesByProperty(String propertyKey, String propertyValue) throws ServiceException {
    List<String> usernames = PropertyDAO.getUsernameByProperty(propertyKey, propertyValue);
    List<UserEntity> users = new ArrayList<UserEntity>();
    UserEntities userEntities = new UserEntities();
    for (String username : usernames) {
        users.add(getUserEntity(username));
    }
    userEntities.setUsers(users);
    return userEntities;
}
Also used : UserEntities(org.jivesoftware.openfire.plugin.rest.entity.UserEntities) ArrayList(java.util.ArrayList) UserEntity(org.jivesoftware.openfire.plugin.rest.entity.UserEntity)

Example 2 with UserEntities

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

the class UserServiceController method getUserEntities.

/**
	 * Gets the user entities.
	 *
	 * @param userSearch
	 *            the user search
	 * @param propertyValue
	 * @param propertyKey
	 * @return the user entities
	 * @throws ServiceException
	 */
public UserEntities getUserEntities(String userSearch, String propertyKey, String propertyValue) throws ServiceException {
    if (propertyKey != null) {
        return getUserEntitiesByProperty(propertyKey, propertyValue);
    }
    UserEntities userEntities = new UserEntities();
    userEntities.setUsers(UserUtils.convertUsersToUserEntities(userManager.getUsers(), userSearch));
    return userEntities;
}
Also used : UserEntities(org.jivesoftware.openfire.plugin.rest.entity.UserEntities)

Aggregations

UserEntities (org.jivesoftware.openfire.plugin.rest.entity.UserEntities)2 ArrayList (java.util.ArrayList)1 UserEntity (org.jivesoftware.openfire.plugin.rest.entity.UserEntity)1