KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > tigris > scarab > reports > ReportGroup


1 package org.tigris.scarab.reports;
2
3 /* ================================================================
4  * Copyright (c) 2000-2002 CollabNet. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16  *
17  * 3. The end-user documentation included with the redistribution, if
18  * any, must include the following acknowlegement: "This product includes
19  * software developed by Collab.Net <http://www.Collab.Net/>."
20  * Alternately, this acknowlegement may appear in the software itself, if
21  * and wherever such third-party acknowlegements normally appear.
22  *
23  * 4. The hosted project names must not be used to endorse or promote
24  * products derived from this software without prior written
25  * permission. For written permission, please contact info@collab.net.
26  *
27  * 5. Products derived from this software may not use the "Tigris" or
28  * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
29  * prior written permission of Collab.Net.
30  *
31  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
32  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
33  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
34  * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
35  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
37  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
39  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
40  */

41
42 import java.util.List JavaDoc;
43 import java.util.ArrayList JavaDoc;
44 import org.apache.fulcrum.intake.Retrievable;
45 import org.apache.commons.lang.ObjectUtils;
46
47 /**
48  *
49  * @author <a HREF="mailto:jmcnally@collab.net">John McNally</a>
50  * @version $Id: ReportGroup.java 7498 2003-03-28 00:00:16Z jon $
51  */

52 public class ReportGroup
53     implements java.io.Serializable JavaDoc,
54                Retrievable
55 {
56     private String JavaDoc name;
57
58     private List JavaDoc reportOptionAttributes;
59
60     private List JavaDoc reportUserAttributes;
61
62     private String JavaDoc queryKey;
63
64     /**
65      * Get the Name value.
66      * @return the Name value.
67      */

68     public String JavaDoc getName()
69     {
70         return name;
71     }
72
73     /**
74      * Set the Name value.
75      * @param newName The new Name value.
76      */

77     public void setName(String JavaDoc newName)
78     {
79         this.name = newName;
80     }
81
82     /**
83      * Get the ReportOptionAttributes value.
84      * @return the ReportOptionAttributes value.
85      */

86     public List JavaDoc getReportOptionAttributes()
87     {
88         return reportOptionAttributes;
89     }
90
91     /**
92      * Set the ReportOptionAttributes value.
93      * @param newReportOptionAttributes The new ReportOptionAttributes value.
94      */

95     public void setReportOptionAttributes(List JavaDoc newReportOptionAttributes)
96     {
97         this.reportOptionAttributes = newReportOptionAttributes;
98     }
99
100     /**
101      * Add a ReportOptionAttribute value.
102      * @param newReportOptionAttribute The new ReportOptionAttribute value.
103      */

104     public void addReportOptionAttribute(ReportOptionAttribute newReportOptionAttribute)
105     {
106         if (reportOptionAttributes == null)
107         {
108             reportOptionAttributes = new ArrayList JavaDoc();
109         }
110         reportOptionAttributes.add(newReportOptionAttribute);
111     }
112     
113     /**
114      * Get the ReportUserAttributes value.
115      * @return the ReportUserAttributes value.
116      */

117     public List JavaDoc getReportUserAttributes()
118     {
119         return reportUserAttributes;
120     }
121
122     /**
123      * Set the ReportUserAttributes value.
124      * @param newReportUserAttributes The new ReportUserAttributes value.
125      */

126     public void setReportUserAttributes(List JavaDoc newReportUserAttributes)
127     {
128         this.reportUserAttributes = newReportUserAttributes;
129     }
130
131     /**
132      * Add a ReportUserAttribute value.
133      * @param newReportUserAttribute The new ReportUserAttribute value.
134      */

135     public void addReportUserAttribute(ReportUserAttribute newReportUserAttribute)
136     {
137         if (reportUserAttributes == null)
138         {
139             reportUserAttributes = new ArrayList JavaDoc();
140         }
141         reportUserAttributes.add(newReportUserAttribute);
142     }
143
144     /**
145      * sets the option and user lists to null. does not affect name.
146      */

147     public void reset()
148     {
149         reportOptionAttributes = null;
150         reportUserAttributes = null;
151     }
152
153     /**
154      * A group is considered equal if it has the same name. As the name
155      * should be unique, there is no need to compare the option/user lists.
156      *
157      * @param obj an <code>Object</code> value
158      * @return a <code>boolean</code> value
159      */

160     public boolean equals(Object JavaDoc obj)
161     {
162         boolean result = obj == this;
163         if (!result && obj instanceof ReportGroup)
164         {
165             result = ObjectUtils.equals(name,
166                 ((ReportGroup)obj).getName());
167         }
168         return result;
169     }
170
171     public int hashCode()
172     {
173         return name == null ? 0 : name.hashCode();
174     }
175
176     /**
177      * Get the QueryKey value.
178      * @return the QueryKey value.
179      */

180     public String JavaDoc getQueryKey()
181     {
182         return queryKey == null ? "" : queryKey;
183     }
184     
185     /**
186      * Set the QueryKey value.
187      * @param newQueryKey The new QueryKey value.
188      */

189     public void setQueryKey(String JavaDoc newQueryKey)
190     {
191         this.queryKey = newQueryKey;
192     }
193 }
194
Popular Tags