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.Table;
33 import javax.persistence.Temporal;
34 import org.turro.string.Strings;
35 import org.turro.action.Contacts;
36 import org.turro.assistant.ParticipationInfo;
37 import org.turro.auth.Authentication;
38 import org.turro.elephant.db.ElephantPU;
39 import org.turro.elephant.db.WhereClause;
40 import org.turro.entities.Entities;
41 import org.turro.entities.IElephantEntity;
42 import org.turro.entities.ITreeEntity;
43 import org.turro.entities.IUniquePath;
44 import org.turro.jpa.Dao;
45 import org.turro.participation.ParticipationReason;
46 import org.turro.plugin.contacts.IContact;
54 @Index(name =
"UniquePath", columnList =
"uniquePath")
59 @GeneratedValue(strategy=GenerationType.IDENTITY)
60 @Column(name=
"IDENTIFIER")
63 private String entityPath;
65 private String uniquePath;
67 private String authorId;
69 @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
70 private java.util.Date creation;
89 this.entityPath = entityPath;
99 this.uniquePath = uniquePath;
107 this.authorId = authorId;
115 this.creation = creation;
129 return Strings.isBlank(text) || Strings.isBlank(authorId) ||
130 Strings.isBlank(entityPath) || getEntity().getPath() ==
null;
152 return dao.getResultList(wc);
169 if(contact !=
null && contact.
isValid() && contact.
getId().equals(authorId)) {
172 for(
Post post : getPosts()) {
173 if(post.isParticipant(contact)) {
184 wc.
addClause(
"select count(p) from Post p");
185 wc.
addClause(
"where p.uniquePath like concat(:tp, '/%')");
199 return new ArrayList<>(getPosts());
static IContact getIContact()
void addClause(String clause)
void addNamedValue(String name, Object value)
ITreeEntity getEntityParent()
void setCreation(Date creation)
void setText(String text)
IElephantEntity getEntity()
void setEntityPath(String entityPath)
Collection< ITreeEntity > getEntityChildren()
void setAuthorId(String authorId)
boolean isParticipant(IContact contact)
boolean isSeen(IContact contact)
List< Post > getPosts(Dao dao)
void setUniquePath(String uniquePath)
static IElephantEntity getController(String path)
Object getSingleResultOrNull(SqlClause sc)