Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Release |
|
| 1.5384615384615385;1.538 |
1 | /* | |
2 | * $Id$ | |
3 | */ | |
4 | ||
5 | package org.apache.maven.plugins.changes.model; | |
6 | ||
7 | //---------------------------------/ | |
8 | //- Imported classes and packages -/ | |
9 | //---------------------------------/ | |
10 | ||
11 | import java.util.Date; | |
12 | ||
13 | /** | |
14 | * A single release of this project. | |
15 | * | |
16 | * @version $Revision$ $Date$ | |
17 | */ | |
18 | 7 | public class Release implements java.io.Serializable { |
19 | ||
20 | ||
21 | //--------------------------/ | |
22 | //- Class/Member Variables -/ | |
23 | //--------------------------/ | |
24 | ||
25 | /** | |
26 | * | |
27 | * The version number associated with this release. | |
28 | * | |
29 | */ | |
30 | private String version; | |
31 | ||
32 | /** | |
33 | * | |
34 | * | |
35 | * <p>The date of this release.</p> | |
36 | * <p>This field can be any String, such as "in | |
37 | * SVN" when the version isn't yet released. </p> | |
38 | * | |
39 | * | |
40 | */ | |
41 | private String dateRelease; | |
42 | ||
43 | /** | |
44 | * | |
45 | * A short description of this release. | |
46 | * | |
47 | */ | |
48 | private String description; | |
49 | ||
50 | /** | |
51 | * Field actions. | |
52 | */ | |
53 | private java.util.List actions; | |
54 | ||
55 | ||
56 | //-----------/ | |
57 | //- Methods -/ | |
58 | //-----------/ | |
59 | ||
60 | /** | |
61 | * Method addAction. | |
62 | * | |
63 | * @param action | |
64 | */ | |
65 | public void addAction(Action action) | |
66 | { | |
67 | 0 | if ( !(action instanceof Action) ) |
68 | { | |
69 | 0 | throw new ClassCastException( "Release.addActions(action) parameter must be instanceof " + Action.class.getName() ); |
70 | } | |
71 | 0 | getActions().add( action ); |
72 | 0 | } //-- void addAction(Action) |
73 | ||
74 | /** | |
75 | * Method getActions. | |
76 | * | |
77 | * @return java.util.List | |
78 | */ | |
79 | public java.util.List getActions() | |
80 | { | |
81 | 22 | if ( this.actions == null ) |
82 | { | |
83 | 4 | this.actions = new java.util.ArrayList(); |
84 | } | |
85 | ||
86 | 22 | return this.actions; |
87 | } //-- java.util.List getActions() | |
88 | ||
89 | /** | |
90 | * Get | |
91 | * | |
92 | * <p>The date of this release.</p> | |
93 | * <p>This field can be any String, such as "in | |
94 | * SVN" when the version isn't yet released. </p> | |
95 | * | |
96 | * | |
97 | * | |
98 | * @return String | |
99 | */ | |
100 | public String getDateRelease() | |
101 | { | |
102 | 1 | return this.dateRelease; |
103 | } //-- String getDateRelease() | |
104 | ||
105 | /** | |
106 | * Get | |
107 | * A short description of this release. | |
108 | * | |
109 | * | |
110 | * @return String | |
111 | */ | |
112 | public String getDescription() | |
113 | { | |
114 | 0 | return this.description; |
115 | } //-- String getDescription() | |
116 | ||
117 | /** | |
118 | * Get | |
119 | * The version number associated with this release. | |
120 | * | |
121 | * | |
122 | * @return String | |
123 | */ | |
124 | public String getVersion() | |
125 | { | |
126 | 5 | return this.version; |
127 | } //-- String getVersion() | |
128 | ||
129 | /** | |
130 | * Method removeAction. | |
131 | * | |
132 | * @param action | |
133 | */ | |
134 | public void removeAction(Action action) | |
135 | { | |
136 | 0 | if ( !(action instanceof Action) ) |
137 | { | |
138 | 0 | throw new ClassCastException( "Release.removeActions(action) parameter must be instanceof " + Action.class.getName() ); |
139 | } | |
140 | 0 | getActions().remove( action ); |
141 | 0 | } //-- void removeAction(Action) |
142 | ||
143 | /** | |
144 | * Set the list of actions taken for this release. | |
145 | * | |
146 | * @param actions | |
147 | */ | |
148 | public void setActions(java.util.List actions) | |
149 | { | |
150 | 1 | this.actions = actions; |
151 | 1 | } //-- void setActions(java.util.List) |
152 | ||
153 | /** | |
154 | * Set | |
155 | * | |
156 | * <p>The date of this release.</p> | |
157 | * <p>This field can be any String, such as "in | |
158 | * SVN" when the version isn't yet released. </p> | |
159 | * | |
160 | * | |
161 | * | |
162 | * @param dateRelease | |
163 | */ | |
164 | public void setDateRelease(String dateRelease) | |
165 | { | |
166 | 5 | this.dateRelease = dateRelease; |
167 | 5 | } //-- void setDateRelease(String) |
168 | ||
169 | /** | |
170 | * Set | |
171 | * A short description of this release. | |
172 | * | |
173 | * | |
174 | * @param description | |
175 | */ | |
176 | public void setDescription(String description) | |
177 | { | |
178 | 4 | this.description = description; |
179 | 4 | } //-- void setDescription(String) |
180 | ||
181 | /** | |
182 | * Set | |
183 | * The version number associated with this release. | |
184 | * | |
185 | * | |
186 | * @param version | |
187 | */ | |
188 | public void setVersion(String version) | |
189 | { | |
190 | 5 | this.version = version; |
191 | 5 | } //-- void setVersion(String) |
192 | ||
193 | ||
194 | public java.util.List getActions(String type) | |
195 | { | |
196 | 8 | java.util.List actions = new java.util.ArrayList(); |
197 | 8 | for (java.util.Iterator iterator = getActions().iterator(); iterator.hasNext(); ) |
198 | { | |
199 | 40 | Action action = (Action) iterator.next(); |
200 | 40 | if ( action.getType() != null && action.getType().equalsIgnoreCase( type ) ) |
201 | { | |
202 | 10 | actions.add( action ); |
203 | } | |
204 | } | |
205 | 8 | return actions; |
206 | } | |
207 | ||
208 | 7 | private String modelEncoding = "UTF-8"; |
209 | ||
210 | /** | |
211 | * Set an encoding used for reading/writing the model. | |
212 | * | |
213 | * @param modelEncoding the encoding used when reading/writing the model. | |
214 | */ | |
215 | public void setModelEncoding( String modelEncoding ) | |
216 | { | |
217 | 0 | this.modelEncoding = modelEncoding; |
218 | 0 | } |
219 | ||
220 | /** | |
221 | * @return the current encoding used when reading/writing this model. | |
222 | */ | |
223 | public String getModelEncoding() | |
224 | { | |
225 | 0 | return modelEncoding; |
226 | } | |
227 | } |