Coverage report

  %line %branch
org.apache.jetspeed.capabilities.impl.ClientImpl
0% 
0% 

 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  * 
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 
 18  
 package org.apache.jetspeed.capabilities.impl;
 19  
 
 20  
 import org.apache.commons.collections.CollectionUtils;
 21  
 import org.apache.jetspeed.capabilities.Client;
 22  
 
 23  
 import java.util.ArrayList;
 24  
 import java.util.Collection;
 25  
 
 26  
 /**
 27  
  * Simple implementation of the ClientRegistry interface.
 28  
  *
 29  
  * @author <a href="shesmer@raleigh.ibm.com">Stephan Hesmer</a>
 30  
  * @author <a href="mailto:raphael@apache.org">Rapha\u00ebl Luta</a>
 31  
  * @author <a href="mailto:roger.ruttimann@earthlink.net">Roger Ruttimann</a>
 32  
  * @version $Id: ClientImpl.java 516448 2007-03-09 16:25:47Z ate $
 33  
  */
 34  
 public class ClientImpl implements Client, java.io.Serializable
 35  
 {
 36  0
     private String userAgentPattern = "";
 37  0
     private String manufacturer = "";
 38  0
     private String model = "";
 39  0
     private String version = "";
 40  
     private String name;
 41  
     private Collection mimetypes;
 42  
     private Collection capabilities;
 43  
     private int preferredMimeTypeId;
 44  
 
 45  
     private int clientId;
 46  0
     private int evalOrder = 0;
 47  
 
 48  
     public ClientImpl()
 49  0
     {
 50  0
     }
 51  
 
 52  
     /**
 53  
      * Implements the equals operation so that 2 elements are equal if
 54  
      * all their member values are equal.
 55  
      */
 56  
     public boolean equals(Object object)
 57  
     {
 58  0
         if (object == this)
 59  0
         	return true;
 60  
 
 61  0
         if (object == null)
 62  
         {
 63  0
             return false;
 64  
         }
 65  
         
 66  0
         ClientImpl obj = (ClientImpl) object;
 67  
 
 68  0
         if (name != null)
 69  
         {
 70  0
             if (!name.equals(obj.name))
 71  
             {
 72  0
                 return false;
 73  
             }
 74  
         } else
 75  
         {
 76  0
             if (obj.name != null)
 77  
             {
 78  0
                 return false;
 79  
             }
 80  
         }
 81  
      
 82  0
         if (userAgentPattern != null)
 83  
         {
 84  0
             if (!userAgentPattern.equals(obj.userAgentPattern))
 85  
             {
 86  0
                 return false;
 87  
             }
 88  
         } else
 89  
         {
 90  0
             if (obj.userAgentPattern != null)
 91  
             {
 92  0
                 return false;
 93  
             }
 94  
         }
 95  
 
 96  0
         if (manufacturer != null)
 97  
         {
 98  0
             if (!manufacturer.equals(obj.manufacturer))
 99  
             {
 100  0
                 return false;
 101  
             }
 102  
         } else
 103  
         {
 104  0
             if (obj.manufacturer != null)
 105  
             {
 106  0
                 return false;
 107  
             }
 108  
         }
 109  
 
 110  0
         if (model != null)
 111  
         {
 112  0
             if (!model.equals(obj.model))
 113  
             {
 114  0
                 return false;
 115  
             }
 116  
         } else
 117  
         {
 118  0
             if (obj.model != null)
 119  
             {
 120  0
                 return false;
 121  
             }
 122  
         }
 123  
 
 124  0
         if (version != null)
 125  
         {
 126  0
             if (!version.equals(obj.version))
 127  
             {
 128  0
                 return false;
 129  
             }
 130  
         } else
 131  
         {
 132  0
             if (obj.version != null)
 133  
             {
 134  0
                 return false;
 135  
             }
 136  
         }
 137  0
         if (mimetypes != null)
 138  
         {
 139  0
         	if (!CollectionUtils.isEqualCollection(mimetypes, obj.mimetypes))
 140  
             {
 141  0
                 return false;
 142  
             }
 143  
         }
 144  
         else
 145  
         {
 146  0
             if (obj.mimetypes != null)
 147  
             {
 148  0
                 return false;
 149  
             }
 150  
         }
 151  
 
 152  0
          if (capabilities != null)
 153  
         {
 154  0
 	       if (!(CollectionUtils.isEqualCollection(capabilities,obj.capabilities )))
 155  0
 	            return false;
 156  
 	    }
 157  
         else
 158  
         {
 159  0
             if (obj.capabilities != null)
 160  
             {
 161  0
                 return false;
 162  
             }
 163  
         }
 164  0
         return true;
 165  
     }
 166  
 
 167  
     public String getUserAgentPattern()
 168  
     {
 169  0
         return userAgentPattern;
 170  
     }
 171  
 
 172  
     public void setUserAgentPattern(String userAgentPattern)
 173  
     {
 174  0
         this.userAgentPattern = userAgentPattern;
 175  0
     }
 176  
 
 177  
     public String getManufacturer()
 178  
     {
 179  0
         return manufacturer;
 180  
     }
 181  
 
 182  
     public void setManufacturer(String name)
 183  
     {
 184  0
         manufacturer = name;
 185  0
     }
 186  
 
 187  
     public String getModel()
 188  
     {
 189  0
         return model;
 190  
     }
 191  
 
 192  
     public void setModel(String name)
 193  
     {
 194  0
         model = name;
 195  0
     }
 196  
 
 197  
     public String getVersion()
 198  
     {
 199  0
         return version;
 200  
     }
 201  
 
 202  
     public void setVersion(String name)
 203  
     {
 204  0
         version = name;
 205  0
     }
 206  
 
 207  
     public Collection getMimetypes()
 208  
     {
 209  0
         if(this.mimetypes == null)
 210  
         {
 211  0
             this.mimetypes = new ArrayList();
 212  
         }
 213  0
         return mimetypes;
 214  
     }
 215  
 
 216  
     public void setMimetypes(Collection mimetypes)
 217  
     {
 218  0
         this.mimetypes = mimetypes;
 219  0
     }
 220  
 
 221  
     public Collection getCapabilities()
 222  
     {
 223  0
         if(capabilities == null)
 224  
         {
 225  0
             capabilities = new ArrayList();
 226  
         }
 227  0
         return capabilities;
 228  
     }
 229  
 
 230  
     public void setCapabilities(Collection capabilities)
 231  
     {
 232  0
         this.capabilities = capabilities;
 233  0
     }
 234  
 
 235  
     /**
 236  
      * Set Client ID -- Assigns the Client ID
 237  
      * @param id
 238  
      */
 239  
     public void setClientId(int id)
 240  
     {
 241  0
         this.clientId = id;
 242  0
     }
 243  
 
 244  
     /**
 245  
      * Get Client ID
 246  
      * @return Client ID
 247  
      */
 248  
     public int getClientId()
 249  
     {
 250  0
         return this.clientId;
 251  
     }
 252  
     /**
 253  
      * @return
 254  
      */
 255  
     public String getName()
 256  
     {
 257  0
         return name;
 258  
     }
 259  
 
 260  
     /**
 261  
      * @param string
 262  
      */
 263  
     public void setName(String string)
 264  
     {
 265  0
         name = string;
 266  0
     }
 267  
 
 268  
     /**
 269  
      * @return Preferred MimeType ID for Client
 270  
      */
 271  
     public int getPreferredMimeTypeId()
 272  
     {
 273  0
         return this.preferredMimeTypeId;
 274  
     }
 275  
 
 276  
     /**
 277  
      * Set preferred Mimetype ID for Client
 278  
      * @param mimeTypeId MimeTypeId
 279  
      */
 280  
     public void setPreferredMimeTypeId(int mimeTypeId)
 281  
     {
 282  0
         this.preferredMimeTypeId = mimeTypeId;
 283  0
     }
 284  
 
 285  
     /**
 286  
      * @return Returns the evalOrder.
 287  
      */
 288  
     public int getEvalOrder()
 289  
     {
 290  0
         return evalOrder;
 291  
     }
 292  
     /**
 293  
      * @param evalOrder The evalOrder to set.
 294  
      */
 295  
     public void setEvalOrder(int evalOrder)
 296  
     {
 297  0
         this.evalOrder = evalOrder;
 298  0
     }
 299  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.