Coverage Report - org.apache.myfaces.flow.MethodCallNodeImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
MethodCallNodeImpl
0%
0/30
0%
0/6
1.364
 
 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.flow;
 20  
 
 21  
 import java.util.ArrayList;
 22  
 import java.util.Collections;
 23  
 import java.util.List;
 24  
 import javax.el.MethodExpression;
 25  
 import javax.el.ValueExpression;
 26  
 import javax.faces.flow.MethodCallNode;
 27  
 import javax.faces.flow.Parameter;
 28  
 
 29  
 /**
 30  
  *
 31  
  * @since 2.2
 32  
  * @author Leonardo Uribe
 33  
  */
 34  
 public class MethodCallNodeImpl extends MethodCallNode implements Freezable
 35  
 {
 36  
     private String _id;
 37  
     private MethodExpression _methodExpression;
 38  
     private ValueExpression _outcome;
 39  
     
 40  
     private List<Parameter> _parameters;
 41  
     private List<Parameter> _unmodifiableParameters;
 42  
     
 43  
     private boolean _initialized;
 44  
     
 45  
     public MethodCallNodeImpl(String methodCallNodeId)
 46  0
     {
 47  0
         this._id = methodCallNodeId;
 48  0
         _parameters = new ArrayList<Parameter>();
 49  0
         _unmodifiableParameters = Collections.unmodifiableList(_parameters);
 50  0
     }
 51  
 
 52  
     @Override
 53  
     public MethodExpression getMethodExpression()
 54  
     {
 55  0
         return _methodExpression;
 56  
     }
 57  
 
 58  
     @Override
 59  
     public ValueExpression getOutcome()
 60  
     {
 61  0
         return _outcome;
 62  
     }
 63  
 
 64  
     @Override
 65  
     public List<Parameter> getParameters()
 66  
     {
 67  0
         return _unmodifiableParameters;
 68  
     }
 69  
     
 70  
     public void addParameter(Parameter parameter)
 71  
     {
 72  0
         checkInitialized();
 73  0
         _parameters.add(parameter);
 74  0
     }
 75  
 
 76  
     @Override
 77  
     public String getId()
 78  
     {
 79  0
         return _id;
 80  
     }
 81  
     
 82  
     public void freeze()
 83  
     {
 84  0
         _initialized = true;
 85  
         
 86  0
         for (Parameter value : _parameters)
 87  
         {
 88  0
             if (value instanceof Freezable)
 89  
             {
 90  0
                 ((Freezable)value).freeze();
 91  
             }
 92  0
         }
 93  0
     }
 94  
     
 95  
     private void checkInitialized() throws IllegalStateException
 96  
     {
 97  0
         if (_initialized)
 98  
         {
 99  0
             throw new IllegalStateException("Flow is inmutable once initialized");
 100  
         }
 101  0
     }
 102  
 
 103  
     public void setMethodExpression(MethodExpression methodExpression)
 104  
     {
 105  0
         checkInitialized();
 106  0
         this._methodExpression = methodExpression;
 107  0
     }
 108  
 
 109  
     public void setOutcome(ValueExpression outcome)
 110  
     {
 111  0
         checkInitialized();
 112  0
         this._outcome = outcome;
 113  0
     }
 114  
 
 115  
     public void setId(String id)
 116  
     {
 117  0
         checkInitialized();
 118  0
         this._id = id;
 119  0
     }
 120  
 }