View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello 1.4.1 on 2013-02-24 03:31:03,
4    any modifications will be overwritten.
5    ==============================================================
6    */
7   
8   package org.apache.maven.artifact.repository.metadata;
9   
10  /**
11   * Versioning information for an artifact.
12   * 
13   * @version $Revision$ $Date$
14   */
15  @SuppressWarnings( "all" )
16  public class Versioning
17      implements java.io.Serializable, java.lang.Cloneable
18  {
19  
20        //--------------------------/
21       //- Class/Member Variables -/
22      //--------------------------/
23  
24      /**
25       * What the latest version in the directory is, including
26       * snapshots.
27       */
28      private String latest;
29  
30      /**
31       * What the latest version in the directory is, of the releases.
32       */
33      private String release;
34  
35      /**
36       * The current snapshot data in use for this version.
37       */
38      private Snapshot snapshot;
39  
40      /**
41       * Field versions.
42       */
43      private java.util.List<String> versions;
44  
45      /**
46       * When the metadata was last updated.
47       */
48      private String lastUpdated;
49  
50      /**
51       * Field snapshotVersions.
52       */
53      private java.util.List<SnapshotVersion> snapshotVersions;
54  
55  
56        //-----------/
57       //- Methods -/
58      //-----------/
59  
60      /**
61       * Method addSnapshotVersion.
62       * 
63       * @param snapshotVersion
64       */
65      public void addSnapshotVersion( SnapshotVersion snapshotVersion )
66      {
67          getSnapshotVersions().add( snapshotVersion );
68      } //-- void addSnapshotVersion( SnapshotVersion )
69  
70      /**
71       * Method addVersion.
72       * 
73       * @param string
74       */
75      public void addVersion( String string )
76      {
77          getVersions().add( string );
78      } //-- void addVersion( String )
79  
80      /**
81       * Method clone.
82       * 
83       * @return Versioning
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     } //-- Versioning clone()
119 
120     /**
121      * Get when the metadata was last updated.
122      * 
123      * @return String
124      */
125     public String getLastUpdated()
126     {
127         return this.lastUpdated;
128     } //-- String getLastUpdated()
129 
130     /**
131      * Get what the latest version in the directory is, including
132      * snapshots.
133      * 
134      * @return String
135      */
136     public String getLatest()
137     {
138         return this.latest;
139     } //-- String getLatest()
140 
141     /**
142      * Get what the latest version in the directory is, of the
143      * releases.
144      * 
145      * @return String
146      */
147     public String getRelease()
148     {
149         return this.release;
150     } //-- String getRelease()
151 
152     /**
153      * Get the current snapshot data in use for this version.
154      * 
155      * @return Snapshot
156      */
157     public Snapshot getSnapshot()
158     {
159         return this.snapshot;
160     } //-- Snapshot getSnapshot()
161 
162     /**
163      * Method getSnapshotVersions.
164      * 
165      * @return List
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     } //-- java.util.List<SnapshotVersion> getSnapshotVersions()
176 
177     /**
178      * Method getVersions.
179      * 
180      * @return List
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     } //-- java.util.List<String> getVersions()
191 
192     /**
193      * Method removeSnapshotVersion.
194      * 
195      * @param snapshotVersion
196      */
197     public void removeSnapshotVersion( SnapshotVersion snapshotVersion )
198     {
199         getSnapshotVersions().remove( snapshotVersion );
200     } //-- void removeSnapshotVersion( SnapshotVersion )
201 
202     /**
203      * Method removeVersion.
204      * 
205      * @param string
206      */
207     public void removeVersion( String string )
208     {
209         getVersions().remove( string );
210     } //-- void removeVersion( String )
211 
212     /**
213      * Set when the metadata was last updated.
214      * 
215      * @param lastUpdated
216      */
217     public void setLastUpdated( String lastUpdated )
218     {
219         this.lastUpdated = lastUpdated;
220     } //-- void setLastUpdated( String )
221 
222     /**
223      * Set what the latest version in the directory is, including
224      * snapshots.
225      * 
226      * @param latest
227      */
228     public void setLatest( String latest )
229     {
230         this.latest = latest;
231     } //-- void setLatest( String )
232 
233     /**
234      * Set what the latest version in the directory is, of the
235      * releases.
236      * 
237      * @param release
238      */
239     public void setRelease( String release )
240     {
241         this.release = release;
242     } //-- void setRelease( String )
243 
244     /**
245      * Set the current snapshot data in use for this version.
246      * 
247      * @param snapshot
248      */
249     public void setSnapshot( Snapshot snapshot )
250     {
251         this.snapshot = snapshot;
252     } //-- void setSnapshot( Snapshot )
253 
254     /**
255      * Set the snapshot versions available for the artifact.
256      * 
257      * @param snapshotVersions
258      */
259     public void setSnapshotVersions( java.util.List<SnapshotVersion> snapshotVersions )
260     {
261         this.snapshotVersions = snapshotVersions;
262     } //-- void setSnapshotVersions( java.util.List )
263 
264     /**
265      * Set versions available for the artifact.
266      * 
267      * @param versions
268      */
269     public void setVersions( java.util.List<String> versions )
270     {
271         this.versions = versions;
272     } //-- void setVersions( java.util.List )
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 }