Package com.agiletec.plugins.jpcontentfeedback.aps.system.services.contentfeedback.rating.model

Examples of com.agiletec.plugins.jpcontentfeedback.aps.system.services.contentfeedback.rating.model.Rating


  @Override
  public synchronized void addRatingToContent(String contentId, int vote) throws ApsSystemException{
    try {
      RatingSearchBean searchBean = new RatingSearchBean();
      searchBean.setContentId(contentId);
      Rating rating = this.getRatingDAO().getRating(searchBean);
      if (rating == null){
        rating = new Rating();
        int key = this.getKeyGeneratorManager().getUniqueKeyCurrentValue();
        rating.setId(key);
        rating.setContentId(contentId);
        rating.setVote(1, vote);
        this.getRatingDAO().addRating(rating);
      } else {
        rating.setVote(rating.getVoters()+1, rating.getSumvote()+vote);
        this.getRatingDAO().updateRating(rating);
      }
            this.notifyEvent(contentId, -1, ContentFeedbackChangedEvent.CONTENT_RATING, ContentFeedbackChangedEvent.INSERT_OPERATION_CODE);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "addRatingToContent");
View Full Code Here


  @Override
  public synchronized void addRatingToComment(int commentId, int vote) throws ApsSystemException{
    try {
      RatingSearchBean searchBean = new RatingSearchBean();
      searchBean.setCommentId(commentId);
      Rating rating = this.getRatingDAO().getRating(searchBean);
      if (rating == null){
        rating = new Rating();
        int key = this.getKeyGeneratorManager().getUniqueKeyCurrentValue();
        rating.setId(key);
        rating.setCommentId(commentId);
        rating.setVote(1, vote);
        this.getRatingDAO().addRating(rating);
      } else {
        rating.setVote(rating.getVoters()+1, rating.getSumvote()+vote);
        this.getRatingDAO().updateRating(rating);
      }
            this.notifyEvent(null, commentId, ContentFeedbackChangedEvent.COMMENT_RATING, ContentFeedbackChangedEvent.INSERT_OPERATION_CODE);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "addRatingToComment");
View Full Code Here

  }


  @Override
  public Rating getRating(IRatingSearchBean searchBean){
    Rating rating = null;
    PreparedStatement stat = null;
    ResultSet res = null;
    Connection conn = null;
    try {
      conn = this.getConnection();
      String query = this.createQueryString(searchBean);
      stat = conn.prepareStatement(query);
      this.buildStatement(searchBean, stat);
      res = stat.executeQuery();
      if (res.next()) {
        rating = new Rating();
        rating.setId(res.getInt("id"));
        rating.setCommentId(res.getInt("commentid"));
        rating.setContentId(res.getString("contentid"));
        rating.setVote(res.getInt("voters"), res.getInt("sumvote"));
      }
    } catch (Throwable t) {
      processDaoException(t, "Errore while search rating", "getRating");
    } finally {
      closeDaoResources(res, stat, conn);
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpcontentfeedback.aps.system.services.contentfeedback.rating.model.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.