コード例 #1
0
ファイル: FeedbackService.java プロジェクト: eletto/fra2015
  /**
   * Load All feedbacks related to the Latest review / ReviewEditing. The feedback is loaded only if
   * his timestamp is > to the LastContributorSubmission field stored in the survey status
   *
   * @param user
   * @param survey
   * @param question
   * @param harmonized
   * @return
   * @throws BadRequestServiceEx
   */
  public List<Feedback> loadFeedback(User user, SurveyInstance survey, Long question)
      throws BadRequestServiceEx {

    List<Feedback> list = new ArrayList<Feedback>();
    List<Feedback> harmonizedList = new ArrayList<Feedback>();
    try {

      Search search = new Search();
      if (user != null) {
        search.addFilterEqual("user", user);
      }
      search.addFilterEqual("harmonized", false);
      search.addFilterEqual("survey", survey);
      search.addFilterEqual("entry.question.id", question);

      // search.addFilterGreaterThan("timestamp", survey.getStatus().getLastSurveyReview());
      search.addFilterGreaterThan("timestamp", survey.getStatus().getLastPendingFixSubmit());

      list = feedbackDAO.search(search);
    } catch (Exception e) {

      LOGGER.error(e.getLocalizedMessage());
      throw new BadRequestServiceEx(e.getLocalizedMessage());
    }
    list.addAll(harmonizedList);
    return list;
  }
コード例 #2
0
ファイル: FeedbackService.java プロジェクト: eletto/fra2015
  /**
   * Load the feedbacks that are saved between the previous editor submission and the latest in
   * order to allow the reviewer to see their previous comment for each entry.
   *
   * @param user
   * @param survey
   * @param question
   * @param harmonized
   * @return
   * @throws BadRequestServiceEx
   */
  public List<Feedback> loadPreviousReviewFeedbacks(User user, SurveyInstance survey, Long question)
      throws BadRequestServiceEx {

    List<Feedback> list = new ArrayList<Feedback>();
    try {

      Search search = new Search();
      search.addFilterEqual("user", user);
      search.addFilterEqual("survey", survey);
      search.addFilterEqual("entry.question.id", question);
      Long prev =
          (survey.getStatus().getPreviousPendingFix() != null)
              ? survey.getStatus().getPreviousPendingFix()
              : 0;

      // Long last = (survey.getStatus().getLastSurveyReview() !=
      // null)?survey.getStatus().getLastSurveyReview():0;
      Long last =
          (survey.getStatus().getLastPendingFixSubmit() != null)
              ? survey.getStatus().getLastPendingFixSubmit()
              : 0;

      search.addFilterGreaterThan("timestamp", prev);
      search.addFilterLessThan("timestamp", last);
      list = feedbackDAO.search(search);
    } catch (Exception e) {

      LOGGER.error(e.getLocalizedMessage());
      throw new BadRequestServiceEx(e.getLocalizedMessage());
    }
    return list;
  }
コード例 #3
0
ファイル: FeedbackService.java プロジェクト: eletto/fra2015
  public boolean checkQuestionFeedbackStatus(User user, SurveyInstance survey, Long question) {

    Collection<Entry> entries = catalog.getEntriesForQuestion(question);

    Search search = new Search();
    search.addFilterEqual("user", user);
    search.addFilterEqual("harmonized", false);
    search.addFilterEqual("survey", survey);
    search.addFilterEqual("entry.question.id", question);
    search.addFilterIn("status", "ok", "ko");
    search.addFilterGreaterThan("timestamp", survey.getStatus().getLastContributorSubmission());
    List<Feedback> list = feedbackDAO.search(search);
    return (list.size() == entries.size());
  }
コード例 #4
0
ファイル: FeedbackService.java プロジェクト: eletto/fra2015
  /**
   * Counts feedback for a survey
   *
   * @param survey
   * @param harmonized
   * @return
   */
  public int[] getFeedbackCounter(SurveyInstance survey, boolean harmonized) {
    List<Feedback> list = new ArrayList<Feedback>();
    int[] counts = new int[22];
    for (int q = 0; q < counts.length; q++) {
      Search search = new Search();

      search.addFilterEqual("harmonized", harmonized);
      if (!harmonized) {
        search.addFilterEqual("status", "ko");
      }
      search.addFilterEqual("survey", survey);
      search.addFilterEqual("entry.question.id", q);

      search.addFilterGreaterThan("timestamp", survey.getStatus().getLastContributorSubmission());
      counts[q] = feedbackDAO.count(search);
    }
    return counts;
  }
コード例 #5
0
ファイル: FeedbackService.java プロジェクト: eletto/fra2015
  public List<Feedback> loadAllHarmonizedfeedbacks(SurveyInstance survey)
      throws BadRequestServiceEx {

    List<Feedback> list = new ArrayList<Feedback>();
    List<Feedback> harmonizedList = new ArrayList<Feedback>();
    try {

      Search search = new Search();
      search.addFilterEqual("harmonized", true);
      search.addFilterEqual("survey", survey);
      // search.addFilterEqual("entry.question.id", question);
      search.addFilterGreaterThan("timestamp", survey.getStatus().getLastContributorSubmission());
      list = feedbackDAO.search(search);
    } catch (Exception e) {

      LOGGER.error(e.getLocalizedMessage());
      throw new BadRequestServiceEx(e.getLocalizedMessage());
    }
    list.addAll(harmonizedList);
    return list;
  }