IssueSearchQuery.java

  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. package org.itracker.model;

  19. import org.apache.commons.lang.builder.ToStringBuilder;

  20. import java.io.Serializable;
  21. import java.util.ArrayList;
  22. import java.util.Collections;
  23. import java.util.List;

  24. public class IssueSearchQuery implements Serializable {

  25.     /**
  26.      *
  27.      */
  28.     private static final long serialVersionUID = 1L;
  29.     public static final Integer TYPE_FULL = 1;
  30.     public static final Integer TYPE_PROJECT = 2;

  31.     private List<Project> availableProjects = new ArrayList<Project>();

  32.     private List<Integer> projects = new ArrayList<Integer>();
  33.     private List<Integer> statuses = new ArrayList<Integer>();
  34.     private List<Integer> severities = new ArrayList<Integer>();
  35.     private List<Integer> components = new ArrayList<Integer>();
  36.     private List<Integer> versions = new ArrayList<Integer>();
  37.     private Integer targetVersion = null;
  38.     private User owner = null;
  39.     private User creator = null;
  40.     private String text = null;
  41.     private String resolution = null;

  42.     private String orderBy = null;

  43.     private Integer type = -1;
  44.     private Project project = null;
  45.     private Integer projectId = -1;
  46.     private String projectName = "";

  47.     private List<Issue> results = null;

  48.     public IssueSearchQuery() {
  49.     }

  50.     public List<Project> getAvailableProjects() {
  51.         return availableProjects;
  52.     }

  53.     public void setAvailableProjects(List<Project> value) {
  54.         if (null != value) {
  55.             availableProjects = Collections.unmodifiableList(value);
  56.         } else {
  57.             availableProjects = Collections.emptyList();
  58.         }
  59.     }

  60.     public Project getProject() {
  61.         return project;
  62.     }

  63.     public void setProject(Project value) {
  64.         project = value;
  65.     }

  66.     public Integer getProjectId() {
  67.         return (project == null ? projectId : project.getId());
  68.     }

  69.     public void setProjectId(Integer value) {
  70.         projectId = value;

  71.     }

  72.     public String getProjectName() {
  73.         return (project == null ? projectName : project.getName());
  74.     }

  75.     public void setProjectName(String value) {
  76.         projectName = value;
  77.     }

  78.     public List<Integer> getProjects() {
  79.         return projects;
  80.     }

  81.     public void setProjects(List<Integer> value) {
  82.         if (value != null) {
  83.             projects = Collections.unmodifiableList(value);
  84.         } else {
  85.             projects = Collections.emptyList();
  86.         }
  87.     }

  88.     public List<Integer> getSeverities() {
  89.         return severities;
  90.     }

  91.     public void setSeverities(List<Integer> value) {
  92.         if (value != null) {
  93.             severities = Collections.unmodifiableList(value);
  94.         } else {
  95.             severities = Collections.emptyList();
  96.         }
  97.     }

  98.     public List<Integer> getStatuses() {
  99.         return statuses;
  100.     }

  101.     public void setStatuses(List<Integer> value) {
  102.         if (value != null) {
  103.             statuses = Collections.unmodifiableList(value);
  104.         } else {
  105.             statuses = Collections.emptyList();
  106.         }
  107.     }

  108.     public List<Integer> getComponents() {
  109.         return components;
  110.     }

  111.     public void setComponents(List<Integer> value) {

  112.         if (value != null) {
  113.             components = Collections.unmodifiableList(value);
  114.         } else {
  115.             components = Collections.emptyList();
  116.         }
  117.     }

  118.     public List<Integer> getVersions() {
  119.         return versions;
  120.     }

  121.     public void setVersions(List<Integer> value) {
  122.         if (value != null) {
  123.             versions = Collections.unmodifiableList(value);
  124.         } else {
  125.             versions = Collections.emptyList();
  126.         }
  127.     }

  128.     public Integer getTargetVersion() {
  129.         return targetVersion;
  130.     }

  131.     public void setTargetVersion(Integer value) {
  132.         targetVersion = value;
  133.     }

  134.     public User getOwner() {
  135.         return owner;
  136.     }

  137.     public void setOwner(User value) {
  138.         owner = value;
  139.     }

  140.     public User getCreator() {
  141.         return creator;
  142.     }

  143.     public void setCreator(User value) {
  144.         creator = value;
  145.     }

  146.     public String getText() {
  147.         return text;
  148.     }

  149.     public void setText(String value) {
  150.         text = value;
  151.     }

  152.     public String getResolution() {
  153.         return resolution;
  154.     }

  155.     public void setResolution(String value) {
  156.         resolution = value;
  157.     }

  158.     public String getOrderBy() {
  159.         return orderBy;
  160.     }

  161.     public void setOrderBy(String value) {
  162.         orderBy = value;
  163.     }

  164.     public Integer getType() {
  165.         return type;
  166.     }

  167.     public void setType(Integer value) {
  168.         type = value;
  169.     }

  170.     public List<Issue> getResults() {
  171.         return results;
  172.     }

  173.     public void setResults(List<Issue> value) {
  174.         results = value;
  175.     }

  176.     @Override
  177.     public String toString() {
  178.         return new ToStringBuilder(this).append("type", this.type).append(
  179.                 "severities", severities).append("text", text).append(
  180.                 "resoution", resolution).append("results", results).toString();
  181.     }

  182.     /*
  183.       * this class is coded to keep integer ids, instead of objects the following
  184.       * methods exist to temporarily work around this.
  185.       *
  186.       * the proper fix would be to always keep objects
  187.       */

  188. }