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