use of teammates.common.datatransfer.attributes.AdminEmailAttributes in project teammates by TEAMMATES.
the class AdminEmailComposeSendAction method updateDraftEmailToSent.
private void updateDraftEmailToSent(String emailId, String subject, List<String> addressReceiver, List<String> groupReceiver, String content) {
AdminEmailAttributes finalisedEmail = AdminEmailAttributes.builder(subject, addressReceiver, groupReceiver, new Text(content)).withSendDate(Instant.now()).build();
try {
logic.updateAdminEmailById(finalisedEmail, emailId);
} catch (InvalidParametersException | EntityDoesNotExistException e) {
isError = true;
setStatusForException(e);
return;
}
moveJobToGroupModeTaskQueue();
moveJobToAddressModeTaskQueue();
}
use of teammates.common.datatransfer.attributes.AdminEmailAttributes in project teammates by TEAMMATES.
the class AdminPrepareEmailGroupModeWorkerAction method addAdminEmailToTaskQueue.
private void addAdminEmailToTaskQueue(String emailId, String groupReceiverListFileKey, List<List<String>> processedReceiverEmails, int indexOfEmailListToResume, int indexOfEmailToResume) {
AdminEmailAttributes adminEmail = logic.getAdminEmailById(emailId);
Assumption.assertNotNull(adminEmail);
log.info("Resume adding group mail tasks for mail with id " + emailId + " from list index: " + indexOfEmailListToResume + " and email index: " + indexOfEmailToResume);
int indexOfLastEmailList = 0;
int indexOfLastEmail = 0;
for (int i = indexOfEmailListToResume; i < processedReceiverEmails.size(); i++) {
List<String> currentEmailList = processedReceiverEmails.get(i);
for (int j = indexOfEmailToResume; j < currentEmailList.size(); j++) {
String receiverEmail = currentEmailList.get(j);
taskQueuer.scheduleAdminEmailForSending(emailId, receiverEmail, adminEmail.getSubject(), adminEmail.getContentValue());
if (isNearDeadline()) {
taskQueuer.scheduleAdminEmailPreparationInGroupMode(emailId, groupReceiverListFileKey, i, j);
log.info("Adding group mail tasks for mail with id " + emailId + " have been paused with list index: " + i + " and email index: " + j);
return;
}
indexOfLastEmail = j;
}
indexOfLastEmailList = i;
}
log.info("Adding group mail tasks for mail with id " + emailId + "was complete with last reached list index: " + indexOfLastEmailList + " and last reached email index: " + indexOfLastEmail);
}
Aggregations