1 package org.apache.maven.archiva.model;
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
22 import org.apache.commons.lang.StringUtils;
24 import java.io.Serializable;
27 * RepositoryContentKey - the jpox application key support class for all content within the repository.
29 * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
32 public class RepositoryContentKey implements Serializable
35 * The Repository ID. (JPOX Requires this remain public)
37 public String repositoryId = "";
40 * The Group ID. (JPOX Requires this remain public)
42 public String groupId = "";
45 * The Artifact ID. (JPOX Requires this remain public)
47 public String artifactId = "";
50 * The Version. (JPOX Requires this remain public)
52 public String version = "";
55 * Default Constructor. Required by JPOX.
57 public RepositoryContentKey()
63 * Key Based Constructor. Required by JPOX.
65 * @param key the String representing this object's values.
67 public RepositoryContentKey( String key )
69 String parts[] = StringUtils.splitPreserveAllTokens( key, ':' );
70 repositoryId = parts[0];
72 artifactId = parts[2];
77 * Get the String representation of this object. - Required by JPOX.
79 public String toString()
81 return StringUtils.join( new String[] { repositoryId, groupId, artifactId, version } );
85 * Get the hashcode for this object's values - Required by JPOX.
91 result = PRIME * result + ( ( repositoryId == null ) ? 0 : repositoryId.hashCode() );
92 result = PRIME * result + ( ( groupId == null ) ? 0 : groupId.hashCode() );
93 result = PRIME * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() );
94 result = PRIME * result + ( ( version == null ) ? 0 : version.hashCode() );
99 * Get the equals for this object's values - Required by JPOX.
101 public boolean equals( Object obj )
113 if ( getClass() != obj.getClass() )
118 final RepositoryContentKey other = (RepositoryContentKey) obj;
120 if ( repositoryId == null )
122 if ( other.repositoryId != null )
127 else if ( !repositoryId.equals( other.repositoryId ) )
132 if ( groupId == null )
134 if ( other.groupId != null )
139 else if ( !groupId.equals( other.groupId ) )
144 if ( artifactId == null )
146 if ( other.artifactId != null )
151 else if ( !artifactId.equals( other.artifactId ) )
156 if ( version == null )
158 if ( other.version != null )
163 else if ( !version.equals( other.version ) )