BrightSide Workbench Full Report + Source Code
SelectByChart.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 package org.turro.dossier.zul.issue;
19 
20 import java.util.EnumSet;
21 import org.turro.dossier.entity.IssueResolution;
22 import org.turro.dossier.entity.IssueStatus;
23 import org.turro.dossier.entity.IssueType;
24 import org.turro.dossier.search.IssueResults;
25 import org.turro.i18n.I_;
26 import org.zkoss.zul.Area;
27 
32 public class SelectByChart {
33 
34  private String participant;
35  private Area area;
36  private int type;
37 
38  public SelectByChart(String participant, int type, Area area) {
39  this.participant = participant;
40  this.type = type;
41  this.area = area;
42  }
43 
45  if(type == 1) {
46  // Status
47  String statusName = (String) area.getAttribute("category");
48  for(IssueStatus is : IssueStatus.values()) {
49  if(I_.byKey(is.toString()).equals(statusName)) {
50  results.markAll();
51  results.setStatus(EnumSet.of(is));
52  if(participant != null) results.setByParticipantId(participant);
53  break;
54  }
55  }
56  } else if(type == 2) {
57  // Resolution
58  String resolutionName = (String) area.getAttribute("category");
59  for(IssueResolution is : IssueResolution.values()) {
60  if(I_.byKey(is.toString()).equals(resolutionName)) {
61  results.markAll();
62  results.setStatus(EnumSet.of(IssueStatus.STATUS_RESOLVED,
64  results.setResolutions(EnumSet.of(is));
65  if(participant != null) results.setByParticipantId(participant);
66  break;
67  }
68  }
69  } else if(type == 3) {
70  // Type
71  String typeName = (String) area.getAttribute("category");
72  for(IssueType is : IssueType.values()) {
73  if(I_.byKey(is.toString()).equals(typeName)) {
74  results.markAll();
75  results.setTypes(EnumSet.of(is));
76  if(participant != null) results.setByParticipantId(participant);
77  break;
78  }
79  }
80  }
81 
82  return results;
83  }
84 }
void setTypes(Set< IssueType > types)
void setResolutions(Set< IssueResolution > resolutions)
void setStatus(Set< IssueStatus > status)
IssueResults getResults(IssueResults results)
SelectByChart(String participant, int type, Area area)
static String byKey(String key)
Definition: I_.java:83