Coverage Report - org.apache.myfaces.application.viewstate.StateCacheUtils
 
Classes in this File Line Coverage Branch Coverage Complexity
StateCacheUtils
0%
0/21
0%
0/16
7
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *   http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.myfaces.application.viewstate;
 20  
 
 21  
 import javax.faces.FacesWrapper;
 22  
 import javax.faces.render.ResponseStateManager;
 23  
 import org.apache.myfaces.renderkit.MyfacesResponseStateManager;
 24  
 
 25  0
 public class StateCacheUtils
 26  
 {
 27  
     public static boolean isMyFacesResponseStateManager(ResponseStateManager rsm)
 28  
     {
 29  0
         if (rsm instanceof MyfacesResponseStateManager)
 30  
         {
 31  0
             return true;
 32  
         }
 33  
         else
 34  
         {
 35  0
             ResponseStateManager rsm1 = rsm;
 36  0
             while (rsm1 != null)
 37  
             {
 38  0
                 if (rsm1 instanceof MyfacesResponseStateManager)
 39  
                 {
 40  0
                     return true;
 41  
                 }
 42  0
                 if (rsm1 instanceof FacesWrapper)
 43  
                 {
 44  0
                     rsm1 = ((FacesWrapper<? extends ResponseStateManager>) rsm1).getWrapped();
 45  
                 }
 46  
                 else
 47  
                 {
 48  0
                     rsm1 = null;
 49  
                 }
 50  
             }
 51  0
             return false;
 52  
         }
 53  
     }
 54  
     
 55  
     public static MyfacesResponseStateManager getMyFacesResponseStateManager(ResponseStateManager rsm)
 56  
     {
 57  0
         if (rsm instanceof MyfacesResponseStateManager)
 58  
         {
 59  0
             return (MyfacesResponseStateManager) rsm;
 60  
         }
 61  
         else
 62  
         {
 63  0
             ResponseStateManager rsm1 = rsm;
 64  0
             while (rsm1 != null)
 65  
             {
 66  0
                 if (rsm1 instanceof MyfacesResponseStateManager)
 67  
                 {
 68  0
                     return (MyfacesResponseStateManager) rsm1;
 69  
                 }
 70  0
                 if (rsm1 instanceof FacesWrapper)
 71  
                 {
 72  0
                     rsm1 = ((FacesWrapper<? extends ResponseStateManager>) rsm1).getWrapped();
 73  
                 }
 74  
                 else
 75  
                 {
 76  0
                     rsm1 = null;
 77  
                 }
 78  
             }
 79  0
             return null;
 80  
         }
 81  
     }
 82  
 }