Coverage report

  %line %branch
org.apache.jetspeed.aggregator.impl.PortletAggregatorImpl
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.aggregator.impl;
 18  
 
 19  
 import java.io.IOException;
 20  
 import java.util.HashMap;
 21  
 
 22  
 import org.apache.jetspeed.PortalReservedParameters;
 23  
 import org.apache.jetspeed.aggregator.PortletAggregator;
 24  
 import org.apache.jetspeed.aggregator.PortletRenderer;
 25  
 import org.apache.jetspeed.exception.JetspeedException;
 26  
 import org.apache.jetspeed.om.page.ContentFragment;
 27  
 import org.apache.jetspeed.om.page.ContentFragmentImpl;
 28  
 import org.apache.jetspeed.om.page.Fragment;
 29  
 import org.apache.jetspeed.request.RequestContext;
 30  
 
 31  
 /**
 32  
  * PortletAggregator builds the content required to render a single portlet.
 33  
  *
 34  
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
 35  
  * @version $Id: PortletAggregatorImpl.java 543171 2007-05-31 15:55:09Z ate $
 36  
  */
 37  
 public class PortletAggregatorImpl implements PortletAggregator
 38  
 {
 39  
     private PortletRenderer renderer;
 40  
 
 41  
     public PortletAggregatorImpl(PortletRenderer renderer) 
 42  0
     {
 43  0
         this.renderer = renderer;
 44  0
     }
 45  
 
 46  
     /* (non-Javadoc)
 47  
      * @see org.apache.jetspeed.aggregator.Aggregator#build(org.apache.jetspeed.request.RequestContext)
 48  
      */
 49  
     public void build(RequestContext context) throws JetspeedException, IOException
 50  
     {
 51  
         // construct Fragment for rendering use with
 52  
         // appropriate id to match portlet entity
 53  0
         String entity = context.getRequestParameter(PortalReservedParameters.PORTLET_ENTITY);
 54  0
         if (entity == null)
 55  
         {
 56  0
             entity = (String)context.getAttribute(PortalReservedParameters.PORTLET_ENTITY);
 57  
         }
 58  0
         if (entity == null)
 59  
         {
 60  0
             return;
 61  
         }        
 62  0
         Fragment fragment = context.getPage().getFragmentById(entity);
 63  0
         if (fragment == null) 
 64  
         {        
 65  0
             String name = context.getRequestParameter(PortalReservedParameters.PORTLET);
 66  0
             if (name == null)
 67  
             {
 68  0
                 name = (String)context.getAttribute(PortalReservedParameters.PORTLET);
 69  
             }
 70  0
             if (name == null)
 71  
             {
 72  0
                 return;
 73  
             }
 74  0
             fragment = new PortletAggregatorFragmentImpl(entity);        
 75  0
             fragment.setType(Fragment.PORTLET);
 76  0
             fragment.setName(name);
 77  
         }
 78  0
         ContentFragment contentFragment = new ContentFragmentImpl(fragment, class="keyword">new HashMap());
 79  0
         renderer.renderNow(contentFragment, context);
 80  0
         context.getResponse().getWriter().write(contentFragment.getRenderedContent());
 81  0
     }
 82  
     
 83  
 }

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