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 Versioned Project.
024 * 
025 * @version $Revision$ $Date$
026 */
027@SuppressWarnings( "all" )
028public class VersionedReference
029    implements java.io.Serializable
030{
031
032      //--------------------------/
033     //- Class/Member Variables -/
034    //--------------------------/
035
036    /**
037     * 
038     *             The Group ID of the repository content.
039     *           
040     */
041    private String groupId;
042
043    /**
044     * 
045     *             The Artifact ID of the repository content.
046     *           
047     */
048    private String artifactId;
049
050    /**
051     * 
052     *             The version of the repository content.
053     *           
054     */
055    private String version;
056
057
058      //-----------/
059     //- Methods -/
060    //-----------/
061
062    /**
063     * Get the Artifact ID of the repository content.
064     * 
065     * @return String
066     */
067    public String getArtifactId()
068    {
069        return this.artifactId;
070    } //-- String getArtifactId()
071
072    /**
073     * Get the Group ID of the repository content.
074     * 
075     * @return String
076     */
077    public String getGroupId()
078    {
079        return this.groupId;
080    } //-- String getGroupId()
081
082    /**
083     * Get the version of the repository content.
084     * 
085     * @return String
086     */
087    public String getVersion()
088    {
089        return this.version;
090    } //-- String getVersion()
091
092    /**
093     * Set the Artifact ID of the repository content.
094     * 
095     * @param artifactId
096     */
097    public void setArtifactId( String artifactId )
098    {
099        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}