This project has retired. For details please refer to its Attic page.
ProjectReference 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 (unversioned) Project.
24   * 
25   * @version $Revision$ $Date$
26   */
27  @SuppressWarnings( "all" )
28  public class ProjectReference
29      implements java.io.Serializable
30  {
31  
32        //--------------------------/
33       //- Class/Member Variables -/
34      //--------------------------/
35  
36      /**
37       * 
38       *             The Group ID of the project reference.
39       *           
40       */
41      private String groupId;
42  
43      /**
44       * 
45       *             The Artifact ID of the project reference.
46       *           
47       */
48      private String artifactId;
49  
50  
51        //-----------/
52       //- Methods -/
53      //-----------/
54  
55      /**
56       * Get the Artifact ID of the project reference.
57       * 
58       * @return String
59       */
60      public String getArtifactId()
61      {
62          return this.artifactId;
63      } //-- String getArtifactId()
64  
65      /**
66       * Get the Group ID of the project reference.
67       * 
68       * @return String
69       */
70      public String getGroupId()
71      {
72          return this.groupId;
73      } //-- String getGroupId()
74  
75      /**
76       * Set the Artifact ID of the project reference.
77       * 
78       * @param artifactId
79       */
80      public void setArtifactId( String artifactId )
81      {
82          this.artifactId = artifactId;
83      } //-- void setArtifactId( String )
84  
85      /**
86       * Set the Group ID of the project reference.
87       * 
88       * @param groupId
89       */
90      public void setGroupId( String groupId )
91      {
92          this.groupId = groupId;
93      } //-- void setGroupId( String )
94  
95      
96      private static final long serialVersionUID = 8947981859537138991L;
97            
98      
99      private static String defaultString( String value )
100     {
101         if ( value == null )
102         {
103             return "";
104         }
105         
106         return value.trim();
107     }
108           
109     public static String toKey( ProjectReference reference )
110     {
111         StringBuilder key = new StringBuilder();
112 
113         key.append( defaultString( reference.getGroupId() ) ).append( ":" );
114         key.append( defaultString( reference.getArtifactId() ) );
115 
116         return key.toString();
117     }
118           
119 }