use of org.jivesoftware.openfire.plugin.rest.entity.UserProperty in project Openfire by igniterealtime.
the class UserUtils method convertUserToUserEntity.
/**
* Convert user to user entity.
*
* @param user
* the user
* @return the user entity
*/
public static UserEntity convertUserToUserEntity(User user) {
UserEntity userEntity = new UserEntity(user.getUsername(), user.getName(), user.getEmail());
List<UserProperty> userProperties = new ArrayList<UserProperty>();
for (Entry<String, String> property : user.getProperties().entrySet()) {
userProperties.add(new UserProperty(property.getKey(), property.getValue()));
}
userEntity.setProperties(userProperties);
return userEntity;
}
use of org.jivesoftware.openfire.plugin.rest.entity.UserProperty in project Openfire by igniterealtime.
the class UserServiceController method addProperties.
/**
* Adds the properties.
*
* @param userEntity
* the user entity
* @throws ServiceException
* the service exception
*/
private void addProperties(String username, List<UserProperty> properties) throws ServiceException {
User user = getAndCheckUser(username);
user.getProperties().clear();
if (properties != null) {
for (UserProperty property : properties) {
user.getProperties().put(property.getKey(), property.getValue());
}
}
}
Aggregations