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:
046: /**
047: *
048: * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
049: * @version $Id: ReportAxis.java 9104 2004-05-10 21:04:51Z dabbous $
050: */
051: public class ReportAxis implements java.io.Serializable, Retrievable {
052: private List reportHeadings;
053:
054: private String queryKey;
055:
056: /**
057: * Gets the heading at the given index.
058: * if headingIndex is negative, a new ReportHeading is returned
059: * that is
060: *
061: * @param headingIndex an <code>int</code> value
062: * @return a <code>ReportHeading</code> value
063: */
064: public ReportHeading getHeading(int headingIndex) {
065: ReportHeading heading;
066: List headings = getReportHeadings();
067: if (headingIndex >= 0) {
068: if (headings == null || headings.size() <= headingIndex) {
069: throw new IllegalArgumentException(headingIndex
070: + " is larger than the number of headings"); //EXCEPTION
071: } else {
072: heading = (ReportHeading) headings.get(headingIndex);
073: }
074: } else {
075: heading = new ReportHeading();
076: addReportHeading(heading);
077: }
078: return heading;
079: }
080:
081: /**
082: * Get the ReportHeadings value.
083: * @return the ReportHeadings value.
084: */
085: public List getReportHeadings() {
086: return reportHeadings;
087: }
088:
089: /**
090: * Set the ReportHeadings value.
091: * @param newReportHeadings The new ReportHeadings value.
092: */
093: public void setReportHeadings(List newReportHeadings) {
094: this .reportHeadings = newReportHeadings;
095: }
096:
097: /**
098: * Add a ReportHeading value.
099: * @param newReportHeading The new ReportHeading value.
100: */
101: public void addReportHeading(ReportHeading newReportHeading) {
102: if (reportHeadings == null) {
103: reportHeadings = new ArrayList();
104: }
105: reportHeadings.add(newReportHeading);
106: }
107:
108: /**
109: * Get the QueryKey value.
110: * @return the QueryKey value.
111: */
112: public String getQueryKey() {
113: return queryKey == null ? "" : queryKey;
114: }
115:
116: /**
117: * Set the QueryKey value.
118: * @param newQueryKey The new QueryKey value.
119: */
120: public void setQueryKey(String newQueryKey) {
121: this.queryKey = newQueryKey;
122: }
123: }
|