throw new SerializationException("UserJSONSerializer is unable to serialize object of type: " + o.getClass().getName());
}
try {
UserBO userBO = (UserBO)o;
result.put(ID, userBO.getId());
result.put(USER_ID, userBO.getUserId());
result.put(FULL_NAME, userBO.getFullName());
result.put(PWD, userBO.getPassword());
//roles
List allRoles = DAOFactory.getRoleDAO().loadAllRoles();
Iterator itAllRoles = allRoles.iterator();
List<Integer> userRoles = userBO.getSbiExtUserRoleses();
//Iterator itRoles = userRoles.iterator();
JSONArray rolesJSON = new JSONArray();
//rolesJSON.put("roles");
while(itAllRoles.hasNext()){
JSONObject jsonRole = new JSONObject();
Role role = (Role)itAllRoles.next();
if(role!=null){
Integer roleId = role.getId();
jsonRole.put("name", role.getName());
jsonRole.put("id", role.getId());
jsonRole.put("description", role.getDescription());
if(userRoles.contains(roleId)){
jsonRole.put("checked", true);
}else{
jsonRole.put("checked", false);
}
rolesJSON.put(jsonRole);
}
//Role role = DAOFactory.getRoleDAO().loadByID(roleId);
}
/*while(itRoles.hasNext()){
JSONObject jsonRole = new JSONObject();
Integer roleId = (Integer)itRoles.next();
Role role = DAOFactory.getRoleDAO().loadByID(roleId);
jsonRole.put("name", role.getName());
jsonRole.put("id", role.getId());
jsonRole.put("description", role.getDescription());
jsonRole.put("checked", true);
rolesJSON.put(jsonRole);
} */
result.put("userRoles", rolesJSON);
List allAttributes = DAOFactory.getSbiAttributeDAO().loadSbiAttributes();
Iterator itAttrs = allAttributes.iterator();
//attributes
HashMap<Integer, HashMap<String, String>> userAttributes = userBO.getSbiUserAttributeses();
//Iterator itAttrs = userAttributes.keySet().iterator();
JSONArray attrsJSON = new JSONArray();
//attrsJSON.put("attributes");
while(itAttrs.hasNext()){