org.jboss.identity.idm.api.User idUser= identitySession.getPersistenceManager().createUser(userName);
List<Attribute> attrs = new ArrayList<Attribute>();
if (givenName != null) {
attrs.add(new SimpleAttribute(P3PConstants.INFO_USER_NAME_GIVEN, givenName));
}
if (familyName != null) {
attrs.add(new SimpleAttribute(P3PConstants.INFO_USER_NAME_FAMILY, familyName));
}
if (businessEmail != null) {
attrs.add(new SimpleAttribute(P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, businessEmail));
}
identitySession.getAttributesManager().addAttributes(idUser, attrs.toArray(new Attribute[attrs.size()]));
return idUser.getId();