Package com.google.appengine.api.taskqueue

Examples of com.google.appengine.api.taskqueue.Queue


        if (pl != null
            && TubeValidate.checkForm(req, resp, session, action,
                tube)) {
          tube = processTubeDetail(playlistId, tube);
          // add author to site.
          Queue queue = QueueFactory.getDefaultQueue();
          queue.add(TaskOptions.Builder.withUrl(
              "/task-admin?action=add-author&uri="
                  + tube.getAuthorUrl()).method(
              TaskOptions.Method.GET));
          TubeModel.insert(tube);
          recentAddTreeId.put(tube.getId(), tube.getId());
View Full Code Here


    String channelId = (String) request.getParameter("channel");
    String playlistId = (String) request.getParameter("playlistId");
    String subcribe = (String) request.getParameter("subcribe");
    Playlist pl = PlaylistModel.byId(playlistId, false);
    if (channelId != null && channelId.length() > 0 && pl != null) {
      Queue queue = QueueFactory.getDefaultQueue();
      queue.add(TaskOptions.Builder.withUrl(
          "/task-admin?action=add-all-from-channel&channelId="
              + channelId + "&playlistId=" + playlistId
              + "&subcribe=" + subcribe).method(
          TaskOptions.Method.GET));
      return "";
View Full Code Here

        if (currentPl != null && !currentPl.equals(plId)) {
          recentAddTreeId = new TreeMap();
        } else if (recentAddTreeId == null) {
          recentAddTreeId = new TreeMap();
        }
        Queue queue = QueueFactory.getDefaultQueue();
        for (int i = 0; i < ids.length; i++) {
          if (!ids[i].isEmpty()) {
            Tube tube = YoutubeService.searchStaticById(ids[i]);
            if (tube != null) {
              tube = processTubeDetail(plId, tube);
              recentAddTreeId.put(ids[i], ids[i]);
              list.add(tube);
              // add author to site.
              queue.add(TaskOptions.Builder.withUrl(
                  "/task-admin?action=add-author&uri="
                      + tube.getAuthorUrl()).method(
                  TaskOptions.Method.GET));
            }
          }
View Full Code Here

   *            the name of the coordinator (Precondition: Must not be null)
   */
  public void sendRegistrationKeys(List<Student> studentList,
      String courseID, String courseName, String coordinatorName,
      String coordinatorEmail) {
    Queue queue = QueueFactory.getQueue("email-queue");
    List<TaskOptions> taskOptionsList = new ArrayList<TaskOptions>();

    for (Student s : studentList) {
      // There is a limit of 100 tasks per batch addition to Queue in
      // Google App
      // Engine
      if (taskOptionsList.size() == 100) {
        queue.add(taskOptionsList);
        taskOptionsList = new ArrayList<TaskOptions>();
      }

      taskOptionsList.add(TaskOptions.Builder
          .withUrl("/email")
          .param("operation", "sendregistrationkey")
          .param("email", s.getEmail())
          .param("regkey",
              KeyFactory.createKeyString(
                  Student.class.getSimpleName(),
                  s.getRegistrationKey()))
          .param("courseid", courseID)
          .param("coursename", courseName).param("name", s.getName())
          .param("coordinatorname", coordinatorName)
          .param("coordinatoremail", coordinatorEmail));
    }

    if (!taskOptionsList.isEmpty()) {
      queue.add(taskOptionsList);
    }

  }
View Full Code Here

   *            the evaluation name (Pre-condition: The parameters must be
   *            valid)
   */
  public void informStudentsOfChanges(List<Student> studentList,
      String courseID, String evaluationName) {
    Queue queue = QueueFactory.getQueue("email-queue");
    List<TaskOptions> taskOptionsList = new ArrayList<TaskOptions>();

    DateFormat df = new SimpleDateFormat("dd/MM/yyyy HHmm");

    Evaluation evaluation = getEvaluation(courseID, evaluationName);

    Date start = evaluation.getStart();
    Date deadline = evaluation.getDeadline();
    String instructions = evaluation.getInstructions();

    for (Student s : studentList) {
      // There is a limit of 100 tasks per batch addition to Queue in
      // Google App
      // Engine
      if (taskOptionsList.size() == 100) {
        queue.add(taskOptionsList);
        taskOptionsList = new ArrayList<TaskOptions>();
      }

      taskOptionsList.add(TaskOptions.Builder.withUrl("/email")
          .param("operation", "informstudentsofevaluationchanges")
          .param("email", s.getEmail()).param("name", s.getName())
          .param("courseid", courseID)
          .param("evaluationname", evaluationName)
          .param("start", df.format(start))
          .param("deadline", df.format(deadline))
          .param("instr", instructions));
    }

    if (!taskOptionsList.isEmpty()) {
      queue.add(taskOptionsList);
    }
  }
View Full Code Here

   * @param evaluationName
   *            the evaluation name
   */
  public void informStudentsOfEvaluationOpening(List<Student> studentList,
      String courseID, String evaluationName) {
    Queue queue = QueueFactory.getQueue("email-queue");
    List<TaskOptions> taskOptionsList = new ArrayList<TaskOptions>();

    for (Student s : studentList) {
      // There is a limit of 100 tasks per batch addition to Queue in
      // Google App
      // Engine
      if (taskOptionsList.size() == 100) {
        queue.add(taskOptionsList);
        taskOptionsList = new ArrayList<TaskOptions>();
      }

      taskOptionsList.add(TaskOptions.Builder.withUrl("/email")
          .param("operation", "informstudentsofevaluationopening")
          .param("email", s.getEmail()).param("name", s.getName())
          .param("courseid", courseID)
          .param("evaluationname", evaluationName));
    }

    if (!taskOptionsList.isEmpty()) {
      queue.add(taskOptionsList);
    }
  }
View Full Code Here

   *            the evaluation name
   */
  private void informStudentsOfPublishingOfEvaluationResults(
      List<Student> studentList, String courseID, String name) {

    Queue queue = QueueFactory.getQueue("email-queue");
    List<TaskOptions> taskOptionsList = new ArrayList<TaskOptions>();

    for (Student s : studentList) {
      // There is a limit of 100 tasks per batch addition to Queue in
      // Google App
      // Engine
      if (taskOptionsList.size() == 100) {
        queue.add(taskOptionsList);
        taskOptionsList = new ArrayList<TaskOptions>();
      }

      taskOptionsList.add(TaskOptions.Builder.withUrl("/email")
          .param("operation", "informstudentspublishedevaluation")
          .param("email", s.getEmail()).param("name", s.getName())
          .param("courseid", courseID).param("evaluationname", name));
    }

    if (!taskOptionsList.isEmpty()) {
      queue.add(taskOptionsList);
    }
  }
View Full Code Here

   * @param deadline
   *            the evaluation deadline (Pre-condition: Must not be null)
   */
  public void remindStudents(List<Student> studentList, String courseID,
      String evaluationName, Date deadline) {
    Queue queue = QueueFactory.getQueue("email-queue");
    List<TaskOptions> taskOptionsList = new ArrayList<TaskOptions>();

    DateFormat df = new SimpleDateFormat("dd/MM/yyyy HHmm");

    for (Student s : studentList) {
      // There is a limit of 100 tasks per batch addition to Queue in
      // Google App
      // Engine
      if (taskOptionsList.size() == 100) {
        queue.add(taskOptionsList);
        taskOptionsList = new ArrayList<TaskOptions>();
      }

      taskOptionsList.add(TaskOptions.Builder.withUrl("/email")
          .param("operation", "remindstudents")
          .param("email", s.getEmail()).param("name", s.getName())
          .param("courseid", courseID)
          .param("evaluationname", evaluationName)
          .param("deadline", df.format(deadline)));
    }

    if (!taskOptionsList.isEmpty()) {
      queue.add(taskOptionsList);
    }
  }
View Full Code Here

      statusList.add(md);
      if (md.hasProblem()) {
        md.setWhen(new Date());
        String key = AMessageDAO.createMessageDescriptor(md);

        Queue queue = QueueFactory.getQueue("serverError");
        TaskOptions taskOptions = TaskOptions.Builder.withUrl("/sendAll").param(SendMessageServlet.PARAMETER_SERVER, key).method(Method.POST);
        queue.add(taskOptions);
      }
    }

    writeStatusListToResponse(resp, statusList);
View Full Code Here

      status = "Message ignored as there is no device registered!";
      forwardWithStatus(req, resp, status);
      return;
    }

    Queue queue = QueueFactory.getQueue("gcm");
    // send a multicast message using JSON
    // must split in chunks of 1000 devices (GCM limit)
    int total = devices.size();
    List<String> partialDevices = new ArrayList<String>(total);
    int counter = 0;
    int tasks = 0;
    for (String device : devices) {
      counter++;
      partialDevices.add(device);
      int partialSize = partialDevices.size();
      if (partialSize == Datastore.MULTICAST_SIZE || counter == total) {
        String multicastKey = Datastore.createMulticast(partialDevices);
        logger.fine("Queuing " + partialSize + " devices on multicast " + multicastKey);
        TaskOptions taskOptions = TaskOptions.Builder.withUrl("/send")
            .param(SendMessageServlet.PARAMETER_MULTICAST, multicastKey)
            .param(SendMessageServlet.PARAMETER_SERVER, req.getParameter(SendMessageServlet.PARAMETER_SERVER))
            .method(Method.POST);
        queue.add(taskOptions);
        partialDevices.clear();
        tasks++;
      }
    }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.taskqueue.Queue

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.