1
2
3
4
5
6
7
8 package org.hardcode.juf.status;
9
10
11
12
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import java.util.Enumeration;
19 import java.util.Vector;
20 import org.exolab.castor.xml.MarshalException;
21 import org.exolab.castor.xml.Marshaller;
22 import org.exolab.castor.xml.Unmarshaller;
23 import org.exolab.castor.xml.ValidationException;
24 import org.xml.sax.ContentHandler;
25
26 /***
27 * Class UpdateInfo.
28 *
29 * @version $Revision$ $Date$
30 */
31 public class UpdateInfo implements java.io.Serializable {
32
33
34
35
36
37
38 /***
39 * Field _urlPrefix
40 */
41 private java.lang.String _urlPrefix;
42
43 /***
44 * Field _statusList
45 */
46 private java.util.Vector _statusList;
47
48
49
50
51
52
53 public UpdateInfo() {
54 super();
55 _statusList = new Vector();
56 }
57
58
59
60
61
62
63 /***
64 * Method addStatus
65 *
66 * @param vStatus
67 */
68 public void addStatus(org.hardcode.juf.status.Status vStatus)
69 throws java.lang.IndexOutOfBoundsException
70 {
71 _statusList.addElement(vStatus);
72 }
73
74 /***
75 * Method addStatus
76 *
77 * @param index
78 * @param vStatus
79 */
80 public void addStatus(int index, org.hardcode.juf.status.Status vStatus)
81 throws java.lang.IndexOutOfBoundsException
82 {
83 _statusList.insertElementAt(vStatus, index);
84 }
85
86 /***
87 * Method enumerateStatus
88 */
89 public java.util.Enumeration enumerateStatus()
90 {
91 return _statusList.elements();
92 }
93
94 /***
95 * Method getStatus
96 *
97 * @param index
98 */
99 public org.hardcode.juf.status.Status getStatus(int index)
100 throws java.lang.IndexOutOfBoundsException
101 {
102
103 if ((index < 0) || (index > _statusList.size())) {
104 throw new IndexOutOfBoundsException();
105 }
106
107 return (org.hardcode.juf.status.Status) _statusList.elementAt(index);
108 }
109
110 /***
111 * Method getStatus
112 */
113 public org.hardcode.juf.status.Status[] getStatus()
114 {
115 int size = _statusList.size();
116 org.hardcode.juf.status.Status[] mArray = new org.hardcode.juf.status.Status[size];
117 for (int index = 0; index < size; index++) {
118 mArray[index] = (org.hardcode.juf.status.Status) _statusList.elementAt(index);
119 }
120 return mArray;
121 }
122
123 /***
124 * Method getStatusCount
125 */
126 public int getStatusCount()
127 {
128 return _statusList.size();
129 }
130
131 /***
132 * Returns the value of field 'urlPrefix'.
133 *
134 * @return the value of field 'urlPrefix'.
135 */
136 public java.lang.String getUrlPrefix()
137 {
138 return this._urlPrefix;
139 }
140
141 /***
142 * Method isValid
143 */
144 public boolean isValid()
145 {
146 try {
147 validate();
148 }
149 catch (org.exolab.castor.xml.ValidationException vex) {
150 return false;
151 }
152 return true;
153 }
154
155 /***
156 * Method marshal
157 *
158 * @param out
159 */
160 public void marshal(java.io.Writer out)
161 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
162 {
163
164 Marshaller.marshal(this, out);
165 }
166
167 /***
168 * Method marshal
169 *
170 * @param handler
171 */
172 public void marshal(org.xml.sax.ContentHandler handler)
173 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
174 {
175
176 Marshaller.marshal(this, handler);
177 }
178
179 /***
180 * Method removeAllStatus
181 */
182 public void removeAllStatus()
183 {
184 _statusList.removeAllElements();
185 }
186
187 /***
188 * Method removeStatus
189 *
190 * @param index
191 */
192 public org.hardcode.juf.status.Status removeStatus(int index)
193 {
194 java.lang.Object obj = _statusList.elementAt(index);
195 _statusList.removeElementAt(index);
196 return (org.hardcode.juf.status.Status) obj;
197 }
198
199 /***
200 * Method setStatus
201 *
202 * @param index
203 * @param vStatus
204 */
205 public void setStatus(int index, org.hardcode.juf.status.Status vStatus)
206 throws java.lang.IndexOutOfBoundsException
207 {
208
209 if ((index < 0) || (index > _statusList.size())) {
210 throw new IndexOutOfBoundsException();
211 }
212 _statusList.setElementAt(vStatus, index);
213 }
214
215 /***
216 * Method setStatus
217 *
218 * @param statusArray
219 */
220 public void setStatus(org.hardcode.juf.status.Status[] statusArray)
221 {
222
223 _statusList.removeAllElements();
224 for (int i = 0; i < statusArray.length; i++) {
225 _statusList.addElement(statusArray[i]);
226 }
227 }
228
229 /***
230 * Sets the value of field 'urlPrefix'.
231 *
232 * @param urlPrefix the value of field 'urlPrefix'.
233 */
234 public void setUrlPrefix(java.lang.String urlPrefix)
235 {
236 this._urlPrefix = urlPrefix;
237 }
238
239 /***
240 * Method unmarshal
241 *
242 * @param reader
243 */
244 public static java.lang.Object unmarshal(java.io.Reader reader)
245 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
246 {
247 return (org.hardcode.juf.status.UpdateInfo) Unmarshaller.unmarshal(org.hardcode.juf.status.UpdateInfo.class, reader);
248 }
249
250 /***
251 * Method validate
252 */
253 public void validate()
254 throws org.exolab.castor.xml.ValidationException
255 {
256 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
257 validator.validate(this);
258 }
259
260 }