19 package org.turro.dossier.project;
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.LinkType;
28 import org.turro.action.queue.NotificationCategory;
29 import org.turro.assistant.Assistant;
30 import org.turro.assistant.AssistantSet;
31 import org.turro.auth.Authentication;
32 import org.turro.dossier.command.DossierEntityInfo;
33 import org.turro.dossier.db.DossierPU;
34 import org.turro.dossier.dossier.DossierWrapper;
35 import org.turro.dossier.entity.Dossier;
36 import org.turro.dossier.entity.Issue;
37 import org.turro.dossier.entity.IssueType;
38 import org.turro.dossier.util.DossierElephantNotification;
39 import org.turro.elephant.context.Application;
40 import org.turro.elephant.context.ElephantContext;
41 import org.turro.elephant.context.IConstructor;
42 import org.turro.elephant.security.IUser;
43 import org.turro.mail.message.MailMessageTemplate;
44 import org.turro.mail.provider.MailProviders;
45 import org.turro.mail.queue.QueueManager;
46 import org.turro.marker.ElephantMarker;
47 import org.turro.path.Path;
48 import org.turro.plugin.contacts.IContact;
66 public void send(String
template, String reason) {
67 addToQueue(
template, reason);
77 HashMap<String, String> values =
new HashMap<>();
79 values.put(
Actions.REDIR_PAR, URLEncoder.encode(redir,
"UTF-8"));
89 return "{liveref:" + redir +
"}";
92 private void addToQueue(String
template, String reason) {
102 mmt.
addTo(assistant.email, assistant.name);
106 em.
put(
"contact", assistant.contact);
107 em.
put(
"email", assistant.email);
108 em.
put(
"notifier",
this);
110 mmt.
setMessage(em,
template, assistant.contact);
111 qm.
addToQueue(nc, assistant.contact, mmt, reason,
"Dossier");
113 }
catch (EmailException ex) {
120 return String.format(
"[%s #%d %s] %s",
static String createAction(String email, String redir)
static final String USER_PAR
static IContact getIContact()
static String linkForPath(Path path, IContact contact, LinkType type)
static String getObjectPath(Object object)
String getFullDescription()
final IConstructor constructor
abstract void sendNotification()
abstract void initMarker(ElephantMarker marker)
abstract AssistantSet getAssistants()
String getSubject(String reason)
String createRef(IConstructor constructor, Dossier dossier, IContact contact)
final IContact loggedContact
String createRef(IConstructor constructor, String redir)
AbstractDossierNotification(Dossier dossier)
void send(String template, String reason)
String create(IConstructor constructor, Dossier dossier, IContact contact)
String create(IConstructor constructor, String redir, String email)
static AbstractDossierNotification getByGrouping(Issue issue)
static final String PROJECT_NOTIFICATION
NotificationCategory getCategory(String id)
IConstructor getConstructor()
static Application getApplication()
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()
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