19 package org.turro.activity;
21 import java.util.Date;
22 import java.util.List;
23 import org.turro.string.Strings;
24 import org.turro.dossier.db.DossierPU;
25 import org.turro.dossier.entity.Dossier;
26 import org.turro.dossier.entity.Issue;
27 import org.turro.dossier.entity.IssueComment;
28 import org.turro.dossier.entity.Participant;
29 import org.turro.dossier.entity.Project;
30 import org.turro.elephant.db.WhereClause;
31 import org.turro.entities.Entities;
32 import org.turro.jpa.Dao;
33 import org.turro.path.Path;
45 Path path = Strings.isBlank(entityPath) ? null :
new Path(entityPath);
46 if(path ==
null ||
"dossier".equals(path.getRoot())) {
47 for(Object obj :
getProjects(from,
null,
"startDate")) {
54 for(Object obj :
getProjects(from,
null,
"approvedDate")) {
61 for(Object obj :
getProjects(from,
null,
"oppositingEndDate")) {
68 for(Object obj :
getProjects(from,
null,
"endDate")) {
75 for(Object obj :
getProjects(from,
null,
"changePhase")) {
97 if(path ==
null ||
"issue".equals(path.getRoot())) {
119 }
else if(entity instanceof
Project) {
120 return ((
Project) entity).getDossier();
121 }
else if(entity instanceof
Issue) {
122 return ((
Issue) entity).getDossier();
129 wc.
addClause(
"select dossier" + check(select) +
" from Dossier as dossier");
130 wc.
addClause(
"where dossier.creation >= :date");
132 return getDao().getResultList(wc);
137 wc.
addClause(
"select project" + check(select) +
" from Project as project");
138 wc.
addClause(
"where project." + field +
" >= :date");
140 if(
"changePhase".equals(field)) {
142 wc.
addClause(
"and dossier.project.phase != :phase");
145 return getDao().getResultList(wc);
150 wc.
addClause(
"select participant" + check(select) +
" from Participant as participant");
151 wc.
addClause(
"where participant.creation >= :date");
153 return getDao().getResultList(wc);
158 wc.
addClause(
"select issue" + check(select) +
" from Issue as issue");
159 wc.
addClause(
"where issue.modification >= :date");
161 return getDao().getResultList(wc);
166 wc.
addClause(
"select comment" + check(select) +
" from IssueComment as comment");
167 wc.
addClause(
"where comment.modification >= :date");
169 return getDao().getResultList(wc);
172 private String check(String select) {
173 return Strings.isBlank(select) ?
"" : select;
180 private Dao getDao() {
182 _dao =
new DossierPU();
void setSortPath(String sortPath)
List getDossiers(Date from, String select)
List getIssueComments(Date from, String select)
List getParticipants(Date from, String select)
List getIssues(Date from, String select)
Object getMainEntity(Object entity)
List getProjects(Date from, String select, String field)
EntityActivitySet getActivities(Date from, String entityPath, String type)
static String getObjectPath(Object object)
Date getOppositingEndDate()
void addClause(String clause)
void addNamedValue(String name, Object value)
static IElephantEntity getController(String path)
String getHierarchicalPath()