This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.model;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022/**
023 * A reference to another (unversioned) Project.
024 * 
025 * @version $Revision$ $Date$
026 */
027@SuppressWarnings( "all" )
028public class ProjectReference
029    implements java.io.Serializable
030{
031
032      //--------------------------/
033     //- Class/Member Variables -/
034    //--------------------------/
035
036    /**
037     * 
038     *             The Group ID of the project reference.
039     *           
040     */
041    private String groupId;
042
043    /**
044     * 
045     *             The Artifact ID of the project reference.
046     *           
047     */
048    private String artifactId;
049
050
051      //-----------/
052     //- Methods -/
053    //-----------/
054
055    /**
056     * Get the Artifact ID of the project reference.
057     * 
058     * @return String
059     */
060    public String getArtifactId()
061    {
062        return this.artifactId;
063    } //-- String getArtifactId()
064
065    /**
066     * Get the Group ID of the project reference.
067     * 
068     * @return String
069     */
070    public String getGroupId()
071    {
072        return this.groupId;
073    } //-- String getGroupId()
074
075    /**
076     * Set the Artifact ID of the project reference.
077     * 
078     * @param artifactId
079     */
080    public void setArtifactId( String artifactId )
081    {
082        this.artifactId = artifactId;
083    } //-- void setArtifactId( String )
084
085    /**
086     * Set the Group ID of the project reference.
087     * 
088     * @param groupId
089     */
090    public void setGroupId( String groupId )
091    {
092        this.groupId = groupId;
093    } //-- void setGroupId( String )
094
095    
096    private static final long serialVersionUID = 8947981859537138991L;
097          
098    
099    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}