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 javax.xml.bind.annotation.XmlRootElement; 022import java.io.Serializable; 023import java.util.ArrayList; 024import java.util.List; 025 026/** 027 * @author Olivier Lamy 028 * @since 1.4-M3 029 */ 030@XmlRootElement ( name = "proxyConnectorRule" ) 031public class ProxyConnectorRule 032 implements Serializable 033{ 034 private String pattern; 035 036 //FIXME: olamy possible tru rest ? or a String 037 private ProxyConnectorRuleType proxyConnectorRuleType; 038 039 private List<ProxyConnector> proxyConnectors; 040 041 public ProxyConnectorRule() 042 { 043 // no op 044 } 045 046 public ProxyConnectorRule( String pattern, ProxyConnectorRuleType proxyConnectorRuleType, 047 List<ProxyConnector> proxyConnectors ) 048 { 049 this.pattern = pattern; 050 this.proxyConnectorRuleType = proxyConnectorRuleType; 051 this.proxyConnectors = proxyConnectors; 052 } 053 054 public String getPattern() 055 { 056 return pattern; 057 } 058 059 public void setPattern( String pattern ) 060 { 061 this.pattern = pattern; 062 } 063 064 public ProxyConnectorRuleType getProxyConnectorRuleType() 065 { 066 return proxyConnectorRuleType; 067 } 068 069 public void setProxyConnectorRuleType( ProxyConnectorRuleType proxyConnectorRuleType ) 070 { 071 this.proxyConnectorRuleType = proxyConnectorRuleType; 072 } 073 074 public List<ProxyConnector> getProxyConnectors() 075 { 076 if ( this.proxyConnectors == null ) 077 { 078 this.proxyConnectors = new ArrayList<>(); 079 } 080 return proxyConnectors; 081 } 082 083 public void setProxyConnectors( List<ProxyConnector> proxyConnectors ) 084 { 085 this.proxyConnectors = proxyConnectors; 086 } 087 088 @Override 089 public boolean equals( Object o ) 090 { 091 if ( this == o ) 092 { 093 return true; 094 } 095 if ( !( o instanceof ProxyConnectorRule ) ) 096 { 097 return false; 098 } 099 100 ProxyConnectorRule that = (ProxyConnectorRule) o; 101 102 if ( !pattern.equals( that.pattern ) ) 103 { 104 return false; 105 } 106 if ( proxyConnectorRuleType != that.proxyConnectorRuleType ) 107 { 108 return false; 109 } 110 111 return true; 112 } 113 114 @Override 115 public int hashCode() 116 { 117 int result = pattern.hashCode(); 118 result = 31 * result + proxyConnectorRuleType.hashCode(); 119 return result; 120 } 121 122 @Override 123 public String toString() 124 { 125 final StringBuilder sb = new StringBuilder(); 126 sb.append( "ProxyConnectorRule" ); 127 sb.append( "{pattern='" ).append( pattern ).append( '\'' ); 128 sb.append( ", proxyConnectorRuleType=" ).append( proxyConnectorRuleType ); 129 sb.append( ", proxyConnectors=" ).append( proxyConnectors ); 130 sb.append( '}' ); 131 return sb.toString(); 132 } 133}