View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 1.11,
3   // any modifications will be overwritten.
4   // ==============================================================
5   
6   package org.apache.maven.artifact.repository.metadata;
7   
8   /**
9    * Versioning information for "groupId/artifactId" or
10   * "groupId/artifactId/version" SNAPSHOT.
11   * 
12   * @version $Revision$ $Date$
13   */
14  @SuppressWarnings( "all" )
15  public class Versioning
16      implements java.io.Serializable, java.lang.Cloneable
17  {
18  
19        //--------------------------/
20       //- Class/Member Variables -/
21      //--------------------------/
22  
23      /**
24       * What the last version added to the directory is, including
25       * both releases and snapshots ("groupId/artifactId" directory
26       * only).
27       */
28      private String latest;
29  
30      /**
31       * What the last version added to the directory is, for the
32       * releases only ("groupId/artifactId" directory only).
33       */
34      private String release;
35  
36      /**
37       * Field versions.
38       */
39      private java.util.List<String> versions;
40  
41      /**
42       * When the metadata was last updated (both
43       * "groupId/artifactId" and "groupId/artifactId/version"
44       * directories). The timestamp is expressed using UTC in the
45       * format yyyyMMddHHmmss.
46       */
47      private String lastUpdated;
48  
49      /**
50       * The current snapshot data in use for this version
51       * ("groupId/artifactId/version" only).
52       */
53      private Snapshot snapshot;
54  
55      /**
56       * Field snapshotVersions.
57       */
58      private java.util.List<SnapshotVersion> snapshotVersions;
59  
60  
61        //-----------/
62       //- Methods -/
63      //-----------/
64  
65      /**
66       * Method addSnapshotVersion.
67       * 
68       * @param snapshotVersion
69       */
70      public void addSnapshotVersion( SnapshotVersion snapshotVersion )
71      {
72          getSnapshotVersions().add( snapshotVersion );
73      } //-- void addSnapshotVersion( SnapshotVersion )
74  
75      /**
76       * Method addVersion.
77       * 
78       * @param string
79       */
80      public void addVersion( String string )
81      {
82          getVersions().add( string );
83      } //-- void addVersion( String )
84  
85      /**
86       * Method clone.
87       * 
88       * @return Versioning
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     } //-- Versioning clone()
124 
125     /**
126      * Get when the metadata was last updated (both
127      * "groupId/artifactId" and "groupId/artifactId/version"
128      * directories). The timestamp is expressed using UTC in the
129      * format yyyyMMddHHmmss.
130      * 
131      * @return String
132      */
133     public String getLastUpdated()
134     {
135         return this.lastUpdated;
136     } //-- String getLastUpdated()
137 
138     /**
139      * Get what the last version added to the directory is,
140      * including both releases and snapshots ("groupId/artifactId"
141      * directory only).
142      * 
143      * @return String
144      */
145     public String getLatest()
146     {
147         return this.latest;
148     } //-- String getLatest()
149 
150     /**
151      * Get what the last version added to the directory is, for the
152      * releases only ("groupId/artifactId" directory only).
153      * 
154      * @return String
155      */
156     public String getRelease()
157     {
158         return this.release;
159     } //-- String getRelease()
160 
161     /**
162      * Get the current snapshot data in use for this version
163      * ("groupId/artifactId/version" only).
164      * 
165      * @return Snapshot
166      */
167     public Snapshot getSnapshot()
168     {
169         return this.snapshot;
170     } //-- Snapshot getSnapshot()
171 
172     /**
173      * Method getSnapshotVersions.
174      * 
175      * @return List
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     } //-- java.util.List<SnapshotVersion> getSnapshotVersions()
186 
187     /**
188      * Method getVersions.
189      * 
190      * @return List
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     } //-- java.util.List<String> getVersions()
201 
202     /**
203      * Method removeSnapshotVersion.
204      * 
205      * @param snapshotVersion
206      */
207     public void removeSnapshotVersion( SnapshotVersion snapshotVersion )
208     {
209         getSnapshotVersions().remove( snapshotVersion );
210     } //-- void removeSnapshotVersion( SnapshotVersion )
211 
212     /**
213      * Method removeVersion.
214      * 
215      * @param string
216      */
217     public void removeVersion( String string )
218     {
219         getVersions().remove( string );
220     } //-- void removeVersion( String )
221 
222     /**
223      * Set when the metadata was last updated (both
224      * "groupId/artifactId" and "groupId/artifactId/version"
225      * directories). The timestamp is expressed using UTC in the
226      * format yyyyMMddHHmmss.
227      * 
228      * @param lastUpdated
229      */
230     public void setLastUpdated( String lastUpdated )
231     {
232         this.lastUpdated = lastUpdated;
233     } //-- void setLastUpdated( String )
234 
235     /**
236      * Set what the last version added to the directory is,
237      * including both releases and snapshots ("groupId/artifactId"
238      * directory only).
239      * 
240      * @param latest
241      */
242     public void setLatest( String latest )
243     {
244         this.latest = latest;
245     } //-- void setLatest( String )
246 
247     /**
248      * Set what the last version added to the directory is, for the
249      * releases only ("groupId/artifactId" directory only).
250      * 
251      * @param release
252      */
253     public void setRelease( String release )
254     {
255         this.release = release;
256     } //-- void setRelease( String )
257 
258     /**
259      * Set the current snapshot data in use for this version
260      * ("groupId/artifactId/version" only).
261      * 
262      * @param snapshot
263      */
264     public void setSnapshot( Snapshot snapshot )
265     {
266         this.snapshot = snapshot;
267     } //-- void setSnapshot( Snapshot )
268 
269     /**
270      * Set information for each sub-artifact available in this
271      * artifact snapshot. This is only the most recent SNAPSHOT for
272      * each unique extension/classifier combination.
273      * 
274      * @param snapshotVersions
275      */
276     public void setSnapshotVersions( java.util.List<SnapshotVersion> snapshotVersions )
277     {
278         this.snapshotVersions = snapshotVersions;
279     } //-- void setSnapshotVersions( java.util.List )
280 
281     /**
282      * Set versions available of the artifact (both releases and
283      * snapshots) ("groupId/artifactId" directory only).
284      * 
285      * @param versions
286      */
287     public void setVersions( java.util.List<String> versions )
288     {
289         this.versions = versions;
290     } //-- void setVersions( java.util.List )
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 }