Package it.eng.spagobi.profiling.bo

Examples of it.eng.spagobi.profiling.bo.UserBO


   * @throws EMFUserError
   */
  public UserBO toUserBO(SbiUser sbiUser) throws EMFUserError{
    logger.debug("IN");
        // create empty UserBO
      UserBO userBO = new UserBO();
      userBO.setId(sbiUser.getId());
      userBO.setDtLastAccess(sbiUser.getDtLastAccess());
      userBO.setDtPwdBegin(sbiUser.getDtPwdBegin());
      userBO.setDtPwdEnd(sbiUser.getDtPwdEnd());
      userBO.setFlgPwdBlocked(sbiUser.getFlgPwdBlocked());
      userBO.setFullName(sbiUser.getFullName());
      userBO.setPassword(sbiUser.getPassword());
      userBO.setUserId(sbiUser.getUserId());
     
      List userRoles = new ArrayList();
      Set roles = sbiUser.getSbiExtUserRoleses();
      for (Iterator it = roles.iterator(); it.hasNext(); ) {
        SbiExtRoles role = (SbiExtRoles) it.next();
        Integer roleId = role.getExtRoleId();
        userRoles.add(roleId);
      }
      userBO.setSbiExtUserRoleses(userRoles);

      HashMap<Integer, HashMap<String, String>> userAttributes = new HashMap<Integer, HashMap<String, String>>();
      Set<SbiUserAttributes> attributes = sbiUser.getSbiUserAttributeses();

      for (Iterator<SbiUserAttributes> it = attributes.iterator(); it.hasNext(); ) {
        SbiUserAttributes attr = it.next();
        Integer attrId = attr.getSbiAttribute().getAttributeId()
        HashMap<String, String> nameValueAttr = new HashMap<String, String>();

        nameValueAttr.put(attr.getSbiAttribute().getAttributeName(), attr.getAttributeValue());
        userAttributes.put(attrId, nameValueAttr);
      }
      userBO.setSbiUserAttributeses(userAttributes);
     
      logger.debug("OUT");
      return userBO;
  }
View Full Code Here


      if(toTransform!=null && !toTransform.isEmpty()){
        toReturn = new ArrayList<UserBO>();
        Iterator it = toTransform.iterator();
        while(it.hasNext()){
          SbiUser sbiUser = (SbiUser)it.next();
          UserBO us = toUserBO(sbiUser);
          toReturn.add(us);
        }
      }
     
    } catch (HibernateException he) {
View Full Code Here

      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()){
View Full Code Here

TOP

Related Classes of it.eng.spagobi.profiling.bo.UserBO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.