Ejemplo n.º 1
0
  public ArrayList<Object> getMyHitAnswers(RequesterService service, String hitId) {
    Assignment[] assignments = service.getAllAssignmentsForHIT(hitId);
    ArrayList<Object> rawAnswers = new ArrayList<Object>();

    for (Assignment assignment : assignments) {
      String log =
          assignment.getWorkerId()
              + " had the following"
              + " answers for HIT("
              + assignment.getHITId()
              + "):  "
              + (new Date()).toString()
              + "\n";

      // Interpret the XML and parse answers out.
      String answerXML = assignment.getAnswer();
      QuestionFormAnswers qfa = RequesterService.parseAnswers(answerXML);
      @SuppressWarnings("unchecked")
      ArrayList<QuestionFormAnswersType.AnswerType> answers =
          (ArrayList<QuestionFormAnswersType.AnswerType>) qfa.getAnswer();
      for (QuestionFormAnswersType.AnswerType answer : answers) {
        String assignmentId = assignment.getAssignmentId();
        String answerValues = RequesterService.getAnswerValue(assignmentId, answer);
        String[] rawAnswerValues = null;
        if (answerValues != null) {
          rawAnswerValues = answerValues.split("\\|");
        }
        for (String ans : rawAnswerValues) {
          if (ans.startsWith("desc_identifier:")) {
            rawAnswers.add(ans.substring(16));
            log += ans.substring(16) + "\n";
          }
        }
      }
      log += "---------\n\n";
      LogWriter.writeLog(log, "detail.txt");
    }
    return rawAnswers;
  }
Ejemplo n.º 2
0
 public void run() {
   LogWriter.writeLog();
 }