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

Public Member Functions

 PublicationSendable (Publication entity)
 
 PublicationSendable (String entityPath)
 
String createRef (Publication publication) throws Exception
 
String createRef (String redir) throws Exception
 
Repository repository (Publication pub)
 
- Public Member Functions inherited from org.turro.sendable.AbstractSendable< T >
 AbstractSendable (T entity)
 
 AbstractSendable (String entityPath)
 
Date getSchedule ()
 
boolean isSent ()
 
AssistantSet getAssistants ()
 
void send (IConstructor constructor)
 
void send (IConstructor constructor, Collection< IContact > contacts)
 

Protected Member Functions

boolean doSend (Sendable sendable, Publication entity, IConstructor constructor, AssistantSet assistants, boolean checkSent)
 
void addAssistants (AssistantSet as, Publication entity)
 
- Protected Member Functions inherited from org.turro.sendable.AbstractSendable< T >
abstract boolean doSend (Sendable sendable, T entity, IConstructor constructor, AssistantSet assistants, boolean checkSent)
 
abstract void addAssistants (AssistantSet as, T entity)
 

Detailed Description

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

Definition at line 49 of file PublicationSendable.java.

Constructor & Destructor Documentation

◆ PublicationSendable() [1/2]

org.turro.entities.PublicationSendable.PublicationSendable ( Publication  entity)

Definition at line 53 of file PublicationSendable.java.

53  {
54  super(entity);
55  }

◆ PublicationSendable() [2/2]

org.turro.entities.PublicationSendable.PublicationSendable ( String  entityPath)

Definition at line 57 of file PublicationSendable.java.

57  {
58  super(entityPath);
59  }

Member Function Documentation

◆ addAssistants()

void org.turro.entities.PublicationSendable.addAssistants ( AssistantSet  as,
Publication  entity 
)
protected

Definition at line 98 of file PublicationSendable.java.

98  {
99  // do nothing
100  }

◆ createRef() [1/2]

String org.turro.entities.PublicationSendable.createRef ( Publication  publication) throws Exception

Definition at line 102 of file PublicationSendable.java.

102  {
103  String redir;
104  String entityUrl = ElephantContext.getEntityWebContext("/publication");
105  String ewu = EntityWebUrls.getUrlFromEntity(publication);
106  if(ewu != null && entityUrl != null) {
107  redir = entityUrl + ewu;
108  } else {
109  redir = "/";
110  }
111  return createRef(redir);
112  }
String createRef(Publication publication)
Here is the call graph for this function:

◆ createRef() [2/2]

String org.turro.entities.PublicationSendable.createRef ( String  redir) throws Exception

Definition at line 114 of file PublicationSendable.java.

114  {
115  return "{liveref:" + redir + "}";
116  }

◆ doSend()

boolean org.turro.entities.PublicationSendable.doSend ( Sendable  sendable,
Publication  entity,
IConstructor  constructor,
AssistantSet  assistants,
boolean  checkSent 
)
protected

Definition at line 62 of file PublicationSendable.java.

62  {
63  this.constructor = constructor;
64  if(ElephantMarker.existsTemplate(constructor, true, "envelope", "header")) {
65  MailMessagePool pool = MailProviders.instance().getPool(constructor, "Publication");
66  if(pool != null) {
67  List<MailAttachment> attached = getAttached(entity);
68  for(Assistant assistant : assistants) {
69  try {
70  MailMessageTemplate mmt = MailMessageTemplate.of(pool.getProvider());
71  mmt.setRoot("/publications");
72  mmt.setSubject(entity.getTitle()+ " - " + ElephantContext.getSiteName());
73  mmt.addTo(assistant.email, assistant.name);
74  ElephantMarker em = new ElephantMarker(constructor, true);
75  ArrayList<Publication> pubs = new ArrayList<>();
76  pubs.add(entity);
77  em.put("pubs", pubs);
78  em.put("contact", assistant.contact);
79  em.put("email", assistant.email);
80  em.put("notifier", this);
81  mmt.setMessage(em, "sendable", assistant.contact);
82  for(MailAttachment ma : attached) {
83  mmt.attach(ma.getPath(), ma.getName(), ma.getName());
84  }
85  pool.addToPool(mmt);
86  pool.sendPool();
87  if(checkSent) Sendables.delivered(sendable.getEntityPath(), assistant.contact.getId());
88  } catch (EmailException | NullPointerException ex) {
89  Logger.getLogger(PublicationSendable.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
90  }
91  }
92  }
93  }
94  return checkSent;
95  }
Here is the call graph for this function:

◆ repository()

Repository org.turro.entities.PublicationSendable.repository ( Publication  pub)

Definition at line 118 of file PublicationSendable.java.

118  {
119  return new FileAttach(PublicationPU.getObjectPath(pub)).getPublishableRepository(constructor);
120  }
Here is the call graph for this function:

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