◆ acceptComment()
static void org.turro.commentit.CommentItUtil.acceptComment |
( |
CommentIt |
comment | ) |
|
|
static |
Definition at line 84 of file CommentItUtil.java.
85 comment.setAccepted(
true);
86 new ContactsPU().saveObject(comment);
87 IElephantEntity iee = Entities.getController(comment.getPath());
91 .addByEntity(comment.getPath(), AssistantConstants.participants())
92 .setCategory(GenericElephantNotification.GENERIC_NOTIFICATION)
93 .setReason(I_.get(
"Comments"))
95 .put(
"commentIt", comment)
96 .put(
"entityUrl", iee.getEntityUrl())
97 .sendTemplate(
"comment", I_.get(
"Comment"));
98 }
catch (EmailException ex) {
99 Logger.getLogger(CommentItUtil.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
◆ addComment() [1/2]
static void org.turro.commentit.CommentItUtil.addComment |
( |
Object |
entity, |
|
|
String |
comment, |
|
|
SoftContact |
contact |
|
) |
| |
|
static |
Definition at line 48 of file CommentItUtil.java.
49 String path = Entities.getController(entity).getPath();
◆ addComment() [2/2]
static void org.turro.commentit.CommentItUtil.addComment |
( |
String |
path, |
|
|
String |
comment, |
|
|
SoftContact |
contact |
|
) |
| |
|
static |
Definition at line 55 of file CommentItUtil.java.
56 if(!Strings.isBlank(path) && contact !=
null && contact.isValid()) {
57 Dao dao =
new ContactsPU();
58 CommentIt commentIt =
new CommentIt();
59 commentIt.setCreator((Contact) contact.getContact());
60 commentIt.setAuthor(contact.author);
61 commentIt.setAuthor_email(contact.author_email);
62 commentIt.setAuthor_ip(contact.author_ip);
63 commentIt.setAuthor_web(contact.author_web);
64 commentIt.setDateCreation(
new Date());
65 commentIt.setBody(HTMLEntities.escape(comment));
66 commentIt.setPath(path);
67 dao.saveObject(commentIt);
68 IElephantEntity iee = Entities.getController(path);
73 .addByRole(
"PublicationAdmin")
74 .setReason(I_.get(
"Pending revision"))
76 .put(
"commentIt", commentIt)
77 .sendTemplate(
"new-comment", I_.get(
"New comment"));
78 }
catch (EmailException ex) {
79 Logger.getLogger(CommentItUtil.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
◆ allComments() [1/2]
static Collection<CommentIt> org.turro.commentit.CommentItUtil.allComments |
( |
Object |
entity | ) |
|
|
static |
Definition at line 140 of file CommentItUtil.java.
141 String path = Entities.getController(entity).getPath();
◆ allComments() [2/2]
static Collection<CommentIt> org.turro.commentit.CommentItUtil.allComments |
( |
String |
path | ) |
|
|
static |
Definition at line 148 of file CommentItUtil.java.
149 Dao dao =
new ContactsPU();
150 return dao.getResultList(
151 " select c from CommentIt c " +
153 " order by dateCreation ",
154 new Object[] { path }
◆ comments() [1/2]
static Collection<CommentIt> org.turro.commentit.CommentItUtil.comments |
( |
Object |
entity, |
|
|
SoftContact |
contact |
|
) |
| |
|
static |
Definition at line 111 of file CommentItUtil.java.
112 String path = Entities.getController(entity).getPath();
◆ comments() [2/2]
static Collection<CommentIt> org.turro.commentit.CommentItUtil.comments |
( |
String |
path, |
|
|
SoftContact |
contact |
|
) |
| |
|
static |
Definition at line 119 of file CommentItUtil.java.
120 Dao dao =
new ContactsPU();
121 if(contact.getContact() !=
null) {
122 return dao.getResultList(
123 " select c from CommentIt c " +
125 " and (accepted = TRUE or creator = ?) " +
126 " order by dateCreation ",
127 new Object[] { path, contact.getContact() }
130 return dao.getResultList(
131 " select c from CommentIt c " +
133 " and (accepted = TRUE or author_ip = ?) " +
134 " order by dateCreation ",
135 new Object[] { path, contact.author_ip }
◆ count() [1/3]
static long org.turro.commentit.CommentItUtil.count |
( |
| ) |
|
|
static |
Definition at line 175 of file CommentItUtil.java.
176 Dao dao =
new ContactsPU();
177 return (Long) dao.getSingleResultOrNull(
178 " select count(c) from CommentIt c "
◆ count() [2/3]
static long org.turro.commentit.CommentItUtil.count |
( |
Object |
entity, |
|
|
SoftContact |
contact |
|
) |
| |
|
static |
Definition at line 182 of file CommentItUtil.java.
183 String path = Entities.getController(entity).getPath();
185 return count(path, contact);
◆ count() [3/3]
static long org.turro.commentit.CommentItUtil.count |
( |
String |
path, |
|
|
SoftContact |
contact |
|
) |
| |
|
static |
Definition at line 190 of file CommentItUtil.java.
191 Dao dao =
new ContactsPU();
193 if(contact.getContact() !=
null) {
194 count = (Long) dao.getSingleResultOrNull(
195 " select count(c) from CommentIt c " +
197 " and (accepted = TRUE or creator = ?) " +
198 " order by dateCreation desc ",
199 new Object[] { path, contact.getContact() }
202 count = (Long) dao.getSingleResultOrNull(
203 " select count(c) from CommentIt c " +
205 " and (accepted = TRUE or author_ip = ?) " +
206 " order by dateCreation desc ",
207 new Object[] { path, contact.author_ip }
◆ countPending()
static long org.turro.commentit.CommentItUtil.countPending |
( |
| ) |
|
|
static |
Definition at line 167 of file CommentItUtil.java.
168 Dao dao =
new ContactsPU();
169 return (Long) dao.getSingleResultOrNull(
170 " select count(c) from CommentIt c " +
171 " where accepted = FALSE "
◆ paths()
static Collection<String> org.turro.commentit.CommentItUtil.paths |
( |
String |
path, |
|
|
int |
fromDays |
|
) |
| |
|
static |
Definition at line 216 of file CommentItUtil.java.
217 Dao dao =
new ContactsPU();
218 return dao.getResultList(
219 " select g.path from CommentIt g " +
220 " where g.path like ? " +
221 " and g.dateCreation >= ?",
222 new Object[] { path +
"/%",
new CheckDate().addDays(-fromDays).getDate() }
◆ pending()
static Collection<CommentIt> org.turro.commentit.CommentItUtil.pending |
( |
| ) |
|
|
static |
Definition at line 158 of file CommentItUtil.java.
159 Dao dao =
new ContactsPU();
160 return dao.getResultList(
161 " select c from CommentIt c " +
162 " where accepted = FALSE " +
163 " order by dateCreation "
◆ remove()
static void org.turro.commentit.CommentItUtil.remove |
( |
String |
id | ) |
|
|
static |
Definition at line 103 of file CommentItUtil.java.
104 Dao dao =
new ContactsPU();
106 " delete from CommentIt c " +
107 " where c.id = '" +
id +
"'"
The documentation for this class was generated from the following file: