BrightSide Workbench Full Report + Source Code
org.turro.publication.entity.Newsletter Class Reference
Inheritance diagram for org.turro.publication.entity.Newsletter:
Collaboration diagram for org.turro.publication.entity.Newsletter:

Public Member Functions

boolean isAccepted ()
 
void setAccepted (boolean accepted)
 
boolean isStaticContent ()
 
void setStaticContent (boolean staticContent)
 
String getIdCategory ()
 
void setIdCategory (String idCategory)
 
Date getCreation ()
 
void setCreation (Date creation)
 
Date getDate ()
 
String getDateStr ()
 
void setDate (Date date)
 
Long getId ()
 
void setId (Long id)
 
String getTitle ()
 
void setTitle (String title)
 
String getUnescapedTitle ()
 
String getLang ()
 
void setLang (String lang)
 
String getTemplate ()
 
void setTemplate (String template)
 
SendingChoice getSendingChoice ()
 
void setSendingChoice (SendingChoice sendingChoice)
 
Set< NewsSectiongetNewsSections ()
 
void setNewsSections (Set< NewsSection > newsSections)
 
Object entityId ()
 
boolean isEmpty ()
 
boolean trigger (IContact contact)
 
NotificationCategory getCategory ()
 
void setCategory (NotificationCategory category)
 
List< MailTrackergetTrackers ()
 
void generateNewsletter (IContact contact, Writer writer) throws IOException
 
boolean checkStartRow (NewsSection newsSection)
 
boolean checkEndRow (NewsSection newsSection)
 
void resetSections ()
 
void resetGlobalContext ()
 
MappingSet getSerializerMappings ()
 
- Public Member Functions inherited from org.turro.jpa.entity.IDaoEntity
default boolean isNew ()
 
default void prepareSave ()
 
default void prepareDelete ()
 
default void removeEmpties ()
 
default Collection< Collection > collections ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 53 of file Newsletter.java.

Member Function Documentation

◆ checkEndRow()

boolean org.turro.publication.entity.Newsletter.checkEndRow ( NewsSection  newsSection)

Definition at line 235 of file Newsletter.java.

235  {
236  NewsSection ns = new TreeSet<>(newsSections).higher(newsSection);
237  return ns == null || !ns.isNewColumn();
238  }
Here is the call graph for this function:

◆ checkStartRow()

boolean org.turro.publication.entity.Newsletter.checkStartRow ( NewsSection  newsSection)

Definition at line 230 of file Newsletter.java.

230  {
231  NewsSection ns = new TreeSet<>(newsSections).lower(newsSection);
232  return ns == null || !ns.isNewColumn();
233  }
Here is the call graph for this function:

◆ entityId()

Object org.turro.publication.entity.Newsletter.entityId ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 177 of file Newsletter.java.

177  {
178  return id;
179  }

◆ generateNewsletter()

void org.turro.publication.entity.Newsletter.generateNewsletter ( IContact  contact,
Writer  writer 
) throws IOException

Definition at line 208 of file Newsletter.java.

208  {
209  writer.write("<#include \"/macros/site/*/buttonMacro.ftl\">\n");
210  writer.write("<#include \"/macros/site/*/summaryMacro.ftl\">\n");
211  writer.write("<#include \"/envelope/site/*/header" +
212  (Strings.isBlank(template) ? "" : template) +
213  "Template.html\">\n");
214 
215  writer.write("<@start_full_table \"2\" \"2\"/>\n");
216 
217  for(NewsSection ns : new TreeSet<>(newsSections)) {
218  if(ns.canShow(contact)) {
219  ns.generateSection(writer);
220  }
221  }
222 
223  writer.write("<@end_table/>\n");
224 
225  writer.write("<#include \"/envelope/site/*/footer" +
226  (Strings.isBlank(template) ? "" : template) +
227  "Template.html\">\n");
228  }
Here is the caller graph for this function:

◆ getCategory()

