BrightSide Workbench Full Report + Source Code
org.turro.sendable.Sendables Class Reference

Static Public Member Functions

static void send (IConstructor constructor)
 
static Collection< SendablegetSendables ()
 
static Sendable getSendable (String entityPath)
 
static Collection< SendableAssistantgetAssistants (String entityPath, boolean all)
 
static void cleanOrphans ()
 
static void delete (String entityPath)
 
static void delivered (String entityPath, String contactId)
 
static void sent (String entityPath)
 

Detailed Description

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

Definition at line 38 of file Sendables.java.

Member Function Documentation

◆ cleanOrphans()

static void org.turro.sendable.Sendables.cleanOrphans ( )
static

Definition at line 88 of file Sendables.java.

88  {
89  Dao dao = new ElephantPU();
90  WhereClause wc = new WhereClause();
91  wc.addClause("delete from SendableAssistant");
92  wc.addClause("where not exists (");
93  wc.addClause("select s from Sendable s");
94  wc.addClause("where s.entityPath = entityPath");
95  wc.addClause(")");
96  dao.executeUpdate(wc);
97  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete()

static void org.turro.sendable.Sendables.delete ( String  entityPath)
static

Definition at line 99 of file Sendables.java.

99  {
100  Dao dao = new ElephantPU();
101  WhereClause wc = new WhereClause();
102  wc.addClause("delete from SendableAssistant");
103  wc.addClause("where entityPath = :path");
104  wc.addNamedValue("path", entityPath);
105  dao.executeUpdate(wc);
106  wc = new WhereClause();
107  wc.addClause("delete from Sendable");
108  wc.addClause("where entityPath = :path");
109  wc.addNamedValue("path", entityPath);
110  dao.executeUpdate(wc);
111  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ delivered()

static void org.turro.sendable.Sendables.delivered ( String  entityPath,
String  contactId 
)
static

Definition at line 113 of file Sendables.java.

113  {
114  Dao dao = new ElephantPU();
115  WhereClause wc = new WhereClause();
116  wc.addClause("update SendableAssistant");
117  wc.addClause("set delivered = TRUE");
118  wc.addClause("where entityPath = :path");
119  wc.addNamedValue("path", entityPath);
120  wc.addClause("and contactId = :contact");
121  wc.addNamedValue("contact", contactId);
122  dao.executeUpdate(wc);
123  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAssistants()

static Collection<SendableAssistant> org.turro.sendable.Sendables.getAssistants ( String  entityPath,
boolean  all 
)
static

Definition at line 76 of file Sendables.java.

76  {
77  Dao dao = new ElephantPU();
78  WhereClause wc = new WhereClause();
79  wc.addClause("select sa from SendableAssistant sa");
80  wc.addClause("where sa.entityPath = :path");
81  wc.addNamedValue("path", entityPath);
82  if(!all) {
83  wc.addClause("and sa.delivered = FALSE");
84  }
85  return dao.getResultList(wc);
86  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSendable()

static Sendable org.turro.sendable.Sendables.getSendable ( String  entityPath)
static

Definition at line 67 of file Sendables.java.

67  {
68  Dao dao = new ElephantPU();
69  WhereClause wc = new WhereClause();
70  wc.addClause("select s from Sendable s");
71  wc.addClause("where s.entityPath = :path");
72  wc.addNamedValue("path", entityPath);
73  return (Sendable) dao.getSingleResultOrNull(wc);
74  }
Here is the call graph for this function:

◆ getSendables()

static Collection<Sendable> org.turro.sendable.Sendables.getSendables ( )
static

Definition at line 57 of file Sendables.java.

57  {
58  Dao dao = new ElephantPU();
59  WhereClause wc = new WhereClause();
60  wc.addClause("select s from Sendable s");
61  wc.addClause("where s.sent = FALSE");
62  wc.addClause("and s.schedule < :now");
63  wc.addNamedValue("now", new Date());
64  return dao.getResultList(wc);
65  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send()

static void org.turro.sendable.Sendables.send ( IConstructor  constructor)
static

Definition at line 40 of file Sendables.java.

40  {
41  boolean lockAcquired = SENDABLE_LOCK.tryLock();
42  if(lockAcquired) {
43  try {
44  for(Sendable sendable : getSendables()) {
45  IElephantEntity iee = Entities.getController(sendable.getEntityPath());
46  IElephantSendable is = iee.getSendable();
47  if(is != null) {
48  is.send(constructor);
49  }
50  }
51  } finally {
52  SENDABLE_LOCK.unlock();
53  }
54  }
55  }
static Collection< Sendable > getSendables()
Definition: Sendables.java:57
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sent()

static void org.turro.sendable.Sendables.sent ( String  entityPath)
static

Definition at line 125 of file Sendables.java.

125  {
126  Dao dao = new ElephantPU();
127  WhereClause wc = new WhereClause();
128  wc.addClause("update Sendable");
129  wc.addClause("set sent = TRUE");
130  wc.addClause("where entityPath = :path");
131  wc.addNamedValue("path", entityPath);
132  dao.executeUpdate(wc);
133  }
Here is the call graph for this function:

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