KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > pmti > v1 > defimpl > AbstractIssue


1 /*
2  * @(#)AbstractIssue.java
3  *
4  * Copyright (C) 2002-2003 Matt Albrecht
5  * groboclown@users.sourceforge.net
6  * http://groboutils.sourceforge.net
7  *
8  * Part of the GroboUtils package at:
9  * http://groboutils.sourceforge.net
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included in
19  * all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  */

29 package net.sourceforge.groboutils.pmti.v1.defimpl;
30
31
32 import net.sourceforge.groboutils.pmti.v1.IIssue;
33 import net.sourceforge.groboutils.pmti.v1.IAttributeSet;
34 import net.sourceforge.groboutils.pmti.v1.IIssueState;
35 import net.sourceforge.groboutils.pmti.v1.ProblemManagerException;
36  
37
38 /**
39  * Reflects an issue (or bug, or anomally report, or problem ticket) that
40  * is generic enough to be used by most problem tracker system. All
41  * <tt>IIssue</tt> instances are immutable, unless they also implement
42  * <tt>IEditableIssue</tt>.
43  * <P>
44  * An issue will only reflect the data associated with the issue at the time of
45  * the polling of the issue from the tracker. Currently, the only way to
46  * update the issue's data fields is to re-poll the issue from the
47  * <tt>ProblemManager</tt>, or to call <tt>reload()</tt>. Individual
48  * implemenations of the PMTI framework
49  * may provide alternative means to real-time update the issue data, but that
50  * is not the standard implementation.
51  * <P>
52  * Containment patterns would require the creation methods for an editable form
53  * of the issue to be in this interface. For security reasons, this method
54  * is placed in the <tt>ProblemManager</tt> interface instead.
55  * <P>
56  * NOTE: this interface may be too generic to be useful.
57  *
58  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
59  * @version $Date: 2003/02/10 22:51:57 $
60  * @since July 12, 2002
61  */

62 public abstract class AbstractIssue implements IIssue
63 {
64     private String JavaDoc id;
65     private String JavaDoc type;
66     private String JavaDoc desc;
67     private IIssueState state;
68     private IAttributeSet attribs;
69     
70     
71     public AbstractIssue( String JavaDoc i, String JavaDoc t, String JavaDoc d, IIssueState s,
72             IAttributeSet a )
73     {
74         if (i == null || s == null)
75         {
76             throw new IllegalArgumentException JavaDoc("no null arguments");
77         }
78         this.id = i;
79         this.type = t;
80         this.desc = d;
81         this.state = s;
82         this.attribs = a;
83     }
84     
85     
86     
87     /**
88      * Returns the unique ID associated with this issue.
89      *
90      * @return the problem tracker's assigned ID for this issue.
91      */

92     public String JavaDoc getID()
93     {
94         return this.id;
95     }
96     
97     
98     /**
99      * Returns the type of issue. For the SourceForge.net site, this may
100      * be "bug", "feature request", and so forth. Some trackers may only
101      * have one type of issue, so this field may not be as useful. For
102      * those trackers that have different attribute data sets for different
103      * types, this may aid programs in decoding the attributes and states.
104      * <P>
105      * NOTE: this field may be deprecated in the future in favor of specific
106      * IAttributeSet types.
107      *
108      * @see #getAttributes()
109      */

110     public String JavaDoc getType()
111     {
112         return this.type;
113     }
114     
115     
116     /**
117      * Retrieves the short description of the issue. This can also be
118      * referred to as the issue title or summary. It should be a
119      * human-readable short description, describing a general overview
120      * of the issue.
121      *
122      * @return the issue's short description.
123      */

124     public String JavaDoc getShortDescription()
125     {
126         return this.desc;
127     }
128     
129     
130     /**
131      * Queries the "state" of the issue. In a very general way, this refers
132      * to various progress states an issue can be in, such as "new", "assigned",
133      * "investigating", "resolved", "verified", "closed", and so on. Additional
134      * data may be associated with this state, such as who's working on the
135      * issue, the resolution of the issue, who verified the resolution, and
136      * so on. If the tracker does not support a state, then <tt>null</tt>
137      * may be returned.
138      * <P>
139      * Some trackers may have different state categories for different
140      * issue types.
141      *
142      * @return the issue's state, which may be <tt>null</tt>.
143      */

144     public IIssueState getState()
145     {
146         return this.state;
147     }
148     
149     
150     /**
151      * Returns a list of all attributes associated with this issue. All
152      * issues of a particular type should have the same set of issues.
153      *
154      * @return the set of tracker-specific and issue type-specific attributes
155      * and values associated with this issue. Can never return
156      * <tt>null</tt>.
157      */

158     public IAttributeSet getAttributes()
159     {
160         return this.attribs;
161     }
162     
163     
164     /**
165      * Reloads all the data in this issue so that it reflects the most current
166      * tracker data possible. If this is called on an editable issue, then
167      * all changes will be forgotten, and the issue will reflect the current
168      * tracker state.
169      * <P>
170      * In theory, issues should never be removed. However, some systems allow
171      * them to be deleted (say, if there was an accidental creation). In this
172      * case, an <tt>IssueRemovedException</tt> will be thrown.
173      *
174      * @exception ProblemManagerException if there was an underlying tracker
175      * error.
176      */

177     public abstract IIssue reload()
178             throws ProblemManagerException;
179 }
180
181
Popular Tags