This project has retired. For details please refer to its Attic page.
VersionedReference xref
View Javadoc
1   package org.apache.archiva.model;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /**
23   * A reference to another Versioned Project.
24   * 
25   * @version $Revision$ $Date$
26   */
27  @SuppressWarnings( "all" )
28  public class VersionedReference
29      implements java.io.Serializable
30  {
31  
32        //--------------------------/
33       //- Class/Member Variables -/
34      //--------------------------/
35  
36      /**
37       * 
38       *             The Group ID of the repository content.
39       *           
40       */
41      private String groupId;
42  
43      /**
44       * 
45       *             The Artifact ID of the repository content.
46       *           
47       */
48      private String artifactId;
49  
50      /**
51       * 
52       *             The version of the repository content.
53       *           
54       */
55      private String version;
56  
57  
58        //-----------/
59       //- Methods -/
60      //-----------/
61  
62      /**
63       * Get the Artifact ID of the repository content.
64       * 
65       * @return String
66       */
67      public String getArtifactId()
68      {
69          return this.artifactId;
70      } //-- String getArtifactId()
71  
72      /**
73       * Get the Group ID of the repository content.
74       * 
75       * @return String
76       */
77      public String getGroupId()
78      {
79          return this.groupId;
80      } //-- String getGroupId()
81  
82      /**
83       * Get the version of the repository content.
84       * 
85       * @return String
86       */
87      public String getVersion()
88      {
89          return this.version;
90      } //-- String getVersion()
91  
92      /**
93       * Set the Artifact ID of the repository content.
94       * 
95       * @param artifactId
96       */
97      public void setArtifactId( String artifactId )
98      {
99          this.artifactId = artifactId;
100     } //-- void setArtifactId( String )
101 
102     /**
103      * Set the Group ID of the repository content.
104      * 
105      * @param groupId
106      */
107     public void setGroupId( String groupId )
108     {
109         this.groupId = groupId;
110     } //-- void setGroupId( String )
111 
112     /**
113      * Set the version of the repository content.
114      * 
115      * @param version
116      */
117     public void setVersion( String version )
118     {
119         this.version = version;
120     } //-- void setVersion( String )
121 
122     
123     private static final long serialVersionUID = -6990353165677563113L;
124           
125     
126     private static String defaultString( String value )
127     {
128         if ( value == null )
129         {
130             return "";
131         }
132         
133         return value.trim();
134     }
135           
136     public static String toKey( VersionedReference reference )
137     {
138         StringBuilder key = new StringBuilder();
139 
140         key.append( defaultString( reference.getGroupId() ) ).append( ":" );
141         key.append( defaultString( reference.getArtifactId() ) ).append( ":" );
142         key.append( defaultString( reference.getVersion() ) );
143 
144         return key.toString();
145     }
146           
147 }