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 022import javax.xml.bind.annotation.XmlRootElement; 023import java.io.Serializable; 024 025/** 026 * A description of a particular license used by a project. 027 */ 028@XmlRootElement(name = "license") 029public class License 030 implements Serializable, Comparable<License> 031{ 032 /** 033 * The name of the license. 034 */ 035 private String name; 036 037 /** 038 * The URL of the license text. 039 */ 040 private String url; 041 042 private Integer index = 0; 043 044 public License( String name, String url ) 045 { 046 this.name = name; 047 this.url = url; 048 } 049 050 public License() 051 { 052 // no op 053 } 054 055 public String getName() 056 { 057 return name; 058 } 059 060 public void setName( String name ) 061 { 062 this.name = name; 063 } 064 065 public String getUrl() 066 { 067 return url; 068 } 069 070 public void setUrl( String url ) 071 { 072 this.url = url; 073 } 074 075 @Override 076 public boolean equals( Object o ) 077 { 078 if ( this == o ) 079 { 080 return true; 081 } 082 if ( o == null || getClass() != o.getClass() ) 083 { 084 return false; 085 } 086 087 License license = (License) o; 088 089 if ( name != null ? !name.equals( license.name ) : license.name != null ) 090 { 091 return false; 092 } 093 if ( url != null ? !url.equals( license.url ) : license.url != null ) 094 { 095 return false; 096 } 097 098 return true; 099 } 100 101 @Override 102 public int hashCode() 103 { 104 int result = name != null ? name.hashCode() : 0; 105 result = 31 * result + ( url != null ? url.hashCode() : 0 ); 106 return result; 107 } 108 109 @Override 110 public String toString() 111 { 112 return "License{" + "name='" + name + '\'' + ", url='" + url + '\'' + '}'; 113 } 114 115 public Integer getIndex() { 116 return index; 117 } 118 119 public void setIndex(int index) { 120 this.index = index; 121 } 122 123 124 @Override 125 public int compareTo(License o) { 126 return this.index.compareTo(o.getIndex()); 127 } 128}