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

Public Member Functions

Long getId ()
 
void setId (Long id)
 
String getTitle ()
 
void setTitle (String title)
 
String getLocation ()
 
void setLocation (String location)
 
String getEntityPath ()
 
void setEntityPath (String entityPath)
 
Date getDeadline ()
 
void setDeadline (Date deadline)
 
String getWiki ()
 
void setWiki (String wiki)
 
String getText ()
 
void setText (String text)
 
int getMaxPerOption ()
 
void setMaxPerOption (int maxPerOption)
 
int getMaxVotedOptions ()
 
void setMaxVotedOptions (int maxVotedOptions)
 
boolean isShowParticipants ()
 
void setShowParticipants (boolean showParticipants)
 
boolean isShowVotes ()
 
void setShowVotes (boolean showVotes)
 
boolean isAllowInsertions ()
 
void setAllowInsertions (boolean allowInsertions)
 
boolean isAllowNegatives ()
 
void setAllowNegatives (boolean allowNegatives)
 
String getOptionClass ()
 
void setOptionClass (String optionClass)
 
String getOptionStart ()
 
void setOptionStart (String optionStart)
 
String getOptionEnd ()
 
void setOptionEnd (String optionEnd)
 
Object entityId ()
 
boolean isEmpty ()
 
boolean canVote ()
 
IElephantEntity getEntity ()
 
List< PollOptiongetOptions ()
 
List< PollVotegetVotes ()
 
List< PollVotegetVotes (IContact contact)
 
AssistantSet getParticipants ()
 
boolean isParticipant ()
 
boolean isParticipant (IContact contact)
 
boolean isFullyVoted ()
 
boolean isFullyVoted (IContact contact)
 
int hashCode ()
 
boolean equals (Object obj)
 
int compareTo (Poll o)
 
- 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 Poll.java.

Member Function Documentation

◆ canVote()

boolean org.turro.elephant.entities.db.Poll.canVote ( )

Definition at line 218 of file Poll.java.

218  {
219  return !isEmpty() && deadline.after(new Date());
220  }
Here is the call graph for this function:

◆ compareTo()

int org.turro.elephant.entities.db.Poll.compareTo ( Poll  o)

Definition at line 316 of file Poll.java.

316  {
317  int result = CompareUtil.compare(o.deadline, deadline);
318  if(result == 0) {
319  CompareUtil.compare(o.id, id);
320  }
321  return result;
322  }

◆ entityId()

Object org.turro.elephant.entities.db.Poll.entityId ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 207 of file Poll.java.

207  {
208  return id;
209  }

◆ equals()

boolean org.turro.elephant.entities.db.Poll.equals ( Object  obj)

Definition at line 298 of file Poll.java.

298  {
299  if (this == obj) {
300  return true;
301  }
302  if (obj == null) {
303  return false;
304  }
305  if (getClass() != obj.getClass()) {
306  return false;
307  }
308  final Poll other = (Poll) obj;
309  if (!Objects.equals(this.id, other.id)) {
310  return false;
311  }
312  return true;
313  }

◆ getDeadline()

Date org.turro.elephant.entities.db.Poll.getDeadline ( )

Definition at line 107 of file Poll.java.

107  {
108  return deadline;
109  }

◆ getEntity()

IElephantEntity org.turro.elephant.entities.db.Poll.getEntity ( )

Definition at line 222 of file Poll.java.

222  {
223  return Entities.getController(entityPath);
224  }
Here is the call graph for this function:

◆ getEntityPath()

String org.turro.elephant.entities.db.Poll.getEntityPath ( )

Definition at line 99 of file Poll.java.

99  {
100  return entityPath;
101  }

◆ getId()

Long org.turro.elephant.entities.db.Poll.getId ( )

Definition at line 75 of file Poll.java.

75  {
76  return id;
77  }
Here is the caller graph for this function:

◆ getLocation()

String org.turro.elephant.entities.db.Poll.getLocation ( )

Definition at line 91 of file Poll.java.

91  {
92  return location;
93  }

◆ getMaxPerOption()

int org.turro.elephant.entities.db.Poll.getMaxPerOption ( )

Definition at line 132 of file Poll.java.

132  {
133  return maxPerOption;
134  }

◆ getMaxVotedOptions()

int org.turro.elephant.entities.db.Poll.getMaxVotedOptions ( )

Definition at line 140 of file Poll.java.

140  {
141  return maxVotedOptions;
142  }

◆ getOptionClass()

String org.turro.elephant.entities.db.Poll.getOptionClass ( )

Definition at line 180 of file Poll.java.

180  {
181  return optionClass;
182  }
Here is the caller graph for this function:

◆ getOptionEnd()

String org.turro.elephant.entities.db.Poll.getOptionEnd ( )

