19 package org.turro.activity;
21 import java.util.Date;
22 import java.util.function.Consumer;
23 import org.turro.assistant.ParticipationInfo;
24 import org.turro.elephant.db.ElephantPU;
25 import org.turro.elephant.db.WhereClause;
26 import org.turro.elephant.entities.db.Poll;
27 import org.turro.entities.Entities;
28 import org.turro.jpa.Dao;
29 import org.turro.sql.SqlClause;
41 SqlClause.select(
"poll").from(
"Poll poll")
42 .where().greater(
"poll.deadline", from)
43 .and().equal(
"poll.entityPath", entityPath)
44 .dao(getDao()).forEach(
Poll.class, poll -> {
45 DefaultEntityLastActivity ela = new DefaultEntityLastActivity(
46 poll, poll.getEntityPath(), poll.getDeadline(),
"Related polls");
47 ela.setSortPath(Entities.getController(poll).getHierarchicalPath());
53 participation, participation.getEntityPath(), participation.getParticipationDate(), participation.getReason().toString());
65 public void getPolls(String path, Date from, Consumer<Poll> action) {
67 wc.
addClause(
"select poll from Poll as poll");
68 wc.
addClause(
"where poll.deadline >= :date");
70 wc.
addClause(
"and poll.entityPath = :path");
72 getDao().forEach(
Poll.class, wc, action);
79 private Dao getDao() {
EntityActivitySet getActivities(Date from, String entityPath, String type)
void getPolls(String path, Date from, Consumer< Poll > action)
Object getMainEntity(Object entity)
void setSortPath(String sortPath)
List< IEntityParticipation > getAnyParticipations(Date from)
void addClause(String clause)
void addNamedValue(String name, Object value)
static IElephantEntity getController(String path)
String getHierarchicalPath()