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

Public Member Functions

Long getId ()
 
void setId (Long id)
 
String getEntityPath ()
 
void setEntityPath (String entityPath)
 
String getUniquePath ()
 
void setUniquePath (String uniquePath)
 
String getAuthorId ()
 
void setAuthorId (String authorId)
 
Date getCreation ()
 
void setCreation (Date creation)
 
String getText ()
 
void setText (String text)
 
boolean isEmpty ()
 
IElephantEntity getEntity ()
 
List< PostgetPosts ()
 
List< PostgetPosts (Dao dao)
 
boolean isSeen ()
 
boolean isSeen (IContact contact)
 
IContact getContact ()
 
boolean isParticipant (IContact contact)
 
long getPostCount ()
 
ITreeEntity getEntityParent ()
 
Collection< ITreeEntitygetEntityChildren ()
 

Detailed Description

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

Definition at line 56 of file Topic.java.

Member Function Documentation

◆ getAuthorId()

String org.turro.elephant.entities.db.Topic.getAuthorId ( )

Definition at line 102 of file Topic.java.

102  {
103  return authorId;
104  }
Here is the caller graph for this function:

◆ getContact()

IContact org.turro.elephant.entities.db.Topic.getContact ( )

Definition at line 164 of file Topic.java.

164  {
165  return Contacts.getContactById(authorId);
166  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCreation()

Date org.turro.elephant.entities.db.Topic.getCreation ( )

Definition at line 110 of file Topic.java.

110  {
111  return creation;
112  }
Here is the caller graph for this function:

◆ getEntity()

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

Definition at line 135 of file Topic.java.

135  {
136  if(iee == null) {
137  iee = Entities.getController(entityPath);
138  }
139  return iee;
140  }
IElephantEntity getController(String entityPath)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntityChildren()

Collection<ITreeEntity> org.turro.elephant.entities.db.Topic.getEntityChildren ( )

Implements org.turro.entities.ITreeEntity.

Definition at line 198 of file Topic.java.

198  {
199  return new ArrayList<>(getPosts());
200  }

◆ getEntityParent()

ITreeEntity org.turro.elephant.entities.db.Topic.getEntityParent ( )

Implements org.turro.entities.ITreeEntity.

Definition at line 193 of file Topic.java.

193  {
194  return null;
195  }

◆ getEntityPath()

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

Definition at line 84 of file Topic.java.

84  {
85  return entityPath;
86  }
Here is the caller graph for this function:

◆ getId()

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

Definition at line 76 of file Topic.java.

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

◆ getPostCount()

long org.turro.elephant.entities.db.Topic.getPostCount ( )

Definition at line 182 of file Topic.java.

182  {
183  WhereClause wc = new WhereClause();
184  wc.addClause("select count(p) from Post p");
185  wc.addClause("where p.uniquePath like concat(:tp, '/%')");
186  wc.addNamedValue("tp", uniquePath);
187  return (Long) new ElephantPU().getSingleResultOrNull(wc);
188  }
Here is the call graph for this function:

◆ getPosts() [1/2]

List<Post> org.turro.elephant.entities.db.Topic.getPosts ( )

Definition at line 142 of file Topic.java.

142  {
143  return getPosts(new ElephantPU());
144  }
Here is the caller graph for this function:

◆ getPosts() [2/2]

List<Post> org.turro.elephant.entities.db.Topic.getPosts ( Dao  dao)

Definition at line 146 of file Topic.java.

146  {
147  WhereClause wc = new WhereClause();
148  wc.addClause("select p from Post p");
149  wc.addClause("where p.topic = :topic");
150  wc.addNamedValue("topic", this);
151  wc.addClause("order by creation");
152  return dao.getResultList(wc);
153  }
Here is the call graph for this function:

◆ getText()

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

Definition at line 118 of file Topic.java.

118  {
119  return text;
120  }
Here is the caller graph for this function:

◆ getUniquePath()

String org.turro.elephant.entities.db.Topic.getUniquePath ( )

Implements org.turro.entities.IUniquePath.

Definition at line 94 of file Topic.java.

94  {
95  return uniquePath;
96  }

◆ isEmpty()

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

Definition at line 128 of file Topic.java.

128  {
129  return Strings.isBlank(text) || Strings.isBlank(authorId) ||
130  Strings.isBlank(entityPath) || getEntity().getPath() == null;
131  }
Here is the caller graph for this function:

◆ isParticipant()

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

Definition at line 168 of file Topic.java.

168  {
169  if(contact != null && contact.isValid() && contact.getId().equals(authorId)) {
170  return true;
171  } else {
172  for(Post post : getPosts()) {
173  if(post.isParticipant(contact)) {
174  return true;
175  }
176  }
177  }
178  return new ParticipationInfo("/topic/" + getId(), "/contact/" + contact.getId(),
179  ParticipationReason.REASON_PARTICIPATE).isChecked();
180  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isSeen() [1/2]

boolean org.turro.elephant.entities.db.Topic.isSeen ( )

Definition at line 155 of file Topic.java.

155  {
156  return isSeen(Authentication.getIContact());
157  }
Here is the call graph for this function:

◆ isSeen() [2/2]

boolean org.turro.elephant.entities.db.Topic.isSeen ( IContact  contact)

Definition at line 159 of file Topic.java.

159  {
160  return new ParticipationInfo("/topic/" + getId(), "/contact/" + contact.getId(),
161  ParticipationReason.REASON_SEEN).isChecked();
162  }
Here is the call graph for this function:

◆ setAuthorId()

void org.turro.elephant.entities.db.Topic.setAuthorId ( String  authorId)

Definition at line 106 of file Topic.java.

106  {
107  this.authorId = authorId;
108  }
Here is the caller graph for this function:

◆ setCreation()

void org.turro.elephant.entities.db.Topic.setCreation ( Date  creation)

Definition at line 114 of file Topic.java.

114  {
115  this.creation = creation;
116  }
Here is the caller graph for this function:

◆ setEntityPath()

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

Definition at line 88 of file Topic.java.

88  {
89  this.entityPath = entityPath;
90  this.iee = null;
91  }
Here is the caller graph for this function:

◆ setId()

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

Definition at line 80 of file Topic.java.

80  {
81  this.id = id;
82  }

◆ setText()

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

Definition at line 122 of file Topic.java.

122  {
123  this.text = text;
124  }
Here is the caller graph for this function:

◆ setUniquePath()

void org.turro.elephant.entities.db.Topic.setUniquePath ( String  uniquePath)

Definition at line 98 of file Topic.java.

98  {
99  this.uniquePath = uniquePath;
100  }

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