1
2
3
4
5
6 package org.apache.archiva.model;
7
8
9
10
11
12
13 @SuppressWarnings( "all" )
14 public class ArchivaRepositoryMetadata
15 implements java.io.Serializable
16 {
17
18
19
20
21
22
23
24
25
26
27 private String groupId;
28
29
30
31
32
33
34 private String artifactId;
35
36
37
38
39
40
41 private String version;
42
43
44
45
46
47
48 private String latestVersion;
49
50
51
52
53
54
55 private String releasedVersion;
56
57
58
59
60
61
62 private SnapshotVersion snapshotVersion;
63
64
65
66
67 private java.util.List<Plugin> plugins;
68
69
70
71
72 private java.util.List<String> availableVersions;
73
74
75
76
77
78
79 private String lastUpdated;
80
81
82
83
84
85
86 private java.util.Date fileLastModified;
87
88
89
90
91
92
93 private long fileSize = 0L;
94
95
96
97
98
99
100
101
102
103
104
105 public void addAvailableVersion( String string )
106 {
107 getAvailableVersions().add( string );
108 }
109
110
111
112
113
114
115 public void addPlugin( Plugin plugin )
116 {
117 getPlugins().add( plugin );
118 }
119
120
121
122
123
124
125
126 public boolean equals( Object other )
127 {
128 if ( this == other )
129 {
130 return true;
131 }
132
133 if ( !( other instanceof ArchivaRepositoryMetadata ) )
134 {
135 return false;
136 }
137
138 ArchivaRepositoryMetadata that = (ArchivaRepositoryMetadata) other;
139 boolean result = true;
140
141 result = result && ( getGroupId() == null ? that.getGroupId() == null : getGroupId().equals( that.getGroupId() ) );
142 result = result && ( getArtifactId() == null ? that.getArtifactId() == null : getArtifactId().equals( that.getArtifactId() ) );
143 result = result && ( getVersion() == null ? that.getVersion() == null : getVersion().equals( that.getVersion() ) );
144
145 return result;
146 }
147
148
149
150
151
152
153 public String getArtifactId()
154 {
155 return this.artifactId;
156 }
157
158
159
160
161
162
163 public java.util.List<String> getAvailableVersions()
164 {
165 if ( this.availableVersions == null )
166 {
167 this.availableVersions = new java.util.ArrayList<String>();
168 }
169
170 return this.availableVersions;
171 }
172
173
174
175
176
177
178 public java.util.Date getFileLastModified()
179 {
180 return this.fileLastModified;
181 }
182
183
184
185
186
187
188 public long getFileSize()
189 {
190 return this.fileSize;
191 }
192
193
194
195
196
197
198 public String getGroupId()
199 {
200 return this.groupId;
201 }
202
203
204
205
206
207
208 public String getLastUpdated()
209 {
210 return this.lastUpdated;
211 }
212
213
214
215
216
217
218 public String getLatestVersion()
219 {
220 return this.latestVersion;
221 }
222
223
224
225
226
227
228 public java.util.List<Plugin> getPlugins()
229 {
230 if ( this.plugins == null )
231 {
232 this.plugins = new java.util.ArrayList<Plugin>();
233 }
234
235 return this.plugins;
236 }
237
238
239
240
241
242
243 public String getReleasedVersion()
244 {
245 return this.releasedVersion;
246 }
247
248
249
250
251
252
253 public SnapshotVersion getSnapshotVersion()
254 {
255 return this.snapshotVersion;
256 }
257
258
259
260
261
262
263 public String getVersion()
264 {
265 return this.version;
266 }
267
268
269
270
271
272
273 public int hashCode()
274 {
275 int result = 17;
276
277 result = 37 * result + ( groupId != null ? groupId.hashCode() : 0 );
278 result = 37 * result + ( artifactId != null ? artifactId.hashCode() : 0 );
279 result = 37 * result + ( version != null ? version.hashCode() : 0 );
280
281 return result;
282 }
283
284
285
286
287
288
289 public void removeAvailableVersion( String string )
290 {
291 getAvailableVersions().remove( string );
292 }
293
294
295
296
297
298
299 public void removePlugin( Plugin plugin )
300 {
301 getPlugins().remove( plugin );
302 }
303
304
305
306
307
308
309 public void setArtifactId( String artifactId )
310 {
311 this.artifactId = artifactId;
312 }
313
314
315
316
317
318
319 public void setAvailableVersions( java.util.List<String> availableVersions )
320 {
321 this.availableVersions = availableVersions;
322 }
323
324
325
326
327
328
329 public void setFileLastModified( java.util.Date fileLastModified )
330 {
331 this.fileLastModified = fileLastModified;
332 }
333
334
335
336
337
338
339 public void setFileSize( long fileSize )
340 {
341 this.fileSize = fileSize;
342 }
343
344
345
346
347
348
349 public void setGroupId( String groupId )
350 {
351 this.groupId = groupId;
352 }
353
354
355
356
357
358
359 public void setLastUpdated( String lastUpdated )
360 {
361 this.lastUpdated = lastUpdated;
362 }
363
364
365
366
367
368
369 public void setLatestVersion( String latestVersion )
370 {
371 this.latestVersion = latestVersion;
372 }
373
374
375
376
377
378
379 public void setPlugins( java.util.List<Plugin> plugins )
380 {
381 this.plugins = plugins;
382 }
383
384
385
386
387
388
389 public void setReleasedVersion( String releasedVersion )
390 {
391 this.releasedVersion = releasedVersion;
392 }
393
394
395
396
397
398
399 public void setSnapshotVersion( SnapshotVersion snapshotVersion )
400 {
401 this.snapshotVersion = snapshotVersion;
402 }
403
404
405
406
407
408
409 public void setVersion( String version )
410 {
411 this.version = version;
412 }
413
414
415
416
417
418
419 public java.lang.String toString()
420 {
421 StringBuilder buf = new StringBuilder( 128 );
422
423 buf.append( "groupId = '" );
424 buf.append( getGroupId() );
425 buf.append( "'" );
426 buf.append( "\n" );
427 buf.append( "artifactId = '" );
428 buf.append( getArtifactId() );
429 buf.append( "'" );
430 buf.append( "\n" );
431 buf.append( "version = '" );
432 buf.append( getVersion() );
433 buf.append( "'" );
434
435 return buf.toString();
436 }
437
438
439 private static final long serialVersionUID = 914715358219606100L;
440
441
442 public void updateTimestamp()
443 {
444 setLastUpdatedTimestamp( new java.util.Date() );
445 }
446
447 public void setLastUpdatedTimestamp( java.util.Date date )
448 {
449 java.util.TimeZone timezone = java.util.TimeZone.getTimeZone( "UTC" );
450 java.text.DateFormat fmt = new java.text.SimpleDateFormat( "yyyyMMddHHmmss" );
451 fmt.setTimeZone( timezone );
452 setLastUpdated( fmt.format( date ) );
453 }
454
455 }