Clover Coverage Report - itracker
Coverage timestamp: Tue May 1 2012 16:42:12 CEST
49   251   44   1.29
16   173   0.9   38
38     1.16  
1    
 
 
  IssueSearchQuery       Line # 32 49 44 0% 0.0
 
No Tests
 
1    /*
2    * This software was designed and created by Jason Carroll.
3    * Copyright (c) 2002, 2003, 2004 Jason Carroll.
4    * The author can be reached at jcarroll@cowsultants.com
5    * ITracker website: http://www.cowsultants.com
6    * ITracker forums: http://www.cowsultants.com/phpBB/index.php
7    *
8    * This program is free software; you can redistribute it and/or modify
9    * it only under the terms of the GNU General Public License as published by
10    * the Free Software Foundation; either version 2 of the License, or
11    * (at your option) any later version.
12    *
13    * This program is distributed in the hope that it will be useful,
14    * but WITHOUT ANY WARRANTY; without even the implied warranty of
15    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16    * GNU General Public License for more details.
17    */
18   
19    package org.itracker.model;
20   
21    import java.io.Serializable;
22    import java.util.ArrayList;
23    import java.util.Collection;
24    import java.util.Collections;
25    import java.util.List;
26   
27    import org.apache.commons.collections.CollectionUtils;
28    import org.apache.commons.collections.Transformer;
29    import org.apache.commons.lang.builder.ToStringBuilder;
30    import org.itracker.persistence.dao.ProjectDAO;
31   
 
32    public class IssueSearchQuery implements Serializable {
33   
34    /**
35    *
36    */
37    private static final long serialVersionUID = 1L;
38    public static final Integer TYPE_FULL = 1;
39    public static final Integer TYPE_PROJECT = 2;
40   
41    private List<Project> availableProjects = new ArrayList<Project>();
42   
43    private List<Integer> projects = new ArrayList<Integer>();
44    private List<Integer> statuses = new ArrayList<Integer>();
45    private List<Integer> severities = new ArrayList<Integer>();
46    private List<Integer> components = new ArrayList<Integer>();
47    private List<Integer> versions = new ArrayList<Integer>();
48    private Integer targetVersion = null;
49    private User owner = null;
50    private User creator = null;
51    private String text = null;
52    private String resolution = null;
53   
54    private String orderBy = null;
55   
56    private Integer type = -1;
57    private Project project = null;
58    private Integer projectId = -1;
59    private String projectName = "";
60   
61    private List<Issue> results = null;
62   
 
63  0 toggle public IssueSearchQuery() {
64    }
65   
 
66  0 toggle public List<Project> getAvailableProjects() {
67  0 return availableProjects;
68    }
69   
 
70  0 toggle public void setAvailableProjects(List<Project> value) {
71  0 if (null != value) {
72  0 availableProjects = Collections.unmodifiableList(value);
73    } else {
74  0 availableProjects = Collections.EMPTY_LIST;
75    }
76    }
77   
 
78  0 toggle public Project getProject() {
79  0 return project;
80    }
81   
 
82  0 toggle public void setProject(Project value) {
83  0 project = value;
84    }
85   
 
86  0 toggle public Integer getProjectId() {
87  0 return (project == null ? projectId : project.getId());
88    }
89   
 
90  0 toggle public void setProjectId(Integer value) {
91  0 projectId = value;
92   
93    }
94   
 
95  0 toggle public String getProjectName() {
96  0 return (project == null ? projectName : project.getName());
97    }
98   
 
99  0 toggle public void setProjectName(String value) {
100  0 projectName = value;
101    }
102   
 
103  0 toggle public List<Integer> getProjects() {
104  0 return projects;
105    }
106   
 
107  0 toggle public void setProjects(List<Integer> value) {
108  0 if (value != null) {
109  0 projects = Collections.unmodifiableList(value);
110    } else {
111  0 projects = Collections.EMPTY_LIST;
112    }
113    }
114   
 
115  0 toggle public List<Integer> getSeverities() {
116  0 return severities;
117    }
118   
 
119  0 toggle public void setSeverities(List<Integer> value) {
120  0 if (value != null) {
121  0 severities = Collections.unmodifiableList(value);
122    } else {
123  0 severities = Collections.EMPTY_LIST;
124    }
125    }
126   
 
127  0 toggle public List<Integer> getStatuses() {
128  0 return statuses;
129    }
130   
 
131  0 toggle public void setStatuses(List<Integer> value) {
132  0 if (value != null) {
133  0 statuses = Collections.unmodifiableList(value);
134    } else {
135  0 statuses = Collections.EMPTY_LIST;
136    }
137    }
138   
 
139  0 toggle public List<Integer> getComponents() {
140  0 return components;
141    }
142   
 
143  0 toggle public void setComponents(List<Integer> value) {
144   
145  0 if (value != null) {
146  0 components = Collections.unmodifiableList(value);
147    } else {
148  0 components = Collections.EMPTY_LIST;
149    }
150    }
151   
 
152  0 toggle public List<Integer> getVersions() {
153  0 return versions;
154    }
155   
 
156  0 toggle public void setVersions(List<Integer> value) {
157  0 if (value != null) {
158  0 versions = Collections.unmodifiableList(value);
159    } else {
160  0 versions = Collections.EMPTY_LIST;
161    }
162    }
163   
 
164  0 toggle public Integer getTargetVersion() {
165  0 return targetVersion;
166    }
167   
 
168  0 toggle public void setTargetVersion(Integer value) {
169  0 targetVersion = value;
170    }
171   
 
172  0 toggle public User getOwner() {
173  0 return owner;
174    }
175   
 
176  0 toggle public void setOwner(User value) {
177  0 owner = value;
178    }
179   
 
180  0 toggle public User getCreator() {
181  0 return creator;
182    }
183   
 
184  0 toggle public void setCreator(User value) {
185  0 creator = value;
186    }
187   
 
188  0 toggle public String getText() {
189  0 return text;
190    }
191   
 
192  0 toggle public void setText(String value) {
193  0 text = value;
194    }
195   
 
196  0 toggle public String getResolution() {
197  0 return resolution;
198    }
199   
 
200  0 toggle public void setResolution(String value) {
201  0 resolution = value;
202    }
203   
 
204  0 toggle public String getOrderBy() {
205  0 return orderBy;
206    }
207   
 
208  0 toggle public void setOrderBy(String value) {
209  0 orderBy = value;
210    }
211   
 
212  0 toggle public Integer getType() {
213  0 return type;
214    }
215   
 
216  0 toggle public void setType(Integer value) {
217  0 type = value;
218    }
219   
 
220  0 toggle public List<Issue> getResults() {
221  0 return results;
222    }
223   
 
224  0 toggle public void setResults(List<Issue> value) {
225  0 results = value;
226    }
227   
 
228  0 toggle @Override
229    public String toString() {
230  0 return new ToStringBuilder(this).append("type", this.type).append(
231    "severities", severities).append("text", text).append(
232    "resoution", resolution).append("results", results).toString();
233    }
234   
235    /*
236    * this class is coded to keep integer ids, instead of objects the following
237    * methods exist to temporarily work around this.
238    *
239    * the proper fix would be to always keep objects
240    */
241   
242    // from the list of project ids this objects has, return a list of
243    // projects
 
244  0 toggle public Collection<?> getProjectsObjects(final ProjectDAO projectDAO) {
245  0 return CollectionUtils.collect(getProjects(), new Transformer() {
 
246  0 toggle public Object transform(Object arg0) {
247  0 return projectDAO.findByPrimaryKey((Integer) arg0);
248    }
249    });
250    }
251    }