18 package org.turro.dossier.issue;
20 import java.util.ArrayList;
21 import java.util.List;
22 import org.amic.util.string.Strings;
23 import org.turro.action.Contacts;
24 import org.turro.action.LinkType;
25 import org.turro.dossier.command.DossierEntityInfo;
26 import org.turro.dossier.entity.IDossierParticipant;
27 import org.turro.dossier.entity.Issue;
28 import org.turro.dossier.entity.IssueParticipant;
29 import org.turro.elephant.context.IConstructor;
30 import org.turro.elephant.impl.util.StringParser;
31 import org.turro.elephant.util.DateFormats;
32 import org.turro.elephant.util.DecimalFormats;
33 import org.turro.html.HTMLGenerator;
34 import org.turro.i18n.I_;
35 import org.turro.mail.impl.MessagePool;
36 import org.turro.path.Path;
37 import org.turro.plugin.contacts.IContact;
38 import org.turro.plugin.contacts.ILinkSolver;
39 import org.turro.plugin.contacts.MailContact;
40 import org.turro.util.Chars;
48 private String comment;
52 this.comment = comment !=
null ? comment.trim() :
null;
58 getPlayers(constructor),
60 getSubject(constructor),
61 getMessage(constructor),
65 public String getLink(
IContact contact) {
75 getPlayers(constructor),
77 getMessage(constructor),
81 public String getLink(
IContact contact) {
89 private String getLinkString() {
93 private String getSubject(IConstructor constructor) {
94 return "[" + I_.get(
"Issue") +
" #" + issue.
getId() +
" " +
99 private String getMessage(IConstructor constructor) {
100 HTMLGenerator hg =
new HTMLGenerator();
101 hg.startTable(
"cellspacing='5px' width='100%' style='padding:5px;background-color:#fefefe;color:#444444;border: solid 1px #eeeeee;font-size:12px;font-family:verdana'");
102 hg.startTableCol(
"");
104 hg.startTag(
"p",
" style='color:gray; font-size:11px;'")
109 .write(I_.get(
"Issue notifier") +
" " +
110 I_.get(
"Issue") +
" #" + issue.
getId())
113 .write(
"{linkTmpSes}")
117 hg.startTableCol(
"");
121 .write(I_.get(
"Start Date") +
": ")
129 .write(I_.get(
"Control Date") +
": ")
137 .write(I_.get(
"Delivery") +
": ")
139 .write(DateFormats.format(issue.
getDelivery(),
true))
145 hg.startTableCol(
"");
149 .write(I_.get(
"Expenses") +
": ")
157 .write(I_.get(
"Hours") +
": ")
159 .write(DecimalFormats.format(issue.
getHours()) +
" / " + DecimalFormats.format(issue.
getSumHours()))
165 .write(I_.get(
"Price") +
": ")
167 .write(DecimalFormats.format(issue.
getPrice()) +
" / " + DecimalFormats.format(issue.
getSumPrice()))
173 if(!Strings.isBlank(comment)) {
175 .startTag(
"div",
" style='border-bottom: solid 1px #eeeeee;font-weight:bold'")
176 .write(I_.get(
"Comment"))
179 .write(StringParser.toHTML(comment))
184 .startTag(
"div",
" style='border-bottom: solid 1px #eeeeee;font-weight:bold'")
185 .write(I_.get(
"Participants"))
189 hg.write(ip.getName() +
": " + I_.byKey(ip.getRole().toString()))
194 if(p.isReceiveAllEmails()) {
195 hg.write(
"- " + p.getName() +
": " + I_.byKey(p.getRole().toString()))
201 return hg.toString();
204 private List<IContact> getPlayers(IConstructor constructor) {
205 ArrayList<IContact> list =
new ArrayList<>();
207 IContact ic = Contacts.getContact(ip.getIdContact());
208 if(ic.isValid() && ic.isWebUser()) {
static String linkForPath(Path path, IContact contact, LinkType type)
String getFullDescription()
ParticipantSet< IDossierParticipant > getFullParticipants()
Set< IssueParticipant > getParticipants()
void poolMail(IConstructor constructor, MessagePool pool)
IssueNotification(String comment, Issue issue)
void sendMail(IConstructor constructor)