Examples of SbiUserAttributes


Examples of it.eng.spagobi.profiling.bean.SbiUserAttributes

      ArrayList<SbiUserAttributes> attribs = DAOFactory.getSbiUserDAO().loadSbiUserAttributesById(user.getId());
      if(attribs != null){
        Iterator iterAttrs = attribs.iterator();
        while(iterAttrs.hasNext()){
            // Attribute to lookup
          SbiUserAttributes attribute = (SbiUserAttributes) iterAttrs.next();
         
          String attributeName = attribute.getSbiAttribute().getAttributeName();

            String attributeValue = attribute.getAttributeValue();
            if (attributeValue != null) {
              logger.debug("Add attribute. " + attributeName + "=" + attributeName + " to the user"
                  + userName);
            attributes.put(attributeName, attributeValue);
            }
View Full Code Here

Examples of it.eng.spagobi.profiling.bean.SbiUserAttributes

              for(int i= 0; i< attributes.size(); i++){
                SourceBean attribute = attributes.get(i);
                String name = (String)attribute.getAttribute("name");
                String value = (String)attribute.getAttribute("value");
               
                SbiUserAttributes sbiUserAttr = new SbiUserAttributes();
                sbiUserAttr.setAttributeValue(value);
               
                Integer attrID = attributesLookup.get(name);
               
                SbiUserAttributesId sbiUserAttrID = new SbiUserAttributesId();
                sbiUserAttrID.setId(idUser);//user ID
                sbiUserAttrID.setAttributeId(attrID.intValue());
                sbiUserAttr.setId(sbiUserAttrID);
               
                userDAO.updateSbiUserAttributes(sbiUserAttr);

              }
            }
View Full Code Here

Examples of it.eng.spagobi.profiling.bean.SbiUserAttributes

  }

  public SbiUserAttributes loadSbiAttributesByUserAndId(Integer userId, Integer attributeId)
      throws EMFUserError {
    logger.debug("IN");
    SbiUserAttributes toReturn = null;
    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
View Full Code Here

Examples of it.eng.spagobi.profiling.bean.SbiUserAttributes

      dbResult = query.list();
      if(dbResult != null && !dbResult.isEmpty()){
        toReturn = new HashMap<Integer, String>();
        for(int i=0; i< dbResult.size(); i++){
          SbiUserAttributes res = (SbiUserAttributes)dbResult.get(i);
          toReturn.put(res.getId().getAttributeId(), res.getAttributeValue());
        }
      }

      tx.commit();
    } catch (HibernateException he) {
View Full Code Here

Examples of it.eng.spagobi.profiling.bean.SbiUserAttributes

      JSONArray attrsJSON = new JSONArray();
      attrsJSON.put("attributes");

      while(itAttrs.hasNext()){
        JSONObject jsonAttr = new JSONObject();
        SbiUserAttributes userAttr = (SbiUserAttributes)itAttrs.next();
        String attrName= userAttr.getSbiAttribute().getAttributeName();
        jsonAttr.put("name", attrName);
        jsonAttr.put("id", userAttr.getSbiAttribute().getAttributeId());
        jsonAttr.put("value", userAttr.getAttributeValue());
        attrsJSON.put(jsonAttr);
     
      result.put("userAttributes", attrsJSON);
    } catch (Throwable t) {
      throw new SerializationException("An error occurred while serializing object: " + o, t);
View Full Code Here

Examples of it.eng.spagobi.profiling.bean.SbiUserAttributes

            //deletes attributes associations
            if(userAttributes != null){
                Iterator attrsIt = userAttributes.iterator();
                while(attrsIt.hasNext()){
                    SbiUserAttributes temp = (SbiUserAttributes)attrsIt.next();
                    attrsIt.remove();

                    aSession.delete(temp);
                    aSession.flush();
                }
View Full Code Here

Examples of it.eng.spagobi.profiling.bean.SbiUserAttributes

        //loop over db attributes for user
        Iterator attrsIt = userAttributes.iterator();
        while(attrsIt.hasNext()){       
       
          //if attribute is modified than update    
          SbiUserAttributes attribute = (SbiUserAttributes)attrsIt.next();
          Integer attrID = attribute.getId().getAttributeId();
          if(attributes.containsKey(attrID)){
            String attrVal = attributes.get(attrID);
            attribute.setAttributeValue(attrVal);
            //checks if value ==""
            if(attrVal.equals("")){
              aSession.delete(attribute);
            }else{
              updateSbiCommonInfo4Update(attribute);
              aSession.saveOrUpdate(attribute);
            }
            aSession.flush();
            attributes.remove(attrID);
          }

       
        }//else if attribute is not present than add it
        Iterator attrsItToAdd = attributes.keySet().iterator();
        while(attrsItToAdd.hasNext()){
          Integer attrID = (Integer)attrsItToAdd.next();
          SbiUserAttributes attributeToAdd =  new SbiUserAttributes();
          attributeToAdd.setAttributeValue(attributes.get(attrID));
          SbiUserAttributesId attributeToAddId = new SbiUserAttributesId();
          attributeToAddId.setId(id);
          attributeToAddId.setAttributeId(attrID);
          attributeToAdd.setId(attributeToAddId);
          updateSbiCommonInfo4Insert(attributeToAdd);
          aSession.saveOrUpdate(attributeToAdd);
          aSession.flush();
         
        }
View Full Code Here

Examples of it.eng.spagobi.profiling.bean.SbiUserAttributes

      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");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.