001package org.apache.archiva.metadata.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 022public class ProjectVersionReference 023{ 024 private ReferenceType referenceType; 025 026 private String projectId; 027 028 private String namespace; 029 030 private String projectVersion; 031 032 public ProjectVersionReference() 033 { 034 // no op 035 } 036 037 public ProjectVersionReference( ReferenceType referenceType, String projectId, String namespace, 038 String projectVersion ) 039 { 040 this.referenceType = referenceType; 041 this.projectId = projectId; 042 this.namespace = namespace; 043 this.projectVersion = projectVersion; 044 } 045 046 public void setReferenceType( ReferenceType referenceType ) 047 { 048 this.referenceType = referenceType; 049 } 050 051 public void setNamespace( String namespace ) 052 { 053 this.namespace = namespace; 054 } 055 056 public void setProjectId( String projectId ) 057 { 058 this.projectId = projectId; 059 } 060 061 public ReferenceType getReferenceType() 062 { 063 return referenceType; 064 } 065 066 public String getProjectId() 067 { 068 return projectId; 069 } 070 071 public String getProjectVersion() 072 { 073 return projectVersion; 074 } 075 076 public String getNamespace() 077 { 078 return namespace; 079 } 080 081 public void setProjectVersion( String projectVersion ) 082 { 083 this.projectVersion = projectVersion; 084 } 085 086 public enum ReferenceType 087 { 088 DEPENDENCY, 089 PARENT 090 } 091 092 @Override 093 public boolean equals( Object o ) 094 { 095 if ( this == o ) 096 { 097 return true; 098 } 099 if ( o == null || getClass() != o.getClass() ) 100 { 101 return false; 102 } 103 104 ProjectVersionReference that = (ProjectVersionReference) o; 105 106 if ( !namespace.equals( that.namespace ) ) 107 { 108 return false; 109 } 110 if ( !projectId.equals( that.projectId ) ) 111 { 112 return false; 113 } 114 if ( !projectVersion.equals( that.projectVersion ) ) 115 { 116 return false; 117 } 118 if ( referenceType != that.referenceType ) 119 { 120 return false; 121 } 122 123 return true; 124 } 125 126 @Override 127 public int hashCode() 128 { 129 int result = referenceType.hashCode(); 130 result = 31 * result + projectId.hashCode(); 131 result = 31 * result + namespace.hashCode(); 132 result = 31 * result + projectVersion.hashCode(); 133 return result; 134 } 135}