* 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);
}
}