Coverage report

  %line %branch
org.apache.jetspeed.om.portlet.impl.PortletDefinitionListImpl
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.portlet.impl;
 18  
 
 19  
 import java.io.Serializable;
 20  
 import java.util.ArrayList;
 21  
 import java.util.Collection;
 22  
 import java.util.Iterator;
 23  
 
 24  
 
 25  
 
 26  
 import org.apache.pluto.om.common.ObjectID;
 27  
 import org.apache.pluto.om.portlet.PortletDefinition;
 28  
 import org.apache.pluto.om.portlet.PortletDefinitionList;
 29  
 
 30  
 /**
 31  
  * 
 32  
  * PortletDefinitionListImpl
 33  
  * 
 34  
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
 35  
  * @version $Id: PortletDefinitionListImpl.java 516448 2007-03-09 16:25:47Z ate $
 36  
  *
 37  
  */
 38  
 public class PortletDefinitionListImpl implements PortletDefinitionList, Serializable
 39  
 {
 40  
 
 41  
     protected Collection innerCollection;
 42  
 
 43  
     /**
 44  
      * 
 45  
      */
 46  
     public PortletDefinitionListImpl()
 47  
     {
 48  0
         super();
 49  0
         innerCollection = new ArrayList();
 50  0
     }
 51  
 
 52  
     public PortletDefinitionListImpl(Collection collection)
 53  
     {
 54  0
         super();
 55  0
         innerCollection = collection;
 56  0
     }
 57  
 
 58  
     /**
 59  
      * @see org.apache.pluto.om.portlet.PortletDefinitionList#iterator()
 60  
      */
 61  
     public Iterator iterator()
 62  
     {
 63  0
         return innerCollection.iterator();
 64  
     }
 65  
 
 66  
     /**
 67  
      * @see org.apache.pluto.om.portlet.PortletDefinitionList#get(org.apache.pluto.om.common.ObjectID)
 68  
      */
 69  
     public PortletDefinition get(ObjectID id)
 70  
     {
 71  0
         Iterator itr = innerCollection.iterator();
 72  0
         while (itr.hasNext())
 73  
         {
 74  0
             PortletDefinition pd = (PortletDefinition) itr.next();
 75  0
             if (pd.getId().equals(id))
 76  
             {
 77  0
                 return pd;
 78  
             }
 79  0
         }
 80  
 
 81  0
         return null;
 82  
     }
 83  
 
 84  
     /**
 85  
      * Retrieves a <code>PortletDefinition</code> from this 
 86  
      * collection by the PortletDefinitions proper name
 87  
      * @param name Proper name of PortletDefinition to locate.
 88  
      * @return PortletDefinition matching <code>name</code> or <code>null</code>
 89  
      * if no PortletDefinition within this PortletApplication has that name.
 90  
      */
 91  
     public PortletDefinition get(String name)
 92  
     {
 93  0
         Iterator itr = innerCollection.iterator();
 94  0
         while (itr.hasNext())
 95  
         {
 96  0
             PortletDefinition pd = (PortletDefinition) itr.next();
 97  0
             if (pd.getName().equals(name))
 98  
             {
 99  0
                 return pd;
 100  
             }
 101  0
         }
 102  
 
 103  0
         return null;
 104  
     }
 105  
 
 106  
     /**
 107  
      * @see java.util.Collection#add(java.lang.Object)
 108  
      */
 109  
     public boolean add(Object o)
 110  
     {
 111  0
         PortletDefinition pd = (PortletDefinition) o;        
 112  0
         return innerCollection.add(pd);
 113  
     }
 114  
 
 115  
     /**
 116  
      * @see java.util.Collection#remove(java.lang.Object)
 117  
      */
 118  
     public boolean remove(Object o)
 119  
     {
 120  0
         PortletDefinition pd = (PortletDefinition) o;        
 121  0
         return innerCollection.remove(pd);
 122  
     }
 123  
 
 124  
     /**
 125  
      * @return
 126  
      */
 127  
     public Collection getInnerCollection()
 128  
     {
 129  0
         return innerCollection;
 130  
     }
 131  
 
 132  
     /**
 133  
      * @param collection
 134  
      */
 135  
     public void setInnerCollection(Collection collection)
 136  
     {
 137  0
         innerCollection = collection;
 138  0
     }
 139  
 
 140  
 }

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