19 package org.turro.dossier.command;
21 import java.util.Collection;
22 import java.util.List;
23 import org.turro.string.Strings;
24 import org.turro.action.IMyContact;
25 import org.turro.annotation.MyContact;
26 import org.turro.auth.Authentication;
27 import org.turro.contacts.util.DefaultContact;
28 import org.turro.dossier.db.DossierPU;
29 import org.turro.elephant.context.IConstructor;
30 import org.turro.elephant.db.WhereClause;
31 import org.turro.i18n.I_;
32 import org.turro.jpa.Dao;
33 import org.turro.plugin.contacts.ContactSortedSet;
34 import org.turro.plugin.contacts.IContact;
46 if(!Strings.isBlank(search)) {
50 for(String c : (List<String>) dao.getResultList(createCategoryCriteria(user, search))) {
57 for(String c : (List<String>) dao.getResultList(createDossierCriteria(user, search))) {
64 for(String c : (List<String>) dao.getResultList(createIssueCriteria(user, search))) {
78 wc.
addClause(
"select distinct p.idContact from CategoryParticipant as p");
80 wc.
addClause(
"select p2 from CategoryParticipant as p2 where p2.idContact = :idUser and p2.id = p.id and p2.showParticipants = TRUE");
87 private WhereClause createDossierCriteria(IContact user, String search) {
88 WhereClause wc =
new WhereClause();
89 wc.addClause(
"select distinct p.idContact from Participant as p");
90 wc.addClause(
"where exists (");
91 wc.addClause(
"select p2 from Participant as p2 where p2.idContact = :idUser and p2.id = p.id and p2.showParticipants = TRUE");
92 wc.addNamedValue(
"idUser", user.getId());
94 wc.addLikeFields(
new String[] {
"p.name" }, search);
98 private WhereClause createIssueCriteria(IContact user, String search) {
99 WhereClause wc =
new WhereClause();
100 wc.addClause(
"select distinct p.idContact from IssueParticipant as p");
101 wc.addClause(
"where exists (");
102 wc.addClause(
"select p2 from IssueParticipant as p2 where p2.idContact = :idUser and p2.id = p.id");
103 wc.addNamedValue(
"idUser", user.getId());
105 wc.addLikeFields(
new String[] {
"p.name" }, search);
static IContact getIContact()
void addClause(String clause)
void addLikeFields(String[] fields, String value)
void addNamedValue(String name, Object value)
static I18nApiWrapper api()