BrightSide Workbench Full Report + Source Code
org.turro.dossier.search.IssueResults Class Reference
Collaboration diagram for org.turro.dossier.search.IssueResults:

Public Member Functions

 IssueResults ()
 
void setApplication (Application app)
 
void markAll ()
 
long getIssueCount ()
 
java.util.List< IssueWrappergetIssueList ()
 
Category getCategory ()
 
void setCategory (Category category)
 
Set< IssueResolutiongetResolutions ()
 
void setResolutions (Set< IssueResolution > resolutions)
 
Set< IssueParticipantRolegetRoles ()
 
void setRoles (Set< IssueParticipantRole > roles)
 
Set< IssueStatusgetStatus ()
 
void setStatus (Set< IssueStatus > status)
 
IContact getSubject ()
 
void setSubject (IContact subject)
 
Set< IssueTypegetTypes ()
 
void setTypes (Set< IssueType > types)
 
void setType (IssueType type)
 
void addCriteria (WhereClause wc)
 
boolean isCkOthers ()
 
void setCkOthers (boolean ckOthers)
 
boolean isCkStartPosible ()
 
void setCkStartPosible (boolean ckStartPosible)
 
Dossier getDossier ()
 
void setDossier (Dossier dossier)
 
Long getDossierId ()
 
void setDossierId (Long dossierId)
 
String getIssueValue ()
 
void setIssueValue (String issueValue)
 
IContact getByQA ()
 
void setByQA (IContact byQA)
 
IContact getByResponsible ()
 
void setByResponsible (IContact byResponsible)
 
IContact getByReporter ()
 
void setByReporter (IContact byReporter)
 
IContact getByParticipant ()
 
void setByParticipant (IContact byParticipant)
 
void setByParticipantId (String id)
 

Protected Member Functions

void addClause (WhereClause wc)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 38 of file IssueResults.java.

Constructor & Destructor Documentation

◆ IssueResults()

org.turro.dossier.search.IssueResults.IssueResults ( )

Definition at line 56 of file IssueResults.java.

56  {
57  roles.addAll(Arrays.asList(IssueParticipantRole.values()));
58  types.addAll(Arrays.asList(IssueType.values()));
59  status.addAll(Arrays.asList(IssueStatus.values()));
60  status.remove(IssueStatus.STATUS_CLOSED);
61  resolutions.addAll(Arrays.asList(IssueResolution.values()));
62  }

Member Function Documentation

◆ addClause()

void org.turro.dossier.search.IssueResults.addClause ( WhereClause  wc)
protected

Definition at line 382 of file IssueResults.java.

382  {
383  // Do nothing
384  }
Here is the caller graph for this function:

◆ addCriteria()

void org.turro.dossier.search.IssueResults.addCriteria ( WhereClause  wc)

Definition at line 154 of file IssueResults.java.

