19 package org.turro.dossier.dw;
21 import java.util.Date;
22 import java.util.List;
23 import org.turro.action.Contacts;
24 import org.turro.dossier.db.DossierPU;
25 import org.turro.dossier.entity.DossierStatus;
26 import org.turro.dossier.entity.DossierType;
27 import org.turro.dossier.entity.ParticipantRole;
28 import org.turro.elephant.db.WhereClause;
29 import org.turro.jpa.Dao;
30 import org.turro.plugin.contacts.IContact;
31 import org.zkoss.lang.Strings;
40 private String participantId, categoryPath;
41 private Long dossierId, versionId;
42 private Date startDate, endDate;
48 wc.
addClause(
"select count(distinct dossierId)");
57 wc.
addClause(
"select count(distinct dossierId)");
67 wc.
addClause(
"select count(distinct dossierId)");
77 wc.
addClause(
"select status, count(distinct dossierId)");
82 return getDao().getResultList(wc);
87 wc.
addClause(
"select phase, count(distinct dossierId)");
92 return getDao().getResultList(wc);
97 wc.
addClause(
"select count(participantId)");
108 private Dao getDao() {
116 private void addCriteria(WhereClause wc) {
117 if(!Strings.isBlank(participantId)) {
118 wc.addClause(
"and (participantId = :participantId");
119 wc.addNamedValue(
"participantId", participantId);
120 wc.addClause(
"or exists(");
121 wc.addClause(
"select cp from CategoryParticipant cp");
122 wc.addClause(
"where cp.role <> :role");
123 wc.addNamedValue(
"role", ParticipantRole.PARTICIPANT_SUBJECT);
124 wc.addClause(
"and cp.idContact = :participantId");
125 wc.addClause(
"and categoryPath like concat(cp.category.fullDescription, '%')");
128 if(!Strings.isBlank(categoryPath)) {
129 wc.addClause(
"and categoryPath = :categoryPath");
130 wc.addNamedValue(
"categoryPath", categoryPath);
132 if(versionId !=
null && versionId > 0) {
133 wc.addClause(
"and versionId = :versionId");
134 wc.addNamedValue(
"versionId", versionId);
140 private transient IContact _contact;
143 if(_contact ==
null) {
151 participantId = _contact !=
null ? _contact.
getId() :
null;
154 private void resetIContact() {
void setIParticipant(IContact contact)
Long getParticipantsCount()
IContact getIParticipant()
static void generateData()
void addClause(String clause)
void addNamedValue(String name, Object value)
Object getSingleResultOrNull(SqlClause sc)