Coverage Report - org.apache.myfaces.util.NavigationUtils
 
Classes in this File Line Coverage Branch Coverage Complexity
NavigationUtils
0%
0/14
0%
0/6
4
 
 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.util;
 20  
 
 21  
 import java.util.Collection;
 22  
 import java.util.HashSet;
 23  
 import java.util.Set;
 24  
 import org.apache.myfaces.config.element.NavigationRule;
 25  
 
 26  
 /**
 27  
  *
 28  
  * @author lu4242
 29  
  */
 30  0
 public final class NavigationUtils
 31  
 {
 32  
     public static Set<javax.faces.application.NavigationCase> convertNavigationCasesToAPI(NavigationRule rule)
 33  
     {
 34  0
         Collection<? extends org.apache.myfaces.config.element.NavigationCase> configCases = 
 35  
                 rule.getNavigationCases();
 36  0
         Set<javax.faces.application.NavigationCase> apiCases = 
 37  
                 new HashSet<javax.faces.application.NavigationCase>(configCases.size());
 38  
         
 39  0
         for(org.apache.myfaces.config.element.NavigationCase configCase : configCases)
 40  
         {   
 41  0
             if(configCase.getRedirect() != null)
 42  
             {
 43  0
                 String includeViewParamsAttribute = configCase.getRedirect().getIncludeViewParams();
 44  0
                 boolean includeViewParams = false; // default value is false
 45  0
                 if (includeViewParamsAttribute != null)
 46  
                 {
 47  0
                     includeViewParams = Boolean.valueOf(includeViewParamsAttribute);
 48  
                 }
 49  0
                 apiCases.add(new javax.faces.application.NavigationCase(rule.getFromViewId(),
 50  
                         configCase.getFromAction(),
 51  
                                                 configCase.getFromOutcome(),configCase.getIf(),
 52  
                         configCase.getToViewId(),
 53  
                                                 configCase.getRedirect().getViewParams(),true,includeViewParams));
 54  0
             }
 55  
             else
 56  
             {
 57  0
                 apiCases.add(new javax.faces.application.NavigationCase(rule.getFromViewId(),
 58  
                         configCase.getFromAction(),
 59  
                                                 configCase.getFromOutcome(),configCase.getIf(),
 60  
                                                 configCase.getToViewId(),null,false,false));
 61  
             }
 62  0
         }
 63  
         
 64  0
         return apiCases;
 65  
     }
 66  
 }