1 /* 2 Licensed to the Apache Software Foundation (ASF) under one 3 or more contributor license agreements. See the NOTICE file 4 distributed with this work for additional information 5 regarding copyright ownership. The ASF licenses this file 6 to you under the Apache License, Version 2.0 (the 7 "License"); you may not use this file except in compliance 8 with the License. You may obtain a copy of the License at 9 10 http://www.apache.org/licenses/LICENSE-2.0 11 12 Unless required by applicable law or agreed to in writing, 13 software distributed under the License is distributed on an 14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 KIND, either express or implied. See the License for the 16 specific language governing permissions and limitations 17 under the License. 18 =================== DO NOT EDIT THIS FILE ==================== 19 Generated by Modello 2.4.0, 20 any modifications will be overwritten. 21 ============================================================== 22 */ 23 24 package org.apache.maven.artifact.repository.metadata; 25 26 /** 27 * Versioning information for "groupId/artifactId" or 28 * "groupId/artifactId/version" SNAPSHOT. 29 * 30 * @version $Revision$ $Date$ 31 */ 32 @SuppressWarnings( "all" ) 33 public class Versioning 34 implements java.io.Serializable, java.lang.Cloneable 35 { 36 37 //--------------------------/ 38 //- Class/Member Variables -/ 39 //--------------------------/ 40 41 /** 42 * What the last version added to the directory is, including 43 * both releases and snapshots ("groupId/artifactId" directory 44 * only). 45 */ 46 private String latest; 47 48 /** 49 * What the last version added to the directory is, for the 50 * releases only ("groupId/artifactId" directory only). 51 */ 52 private String release; 53 54 /** 55 * Field versions. 56 */ 57 private java.util.List<String> versions; 58 59 /** 60 * When the metadata was last updated (both 61 * "groupId/artifactId" and "groupId/artifactId/version" 62 * directories). The timestamp is expressed using UTC in the 63 * format yyyyMMddHHmmss. 64 */ 65 private String lastUpdated; 66 67 /** 68 * The current snapshot data in use for this version 69 * ("groupId/artifactId/version" only). 70 */ 71 private Snapshot snapshot; 72 73 /** 74 * Field snapshotVersions. 75 */ 76 private java.util.List<SnapshotVersion> snapshotVersions; 77 78 79 //-----------/ 80 //- Methods -/ 81 //-----------/ 82 83 /** 84 * Method addSnapshotVersion. 85 * 86 * @param snapshotVersion a snapshotVersion object. 87 */ 88 public void addSnapshotVersion( SnapshotVersion snapshotVersion ) 89 { 90 getSnapshotVersions().add( snapshotVersion ); 91 } //-- void addSnapshotVersion( SnapshotVersion ) 92 93 /** 94 * Method addVersion. 95 * 96 * @param string a string object. 97 */ 98 public void addVersion( String string ) 99 { 100 getVersions().add( string ); 101 } //-- void addVersion( String ) 102 103 /** 104 * Method clone. 105 * 106 * @return Versioning 107 */ 108 public Versioning clone() 109 { 110 try 111 { 112 Versioning copy = (Versioning) super.clone(); 113 114 if ( this.versions != null ) 115 { 116 copy.versions = new java.util.ArrayList<String>(); 117 copy.versions.addAll( this.versions ); 118 } 119 120 if ( this.snapshot != null ) 121 { 122 copy.snapshot = (Snapshot) this.snapshot.clone(); 123 } 124 125 if ( this.snapshotVersions != null ) 126 { 127 copy.snapshotVersions = new java.util.ArrayList<SnapshotVersion>(); 128 for ( SnapshotVersion item : this.snapshotVersions ) 129 { 130 copy.snapshotVersions.add( ( (SnapshotVersion) item).clone() ); 131 } 132 } 133 134 return copy; 135 } 136 catch ( java.lang.Exception ex ) 137 { 138 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName() 139 + " does not support clone()" ).initCause( ex ); 140 } 141 } //-- Versioning clone() 142 143 /** 144 * Get when the metadata was last updated (both 145 * "groupId/artifactId" and "groupId/artifactId/version" 146 * directories). The timestamp is expressed using UTC in the 147 * format yyyyMMddHHmmss. 148 * 149 * @return String 150 */ 151 public String getLastUpdated() 152 { 153 return this.lastUpdated; 154 } //-- String getLastUpdated() 155 156 /** 157 * Get what the last version added to the directory is, 158 * including both releases and snapshots ("groupId/artifactId" 159 * directory only). 160 * 161 * @return String 162 */ 163 public String getLatest() 164 { 165 return this.latest; 166 } //-- String getLatest() 167 168 /** 169 * Get what the last version added to the directory is, for the 170 * releases only ("groupId/artifactId" directory only). 171 * 172 * @return String 173 */ 174 public String getRelease() 175 { 176 return this.release; 177 } //-- String getRelease() 178 179 /** 180 * Get the current snapshot data in use for this version 181 * ("groupId/artifactId/version" only). 182 * 183 * @return Snapshot 184 */ 185 public Snapshot getSnapshot() 186 { 187 return this.snapshot; 188 } //-- Snapshot getSnapshot() 189 190 /** 191 * Method getSnapshotVersions. 192 * 193 * @return List 194 */ 195 public java.util.List<SnapshotVersion> getSnapshotVersions() 196 { 197 if ( this.snapshotVersions == null ) 198 { 199 this.snapshotVersions = new java.util.ArrayList<SnapshotVersion>(); 200 } 201 202 return this.snapshotVersions; 203 } //-- java.util.List<SnapshotVersion> getSnapshotVersions() 204 205 /** 206 * Method getVersions. 207 * 208 * @return List 209 */ 210 public java.util.List<String> getVersions() 211 { 212 if ( this.versions == null ) 213 { 214 this.versions = new java.util.ArrayList<String>(); 215 } 216 217 return this.versions; 218 } //-- java.util.List<String> getVersions() 219 220 /** 221 * Method removeSnapshotVersion. 222 * 223 * @param snapshotVersion a snapshotVersion object. 224 */ 225 public void removeSnapshotVersion( SnapshotVersion snapshotVersion ) 226 { 227 getSnapshotVersions().remove( snapshotVersion ); 228 } //-- void removeSnapshotVersion( SnapshotVersion ) 229 230 /** 231 * Method removeVersion. 232 * 233 * @param string a string object. 234 */ 235 public void removeVersion( String string ) 236 { 237 getVersions().remove( string ); 238 } //-- void removeVersion( String ) 239 240 /** 241 * Set when the metadata was last updated (both 242 * "groupId/artifactId" and "groupId/artifactId/version" 243 * directories). The timestamp is expressed using UTC in the 244 * format yyyyMMddHHmmss. 245 * 246 * @param lastUpdated a lastUpdated object. 247 */ 248 public void setLastUpdated( String lastUpdated ) 249 { 250 this.lastUpdated = lastUpdated; 251 } //-- void setLastUpdated( String ) 252 253 /** 254 * Set what the last version added to the directory is, 255 * including both releases and snapshots ("groupId/artifactId" 256 * directory only). 257 * 258 * @param latest a latest object. 259 */ 260 public void setLatest( String latest ) 261 { 262 this.latest = latest; 263 } //-- void setLatest( String ) 264 265 /** 266 * Set what the last version added to the directory is, for the 267 * releases only ("groupId/artifactId" directory only). 268 * 269 * @param release a release object. 270 */ 271 public void setRelease( String release ) 272 { 273 this.release = release; 274 } //-- void setRelease( String ) 275 276 /** 277 * Set the current snapshot data in use for this version 278 * ("groupId/artifactId/version" only). 279 * 280 * @param snapshot a snapshot object. 281 */ 282 public void setSnapshot( Snapshot snapshot ) 283 { 284 this.snapshot = snapshot; 285 } //-- void setSnapshot( Snapshot ) 286 287 /** 288 * Set information for each sub-artifact available in this 289 * artifact snapshot. This is only the most recent SNAPSHOT for 290 * each unique extension/classifier combination. 291 * 292 * @param snapshotVersions a snapshotVersions object. 293 */ 294 public void setSnapshotVersions( java.util.List<SnapshotVersion> snapshotVersions ) 295 { 296 this.snapshotVersions = snapshotVersions; 297 } //-- void setSnapshotVersions( java.util.List ) 298 299 /** 300 * Set versions available of the artifact (both releases and 301 * snapshots) ("groupId/artifactId" directory only). 302 * 303 * @param versions a versions object. 304 */ 305 public void setVersions( java.util.List<String> versions ) 306 { 307 this.versions = versions; 308 } //-- void setVersions( java.util.List ) 309 310 311 public void updateTimestamp() 312 { 313 setLastUpdatedTimestamp( new java.util.Date() ); 314 } 315 316 public void setLastUpdatedTimestamp( java.util.Date date ) 317 { 318 java.util.TimeZone timezone = java.util.TimeZone.getTimeZone( "UTC" ); 319 java.text.DateFormat fmt = new java.text.SimpleDateFormat( "yyyyMMddHHmmss" ); 320 fmt.setTimeZone( timezone ); 321 setLastUpdated( fmt.format( date ) ); 322 } 323 324 }