154  {
155  boolean asParticipant =
156  roles.contains(IssueParticipantRole.ISSUE_REPORTER) ||
157  roles.contains(IssueParticipantRole.ISSUE_RESPONSIBLE) ||
158  roles.contains(IssueParticipantRole.ISSUE_QA) ||
159  roles.contains(IssueParticipantRole.ISSUE_ASSISTANT);
160 
161  if(Strings.isEmpty(issueValue) || (!asParticipant && !app.isInRole("issue:all"))) {
162  wc.addClause("and 1=0");
163  return;
164  }
165 
166  if(byParticipant == null) {
167  byParticipant = Authentication.getIContact();
168  }
169 
170  long id = 0;
171  try {
172  id = Long.valueOf(issueValue);
173  if(id > 0) {
174  wc.addClause("and ((issue.id = :id)");
175  wc.addNamedValue("id", id);
176  wc.setPrefix("or");
177  }
178  } catch(Exception ex) {}
179 
180  wc.addLikeFields(new String[] {
181  "issue.description",
182  "comment.comment"
183  }, (issueValue == null ? "" : issueValue.replaceAll("\\*", "%")));
184 
185  if(id > 0) {
186  wc.addClause(")");
187  wc.setPrefix(null);
188  }
189 
190  if(ckStartPosible) {
191  wc.addClause("and (issue.startDate >= :startDate or issue.startDate is null)");
192  wc.addNamedValue("startDate", new Date());
193  }
194 
195  if(asParticipant && !(ckOthers && app.isInRole("issue:all"))) {
196  String sep = "";
197  wc.addClause("and (");
198  for(IssueParticipantRole ii : IssueParticipantRole.values()) {
199  if(roles.contains(ii)) {
200  wc.addClause(sep);
201  sep = "or";
202  wc.addClause("(");
203  wc.addClause("participant.idContact = :idContact");
204  wc.addNamedValue("idContact", byParticipant.getId());
205  wc.addClause("and participant.role = :" + ii.toString());
206  wc.addNamedValue(ii.toString(), ii);
207  wc.addClause(")");
208  }
209  }
210  wc.addClause(")");
211  }
212 
213  if(byResponsible != null && byResponsible.getId() != null) {
214  wc.addClause("and (");
215  wc.addClause("participant.idContact = :idRes");
216  wc.addNamedValue("idRes", byResponsible.getId());
217  wc.addClause("and participant.role = :byRes");
219  wc.addClause(")");
220  }
221 
222  if(byReporter != null && byReporter.getId() != null) {
223  wc.addClause("and (");
224  wc.addClause("participant.idContact = :idInf");
225  wc.addNamedValue("idInf", byReporter.getId());
226  wc.addClause("and participant.role = :byInf");
228  wc.addClause(")");
229  }
230 
231  if(byQA != null && byQA.getId() != null) {
232  wc.addClause("and (");
233  wc.addClause("participant.idContact = :idQA");
234  wc.addNamedValue("idQA", byQA.getId());
235  wc.addClause("and participant.role = :byQA");
237  wc.addClause(")");
238  }
239 
240  String sep = "";
241  wc.addClause("and (");
242  for(IssueStatus ii : IssueStatus.values()) {
243  if(status.contains(ii)) {
244  wc.addClause(sep);
245  sep = "or";
246  wc.addClause("issue.status = :" + ii.toString());
247  wc.addNamedValue(ii.toString(), ii);
248  }
249  }
250  wc.addClause(")");
251 
252  sep = "";
253  wc.addClause("and (");
254  for(IssueResolution ii : IssueResolution.values()) {
255  if(resolutions.contains(ii)) {
256  wc.addClause(sep);
257  sep = "or";
258  wc.addClause("issue.resolution = :" + ii.toString());
259  wc.addNamedValue(ii.toString(), ii);
260  }
261  }
262  wc.addClause(")");
263 
264  sep = "";
265  wc.addClause("and (");
266  for(IssueType ii : IssueType.values()) {
267  if(types.contains(ii)) {
268  wc.addClause(sep);
269  sep = "or";
270  wc.addClause("issue.type = :" + ii.toString());
271  wc.addNamedValue(ii.toString(), ii);
272  }
273  }
274  wc.addClause(")");
275 
276  if(subject != null) {
277  wc.addClause("and exists ( select subject from Participant as subject");
278  wc.addClause("where subject.dossier = issue.dossier");
279  wc.addClause("and subject.idContact = :idSubject");
280  wc.addNamedValue("idSubject", subject.getId());
281  wc.addClause("and subject.role = :roleSubject )");
283  }
284 
285  if(dossier != null) {
286  wc.addClause("and issue.dossier = :dossier");
287  wc.addNamedValue("dossier", dossier);
288  } else if(dossierId != null && dossierId > 0) {
289  wc.addClause("and issue.dossier.id = :dossierId");
290  wc.addNamedValue("dossierId", dossierId);
291  } else {
292  wc.addClause("and issue.dossier.status = :dstatus");
294  }
295 
296  if(category != null) {
297  wc.addClause("and (issue.dossier.category.fullDescription = :decat");
298  wc.addNamedValue("decat", category.getFullDescription());
299  wc.addClause("or issue.dossier.category.fullDescription like :dlcat)");
300  wc.addNamedValue("dlcat", category.getFullDescription() + Chars.backward().spaced() + "%");
301  //DossierResults.addExistsCategoryAffiliance(wc, category, "issue.dossier");
302  }
303 
304  }
void addLikeFields(String[] fields, String value)
void addNamedValue(String name, Object value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getByParticipant()

IContact org.turro.dossier.search.IssueResults.getByParticipant ( )

Definition at line 370 of file IssueResults.java.

370  {
371  return byParticipant;
372  }

◆ getByQA()

IContact org.turro.dossier.search.IssueResults.getByQA ( )

Definition at line 346 of file IssueResults.java.

346  {
347  return byQA;
348  }

◆ getByReporter()

IContact org.turro.dossier.search.IssueResults.getByReporter ( )

Definition at line 362 of file IssueResults.java.

362  {
363  return byReporter;
364  }

◆ getByResponsible()

IContact org.turro.dossier.search.IssueResults.getByResponsible ( )

Definition at line 354 of file IssueResults.java.

354  {
355  return byResponsible;
356  }

◆ getCategory()

Category org.turro.dossier.search.IssueResults.getCategory ( )

Definition at line 102 of file IssueResults.java.

102  {
103  return category;
104  }

◆ getDossier()

Dossier org.turro.dossier.search.IssueResults.getDossier ( )

Definition at line 322 of file IssueResults.java.

322  {
323  return dossier;
324  }

◆ getDossierId()

Long org.turro.dossier.search.IssueResults.getDossierId ( )

Definition at line 330 of file IssueResults.java.

330  {
331  return dossierId;
332  }

◆ getIssueCount()

long org.turro.dossier.search.IssueResults.getIssueCount ( )

Definition at line 79 of file IssueResults.java.

79  {
80  Dao dao = new DossierPU();
81  WhereClause wc = new WhereClause();
82  wc.addClause("select count(distinct issue) from Issue as issue");
83  wc.addClause("left outer join issue.participants participant");
84  wc.addClause("left outer join issue.comments comment");
85  wc.addClause("where 1=1");
86  addCriteria(wc);
87  return (Long) dao.getSingleResult(wc);
88  }
Object getSingleResult(WhereClause wc)
Definition: Dao.java:380
Here is the call graph for this function:

◆ getIssueList()

java.util.List<IssueWrapper> org.turro.dossier.search.IssueResults.getIssueList ( )

Definition at line 90 of file IssueResults.java.

90  {
91  Dao dao = new DossierPU();
92  WhereClause wc = new WhereClause();
93  wc.addClause("select distinct issue from Issue as issue");
94  wc.addClause("left outer join issue.participants participant");
95  wc.addClause("left outer join issue.comments comment");
96  wc.addClause("where 1=1");
97  addCriteria(wc);
98  addClause(wc);
99  return new ArrayList(new IssueSet(dao.getResultList(wc), ckStartPosible, byParticipant));
100  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIssueValue()

String org.turro.dossier.search.IssueResults.getIssueValue ( )

Definition at line 338 of file IssueResults.java.

338  {
339  return issueValue;
340  }

◆ getResolutions()

Set<IssueResolution> org.turro.dossier.search.IssueResults.getResolutions ( )

Definition at line 110 of file IssueResults.java.

110  {
111  return resolutions;
112  }

◆ getRoles()

Set<IssueParticipantRole> org.turro.dossier.search.IssueResults.getRoles ( )

Definition at line 118 of file IssueResults.java.

118  {
119  return roles;
120  }

◆ getStatus()

Set<IssueStatus> org.turro.dossier.search.IssueResults.getStatus ( )

Definition at line 126 of file IssueResults.java.

126  {
127  return status;
128  }

◆ getSubject()

IContact org.turro.dossier.search.IssueResults.getSubject ( )

Definition at line 134 of file IssueResults.java.

134  {
135  return subject;
136  }

◆ getTypes()

Set<IssueType> org.turro.dossier.search.IssueResults.getTypes ( )

Definition at line 142 of file IssueResults.java.

142  {
143  return types;
144  }

◆ isCkOthers()

boolean org.turro.dossier.search.IssueResults.isCkOthers ( )

Definition at line 306 of file IssueResults.java.

306  {
307  return ckOthers;
308  }

◆ isCkStartPosible()

boolean org.turro.dossier.search.IssueResults.isCkStartPosible ( )

Definition at line 314 of file IssueResults.java.

314  {
315  return ckStartPosible;
316  }

◆ markAll()

void org.turro.dossier.search.IssueResults.markAll ( )

Definition at line 68 of file IssueResults.java.

68  {
69  ckStartPosible = true;
70 
71  ckOthers = app.isInRole("issue:all");
72 
73  roles.addAll(Arrays.asList(IssueParticipantRole.values()));
74  types.addAll(Arrays.asList(IssueType.values()));
75  status.addAll(Arrays.asList(IssueStatus.values()));
76  resolutions.addAll(Arrays.asList(IssueResolution.values()));
77  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setApplication()

void org.turro.dossier.search.IssueResults.setApplication ( Application  app)

Definition at line 64 of file IssueResults.java.

64  {
65  this.app = app;
66  }

◆ setByParticipant()

void org.turro.dossier.search.IssueResults.setByParticipant ( IContact  byParticipant)

Definition at line 374 of file IssueResults.java.

374  {
375  this.byParticipant = byParticipant;
376  }
Here is the caller graph for this function:

◆ setByParticipantId()

void org.turro.dossier.search.IssueResults.setByParticipantId ( String  id)

Definition at line 378 of file IssueResults.java.

378  {
379  this.byParticipant = Contacts.getContactById(id);
380  }
static IContact getContactById(String id)
Definition: Contacts.java:72
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setByQA()

void org.turro.dossier.search.IssueResults.setByQA ( IContact  byQA)

Definition at line 350 of file IssueResults.java.

350  {
351  this.byQA = byQA;
352  }

◆ setByReporter()

void org.turro.dossier.search.IssueResults.setByReporter ( IContact  byReporter)

Definition at line 366 of file IssueResults.java.

366  {
367  this.byReporter = byReporter;
368  }

◆ setByResponsible()

void org.turro.dossier.search.IssueResults.setByResponsible ( IContact  byResponsible)

Definition at line 358 of file IssueResults.java.

358  {
359  this.byResponsible = byResponsible;
360  }

◆ setCategory()

void org.turro.dossier.search.IssueResults.setCategory ( Category  category)

Definition at line 106 of file IssueResults.java.

106  {
107  this.category = category;
108  }

◆ setCkOthers()

void org.turro.dossier.search.IssueResults.setCkOthers ( boolean  ckOthers)

Definition at line 310 of file IssueResults.java.

310  {
311  this.ckOthers = ckOthers;
312  }
Here is the caller graph for this function:

◆ setCkStartPosible()

void org.turro.dossier.search.IssueResults.setCkStartPosible ( boolean  ckStartPosible)

Definition at line 318 of file IssueResults.java.

318  {
319  this.ckStartPosible = ckStartPosible;
320  }

◆ setDossier()

void org.turro.dossier.search.IssueResults.setDossier ( Dossier  dossier)

Definition at line 326 of file IssueResults.java.

326  {
327  this.dossier = dossier;
328  }

◆ setDossierId()

void org.turro.dossier.search.IssueResults.setDossierId ( Long  dossierId)

Definition at line 334 of file IssueResults.java.

334  {
335  this.dossierId = dossierId;
336  }
Here is the caller graph for this function:

◆ setIssueValue()

void org.turro.dossier.search.IssueResults.setIssueValue ( String  issueValue)

Definition at line 342 of file IssueResults.java.

342  {
343  this.issueValue = issueValue;
344  }
Here is the caller graph for this function:

◆ setResolutions()

void org.turro.dossier.search.IssueResults.setResolutions ( Set< IssueResolution resolutions)

Definition at line 114 of file IssueResults.java.

114  {
115  this.resolutions = resolutions;
116  }
Here is the caller graph for this function:

◆ setRoles()

void org.turro.dossier.search.IssueResults.setRoles ( Set< IssueParticipantRole roles)

Definition at line 122 of file IssueResults.java.

122  {
123  this.roles = roles;
124  }
Here is the caller graph for this function:

◆ setStatus()

void org.turro.dossier.search.IssueResults.setStatus ( Set< IssueStatus status)

Definition at line 130 of file IssueResults.java.

130  {
131  this.status = status;
132  }
Here is the caller graph for this function:

◆ setSubject()

void org.turro.dossier.search.IssueResults.setSubject ( IContact  subject)

Definition at line 138 of file IssueResults.java.

138  {
139  this.subject = subject;
140  }

◆ setType()

void org.turro.dossier.search.IssueResults.setType ( IssueType  type)

Definition at line 150 of file IssueResults.java.

150  {
151  this.types = EnumSet.of(type);
152  }

◆ setTypes()

void org.turro.dossier.search.IssueResults.setTypes ( Set< IssueType types)

Definition at line 146 of file IssueResults.java.

146  {
147  this.types = types;
148  }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: