Coverage Report - org.apache.tapestry.portlet.PortletWebSession
 
Classes in this File Line Coverage Branch Coverage Complexity
PortletWebSession
0%
0/19
N/A
1
 
 1  
 // Copyright 2005 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  
 
 15  
 package org.apache.tapestry.portlet;
 16  
 
 17  
 import java.util.List;
 18  
 
 19  
 import javax.portlet.PortletSession;
 20  
 
 21  
 import org.apache.hivemind.util.Defense;
 22  
 import org.apache.tapestry.describe.DescriptionReceiver;
 23  
 import org.apache.tapestry.web.WebSession;
 24  
 import org.apache.tapestry.web.WebUtils;
 25  
 
 26  
 /**
 27  
  * Adapts a {@link javax.portlet.PortletSession}as a
 28  
  * {@link org.apache.tapestry.web.WebSession}.
 29  
  * 
 30  
  * @author Howard M. Lewis Ship
 31  
  * @since 4.0
 32  
  */
 33  
 public class PortletWebSession implements WebSession
 34  
 {
 35  
 
 36  
     private final PortletSession _portletSession;
 37  
 
 38  
     public PortletWebSession(final PortletSession portletSession)
 39  0
     {
 40  0
         Defense.notNull(portletSession, "portletSession");
 41  
 
 42  0
         _portletSession = portletSession;
 43  0
     }
 44  
 
 45  
     public void describeTo(DescriptionReceiver receiver)
 46  
     {
 47  0
         receiver.describeAlternate(_portletSession);
 48  0
     }
 49  
 
 50  
     public String getId()
 51  
     {
 52  0
         return _portletSession.getId();
 53  
     }
 54  
 
 55  
     public boolean isNew()
 56  
     {
 57  0
         return _portletSession.isNew();
 58  
     }
 59  
 
 60  
     public List getAttributeNames()
 61  
     {
 62  0
         return WebUtils.toSortedList(_portletSession.getAttributeNames());
 63  
     }
 64  
 
 65  
     public Object getAttribute(String name)
 66  
     {
 67  0
         return _portletSession.getAttribute(name);
 68  
     }
 69  
 
 70  
     public void setAttribute(String name, Object attribute)
 71  
     {
 72  0
         _portletSession.setAttribute(name, attribute);
 73  0
     }
 74  
 
 75  
     public void invalidate()
 76  
     {
 77  0
         _portletSession.invalidate();
 78  0
     }
 79  
 
 80  
     /** 
 81  
      * {@inheritDoc}
 82  
      */
 83  
     public long getCreationTime()
 84  
     {
 85  0
         return _portletSession.getCreationTime();
 86  
     }
 87  
 
 88  
     /** 
 89  
      * {@inheritDoc}
 90  
      */
 91  
     public long getLastAccessedTime()
 92  
     {
 93  0
         return _portletSession.getLastAccessedTime();
 94  
     }
 95  
 
 96  
     /** 
 97  
      * {@inheritDoc}
 98  
      */
 99  
     public int getMaxInactiveInterval()
 100  
     {
 101  0
         return _portletSession.getMaxInactiveInterval();
 102  
     }
 103  
 
 104  
     /** 
 105  
      * {@inheritDoc}
 106  
      */
 107  
     public void setMaxInactiveInterval(int interval)
 108  
     {
 109  0
         _portletSession.setMaxInactiveInterval(interval);
 110  0
     }
 111  
     
 112  
 }