001: package org.tigris.scarab.reports;
002:
003: /* ================================================================
004: * Copyright (c) 2000-2002 CollabNet. All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions are
008: * met:
009: *
010: * 1. Redistributions of source code must retain the above copyright
011: * notice, this list of conditions and the following disclaimer.
012: *
013: * 2. Redistributions in binary form must reproduce the above copyright
014: * notice, this list of conditions and the following disclaimer in the
015: * documentation and/or other materials provided with the distribution.
016: *
017: * 3. The end-user documentation included with the redistribution, if
018: * any, must include the following acknowlegement: "This product includes
019: * software developed by Collab.Net <http://www.Collab.Net/>."
020: * Alternately, this acknowlegement may appear in the software itself, if
021: * and wherever such third-party acknowlegements normally appear.
022: *
023: * 4. The hosted project names must not be used to endorse or promote
024: * products derived from this software without prior written
025: * permission. For written permission, please contact info@collab.net.
026: *
027: * 5. Products derived from this software may not use the "Tigris" or
028: * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
029: * prior written permission of Collab.Net.
030: *
031: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
032: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
033: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
034: * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
035: * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
036: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
037: * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
038: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
039: * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
040: */
041:
042: import java.util.List;
043: import java.util.ArrayList;
044: import org.apache.fulcrum.intake.Retrievable;
045: import org.apache.commons.lang.ObjectUtils;
046:
047: /**
048: *
049: * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
050: * @version $Id: ReportGroup.java 7498 2003-03-28 00:00:16Z jon $
051: */
052: public class ReportGroup implements java.io.Serializable, Retrievable {
053: private String name;
054:
055: private List reportOptionAttributes;
056:
057: private List reportUserAttributes;
058:
059: private String queryKey;
060:
061: /**
062: * Get the Name value.
063: * @return the Name value.
064: */
065: public String getName() {
066: return name;
067: }
068:
069: /**
070: * Set the Name value.
071: * @param newName The new Name value.
072: */
073: public void setName(String newName) {
074: this .name = newName;
075: }
076:
077: /**
078: * Get the ReportOptionAttributes value.
079: * @return the ReportOptionAttributes value.
080: */
081: public List getReportOptionAttributes() {
082: return reportOptionAttributes;
083: }
084:
085: /**
086: * Set the ReportOptionAttributes value.
087: * @param newReportOptionAttributes The new ReportOptionAttributes value.
088: */
089: public void setReportOptionAttributes(List newReportOptionAttributes) {
090: this .reportOptionAttributes = newReportOptionAttributes;
091: }
092:
093: /**
094: * Add a ReportOptionAttribute value.
095: * @param newReportOptionAttribute The new ReportOptionAttribute value.
096: */
097: public void addReportOptionAttribute(
098: ReportOptionAttribute newReportOptionAttribute) {
099: if (reportOptionAttributes == null) {
100: reportOptionAttributes = new ArrayList();
101: }
102: reportOptionAttributes.add(newReportOptionAttribute);
103: }
104:
105: /**
106: * Get the ReportUserAttributes value.
107: * @return the ReportUserAttributes value.
108: */
109: public List getReportUserAttributes() {
110: return reportUserAttributes;
111: }
112:
113: /**
114: * Set the ReportUserAttributes value.
115: * @param newReportUserAttributes The new ReportUserAttributes value.
116: */
117: public void setReportUserAttributes(List newReportUserAttributes) {
118: this .reportUserAttributes = newReportUserAttributes;
119: }
120:
121: /**
122: * Add a ReportUserAttribute value.
123: * @param newReportUserAttribute The new ReportUserAttribute value.
124: */
125: public void addReportUserAttribute(
126: ReportUserAttribute newReportUserAttribute) {
127: if (reportUserAttributes == null) {
128: reportUserAttributes = new ArrayList();
129: }
130: reportUserAttributes.add(newReportUserAttribute);
131: }
132:
133: /**
134: * sets the option and user lists to null. does not affect name.
135: */
136: public void reset() {
137: reportOptionAttributes = null;
138: reportUserAttributes = null;
139: }
140:
141: /**
142: * A group is considered equal if it has the same name. As the name
143: * should be unique, there is no need to compare the option/user lists.
144: *
145: * @param obj an <code>Object</code> value
146: * @return a <code>boolean</code> value
147: */
148: public boolean equals(Object obj) {
149: boolean result = obj == this ;
150: if (!result && obj instanceof ReportGroup) {
151: result = ObjectUtils.equals(name, ((ReportGroup) obj)
152: .getName());
153: }
154: return result;
155: }
156:
157: public int hashCode() {
158: return name == null ? 0 : name.hashCode();
159: }
160:
161: /**
162: * Get the QueryKey value.
163: * @return the QueryKey value.
164: */
165: public String getQueryKey() {
166: return queryKey == null ? "" : queryKey;
167: }
168:
169: /**
170: * Set the QueryKey value.
171: * @param newQueryKey The new QueryKey value.
172: */
173: public void setQueryKey(String newQueryKey) {
174: this.queryKey = newQueryKey;
175: }
176: }
|