Definition at line 196 of file Poll.java.

196  {
197  return optionEnd;
198  }

◆ getOptions()

List<PollOption> org.turro.elephant.entities.db.Poll.getOptions ( )

Definition at line 226 of file Poll.java.

226  {
227  WhereClause wc = new WhereClause();
228  wc.addClause("select opt from PollOption opt");
229  wc.addClause("where opt.idPoll = :idPoll");
230  wc.addNamedValue("idPoll", this.getId());
231  wc.addClause("order by opt.ordering, opt.pollData");
232  return new ElephantPU().getResultList(wc);
233  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOptionStart()

String org.turro.elephant.entities.db.Poll.getOptionStart ( )

Definition at line 188 of file Poll.java.

188  {
189  return optionStart;
190  }

◆ getParticipants()

AssistantSet org.turro.elephant.entities.db.Poll.getParticipants ( )

Definition at line 259 of file Poll.java.

259  {
260  if(assistantSet == null) {
261  assistantSet = new AssistantSet();
262  Assistants.addAssistants(entityPath, true, assistantSet, AssistantConstants.all());
263  }
264  return assistantSet;
265  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getText()

String org.turro.elephant.entities.db.Poll.getText ( )

Definition at line 124 of file Poll.java.

124  {
125  return text == null ? null : text.replaceAll("\\{site\\}", ElephantContext.getSiteName());
126  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTitle()

String org.turro.elephant.entities.db.Poll.getTitle ( )

Definition at line 83 of file Poll.java.

83  {
84  return title;
85  }
Here is the caller graph for this function:

◆ getVotes() [1/2]

List<PollVote> org.turro.elephant.entities.db.Poll.getVotes ( )

Definition at line 235 of file Poll.java.

235  {
236  WhereClause wc = new WhereClause();
237  wc.addClause("select vote from PollVote vote");
238  wc.addClause("where vote.idPoll = :idPoll");
239  wc.addNamedValue("idPoll", this.getId());
240  wc.addClause("order by vote.idPoll, vote.pollData");
241  return new ElephantPU().getResultList(wc);
242  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVotes() [2/2]

List<PollVote> org.turro.elephant.entities.db.Poll.getVotes ( IContact  contact)

Definition at line 244 of file Poll.java.

244  {
245  WhereClause wc = new WhereClause();
246  wc.addClause("select vote from PollVote vote");
247  wc.addClause("where vote.idPoll = :idPoll");
248  wc.addNamedValue("idPoll", this.getId());
249  wc.addClause("and vote.idContact = :contact");
250  wc.addNamedValue("contact", contact.getId());
251  wc.addClause("order by vote.idPoll, vote.pollData");
252  return new ElephantPU().getResultList(wc);
253  }
Here is the call graph for this function:

◆ getWiki()

String org.turro.elephant.entities.db.Poll.getWiki ( )

Definition at line 115 of file Poll.java.

115  {
116  return wiki;
117  }

◆ hashCode()

int org.turro.elephant.entities.db.Poll.hashCode ( )

Definition at line 291 of file Poll.java.

291  {
292  int hash = 5;
293  hash = 17 * hash + Objects.hashCode(this.id);
294  return hash;
295  }

◆ isAllowInsertions()

boolean org.turro.elephant.entities.db.Poll.isAllowInsertions ( )

Definition at line 164 of file Poll.java.

164  {
165  return allowInsertions;
166  }

◆ isAllowNegatives()

boolean org.turro.elephant.entities.db.Poll.isAllowNegatives ( )

Definition at line 172 of file Poll.java.

172  {
173  return allowNegatives;
174  }
Here is the caller graph for this function:

◆ isEmpty()

boolean org.turro.elephant.entities.db.Poll.isEmpty ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 212 of file Poll.java.

212  {
213  return Strings.isBlank(title) || deadline == null;
214  }
Here is the caller graph for this function:

◆ isFullyVoted() [1/2]

boolean org.turro.elephant.entities.db.Poll.isFullyVoted ( )

Definition at line 275 of file Poll.java.

275  {
276  return isFullyVoted(Authentication.getIContact());
277  }
Here is the call graph for this function:

◆ isFullyVoted() [2/2]

boolean org.turro.elephant.entities.db.Poll.isFullyVoted ( IContact  contact)

Definition at line 279 of file Poll.java.

279  {
280  for(PollOption po : getOptions()) {
281  if(po.getPollVote(contact) == null) {
282  return false;
283  }
284  }
285  return true;
286  }
List< PollOption > getOptions()
Definition: Poll.java:226
Here is the call graph for this function:

◆ isParticipant() [1/2]

boolean org.turro.elephant.entities.db.Poll.isParticipant ( )

Definition at line 267 of file Poll.java.

267  {
268  return isParticipant(Authentication.getIContact());
269  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isParticipant() [2/2]

boolean org.turro.elephant.entities.db.Poll.isParticipant ( IContact  contact)

Definition at line 271 of file Poll.java.

271  {
272  return getParticipants().exists(contact);
273  }
boolean exists(IContact contact)
Here is the call graph for this function:

◆ isShowParticipants()

boolean org.turro.elephant.entities.db.Poll.isShowParticipants ( )

Definition at line 148 of file Poll.java.

148  {
149  return showParticipants;
150  }
Here is the caller graph for this function:

◆ isShowVotes()

boolean org.turro.elephant.entities.db.Poll.isShowVotes ( )

Definition at line 156 of file Poll.java.

156  {
157  return showVotes;
158  }

◆ setAllowInsertions()

void org.turro.elephant.entities.db.Poll.setAllowInsertions ( boolean  allowInsertions)

Definition at line 168 of file Poll.java.

168  {
169  this.allowInsertions = allowInsertions;
170  }
Here is the caller graph for this function:

◆ setAllowNegatives()

void org.turro.elephant.entities.db.Poll.setAllowNegatives ( boolean  allowNegatives)

Definition at line 176 of file Poll.java.

176  {
177  this.allowNegatives = allowNegatives;
178  }
Here is the caller graph for this function:

◆ setDeadline()

void org.turro.elephant.entities.db.Poll.setDeadline ( Date  deadline)

Definition at line 111 of file Poll.java.

111  {
112  this.deadline = deadline;
113  }
Here is the caller graph for this function:

◆ setEntityPath()

void org.turro.elephant.entities.db.Poll.setEntityPath ( String  entityPath)

Definition at line 103 of file Poll.java.

103  {
104  this.entityPath = entityPath;
105  }
Here is the caller graph for this function:

◆ setId()

void org.turro.elephant.entities.db.Poll.setId ( Long  id)

Definition at line 79 of file Poll.java.

79  {
80  this.id = id;
81  }

◆ setLocation()

void org.turro.elephant.entities.db.Poll.setLocation ( String  location)

Definition at line 95 of file Poll.java.

95  {
96  this.location = location;
97  }
Here is the caller graph for this function:

◆ setMaxPerOption()

void org.turro.elephant.entities.db.Poll.setMaxPerOption ( int  maxPerOption)

Definition at line 136 of file Poll.java.

136  {
137  this.maxPerOption = maxPerOption;
138  }
Here is the caller graph for this function:

◆ setMaxVotedOptions()

void org.turro.elephant.entities.db.Poll.setMaxVotedOptions ( int  maxVotedOptions)

Definition at line 144 of file Poll.java.

144  {
145  this.maxVotedOptions = maxVotedOptions;
146  }
Here is the caller graph for this function:

◆ setOptionClass()

void org.turro.elephant.entities.db.Poll.setOptionClass ( String  optionClass)

Definition at line 184 of file Poll.java.

184  {
185  this.optionClass = optionClass;
186  }
Here is the caller graph for this function:

◆ setOptionEnd()

void org.turro.elephant.entities.db.Poll.setOptionEnd ( String  optionEnd)

Definition at line 200 of file Poll.java.

200  {
201  this.optionEnd = optionEnd;
202  }

◆ setOptionStart()

void org.turro.elephant.entities.db.Poll.setOptionStart ( String  optionStart)

Definition at line 192 of file Poll.java.

192  {
193  this.optionStart = optionStart;
194  }

◆ setShowParticipants()

void org.turro.elephant.entities.db.Poll.setShowParticipants ( boolean  showParticipants)

Definition at line 152 of file Poll.java.

152  {
153  this.showParticipants = showParticipants;
154  }
Here is the caller graph for this function:

◆ setShowVotes()

void org.turro.elephant.entities.db.Poll.setShowVotes ( boolean  showVotes)

Definition at line 160 of file Poll.java.

160  {
161  this.showVotes = showVotes;
162  }
Here is the caller graph for this function:

◆ setText()

void org.turro.elephant.entities.db.Poll.setText ( String  text)

Definition at line 128 of file Poll.java.

128  {
129  this.text = text;
130  }

◆ setTitle()

void org.turro.elephant.entities.db.Poll.setTitle ( String  title)

Definition at line 87 of file Poll.java.

87  {
88  this.title = title;
89  }
Here is the caller graph for this function:

◆ setWiki()

void org.turro.elephant.entities.db.Poll.setWiki ( String  wiki)

Definition at line 119 of file Poll.java.

119  {
120  this.wiki = wiki;
121  text = WikiCompiler.source(wiki).html();
122  }
Here is the caller graph for this function:

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