18 package org.turro.dossier.dossier;
20 import java.net.URLEncoder;
21 import java.util.Collection;
22 import java.util.Date;
23 import java.util.HashMap;
24 import java.util.List;
25 import java.util.logging.Level;
26 import java.util.logging.Logger;
27 import org.apache.commons.mail.EmailException;
28 import org.turro.action.Actions;
29 import org.turro.action.Contacts;
30 import org.turro.action.LinkType;
31 import org.turro.action.queue.NotificationCategory;
32 import org.turro.attach.entity.Attachment;
33 import org.turro.attach.search.AttachCollection;
34 import org.turro.dossier.command.DossierEntityInfo;
35 import org.turro.dossier.db.DossierPU;
36 import org.turro.dossier.entity.Dossier;
37 import org.turro.dossier.entity.DossierType;
38 import org.turro.dossier.entity.IDossierParticipant;
39 import org.turro.dossier.entity.Issue;
40 import org.turro.dossier.entity.ParticipantRole;
41 import org.turro.dossier.project.AbstractDossierNotification;
42 import org.turro.dossier.util.DossierElephantNotification;
43 import org.turro.elephant.context.ElephantContext;
44 import org.turro.elephant.context.IConstructor;
45 import org.turro.elephant.security.IUser;
46 import org.turro.i18n.I_;
47 import org.turro.mail.message.MailMessageTemplate;
48 import org.turro.mail.provider.MailProviders;
49 import org.turro.mail.queue.QueueManager;
50 import org.turro.marker.ElephantMarker;
51 import org.turro.path.Path;
52 import org.turro.plugin.contacts.ContactList;
53 import org.turro.plugin.contacts.IContact;
63 private final Date from;
66 this.dossier = dossier;
72 addToQueue(constructor);
88 HashMap<String, String> values =
new HashMap<>();
90 values.put(
Actions.REDIR_PAR, URLEncoder.encode(redir,
"UTF-8"));
105 return "{liveref:" + redir +
"}";
114 for(
IContact contact : getPlayers(constructor)) {
123 em.
put(
"dossier", dossier);
126 em.
put(
"contact", contact);
127 em.
put(
"attachments", attachments);
129 em.
put(
"notifier",
this);
130 mmt.
setMessage(em,
"dossier-activity", contact);
131 qm.
addToQueue(nc, contact, mmt,
null,
"Dossier");
133 }
catch (EmailException ex) {
134 Logger.getLogger(AbstractDossierNotification.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
139 private String getSubject() {
140 return "[" + I_.get(
"Dossier") +
" #" + dossier.
getId() +
" " +
144 private List<IContact> getPlayers(IConstructor constructor) {
145 ContactList list =
new ContactList();
147 if(!p.getRole().equals(ParticipantRole.PARTICIPANT_SUBJECT) && p.isShowAllIssues()) {
148 IContact ic = Contacts.getContactById(p.getIdContact());
149 if(ic.isValid() && ic.isWebUser()) {
static String createAction(String email, String redir)
static final String USER_PAR
Collection< Attachment > getAttachmentList(String path, boolean publicOnly, Date from)
static String linkForPath(Path path, IContact contact, LinkType type)
static String getObjectPath(Object object)
DossierNotification(Dossier dossier, DossierActivitySet das, Date from)
String createRef(IConstructor constructor, Issue issue, IContact contact)
String createRef(IConstructor constructor, String redir)
String create(IConstructor constructor, String redir, String email)
String create(IConstructor constructor, Issue issue, IContact contact)
String createRef(IConstructor constructor, Dossier dossier, IContact contact)
String create(IConstructor constructor, Dossier dossier, IContact contact)
void sendMail(IConstructor constructor)
String getFullDescription()
ParticipantSet< IDossierParticipant > getFullParticipants()
static final String PROJECT_NOTIFICATION
NotificationCategory getCategory(String id)
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