Package it.eng.spagobi.analiticalmodel.document.metadata

Examples of it.eng.spagobi.analiticalmodel.document.metadata.SbiObjectsRating


    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
       
      SbiObjects hibBIObject = (SbiObjects)aSession.load(SbiObjects.class,  obj.getId());
      SbiObjectsRating hibBIObjectsRating = new SbiObjectsRating();
     
      hibBIObjectsRating = loadBIObjectRatingById(obj, userid);
      Integer newRating = new Integer(rating);
      if(newRating!= null && newRating.intValue()> 5){
        newRating = new Integer(5);
      }else if(newRating!= null && newRating.intValue()< 0){
        newRating = new Integer(0);
      }
      if (hibBIObjectsRating != null){
       
        hibBIObjectsRating.setRating(newRating);
        updateSbiCommonInfo4Update(hibBIObjectsRating);
        aSession.update(hibBIObjectsRating);

      }else {
        SbiObjectsRating hibBIObjectsRating1 = new SbiObjectsRating();
        SbiObjectsRatingId hibBIObjectsRatingId1 = new SbiObjectsRatingId();
        hibBIObjectsRatingId1.setObjId(obj.getId());
        hibBIObjectsRatingId1.setUserId(userid);
        hibBIObjectsRating1.setId(hibBIObjectsRatingId1);
        hibBIObjectsRating1.setRating(newRating);
        hibBIObjectsRating1.setSbiObjects(hibBIObject);
        hibBIObjectsRating = hibBIObjectsRating1 ;
        updateSbiCommonInfo4Insert(hibBIObjectsRating);
        aSession.save(hibBIObjectsRating);
       
       
View Full Code Here


      double totalVotes = 0 ;
      double sumVotes = 0 ;
     
        Iterator it = l.iterator();
        while(it.hasNext()){
          SbiObjectsRating temp = (SbiObjectsRating)it.next();
          Integer rat = temp.getRating();
          sumVotes = sumVotes + rat.doubleValue();
          totalVotes ++ ;
        }
        if (totalVotes != 0){
          rating = new Double (sumVotes / totalVotes);
View Full Code Here

     
    }
   
    private SbiObjectsRating loadBIObjectRatingById(BIObject obj, String userid) throws EMFUserError {

      SbiObjectsRating hibBIObjectsRating = new SbiObjectsRating();
    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
View Full Code Here

TOP

Related Classes of it.eng.spagobi.analiticalmodel.document.metadata.SbiObjectsRating

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.