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