19 package org.turro.jobboard;
21 import java.net.URLEncoder;
22 import java.util.HashMap;
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
25 import org.apache.commons.mail.EmailException;
26 import org.turro.action.Actions;
27 import org.turro.action.queue.NotificationCategory;
28 import org.turro.assistant.Assistant;
29 import org.turro.assistant.AssistantSet;
30 import org.turro.auth.Authentication;
31 import org.turro.elephant.context.Application;
32 import org.turro.elephant.context.ElephantContext;
33 import org.turro.elephant.context.IConstructor;
34 import org.turro.elephant.security.IUser;
35 import org.turro.entities.Entities;
36 import org.turro.mail.message.MailMessageTemplate;
37 import org.turro.mail.provider.MailProviders;
38 import org.turro.mail.queue.GenericElephantNotification;
39 import org.turro.mail.queue.QueueManager;
40 import org.turro.marker.ElephantMarker;
41 import org.turro.plugin.contacts.IContact;
42 import org.turro.students.entities.PracticalWork;
60 public void send(String
template, String reason) {
61 addToQueue(
template, reason);
71 HashMap<String, String> values =
new HashMap<>();
73 values.put(
Actions.REDIR_PAR, URLEncoder.encode(redir,
"UTF-8"));
84 return "{liveref:" + redir +
"}";
87 private void addToQueue(String
template, String reason) {
97 mmt.
addTo(assistant.email, assistant.name);
101 em.
put(
"contact", assistant.contact);
102 em.
put(
"email", assistant.email);
103 em.
put(
"notifier",
this);
105 mmt.
setMessage(em,
template, assistant.contact);
106 qm.
addToQueue(nc, assistant.contact, mmt, reason,
null);
108 }
catch (EmailException ex) {
115 return String.format(
"[%s %s] %s",
static String createAction(String email, String redir)
static final String USER_PAR
static IContact getIContact()
IConstructor getConstructor()
static Application getApplication()
static IElephantEntity getController(String path)
abstract void initMarker(ElephantMarker marker)
PracticalWork practicalWork
String create(IConstructor constructor, PracticalWork practicalWork, IContact contact)
String createRef(IConstructor constructor, PracticalWork practicalWork, IContact contact)
String createRef(IConstructor constructor, String redir)
abstract AssistantSet getAssistants()
final IContact loggedContact
String getSubject(String reason)
String create(IConstructor constructor, String redir, String email)
abstract void sendNotification()
AbstractPracticalWorkNotification(PracticalWork practicalWork)
void send(String template, String reason)
final IConstructor constructor
void setProcessLiveLinks(boolean processLiveLinks)
void setMessage(ElephantMarker marker, IContact contact)
static MailMessageTemplate of(MailProvider provider)
void setRoot(String root)
Email addTo(String email, String name)
void setSubject(String subject)
MailProvider getProvider(String name)
static MailProviders instance()
static final String GENERIC
static final String GENERIC_NOTIFICATION
NotificationCategory getCategory(String id)
MailItem addToQueue(NotificationCategory category, IContact contact, MailMessage mmt, String reason, String poolName)
boolean contactMayWant(IContact contact, String idCategory)
Object put(Object key, Object value)
static final String CONNECTOR_EMAIL