Coverage report

  %line %branch
org.apache.jetspeed.om.impl.DisplayNameSetImpl
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  
 package org.apache.jetspeed.om.impl;
 18  
 
 19  
 import java.io.Serializable;
 20  
 import java.util.ArrayList;
 21  
 import java.util.Collection;
 22  
 import java.util.Iterator;
 23  
 import java.util.Locale;
 24  
 
 25  
 import org.apache.jetspeed.om.common.MutableDisplayNameSet;
 26  
 import org.apache.jetspeed.util.JetspeedLocale;
 27  
 import org.apache.pluto.om.common.DisplayName;
 28  
 /**
 29  
  * DisplayNameSetImpl
 30  
  * 
 31  
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
 32  
  * @version $Id: DisplayNameSetImpl.java 517121 2007-03-12 07:45:49Z ate $
 33  
  *
 34  
  */
 35  
 public class DisplayNameSetImpl  implements MutableDisplayNameSet, Serializable
 36  
 {
 37  
 
 38  
     /** Specifies the type Description we are storing */
 39  
     protected String displayNameType;
 40  
     
 41  
 	protected Collection innerCollection;
 42  
 
 43  
 
 44  
 
 45  
 
 46  
     public DisplayNameSetImpl()
 47  
     {
 48  0
         super();        
 49  0
         this.innerCollection = new ArrayList();
 50  0
     }
 51  
     
 52  
 	public DisplayNameSetImpl(Collection collection)
 53  
 	{
 54  0
 		super();		
 55  0
 		this.innerCollection = collection;
 56  0
 	}
 57  
 
 58  
     /**
 59  
      * @see org.apache.pluto.om.common.DisplayNameSet#get(java.util.Locale)
 60  
      */
 61  
     public DisplayName get(Locale arg0)
 62  
     {
 63  
 
 64  0
         DisplayName fallBack = null;
 65  0
         Iterator searchItr = innerCollection.iterator();
 66  0
         while (searchItr.hasNext())
 67  
         {
 68  0
             DisplayName aDName = (DisplayName) searchItr.next();
 69  0
             if (aDName.getLocale().equals(arg0))
 70  
             {
 71  0
                 return aDName;
 72  
             }
 73  0
             else if (aDName.getLocale().getLanguage().equals(arg0.getLanguage()))
 74  
             {
 75  0
                 fallBack = aDName;
 76  
             }
 77  0
             else if (fallBack == null && aDName.getLocale().equals(JetspeedLocale.getDefaultLocale()))
 78  
             {
 79  0
                 fallBack = aDName;
 80  
             }
 81  0
         }
 82  
 
 83  0
         return fallBack;
 84  
     }
 85  
 
 86  
     public void addDisplayName(DisplayName name)
 87  
     {
 88  0
         if (name == null)
 89  
         {
 90  0
             throw new IllegalArgumentException("DisplayName argument cannot be null");
 91  
         }
 92  
 
 93  0
         add(name);
 94  0
     }
 95  
 
 96  
     /**
 97  
      * @see java.util.Collection#add(java.lang.Object)
 98  
      */
 99  
     public boolean add(Object o)
 100  
     {
 101  0
         return innerCollection.add(o);
 102  
     }
 103  
 
 104  
     /**
 105  
      * @see java.util.Collection#remove(java.lang.Object)
 106  
      */
 107  
     public boolean remove(Object o)
 108  
     {
 109  0
         return innerCollection.remove(o);
 110  
     }
 111  
 
 112  
     /**
 113  
      * @see org.apache.pluto.om.common.DisplayNameSet#iterator()
 114  
      */
 115  
     public Iterator iterator()
 116  
     {        
 117  0
         return this.innerCollection.iterator();
 118  
     }
 119  
 
 120  
     /**
 121  
      * @return
 122  
      */
 123  
     public Collection getInnerCollection()
 124  
     {
 125  0
         return innerCollection;
 126  
     }
 127  
 
 128  
     /**
 129  
      * @param collection
 130  
      */
 131  
     public void setInnerCollection(Collection collection)
 132  
     {
 133  0
         innerCollection = collection;
 134  0
     }
 135  
 
 136  
 }

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