BrightSide Workbench Full Report + Source Code
org.turro.newsletter.NewsletterDashboard Class Reference
Inheritance diagram for org.turro.newsletter.NewsletterDashboard:
Collaboration diagram for org.turro.newsletter.NewsletterDashboard:

Public Member Functions

 NewsletterDashboard ()
 
void loadData () throws ServletException, IOException
 
void startConstruction () throws ServletException, IOException
 
String getStart ()
 
String getEnd ()
 
FoundList search (String value, boolean ignoreCase)
 
List< SyndEntry > getSyndEntries ()
 
- Public Member Functions inherited from org.turro.elephant.impl.abstracts.AbstractElement
 AbstractElement ()
 
String getId ()
 
String getType ()
 
String getTitle ()
 
void setTitle (String title)
 
Collection< String > getMetas ()
 
void setMetas (Collection< String > metas)
 
ElContext getContext ()
 
IConstructor getConstructor ()
 
void setConfiguration (IConstructor constructor, ElContext context)
 
String getStartTitle ()
 
String getEndTitle ()
 
String getStartBody ()
 
String getEndBody ()
 
String getStartFooter ()
 
String getEndFooter ()
 
String getStartOption ()
 
String getEndOption ()
 
boolean canDisplay ()
 
boolean isSelectable ()
 
boolean isInRole ()
 
boolean canPrint ()
 
String getElementFolder ()
 
boolean isOriginalContext ()
 
void setRootCategories (ElContext root)
 
String getTypeName ()
 
AttributeSupport getAttributes ()
 
void applyChanges ()
 
void populateFromParent ()
 
void setDefaultMetas ()
 
void setConfiguration (Element conf, Element factory)
 

Protected Attributes

String sclass
 
long groupId
 
int count
 
PublicationIterator pi
 
- Protected Attributes inherited from org.turro.elephant.impl.abstracts.AbstractElement
IConstructor constructor
 
ElContext context
 
AttributeSupport attrSupport
 
Element conf = null
 
String[] types
 
String title
 
Collection< String > metas
 

Detailed Description

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

Definition at line 54 of file NewsletterDashboard.java.

Constructor & Destructor Documentation

◆ NewsletterDashboard()

org.turro.newsletter.NewsletterDashboard.NewsletterDashboard ( )

Definition at line 61 of file NewsletterDashboard.java.

61  {
62  super();
63  }

Member Function Documentation

◆ getEnd()

String org.turro.newsletter.NewsletterDashboard.getEnd ( )

Reimplemented from org.turro.elephant.impl.abstracts.AbstractElement.

Definition at line 130 of file NewsletterDashboard.java.

130  {
131  return "</div>";
132  }
Here is the caller graph for this function:

◆ getStart()

String org.turro.newsletter.NewsletterDashboard.getStart ( )

Reimplemented from org.turro.elephant.impl.abstracts.AbstractElement.

Definition at line 125 of file NewsletterDashboard.java.

125  {
126  return "<div class='" + sclass + "publication-web'>";
127  }
Here is the caller graph for this function:

◆ getSyndEntries()

List<SyndEntry> org.turro.newsletter.NewsletterDashboard.getSyndEntries ( )

Implements org.turro.elephant.feed.IRSSable.

Definition at line 177 of file NewsletterDashboard.java.

177  {
178  contactId = getAttributes().getAttributeValue("attrib:contactId", null);
179  groupId = getAttributes().getAttributeIntegerValue("attrib:groupId", 0);
180  categoryId = getAttributes().getAttributeIntegerValue("attrib:categoryId", 0);
181  SyndEntry entry;
182  SyndContent description;
183  List<SyndEntry> entries = new ArrayList<>();
184  int rsscount = this.getAttributes().getAttributeIntegerValue("attrib:rss_count", 10);
185  List<Publication> list = PublicationCategories.getPublicationsBy(
186  rsscount, groupId, categoryId, contactId, true);
187  String serverBase = ElephantContext.getServerBase("http");
188  for(Publication pub : list) {
189  entry = new SyndEntryImpl();
190  entry.setTitle(pub.getTitle());
191  entry.setLink(serverBase + context.getFullPath() + getItemLink(pub));
192  entry.setPublishedDate(pub.getDate());
193  entry.setAuthor(pub.getAuthor());
194  description = new SyndContentImpl();
195  description.setType("text/html");
196  String summary = pub.getSummary();
197  if(!Strings.isBlank(summary)) {
198  summary = summary.replaceAll("href=\\'(?![a-z]+:)(\\/?)\\/?([^\\']*)\\'", "href=\\'" + serverBase + "$1$2\\'")
199  .replaceAll("src=\\'(?![a-z]+:)(\\/?)\\/?([^\\']*)\\'", "src=\\'" + serverBase + "$1$2\\'")
200  .replaceAll("href=\\\"(?![a-z]+:)(\\/?)\\/?([^\\\"]*)\\\"", "href=\\\"" + serverBase + "$1$2\\\"")
201  .replaceAll("src=\\\"(?![a-z]+:)(\\/?)\\/?([^\\\"]*)\\\"", "src=\\\"" + serverBase + "$1$2\\\"");
202  description.setValue(summary);
203  }
204  entry.setDescription(description);
205  entries.add(entry);
206  }
207  return entries;
208  }
Here is the call graph for this function:

◆ loadData()

void org.turro.newsletter.NewsletterDashboard.loadData ( ) throws ServletException, IOException

This method loads element's data. It gets called within IConstructor.startConstruction() and before element's startConstruction() method.

