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

Public Member Functions

void onPreview ()
 
void onSendNow ()
 
void onTitle (InputEvent event)
 
void doFinally () throws Exception
 
void afterSave ()
 
- Public Member Functions inherited from org.turro.jpa.composer.EntityComposer< E, ID >
final void onChange (Event event)
 
final void onSave ()
 
final void onDelete ()
 
Object getEntity ()
 
Object getWrapper ()
 
void doBeforeComposeChildren (Component comp) throws Exception
 
void doAfterCompose (Component comp) throws Exception
 

Protected Member Functions

String getAttributeName ()
 
Newsletter getEntityInstance (Long id)
 
DaoEntity getWrapperInstance (Component comp)
 
boolean beforeSave ()
 
boolean shouldBeSaved ()
 
boolean inSaveRole ()
 
boolean inDeleteRole ()
 
void doOnDelete ()
 
- Protected Member Functions inherited from org.turro.jpa.composer.EntityComposer< E, ID >
abstract E getEntityInstance (ID id)
 
void doOnSave ()
 
boolean beforeDelete ()
 
void afterDelete ()
 
void doOnChange ()
 
boolean hasChanged ()
 
void retrieveEntity ()
 
boolean canClose ()
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.jpa.composer.EntityComposer< E, ID >
entity
 
DaoEntity wrapper
 

Detailed Description

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

Definition at line 62 of file NewsletterComposer.java.

Member Function Documentation

◆ afterSave()

void org.turro.newsletter.NewsletterComposer.afterSave ( )

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 198 of file NewsletterComposer.java.

198  {
199  if(entity != null) {
200  PublicationMenu.showNewsletter(entity.getId());
201  }
202  }
Here is the call graph for this function:

◆ beforeSave()

boolean org.turro.newsletter.NewsletterComposer.beforeSave ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 175 of file NewsletterComposer.java.

175  {
176  if(modified && !Application.getApplication().isInRole("publication:accept")) {
177  entity.setAccepted(false);
178  }
179  return super.beforeSave();
180  }
Here is the call graph for this function:

◆ doFinally()

void org.turro.newsletter.NewsletterComposer.doFinally ( ) throws Exception

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 156 of file NewsletterComposer.java.

156  {
157  super.doFinally();
158  newsDate.setValue(entity.getDate());
159  newsCategory.setCategory(entity.getCategory());
160  newsLang.setObjectValue(entity.getLang());
161  newsTemplate.setObjectValue(entity.getTemplate());
162  newsTitle.setValue(entity.getUnescapedTitle());
163  accepted.setChecked(entity.isAccepted());
164  staticContent.setChecked(entity.isStaticContent());
165  sendingChoice.setObjectValue(entity.getSendingChoice());
166  if(!Application.getApplication().isInRole("publication:accept")) {
167  accepted.setDisabled(true);
168  }
169  sectionsGrid.setNewsletter(entity);
170  actionWithEntity.setRoot("contact");
171  actionWithEntity.setEntity(Authentication.getIContact().getContact());
172  }
void setNewsletter(Newsletter newsletter)
void setCategory(NotificationCategory category)
Here is the call graph for this function:

◆ doOnDelete()

void org.turro.newsletter.NewsletterComposer.doOnDelete ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 205 of file NewsletterComposer.java.

205  {
206  Messages.confirmDeletion().show(() -> {
207  NewsletterComposer.super.doOnDelete();
208  });
209  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAttributeName()

String org.turro.newsletter.NewsletterComposer.getAttributeName ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 129 of file NewsletterComposer.java.

129  {
130  return "newsletter";
131  }

◆ getEntityInstance()

Newsletter org.turro.newsletter.NewsletterComposer.getEntityInstance ( Long  id)
protected

Definition at line 134 of file NewsletterComposer.java.

134  {
135  if(id == null) {
136  entity = new Newsletter();
137  entity.setCreation(new Date());
138  entity.setDate(entity.getCreation());
139  entity.setSendingChoice(SendingChoice.USER_WANTS);
140  entity.setCategory(Notifications.getCategory(GenericElephantNotification.GENERIC_NOTIFICATION));
141  } else {
142  entity = new PublicationPU().find(Newsletter.class, id);
143  }
144  return entity;
145  }
Here is the call graph for this function:

◆ getWrapperInstance()

DaoEntity org.turro.newsletter.NewsletterComposer.getWrapperInstance ( Component  comp)
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 148 of file NewsletterComposer.java.

148  {
149  NewsletterWrapper w = new NewsletterWrapper(entity);
150  Framework.getCurrent().setSelectedLabel(w.getTabLabel());
151  Framework.getCurrent().setSelectedTooltiptext(w.getTooltiptext());
152  return w;
153  }
Here is the call graph for this function:

◆ inDeleteRole()

boolean org.turro.newsletter.NewsletterComposer.inDeleteRole ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 193 of file NewsletterComposer.java.

193  {
194  return Application.getApplication().isInRole("publication:delete");
195  }
Here is the call graph for this function:

◆ inSaveRole()

boolean org.turro.newsletter.NewsletterComposer.inSaveRole ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 188 of file NewsletterComposer.java.

188  {
189  return Application.getApplication().isInRole("publication:edit");
190  }
Here is the call graph for this function:

◆ onPreview()

void org.turro.newsletter.NewsletterComposer.onPreview ( )

Definition at line 97 of file NewsletterComposer.java.

97  {
98  IContact contact = Contacts.getContact(actionWithEntity.getEntity());
99  if(contact != null && contact.isWebUser()) {
100  try (NewsletterTemplate nt = new NewsletterTemplate(entity)) {
101  MailMessageTemplate mmt = nt.getMailMessage(null, contact);
102  Div div = new Div();
103  div.setStyle("overflow:auto;");
104  Html html = new Html(new MailInline().inline(mmt.getMessage()));
105  div.appendChild(html);
106  SelectionDialog.showComponent(getPage(), I_.get("Preview"), div, "800px", "80%", null);
107  entity.resetGlobalContext();
108  } catch (IOException ex) {
109  Logger.getLogger(NewsletterComposer.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
110  }
111  }
112  }
Here is the call graph for this function:

◆ onSendNow()

void org.turro.newsletter.NewsletterComposer.onSendNow ( )

Definition at line 115 of file NewsletterComposer.java.

115  {
116  if(entity != null && !entity.isEmpty()) {
117  new NewsletterSendToSubscribers(entity).send();
118  Clients.showNotification(I_.get("Queued sender started"));
119  }
120  }
Here is the call graph for this function:

◆ onTitle()

void org.turro.newsletter.NewsletterComposer.onTitle ( InputEvent  event)

Definition at line 123 of file NewsletterComposer.java.

123  {
124  entity.setTitle(event.getValue());
125  modified = true;
126  }

◆ shouldBeSaved()

boolean org.turro.newsletter.NewsletterComposer.shouldBeSaved ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 183 of file NewsletterComposer.java.

183  {
184  return !entity.isEmpty() && super.shouldBeSaved();
185  }

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