Coverage report

  %line %branch
org.apache.jetspeed.om.portlet.impl.ContentTypeImpl
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.Collection;
 21  
 import java.util.HashSet;
 22  
 import java.util.Iterator;
 23  
 
 24  
 import javax.portlet.PortletMode;
 25  
 
 26  
 import org.apache.jetspeed.om.common.portlet.ContentTypeComposite;
 27  
 import org.apache.jetspeed.util.HashCodeBuilder;
 28  
 import org.apache.pluto.om.portlet.ContentType;
 29  
 
 30  
 /**
 31  
  * 
 32  
  * ContentTypeImpl
 33  
  * 
 34  
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
 35  
  * @version $Id: ContentTypeImpl.java 516448 2007-03-09 16:25:47Z ate $
 36  
  *
 37  
  */
 38  
 public class ContentTypeImpl implements ContentTypeComposite, Serializable
 39  
 {
 40  
 
 41  
     private String contentType;
 42  
     protected Collection portletModes;
 43  
     /**
 44  
      *  field that represents a FK relationship to the parent portlet.
 45  
      * Required by some O/R tools like OJB.
 46  
      */
 47  
     protected long portletId;
 48  
 
 49  
     protected long contentTypeId;
 50  
 
 51  
     public ContentTypeImpl()
 52  0
     {
 53  0
         portletModes = new HashSet();
 54  0
     }
 55  
 
 56  
     /**
 57  
      * @see org.apache.pluto.om.portlet.ContentType#getContentType()
 58  
      */
 59  
     public String getContentType()
 60  
     {
 61  0
         return contentType;
 62  
     }
 63  
 
 64  
     /**
 65  
      * @see org.apache.pluto.om.portlet.ContentType#getPortletModes()
 66  
      */
 67  
     public Iterator getPortletModes()
 68  
     {
 69  0
         return portletModes.iterator();
 70  
     }
 71  
 
 72  
     public Collection getPortletModesCollection()
 73  
     {
 74  0
         return portletModes;
 75  
     }
 76  
 
 77  
     /**
 78  
      * @see org.apache.pluto.om.portlet.ContentTypeCtrl#setContentType(java.lang.String)
 79  
      */
 80  
     public void setContentType(String contentType)
 81  
     {
 82  0
         this.contentType = contentType;
 83  0
     }
 84  
 
 85  
     /**
 86  
      * @see java.lang.Object#equals(java.lang.Object)
 87  
      */
 88  
     public boolean equals(Object obj)
 89  
     {
 90  0
         if (obj != null && obj instanceof ContentType)
 91  
         {
 92  0
             ContentType cType = (ContentType) obj;
 93  0
             return this.getContentType().equals(cType.getContentType());
 94  
         }
 95  
 
 96  0
         return false;
 97  
     }
 98  
 
 99  
     /**
 100  
      * @see java.lang.Object#hashCode()
 101  
      */
 102  
     public int hashCode()
 103  
     {
 104  0
         HashCodeBuilder hasher = new HashCodeBuilder(27, 87);
 105  0
         hasher.append(contentType);
 106  0
         return hasher.toHashCode();
 107  
     }
 108  
 
 109  
     /* (non-Javadoc)
 110  
      * @see org.apache.jetspeed.om.common.portlet.ContentTypeComposite#addPortletMode(javax.portlet.PortletMode)
 111  
      */
 112  
     public void addPortletMode(PortletMode mode)
 113  
     {
 114  0
         portletModes.add(mode);
 115  
 
 116  0
     }
 117  
 
 118  
     public void addPortletMode(String mode)
 119  
     {
 120  0
         portletModes.add(new PortletMode(mode));
 121  
 
 122  0
     }
 123  
 
 124  
     /**
 125  
      * @see org.apache.jetspeed.om.common.portlet.ContentTypeComposite#setModes(java.util.Collection)
 126  
      */
 127  
     public void setPortletModes(Collection modes)
 128  
     {
 129  0
         portletModes = modes;
 130  0
     }
 131  
 
 132  
     /* (non-Javadoc)
 133  
      * @see org.apache.jetspeed.om.common.portlet.ContentTypeComposite#supportsPortletMode(javax.portlet.PortletMode)
 134  
      */
 135  
     public boolean supportsPortletMode(PortletMode mode)
 136  
     {
 137  0
         return portletModes.contains(mode);
 138  
     }
 139  
 
 140  
 }

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