NotificationCategory org.turro.publication.entity.Newsletter.getCategory ( )

Definition at line 196 of file Newsletter.java.

196  {
197  return idCategory != null ? Notifications.getCategory(idCategory) : null;
198  }
Here is the call graph for this function:

◆ getCreation()

Date org.turro.publication.entity.Newsletter.getCreation ( )

Definition at line 102 of file Newsletter.java.

102  {
103  return creation;
104  }

◆ getDate()

Date org.turro.publication.entity.Newsletter.getDate ( )

Definition at line 110 of file Newsletter.java.

110  {
111  return date;
112  }

◆ getDateStr()

String org.turro.publication.entity.Newsletter.getDateStr ( )

Definition at line 114 of file Newsletter.java.

114  {
115  return DateFormats.format(date, true);
116  }
Here is the call graph for this function:

◆ getId()

Long org.turro.publication.entity.Newsletter.getId ( )

Definition at line 122 of file Newsletter.java.

122  {
123  return id;
124  }
Here is the caller graph for this function:

◆ getIdCategory()

String org.turro.publication.entity.Newsletter.getIdCategory ( )

Definition at line 94 of file Newsletter.java.

94  {
95  return idCategory;
96  }
Here is the caller graph for this function:

◆ getLang()

String org.turro.publication.entity.Newsletter.getLang ( )

Definition at line 142 of file Newsletter.java.

142  {
143  return lang;
144  }
Here is the caller graph for this function:

◆ getNewsSections()

Set<NewsSection> org.turro.publication.entity.Newsletter.getNewsSections ( )

Definition at line 166 of file Newsletter.java.

166  {
167  return newsSections;
168  }
Here is the caller graph for this function:

◆ getSendingChoice()

SendingChoice org.turro.publication.entity.Newsletter.getSendingChoice ( )

Definition at line 158 of file Newsletter.java.

158  {
159  return sendingChoice;
160  }

◆ getSerializerMappings()

MappingSet org.turro.publication.entity.Newsletter.getSerializerMappings ( )

Definition at line 259 of file Newsletter.java.

259  {
260  MappingSet set = new MappingSet();
261  set.addMapping(Newsletter.class, 1,
262  new String[] { "id", "creation", "date", "accepted", "staticContent" },
263  new String[] { "title", "lang", "template", "idCategory", "sendingChoice",
264  "newsSections" });
265  set.addMapping(NewsSection.class, 2,
266  new String[] { "id", "newsOrder", "newColumn", "width", "useAsTrigger",
267  "hideIfEmpty", "type" },
268  new String[] { "body", "wiki", "banner" });
269  return set;
270  }

◆ getTemplate()

String org.turro.publication.entity.Newsletter.getTemplate ( )

Definition at line 150 of file Newsletter.java.

150  {
151  return template;
152  }

◆ getTitle()

String org.turro.publication.entity.Newsletter.getTitle ( )

Definition at line 130 of file Newsletter.java.

130  {
131  return title;
132  }
Here is the caller graph for this function:

◆ getTrackers()

List<MailTracker> org.turro.publication.entity.Newsletter.getTrackers ( )

Definition at line 204 of file Newsletter.java.

204  {
205  return new ArrayList<>();
206  }

◆ getUnescapedTitle()

String org.turro.publication.entity.Newsletter.getUnescapedTitle ( )

Definition at line 138 of file Newsletter.java.

138  {
139  return HTMLEntities.unescape(title);
140  }
Here is the call graph for this function:

◆ isAccepted()

boolean org.turro.publication.entity.Newsletter.isAccepted ( )

Definition at line 78 of file Newsletter.java.

78  {
79  return accepted;
80  }
Here is the caller graph for this function:

◆ isEmpty()

boolean org.turro.publication.entity.Newsletter.isEmpty ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 182 of file Newsletter.java.

182  {
183  return Strings.isBlank(title) || newsSections.isEmpty();
184  }

