Beispiel #1
0
  private void createTaskTranslation(
      Long taskID,
      String tweetID,
      String tweet,
      String author,
      String lat,
      String lon,
      String url,
      Long taskQueueID,
      String created,
      ClientAppAnswer clientAppAnswer) {

    if (translationService.findByTaskId(taskID) != null) {
      return;
    }

    System.out.println("createTaskTranslation is called : " + taskQueueID);

    TaskTranslation translation =
        new TaskTranslation(
            taskID,
            clientAppAnswer.getClientAppID().toString(),
            tweetID,
            author,
            lat,
            lon,
            url,
            taskQueueID,
            tweet,
            TaskTranslation.STATUS_NEW);
    translationService.createTranslation(translation);
  }
Beispiel #2
0
  private boolean handleItemAboveCutOff(
      Long taskQueueID,
      int responseCount,
      String answer,
      JSONObject info,
      ClientAppAnswer clientAppAnswer,
      ReportTemplateService reportTemplateService,
      int cutOffSize) {
    // MAKE SURE TO MODIFY TEMPLATE HTML  Standize OUTPUT FORMAT
    boolean processed = false;
    try {

      String tweetID;
      String tweet;
      String author = "";
      String lat = "";
      String lng = "";
      String url = "";
      String created = "";
      Long taskID = taskQueueID;

      if (responseCount >= cutOffSize) {

        Long tid = (Long) info.get("tweetid");
        tweetID = tid + "";
        if (info.get("tweet") == null) {

          tweet = (String) info.get("text");
          author = "";
          lat = "";
          lng = "";
          url = "";
          created = "";
        } else {

          tweet = (String) info.get("tweet");

          if (info.get("author") != null) {
            author = (String) info.get("author");
          }

          if (info.get("lat") != null) {
            lat = (String) info.get("lat");
          }

          if (info.get("lon") != null) {
            lng = (String) info.get("lon");
          }

          if (info.get("url") != null) {
            url = (String) info.get("url");
          }

          created = (String) info.get("timestamp");
          taskID = (Long) info.get("taskid");
        }

        if (taskQueueID != null
            && taskID != null
            && tweetID != null
            && (tweet != null && !tweet.isEmpty())) {
          ReportTemplate template =
              new ReportTemplate(
                  taskQueueID,
                  taskID,
                  tweetID,
                  tweet,
                  author,
                  lat,
                  lng,
                  url,
                  created,
                  answer,
                  StatusCodeType.TEMPLATE_IS_READY_FOR_EXPORT,
                  clientAppAnswer.getClientAppID());
          reportTemplateService.saveReportItem(template);
          processed = true;
        }
      }
    } catch (Exception e) {
      System.out.println("handleItemAboveCutOff exception");
      System.out.println("exception e :" + e.toString());
    }
    return processed;
  }