View Javadoc
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 org.apache.commons.lang.builder.ToStringBuilder;
22  
23  import java.io.Serializable;
24  import java.util.ArrayList;
25  import java.util.Collections;
26  import java.util.List;
27  
28  public class IssueSearchQuery implements Serializable {
29  
30      /**
31       *
32       */
33      private static final long serialVersionUID = 1L;
34      public static final Integer TYPE_FULL = 1;
35      public static final Integer TYPE_PROJECT = 2;
36  
37      private List<Project> availableProjects = new ArrayList<Project>();
38  
39      private List<Integer> projects = new ArrayList<Integer>();
40      private List<Integer> statuses = new ArrayList<Integer>();
41      private List<Integer> severities = new ArrayList<Integer>();
42      private List<Integer> components = new ArrayList<Integer>();
43      private List<Integer> versions = new ArrayList<Integer>();
44      private Integer targetVersion = null;
45      private User owner = null;
46      private User creator = null;
47      private String text = null;
48      private String resolution = null;
49  
50      private String orderBy = null;
51  
52      private Integer type = -1;
53      private Project project = null;
54      private Integer projectId = -1;
55      private String projectName = "";
56  
57      private List<Issue> results = null;
58  
59      public IssueSearchQuery() {
60      }
61  
62      public List<Project> getAvailableProjects() {
63          return availableProjects;
64      }
65  
66      public void setAvailableProjects(List<Project> value) {
67          if (null != value) {
68              availableProjects = Collections.unmodifiableList(value);
69          } else {
70              availableProjects = Collections.emptyList();
71          }
72      }
73  
74      public Project getProject() {
75          return project;
76      }
77  
78      public void setProject(Project value) {
79          project = value;
80      }
81  
82      public Integer getProjectId() {
83          return (project == null ? projectId : project.getId());
84      }
85  
86      public void setProjectId(Integer value) {
87          projectId = value;
88  
89      }
90  
91      public String getProjectName() {
92          return (project == null ? projectName : project.getName());
93      }
94  
95      public void setProjectName(String value) {
96          projectName = value;
97      }
98  
99      public List<Integer> getProjects() {
100         return projects;
101     }
102 
103     public void setProjects(List<Integer> value) {
104         if (value != null) {
105             projects = Collections.unmodifiableList(value);
106         } else {
107             projects = Collections.emptyList();
108         }
109     }
110 
111     public List<Integer> getSeverities() {
112         return severities;
113     }
114 
115     public void setSeverities(List<Integer> value) {
116         if (value != null) {
117             severities = Collections.unmodifiableList(value);
118         } else {
119             severities = Collections.emptyList();
120         }
121     }
122 
123     public List<Integer> getStatuses() {
124         return statuses;
125     }
126 
127     public void setStatuses(List<Integer> value) {
128         if (value != null) {
129             statuses = Collections.unmodifiableList(value);
130         } else {
131             statuses = Collections.emptyList();
132         }
133     }
134 
135     public List<Integer> getComponents() {
136         return components;
137     }
138 
139     public void setComponents(List<Integer> value) {
140 
141         if (value != null) {
142             components = Collections.unmodifiableList(value);
143         } else {
144             components = Collections.emptyList();
145         }
146     }
147 
148     public List<Integer> getVersions() {
149         return versions;
150     }
151 
152     public void setVersions(List<Integer> value) {
153         if (value != null) {
154             versions = Collections.unmodifiableList(value);
155         } else {
156             versions = Collections.emptyList();
157         }
158     }
159 
160     public Integer getTargetVersion() {
161         return targetVersion;
162     }
163 
164     public void setTargetVersion(Integer value) {
165         targetVersion = value;
166     }
167 
168     public User getOwner() {
169         return owner;
170     }
171 
172     public void setOwner(User value) {
173         owner = value;
174     }
175 
176     public User getCreator() {
177         return creator;
178     }
179 
180     public void setCreator(User value) {
181         creator = value;
182     }
183 
184     public String getText() {
185         return text;
186     }
187 
188     public void setText(String value) {
189         text = value;
190     }
191 
192     public String getResolution() {
193         return resolution;
194     }
195 
196     public void setResolution(String value) {
197         resolution = value;
198     }
199 
200     public String getOrderBy() {
201         return orderBy;
202     }
203 
204     public void setOrderBy(String value) {
205         orderBy = value;
206     }
207 
208     public Integer getType() {
209         return type;
210     }
211 
212     public void setType(Integer value) {
213         type = value;
214     }
215 
216     public List<Issue> getResults() {
217         return results;
218     }
219 
220     public void setResults(List<Issue> value) {
221         results = value;
222     }
223 
224     @Override
225     public String toString() {
226         return new ToStringBuilder(this).append("type", this.type).append(
227                 "severities", severities).append("text", text).append(
228                 "resoution", resolution).append("results", results).toString();
229     }
230 
231     /*
232       * this class is coded to keep integer ids, instead of objects the following
233       * methods exist to temporarily work around this.
234       *
235       * the proper fix would be to always keep objects
236       */
237 
238 }