Package es.udc.tfg.journals.model.review

Examples of es.udc.tfg.journals.model.review.Review


    ReviewRatingDto rvdto1 = new ReviewRatingDto("global", 2);
    ReviewRatingDto rvdto2 = new ReviewRatingDto("quality", 5);
    List<ReviewRatingDto> reviewRatingsDto = new ArrayList<ReviewRatingDto>();
    reviewRatingsDto.add(rvdto1);
    reviewRatingsDto.add(rvdto2);
    Review r1 = reviewService.createReview("review 1", user.getUserId(),
        journal.getJournalId(), reviewRatingsDto);

    try {
      reviewService.createReview("review 1", user.getUserId(),
          journal.getJournalId(), reviewRatingsDto);
    } catch (DuplicateInstanceException e) {
    }

    Review r2 = reviewService.createReview("review 2", user1.getUserId(),
        journal.getJournalId(), reviewRatingsDto);

    Block<Review> reviewsBlock = reviewService.findReviewsByJournal(
        journal.getJournalId(), 0, 10);
    assertEquals(2, reviewsBlock.getList().size());
View Full Code Here


      throws InstanceNotFoundException, DuplicateInstanceException {
    if (reviewDao.existDuplicateReview(userId, journalId)) {
      throw new DuplicateInstanceException(comment,
          Review.class.getName());
    }
    Review review = new Review(comment);
    review.setUser(userDao.find(userId));
    review.setJournal(journalDao.find(journalId));
    reviewDao.save(review);

    for (ReviewRatingDto reviewRatingDto : reviewRatingsDto) {
      ReviewType reviewType = reviewTypeDao.findByName(reviewRatingDto
          .getReviewTypeName());
      ReviewRating reviewRating = new ReviewRating(
          reviewRatingDto.getRating(), reviewType);

      review.addReviewRating(reviewRating);
      reviewRatingDao.save(reviewRating);
    }
    return review;
  }
View Full Code Here

TOP

Related Classes of es.udc.tfg.journals.model.review.Review

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.