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