1
2
3
4
5
6 package org.apache.maven.artifact.repository.metadata;
7
8
9
10
11
12
13
14 @SuppressWarnings( "all" )
15 public class Versioning
16 implements java.io.Serializable, java.lang.Cloneable
17 {
18
19
20
21
22
23
24
25
26
27
28 private String latest;
29
30
31
32
33
34 private String release;
35
36
37
38
39 private java.util.List<String> versions;
40
41
42
43
44
45
46
47 private String lastUpdated;
48
49
50
51
52
53 private Snapshot snapshot;
54
55
56
57
58 private java.util.List<SnapshotVersion> snapshotVersions;
59
60
61
62
63
64
65
66
67
68
69
70 public void addSnapshotVersion( SnapshotVersion snapshotVersion )
71 {
72 getSnapshotVersions().add( snapshotVersion );
73 }
74
75
76
77
78
79
80 public void addVersion( String string )
81 {
82 getVersions().add( string );
83 }
84
85
86
87
88
89
90 public Versioning clone()
91 {
92 try
93 {
94 Versioning copy = (Versioning) super.clone();
95
96 if ( this.versions != null )
97 {
98 copy.versions = new java.util.ArrayList<String>();
99 copy.versions.addAll( this.versions );
100 }
101
102 if ( this.snapshot != null )
103 {
104 copy.snapshot = (Snapshot) this.snapshot.clone();
105 }
106
107 if ( this.snapshotVersions != null )
108 {
109 copy.snapshotVersions = new java.util.ArrayList<SnapshotVersion>();
110 for ( SnapshotVersion item : this.snapshotVersions )
111 {
112 copy.snapshotVersions.add( ( (SnapshotVersion) item).clone() );
113 }
114 }
115
116 return copy;
117 }
118 catch ( java.lang.Exception ex )
119 {
120 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
121 + " does not support clone()" ).initCause( ex );
122 }
123 }
124
125
126
127
128
129
130
131
132
133 public String getLastUpdated()
134 {
135 return this.lastUpdated;
136 }
137
138
139
140
141
142
143
144
145 public String getLatest()
146 {
147 return this.latest;
148 }
149
150
151
152
153
154
155
156 public String getRelease()
157 {
158 return this.release;
159 }
160
161
162
163
164
165
166
167 public Snapshot getSnapshot()
168 {
169 return this.snapshot;
170 }
171
172
173
174
175
176
177 public java.util.List<SnapshotVersion> getSnapshotVersions()
178 {
179 if ( this.snapshotVersions == null )
180 {
181 this.snapshotVersions = new java.util.ArrayList<SnapshotVersion>();
182 }
183
184 return this.snapshotVersions;
185 }
186
187
188
189
190
191
192 public java.util.List<String> getVersions()
193 {
194 if ( this.versions == null )
195 {
196 this.versions = new java.util.ArrayList<String>();
197 }
198
199 return this.versions;
200 }
201
202
203
204
205
206
207 public void removeSnapshotVersion( SnapshotVersion snapshotVersion )
208 {
209 getSnapshotVersions().remove( snapshotVersion );
210 }
211
212
213
214
215
216
217 public void removeVersion( String string )
218 {
219 getVersions().remove( string );
220 }
221
222
223
224
225
226
227
228
229
230 public void setLastUpdated( String lastUpdated )
231 {
232 this.lastUpdated = lastUpdated;
233 }
234
235
236
237
238
239
240
241
242 public void setLatest( String latest )
243 {
244 this.latest = latest;
245 }
246
247
248
249
250
251
252
253 public void setRelease( String release )
254 {
255 this.release = release;
256 }
257
258
259
260
261
262
263
264 public void setSnapshot( Snapshot snapshot )
265 {
266 this.snapshot = snapshot;
267 }
268
269
270
271
272
273
274
275
276 public void setSnapshotVersions( java.util.List<SnapshotVersion> snapshotVersions )
277 {
278 this.snapshotVersions = snapshotVersions;
279 }
280
281
282
283
284
285
286
287 public void setVersions( java.util.List<String> versions )
288 {
289 this.versions = versions;
290 }
291
292
293 public void updateTimestamp()
294 {
295 setLastUpdatedTimestamp( new java.util.Date() );
296 }
297
298 public void setLastUpdatedTimestamp( java.util.Date date )
299 {
300 java.util.TimeZone timezone = java.util.TimeZone.getTimeZone( "UTC" );
301 java.text.DateFormat fmt = new java.text.SimpleDateFormat( "yyyyMMddHHmmss" );
302 fmt.setTimeZone( timezone );
303 setLastUpdated( fmt.format( date ) );
304 }
305
306 }