Exceptions
javax.servlet.ServletException
java.io.IOException

Implements org.turro.elephant.context.IElement.

Definition at line 66 of file NewsletterDashboard.java.

66  {
67  sclass = getAttributes().getAttributeValue("attrib:sclass", "");
68  fullTemplate = getAttributes().getAttributeValue("attrib:fullTemplate", "");
69  summaryTemplate = getAttributes().getAttributeValue("attrib:summaryTemplate", "");
70  contactId = getAttributes().getAttributeValue("attrib:contactId", null);
71  groupId = getAttributes().getAttributeIntegerValue("attrib:groupId", 0);
72  categoryId = getAttributes().getAttributeIntegerValue("attrib:categoryId", 0);
73  publicationId = getAttributes().getAttributeIntegerValue("attrib:publicationId", 0);
74  count = getAttributes().getAttributeIntegerValue("attrib:count", 10);
75 
76  if(publicationId > 0) {
77  } else {
78  pi = new PublicationIterator(getConstructor(), getContext().getFullPath(), getId());
79  pi.setFullTemplate(fullTemplate);
80  pi.setSummaryTemplate(summaryTemplate);
81  pi.setPage(count);
82  pi.setContactId(contactId);
84  pi.setCategoryId(categoryId);
85  pi.load();
86  setTitle(pi.getTitle());
87  if(pi.isItem()) {
88  setMetas(pi.getMetas());
89  } else {
91  }
92  }
93  }
void setFullTemplate(String fullTemplate)
void setSummaryTemplate(String summaryTemplate)
void setMetas(Collection< String > metas)
Here is the call graph for this function:

◆ search()

FoundList org.turro.newsletter.NewsletterDashboard.search ( String  value,
boolean  ignoreCase 
)

This method is called by Elephant search implementation.

Parameters
valueValue to search.
ignoreCaseWhether to ignore case.
Returns
A list of coincidences.

Implements org.turro.elephant.search.ISearchable.

Definition at line 137 of file NewsletterDashboard.java.

137  {
138  FoundList fl = new FoundList();
139 
140  String extraSql =
141  "and (" + SearchFormatter.queryToSQL("publication.publicationCategory.name", value, ignoreCase) +
142  "or " + SearchFormatter.queryToSQL("publication.title", value, ignoreCase) +
143  "or " + SearchFormatter.queryToSQL("publication.summary", value, ignoreCase) +
144  "or " + SearchFormatter.queryToSQL("publication.body", value, ignoreCase) +
145  ")";
146 
147  List<Publication> list = PublicationCategories.getPublicationsBy(
148  0, groupId, categoryId, contactId, true, extraSql);
149 
150  for(Publication pub : list) {
151  SearchFormatter sf = new SearchFormatter(value, ignoreCase);
152  sf.processLine(pub.getTitle());
153  sf.processLine(pub.getPublicationCategory().getName());
154  sf.processLine(pub.getSummary());
155  sf.processLine(pub.getBody());
156  if(sf.wasFound()) {
157  fl.addItem(
158  getId() == null ? "" : getId(),
159  context.getPath(),
160  "<img src='" + ElephantContext.getRootResourcePath() + "/_internal/system/images/blog.gif'/>",
161  pub.getTitle(),
162  sf.getResult(),
163  (double)sf.getFound(),
164  value
165  );
166  }
167  }
168 
169  return fl;
170  }
Here is the call graph for this function:

◆ startConstruction()

void org.turro.newsletter.NewsletterDashboard.startConstruction ( ) throws ServletException, IOException

This method start element's construction. It gets called within IConstructor.startConstruction().

Exceptions
javax.servlet.ServletException
java.io.IOException

Implements org.turro.elephant.context.IElement.

Definition at line 96 of file NewsletterDashboard.java.

96  {
97  PrintWriter out = getConstructor().getOut();
98  out.print(getStart());
99  out.print(getStartBody());
100 
101  long fullPub = (Long) ObjectString.parseNativeString(getConstructor().getParameter("pubid"), Long.class, true);
102 
103  if(publicationId > 0) {
104  Publication pub = new PublicationPU().find(Publication.class, publicationId);
105  out.print("");
106  } else {
107  CategoryFilter cf = null;
108  if(categoryId == 0) {
109  cf = new CategoryFilter(getConstructor(), getId());
110  cf.processParameters();
111  }
112  if(cf != null) {
113  DaoHtmlSearch dhs = DaoHtmlSearch.getInstance(getConstructor(), ElephantContext.getContextVariable(getConstructor()));
114  pi.setSearchEngine(dhs);
115  pi.setCategoryFilter(cf);
116  }
117  pi.render();
118  }
119 
120  out.print(getEndBody());
121  out.print(getEnd());
122  }
void setSearchEngine(DaoHtmlSearch searchEngine)
void setCategoryFilter(CategoryFilter categoryFilter)
Here is the call graph for this function:

Member Data Documentation

◆ count

int org.turro.newsletter.NewsletterDashboard.count
protected

Definition at line 58 of file NewsletterDashboard.java.

◆ groupId

long org.turro.newsletter.NewsletterDashboard.groupId
protected

Definition at line 57 of file NewsletterDashboard.java.

◆ pi

PublicationIterator org.turro.newsletter.NewsletterDashboard.pi
protected

Definition at line 59 of file NewsletterDashboard.java.

◆ sclass

String org.turro.newsletter.NewsletterDashboard.sclass
protected

Definition at line 56 of file NewsletterDashboard.java.


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