001// =================== DO NOT EDIT THIS FILE ====================
002// Generated by Modello 1.8.3,
003// any modifications will be overwritten.
004// ==============================================================
005
006package org.apache.maven.artifact.repository.metadata;
007
008/**
009 * Versioning information for an artifact (un-versioned or
010 * snapshot).
011 * 
012 * @version $Revision: 965443 $ $Date: 2015-09-14 22:18:52 +0000 (Mon, 14 Sep 2015) $
013 */
014@SuppressWarnings( "all" )
015public class Versioning
016    implements java.io.Serializable, java.lang.Cloneable
017{
018
019      //--------------------------/
020     //- Class/Member Variables -/
021    //--------------------------/
022
023    /**
024     * What the latest version in the directory is, including
025     * snapshots.
026     */
027    private String latest;
028
029    /**
030     * What the latest version in the directory is, of the releases
031     * only.
032     */
033    private String release;
034
035    /**
036     * The current snapshot data in use for this version (artifact
037     * snapshots only).
038     */
039    private Snapshot snapshot;
040
041    /**
042     * Field versions.
043     */
044    private java.util.List<String> versions;
045
046    /**
047     * When the metadata was last updated.
048     */
049    private String lastUpdated;
050
051    /**
052     * Field snapshotVersions.
053     */
054    private java.util.List<SnapshotVersion> snapshotVersions;
055
056
057      //-----------/
058     //- Methods -/
059    //-----------/
060
061    /**
062     * Method addSnapshotVersion.
063     * 
064     * @param snapshotVersion
065     */
066    public void addSnapshotVersion( SnapshotVersion snapshotVersion )
067    {
068        getSnapshotVersions().add( snapshotVersion );
069    } //-- void addSnapshotVersion( SnapshotVersion )
070
071    /**
072     * Method addVersion.
073     * 
074     * @param string
075     */
076    public void addVersion( String string )
077    {
078        getVersions().add( string );
079    } //-- void addVersion( String )
080
081    /**
082     * Method clone.
083     * 
084     * @return Versioning
085     */
086    public Versioning clone()
087    {
088        try
089        {
090            Versioning copy = (Versioning) super.clone();
091
092            if ( this.snapshot != null )
093            {
094                copy.snapshot = (Snapshot) this.snapshot.clone();
095            }
096
097            if ( this.versions != null )
098            {
099                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}