Coverage Report - org.apache.tapestry.portlet.multipart.UploadFormPortletParametersWrapper
 
Classes in this File Line Coverage Branch Coverage Complexity
UploadFormPortletParametersWrapper
0%
0/10
0%
0/4
1.333
 
 1  
 // Copyright 2006 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 package org.apache.tapestry.portlet.multipart;
 15  
 
 16  
 import java.util.Collections;
 17  
 import java.util.Enumeration;
 18  
 import java.util.Map;
 19  
 
 20  
 import javax.portlet.ActionRequest;
 21  
 
 22  
 import org.apache.hivemind.util.Defense;
 23  
 
 24  
 /**
 25  
  * @author Raphael Jean
 26  
  */
 27  
 public class UploadFormPortletParametersWrapper extends ActionRequestWrapper
 28  
 {
 29  
 
 30  
     /**
 31  
      * Map of {@link ValuePart} keyed on parameter name.
 32  
      */
 33  
     private Map _parameterMap;
 34  
 
 35  
     public UploadFormPortletParametersWrapper(ActionRequest request,
 36  
             Map parameterMap)
 37  
     {
 38  0
         super(request);
 39  
 
 40  0
         Defense.notNull(parameterMap, "parameterMap");
 41  
 
 42  0
         _parameterMap = Collections.unmodifiableMap(parameterMap);
 43  0
     }
 44  
 
 45  
     public String getParameter(String name)
 46  
     {
 47  0
         String[] values = getParameterValues(name);
 48  
 
 49  0
         return (values == null || values.length == 0) ? null : values[0];
 50  
     }
 51  
 
 52  
     public Map getParameterMap()
 53  
     {
 54  0
         return _parameterMap;
 55  
     }
 56  
 
 57  
     public Enumeration getParameterNames()
 58  
     {
 59  0
         return Collections.enumeration(_parameterMap.keySet());
 60  
     }
 61  
 
 62  
     public String[] getParameterValues(String name)
 63  
     {
 64  0
         return (String[]) _parameterMap.get(name);
 65  
     }
 66  
 
 67  
     public String toString()
 68  
     {
 69  0
         return "<UploadFormPortletParametersWrapper for " + getRequest() + ">";
 70  
     }
 71  
 
 72  
 }