19 package org.turro.elephant.entities.db;
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.Date;
24 import java.util.List;
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.GenerationType;
29 import javax.persistence.Id;
30 import javax.persistence.Index;
31 import javax.persistence.Lob;
32 import javax.persistence.ManyToOne;
33 import javax.persistence.Table;
34 import javax.persistence.Temporal;
35 import org.turro.string.Strings;
36 import org.turro.action.Contacts;
37 import org.turro.assistant.ParticipationInfo;
38 import org.turro.auth.Authentication;
39 import org.turro.elephant.db.ElephantPU;
40 import org.turro.elephant.db.WhereClause;
41 import org.turro.entities.ITreeEntity;
42 import org.turro.entities.IUniquePath;
43 import org.turro.jpa.Dao;
44 import org.turro.participation.ParticipationReason;
45 import org.turro.plugin.contacts.IContact;
53 @Index(name =
"UniquePath", columnList =
"uniquePath")
58 @GeneratedValue(strategy=GenerationType.IDENTITY)
59 @Column(name=
"IDENTIFIER")
68 private String uniquePath;
70 private String authorId;
72 @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
73 private java.util.Date creation;
100 this.parent = parent;
109 this.uniquePath = uniquePath;
117 this.authorId = authorId;
125 this.creation = creation;
139 return Strings.isBlank(text) || Strings.isBlank(authorId) ||
140 (parent ==
null && topic ==
null);
153 while(post !=
null && post.
getTopic() ==
null) {
156 return post !=
null ? post.
getTopic() :
null;
169 return dao.getResultList(wc);
185 boolean isParticipant(
IContact contact) {
186 if(contact !=
null && contact.
isValid() && contact.
getId().equals(authorId)) {
189 for(Post post : getPosts()) {
190 if(post.isParticipant(contact)) {
207 return new ArrayList<>(getPosts());
static IContact getIContact()
void addClause(String clause)
void addNamedValue(String name, Object value)
ITreeEntity getEntityParent()
void setUniquePath(String uniquePath)
IUniquePath getCurrentParent()
void setAuthorId(String authorId)
Collection< ITreeEntity > getEntityChildren()
boolean isSeen(IContact contact)
void setCreation(Date creation)
void setText(String text)
void setParent(Post parent)
List< Post > getPosts(Dao dao)
void setTopic(Topic topic)