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