◆ isStaticContent()

boolean org.turro.publication.entity.Newsletter.isStaticContent ( )

Definition at line 86 of file Newsletter.java.

86  {
87  return staticContent;
88  }

◆ resetGlobalContext()

void org.turro.publication.entity.Newsletter.resetGlobalContext ( )

Clears ContentContext created during newsletter generation. For example ContactActivityMap, loaded on last-activity creation.

Definition at line 251 of file Newsletter.java.

251  {
252  newsSections.forEach((ns) -> {
253  ns.resetGlobalContext();
254  });
255  }
Here is the caller graph for this function:

◆ resetSections()

void org.turro.publication.entity.Newsletter.resetSections ( )

Definition at line 240 of file Newsletter.java.

240  {
241  newsSections.forEach((ns) -> {
242  ns.reset();
243  });
244  }
Here is the caller graph for this function:

◆ setAccepted()

void org.turro.publication.entity.Newsletter.setAccepted ( boolean  accepted)

Definition at line 82 of file Newsletter.java.

82  {
83  this.accepted = accepted;
84  }

◆ setCategory()

void org.turro.publication.entity.Newsletter.setCategory ( NotificationCategory  category)

Definition at line 200 of file Newsletter.java.

200  {
201  idCategory = category != null ? category.getIdCategory() : null;
202  }
Here is the call graph for this function:

◆ setCreation()

void org.turro.publication.entity.Newsletter.setCreation ( Date  creation)

Definition at line 106 of file Newsletter.java.

106  {
107  this.creation = creation;
108  }

◆ setDate()

void org.turro.publication.entity.Newsletter.setDate ( Date  date)

Definition at line 118 of file Newsletter.java.

118  {
119  this.date = date;
120  }

◆ setId()

void org.turro.publication.entity.Newsletter.setId ( Long  id)

Definition at line 126 of file Newsletter.java.

126  {
127  this.id = id;
128  }

◆ setIdCategory()

void org.turro.publication.entity.Newsletter.setIdCategory ( String  idCategory)

Definition at line 98 of file Newsletter.java.

98  {
99  this.idCategory = idCategory;
100  }

◆ setLang()

void org.turro.publication.entity.Newsletter.setLang ( String  lang)

Definition at line 146 of file Newsletter.java.

146  {
147  this.lang = lang;
148  }

◆ setNewsSections()

void org.turro.publication.entity.Newsletter.setNewsSections ( Set< NewsSection newsSections)

Definition at line 170 of file Newsletter.java.

170  {
171  this.newsSections = newsSections;
172  }

◆ setSendingChoice()

void org.turro.publication.entity.Newsletter.setSendingChoice ( SendingChoice  sendingChoice)

Definition at line 162 of file Newsletter.java.

162  {
163  this.sendingChoice = sendingChoice;
164  }

◆ setStaticContent()

void org.turro.publication.entity.Newsletter.setStaticContent ( boolean  staticContent)

Definition at line 90 of file Newsletter.java.

90  {
91  this.staticContent = staticContent;
92  }

◆ setTemplate()

void org.turro.publication.entity.Newsletter.setTemplate ( String  template)

Definition at line 154 of file Newsletter.java.

154  {
155  this.template = template;
156  }

◆ setTitle()

void org.turro.publication.entity.Newsletter.setTitle ( String  title)

Definition at line 134 of file Newsletter.java.

134  {
135  this.title = HTMLEntities.escape(title);
136  }
Here is the call graph for this function:

◆ trigger()

boolean org.turro.publication.entity.Newsletter.trigger ( IContact  contact)

Helpers

Definition at line 188 of file Newsletter.java.

188  {
189  if(newsSections.stream().anyMatch((ns) -> (ns.isUseAsTrigger()))) {
190  return newsSections.stream().anyMatch((ns) -> (ns.isUseAsTrigger() && ns.canShow(contact)));
191  } else {
192  return true;
193  }
194  }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: