Coverage Report - org.apache.myfaces.shared.context.flash.ClientWindowFlashTokenLRUMap
 
Classes in this File Line Coverage Branch Coverage Complexity
ClientWindowFlashTokenLRUMap
0%
0/28
0%
0/10
1.625
 
 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  
 
 20  
 package org.apache.myfaces.shared.context.flash;
 21  
 
 22  
 import java.io.Serializable;
 23  
 import java.util.Map;
 24  
 import javax.faces.FacesWrapper;
 25  
 import javax.faces.context.FacesContext;
 26  
 import javax.faces.context.Flash;
 27  
 import org.apache.commons.collections.map.LRUMap;
 28  
 
 29  
 /**
 30  
  *
 31  
  */
 32  
 class ClientWindowFlashTokenLRUMap extends LRUMap implements Serializable
 33  
 {
 34  
 
 35  
     public ClientWindowFlashTokenLRUMap()
 36  0
     {
 37  0
     }
 38  
 
 39  
     public ClientWindowFlashTokenLRUMap(int maxSize)
 40  
     {
 41  0
         super(maxSize);
 42  0
     }
 43  
 
 44  
     public ClientWindowFlashTokenLRUMap(int maxSize, boolean scanUntilRemovable)
 45  
     {
 46  0
         super(maxSize, scanUntilRemovable);
 47  0
     }
 48  
 
 49  
     public ClientWindowFlashTokenLRUMap(int maxSize, float loadFactor)
 50  
     {
 51  0
         super(maxSize, loadFactor);
 52  0
     }
 53  
 
 54  
     public ClientWindowFlashTokenLRUMap(int maxSize, float loadFactor, boolean scanUntilRemovable)
 55  
     {
 56  0
         super(maxSize, loadFactor, scanUntilRemovable);
 57  0
     }
 58  
 
 59  
     public ClientWindowFlashTokenLRUMap(Map map)
 60  
     {
 61  0
         super(map);
 62  0
     }
 63  
 
 64  
     public ClientWindowFlashTokenLRUMap(Map map, boolean scanUntilRemovable)
 65  
     {
 66  0
         super(map, scanUntilRemovable);
 67  0
     }
 68  
     
 69  
     @Override
 70  
     protected boolean removeLRU(LinkEntry entry)
 71  
     {
 72  0
         FacesContext facesContext = FacesContext.getCurrentInstance();
 73  0
         Flash flash = facesContext.getExternalContext().getFlash();
 74  0
         if (flash != null)
 75  
         {
 76  0
             ReleasableFlash rf = null;
 77  0
             while (flash != null)
 78  
             {
 79  0
                 if (flash instanceof ReleasableFlash)
 80  
                 {
 81  0
                     rf = (ReleasableFlash) flash;
 82  0
                     break;
 83  
                 }
 84  0
                 if (flash instanceof FacesWrapper)
 85  
                 {
 86  0
                     flash = ((FacesWrapper<? extends Flash>) flash).getWrapped();
 87  
                 }
 88  
                 else
 89  
                 {
 90  0
                     flash = null;
 91  
                 }
 92  
             }
 93  0
             if (rf != null)
 94  
             {
 95  0
                 rf.clearFlashMap(facesContext, (String) entry.getKey(), (String) entry.getValue());
 96  
             }
 97  
         }
 98  0
         return super.removeLRU(entry);
 99  
     }
 100  
 }