Package com.dotmarketing.beans

Examples of com.dotmarketing.beans.Rating


      }
    } catch (Exception e) {
      Logger.error(this, "Error trying to obtain the current liferay user from the request.", e);
    }

    Rating rt = RatingAPI.getRating(llCookie, identifier, userId);

    rt.setUserId(userId);
    rt.setRating(rating);
    rt.setIdentifier(identifier);
    rt.setLongLiveCookiesId(llCookie);
    rt.setSessionId(session.getId());
    rt.setUserIP(req.getRemoteAddr());

    RatingAPI.saveRating(rt);

  }
View Full Code Here


   * @return
   */
  public static Rating getRating(String longLiveCookie, String identifier, String userId) {

    /* get rating from cache */
     Rating rating = (Rating) RatingCache.getRatingFromCache(identifier, longLiveCookie);

    if(!UtilMethods.isSet(rating.getIdentifier())) {
      rating = RatingsFactory.getRatingByUserId(identifier, userId);
    }
    return rating;

  }
View Full Code Here

   * @param inode
   * @return boolean
   * @author Oswaldo Gallango
   */
  public static boolean wasAlreadyRated(String identifier, String longLiveCookie){
    Rating rt = RatingCache.getRatingFromCache(identifier, longLiveCookie);
    if (rt == null || !UtilMethods.isSet(rt.getId()))
      return false;
    else
      return true;
  }
View Full Code Here

     * @param longLiveCookie
     * @return
     */
    public static Rating getRatingFromCache(String identifier, String longLivedCookie) {
      DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
      Rating rt = null;
      try{
        rt = (Rating) cache.get(getPrimaryGroup() + longLivedCookie + "-" + identifier,getPrimaryGroup());
      }catch (DotCacheException e) {
      Logger.debug(RatingCache.class, "Cache Entry not found", e);
      }
View Full Code Here

      userId = currentUser.getUserId();
    } catch (Exception e) {
      Logger.error(this, "Error trying to obtain the current liferay user from the request.", e);
    }

        Rating rt = RatingAPI.getRating(llCookie, identifier, userId);

    rt.setUserId(userId);
    rt.setRating(rating);
    rt.setIdentifier(identifier);
    rt.setLongLiveCookiesId(llCookie);
    rt.setSessionId(session.getId());
    rt.setUserIP(request.getRemoteAddr());

    RatingAPI.saveRating (rt);

    return new ActionForward(referer,true);
View Full Code Here

   * @param userId
   * @return Rating
   */
  public static Rating getRatingByUserId(String identifier, String userId) {
    if(identifier == null || userId == null){
      return new Rating();
    }
    Rating r = null ;
    try {
      HibernateUtil dh = new HibernateUtil();
      dh.setClass(Rating.class);
      dh.setQuery("from content_rating in class com.dotmarketing.beans.Rating where user_id = '" + userId + "' and identifier = '" + identifier +"'" );
      r = (Rating) dh.load();
View Full Code Here

   * @param sessionId
   * @return
   */
  public static Rating getRatingBySessionId(String identifier, String sessionId) {
    if(identifier == null || sessionId == null){
      return new Rating();
    }
    Rating r = null ;
    try {
      HibernateUtil dh = new HibernateUtil();
      dh.setClass(Rating.class);
      dh.setQuery("from content_rating in class com.dotmarketing.beans.Rating where session_id = '" + sessionId + "' and identifier = '" + identifier + "'");
      r = (Rating) dh.load();
View Full Code Here

   * @return Rating
   * @author Oswaldo Gallango
   */
  public static Rating getRatingByLongCookieId(String identifier, String longCookieId) {
    if(identifier == null || longCookieId == null){
      return new Rating();
    }
    Rating r = null ;
    try {
      HibernateUtil dh = new HibernateUtil();
      dh.setClass(Rating.class);
      dh.setQuery("from content_rating in class com.dotmarketing.beans.Rating where long_live_cookie_id = '" + longCookieId + "' and identifier = '" + identifier + "'");
      r = (Rating) dh.load();
View Full Code Here

TOP

Related Classes of com.dotmarketing.beans.Rating

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.