139 WhereClause wc =
new WhereClause();
140 wc.addClause(
"select distinct issue from Issue as issue");
141 wc.addClause(
"left outer join issue.participants participant");
142 wc.addClause(
"left outer join issue.comments comment");
143 wc.addClause(
"where issue.publishable = TRUE");
145 boolean asParticipant =
false;
147 if(byParticipant !=
null && byParticipant.
isValid()) {
148 asParticipant = roles.isEmpty() ||
149 roles.contains(IssueParticipantRole.ISSUE_REPORTER) ||
150 roles.contains(IssueParticipantRole.ISSUE_RESPONSIBLE) ||
151 roles.contains(IssueParticipantRole.ISSUE_QA) ||
152 roles.contains(IssueParticipantRole.ISSUE_ASSISTANT);
155 if(Strings.isEmpty(searchValue)) {
160 long id = Long.valueOf(searchValue);
162 wc.addClause(
"and issue.id = :id");
163 wc.addNamedValue(
"id",
id);
166 }
catch(Exception ex) {}
169 wc.addLikeFields(
new String[] {
171 }, (searchValue ==
null ?
"" : searchValue.replaceAll(
"\\*",
"%")));
173 wc.addLikeFields(
new String[] {
176 }, (searchValue ==
null ?
"" : searchValue.replaceAll(
"\\*",
"%")));
181 wc.addClause(
"and (");
182 if(roles.isEmpty()) {
184 wc.addClause(
"participant.idContact = :idContact");
185 wc.addNamedValue(
"idContact", byParticipant.
getId());
188 for(IssueParticipantRole ii : roles) {
192 wc.addClause(
"participant.idContact = :idContact");
193 wc.addNamedValue(
"idContact", byParticipant.
getId());
194 wc.addClause(
"and participant.role = :" + ii.toString());
195 wc.addNamedValue(ii.toString(), ii);
202 if(!status.isEmpty()) {
204 wc.addClause(
"and (");
205 for(IssueStatus ii : status) {
208 wc.addClause(
"issue.status = :" + ii.toString());
209 wc.addNamedValue(ii.toString(), ii);
214 if(!resolutions.isEmpty()) {
216 wc.addClause(
"and (");
217 for(IssueResolution ii : resolutions) {
220 wc.addClause(
"issue.resolution = :" + ii.toString());
221 wc.addNamedValue(ii.toString(), ii);
226 if(!types.isEmpty()) {
228 wc.addClause(
"and (");
229 for(IssueType ii : types) {
232 wc.addClause(
"issue.type = :" + ii.toString());
233 wc.addNamedValue(ii.toString(), ii);
238 if(dossier !=
null) {
239 wc.addClause(
"and issue.dossier = :dossier");
240 wc.addNamedValue(
"dossier", dossier);
241 }
else if(dossierId !=
null && dossierId > 0) {
242 wc.addClause(
"and issue.dossier.id = :dossierId");
243 wc.addNamedValue(
"dossierId", dossierId);
245 wc.addClause(
"and issue.dossier.status = :dstatus");
246 wc.addNamedValue(
"dstatus", DossierStatus.DOSSIER_OPENED);
249 if(category !=
null) {
250 wc.addClause(
"and (");
251 wc.addClause(
"issue.dossier.category.fullDescription = :fullCatDesc");
252 wc.addClause(
"or issue.dossier.category.fullDescription like concat(:fullCatDesc, '" + Chars.backward().spaced() +
"%')");
257 wc.addClause(
"order by issue.modification desc");
String getFullDescription()