Coverage Report - org.apache.tiles.request.portlet.delegate.PortletRequestDelegate
 
Classes in this File Line Coverage Branch Coverage Complexity
PortletRequestDelegate
100%
11/11
50%
4/8
2.333
 
 1  
 /*
 2  
  * $Id: PortletRequestDelegate.java 1066849 2011-02-03 16:12:39Z apetrelli $
 3  
  *
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  * http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 package org.apache.tiles.request.portlet.delegate;
 22  
 
 23  
 import java.util.Map;
 24  
 
 25  
 import javax.portlet.PortletRequest;
 26  
 
 27  
 import org.apache.tiles.request.collection.ReadOnlyEnumerationMap;
 28  
 import org.apache.tiles.request.portlet.extractor.ParameterExtractor;
 29  
 
 30  
 /**
 31  
  * Request delegate in case of simple Portlet request.
 32  
  *
 33  
  * @version $Rev: 1066849 $ $Date: 2011-02-04 03:12:39 +1100 (Fri, 04 Feb 2011) $
 34  
  */
 35  
 public class PortletRequestDelegate implements RequestDelegate {
 36  
 
 37  
     /**
 38  
      * The request.
 39  
      */
 40  
     private PortletRequest request;
 41  
 
 42  
     /**
 43  
      * <p>The lazily instantiated <code>Map</code> of request
 44  
      * parameter name-value.</p>
 45  
      */
 46  4
     private Map<String, String> param = null;
 47  
 
 48  
     /**
 49  
      * <p>The lazily instantiated <code>Map</code> of request
 50  
      * parameter name-values.</p>
 51  
      */
 52  4
     private Map<String, String[]> paramValues = null;
 53  
 
 54  
     /**
 55  
      * Constructor.
 56  
      *
 57  
      * @param request The request.
 58  
      */
 59  4
     public PortletRequestDelegate(PortletRequest request) {
 60  4
         this.request = request;
 61  4
     }
 62  
 
 63  
     /** {@inheritDoc} */
 64  
     public Map<String, String> getParam() {
 65  1
         if ((param == null) && (request != null)) {
 66  1
             param = new ReadOnlyEnumerationMap<String>(new ParameterExtractor(request));
 67  
         }
 68  1
         return (param);
 69  
     }
 70  
 
 71  
     /** {@inheritDoc} */
 72  
     public Map<String, String[]> getParamValues() {
 73  1
         if ((paramValues == null) && (request != null)) {
 74  1
             paramValues = request.getParameterMap();
 75  
         }
 76  1
         return (paramValues);
 77  
     }
 78  
 }