KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)DefaultIssueState.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 import net.sourceforge.groboutils.pmti.v1.IIssueState;
32 import net.sourceforge.groboutils.pmti.v1.IAttributeSet;
33
34  
35
36 /**
37  * Describes the state of an Issue. Issue states may have additional
38  * information associated with them, and as such uses the Attribute methodology
39  * in the same way an Issue does. All implementations of <tt>IIssueState</tt>
40  * must be immutable, unless they are also instances of
41  * <tt>IEditableIssueState</tt>.
42  *
43  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
44  * @version $Date: 2003/02/10 22:51:58 $
45  * @since July 12, 2002
46  */

47 public class DefaultIssueState implements IIssueState
48 {
49     private String JavaDoc name;
50     private String JavaDoc desc;
51     private boolean open;
52     private IAttributeSet attribs;
53     
54     public DefaultIssueState( String JavaDoc n, String JavaDoc d, boolean o, IAttributeSet s )
55     {
56         if (n == null || d == null || s == null)
57         {
58             throw new IllegalArgumentException JavaDoc("no null arguments");
59         }
60         
61         this.name = n;
62         this.desc = d;
63         this.open = o;
64         this.attribs = s;
65     }
66     
67     
68     /**
69      * Returns the short name of the state.
70      *
71      * @return the short readable name of the state.
72      */

73     public String JavaDoc getName()
74     {
75         return this.name;
76     }
77     
78     
79     /**
80      * Retrieves a long, human-readable, description of the state.
81      *
82      * @return the state's description.
83      */

84     public String JavaDoc getDescription()
85     {
86         return this.desc;
87     }
88     
89     
90     /**
91      * A broad category for the state - it means that the issue has not been
92      * resolved yet, and the code is still open for changes based on this
93      * issue.
94      * <P>
95      * <tt>isOpen()</tt> must always return the opposite of
96      * <tt>isClosed()</tt>; that is, the following code:
97      * <PRE>
98      * isOpen() == !isClosed()
99      * </PRE>
100      * <i>must always</i> evaluate to <tt>true</tt>.
101      */

102     public boolean isOpen()
103     {
104         return this.open;
105     }
106     
107     
108     /**
109      * A broad category for the state - it means that the issue has been
110      * resolved, and the code is no longer open for changes based on this
111      * issue.
112      * <P>
113      * <tt>isClosed()</tt> must always return the opposite of
114      * <tt>isOpen()</tt>; that is, the following code:
115      * <PRE>
116      * isOpen() == !isClosed()
117      * </PRE>
118      * <i>must always</i> evaluate to <tt>true</tt>.
119      */

120     public boolean isClosed()
121     {
122         return !isOpen();
123     }
124     
125     
126     /**
127      * Returns a list of all attributes associated with this state. All
128      * states of a particular type should have the same set of issues. If
129      * the problem tracker does not have attributes associated with an issue
130      * state, then this must still return a non-<tt>null</tt>, but the set
131      * will be empty.
132      *
133      * @return the set of tracker-specific and issue type-specific attributes
134      * and values associated with this issue. Can never return
135      * <tt>null</tt>.
136      */

137     public IAttributeSet getAttributes()
138     {
139         return this.attribs;
140     }
141 }
142
143
Popular Tags