001package org.apache.archiva.admin.model.beans; 002/* 003 * Licensed to the Apache Software Foundation (ASF) under one 004 * or more contributor license agreements. See the NOTICE file 005 * distributed with this work for additional information 006 * regarding copyright ownership. The ASF licenses this file 007 * to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance 009 * with the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, 014 * software distributed under the License is distributed on an 015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 016 * KIND, either express or implied. See the License for the 017 * specific language governing permissions and limitations 018 * under the License. 019 */ 020 021import org.apache.archiva.proxy.model.ProxyConnectorRuleType; 022 023import javax.xml.bind.annotation.XmlRootElement; 024import java.io.Serializable; 025import java.util.ArrayList; 026import java.util.List; 027 028/** 029 * @author Olivier Lamy 030 * @since 1.4-M3 031 */ 032@XmlRootElement ( name = "proxyConnectorRule" ) 033public class ProxyConnectorRule 034 implements Serializable 035{ 036 private String pattern; 037 038 //FIXME: olamy possible tru rest ? or a String 039 private ProxyConnectorRuleType proxyConnectorRuleType; 040 041 private List<ProxyConnector> proxyConnectors; 042 043 public ProxyConnectorRule() 044 { 045 // no op 046 } 047 048 public ProxyConnectorRule( String pattern, ProxyConnectorRuleType proxyConnectorRuleType, 049 List<ProxyConnector> proxyConnectors ) 050 { 051 this.pattern = pattern; 052 this.proxyConnectorRuleType = proxyConnectorRuleType; 053 this.proxyConnectors = proxyConnectors; 054 } 055 056 public String getPattern() 057 { 058 return pattern; 059 } 060 061 public void setPattern( String pattern ) 062 { 063 this.pattern = pattern; 064 } 065 066 public ProxyConnectorRuleType getProxyConnectorRuleType() 067 { 068 return proxyConnectorRuleType; 069 } 070 071 public void setProxyConnectorRuleType( ProxyConnectorRuleType proxyConnectorRuleType ) 072 { 073 this.proxyConnectorRuleType = proxyConnectorRuleType; 074 } 075 076 public List<ProxyConnector> getProxyConnectors() 077 { 078 if ( this.proxyConnectors == null ) 079 { 080 this.proxyConnectors = new ArrayList<>(); 081 } 082 return proxyConnectors; 083 } 084 085 public void setProxyConnectors( List<ProxyConnector> proxyConnectors ) 086 { 087 this.proxyConnectors = proxyConnectors; 088 } 089 090 @Override 091 public boolean equals( Object o ) 092 { 093 if ( this == o ) 094 { 095 return true; 096 } 097 if ( !( o instanceof ProxyConnectorRule ) ) 098 { 099 return false; 100 } 101 102 ProxyConnectorRule that = (ProxyConnectorRule) o; 103 104 if ( !pattern.equals( that.pattern ) ) 105 { 106 return false; 107 } 108 if ( proxyConnectorRuleType != that.proxyConnectorRuleType ) 109 { 110 return false; 111 } 112 113 return true; 114 } 115 116 @Override 117 public int hashCode() 118 { 119 int result = pattern.hashCode(); 120 result = 31 * result + proxyConnectorRuleType.hashCode(); 121 return result; 122 } 123 124 @Override 125 public String toString() 126 { 127 final StringBuilder sb = new StringBuilder(); 128 sb.append( "ProxyConnectorRule" ); 129 sb.append( "{pattern='" ).append( pattern ).append( '\'' ); 130 sb.append( ", proxyConnectorRuleType=" ).append( proxyConnectorRuleType ); 131 sb.append( ", proxyConnectors=" ).append( proxyConnectors ); 132 sb.append( '}' ); 133 return sb.toString(); 134 } 135}