19 package org.turro.activity;
21 import org.turro.contacts.CommentIt;
22 import org.turro.contacts.Convocation;
23 import org.turro.contacts.StarIt;
24 import org.turro.contacts.VoteIt;
25 import org.turro.contacts.db.ContactsPU;
26 import org.turro.entities.IElephantEntity;
27 import org.turro.jpa.Dao;
28 import org.turro.sql.SqlClause;
29 import org.turro.util.Cached;
41 SqlClause.select(
"comment").from(
"CommentIt comment")
42 .where().greater(
"comment.dateCreation", comacts.
lastDate())
43 .dao(dao.get()).forEach(
CommentIt.class, comment -> {
44 IElephantEntity icom = comment.getOwnerEntity();
46 String path = ContactsPU.getObjectPath(comment);
47 comacts.add(comment.getDateCreation(), path, icom.getPath(), icom.getHierarchicalPath());
51 SqlClause.select(
"star").from(
"StarIt star")
52 .where().greater(
"star.dateCreation", staacts.
lastDate())
53 .dao(dao.get()).forEach(
StarIt.class, star -> {
54 IElephantEntity istar = star.getOwnerEntity();
55 if(!istar.isEmpty()) {
56 String path = ContactsPU.getObjectPath(star);
57 staacts.add(star.getDateCreation(), path, istar.getPath(), istar.getHierarchicalPath());
60 Activities votacts = Activities.of(
"Voted");
61 SqlClause.select(
"vote").from(
"VoteIt vote")
62 .where().greater(
"vote.dateCreation", votacts.lastDate())
63 .dao(dao.get()).forEach(VoteIt.class, vote -> {
64 IElephantEntity ivote = vote.getOwnerEntity();
65 if(!ivote.isEmpty()) {
66 String path = ContactsPU.getObjectPath(vote);
67 votacts.add(vote.getDateCreation(), path, ivote.getPath(), ivote.getHierarchicalPath());
70 Activities conacts = Activities.of(
"Convoked");
71 SqlClause.select(
"convo").from(
"Convocation convo")
72 .where().greater(
"convo.callDate", conacts.lastDate())
73 .dao(dao.get()).forEach(Convocation.class, convo -> {
74 IElephantEntity iconvo = convo.getEntity();
75 if(!iconvo.isEmpty()) {
76 String path = ContactsPU.getObjectPath(convo);
77 conacts.add(convo.getCallDate(), path, iconvo.getPath(), iconvo.getHierarchicalPath());
84 private final Cached<Dao> dao = Cached.instance(() ->
new ContactsPU());
static Activities of(String reason)