Coverage Report - org.mule.config.spring.parsers.assembly.configuration.TempWrapperPropertyConfiguration
 
Classes in this File Line Coverage Branch Coverage Complexity
TempWrapperPropertyConfiguration
0%
0/38
0%
0/22
1.211
 
 1  
 /*
 2  
  * $Id: TempWrapperPropertyConfiguration.java 19695 2010-09-22 17:30:20Z esteban.robles $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.config.spring.parsers.assembly.configuration;
 12  
 
 13  
 import java.util.Map;
 14  
 
 15  
 /**
 16  
  * Wrap a PropertyConfiguration so that changes are kept in the wrapper
 17  
  */
 18  
 public class TempWrapperPropertyConfiguration implements PropertyConfiguration
 19  
 {
 20  
 
 21  
     protected PropertyConfiguration delegate;
 22  0
     protected SimplePropertyConfiguration extra = new SimplePropertyConfiguration();
 23  
     private boolean greedyIgnore;
 24  
 
 25  
     public TempWrapperPropertyConfiguration(PropertyConfiguration delegate)
 26  
     {
 27  0
         this(delegate, true);
 28  0
     }
 29  
 
 30  
     public TempWrapperPropertyConfiguration(PropertyConfiguration delegate, boolean greedyIgnore)
 31  0
     {
 32  0
         this.delegate = delegate;
 33  0
         this.greedyIgnore = greedyIgnore;
 34  0
     }
 35  
 
 36  
     public void addReference(String propertyName)
 37  
     {
 38  0
         extra.addReference(propertyName);
 39  0
     }
 40  
 
 41  
     public void addMapping(String propertyName, Map mappings)
 42  
     {
 43  0
         extra.addMapping(propertyName, mappings);
 44  0
     }
 45  
 
 46  
     public void addMapping(String propertyName, String mappings)
 47  
     {
 48  0
         extra.addMapping(propertyName, mappings);
 49  0
     }
 50  
 
 51  
     public void addMapping(String propertyName, ValueMap mappings)
 52  
     {
 53  0
         extra.addMapping(propertyName, mappings);
 54  0
     }
 55  
 
 56  
     public void addAlias(String alias, String propertyName)
 57  
     {
 58  0
         extra.addAlias(alias, propertyName);
 59  0
     }
 60  
 
 61  
     public void addCollection(String propertyName)
 62  
     {
 63  0
         extra.addCollection(propertyName);
 64  0
     }
 65  
 
 66  
     public void addIgnored(String propertyName)
 67  
     {
 68  0
         extra.addIgnored(propertyName);
 69  0
     }
 70  
 
 71  
     public void removeIgnored(String propertyName)
 72  
     {
 73  0
         extra.removeIgnored(propertyName);
 74  0
     }
 75  
 
 76  
     public void setIgnoredDefault(boolean ignoreAll)
 77  
     {
 78  0
         extra.setIgnoredDefault(ignoreAll);
 79  0
     }
 80  
 
 81  
     public String getAttributeMapping(String alias)
 82  
     {
 83  0
         return extra.getAttributeMapping(alias, delegate.getAttributeMapping(alias));
 84  
     }
 85  
 
 86  
     public String getAttributeAlias(String mapping)
 87  
     {
 88  0
         return extra.getAttributeMapping(mapping, delegate.getAttributeAlias(mapping));
 89  
     }
 90  
 
 91  
     public boolean isCollection(String propertyName)
 92  
     {
 93  0
         return extra.isCollection(propertyName) || delegate.isCollection(propertyName);
 94  
     }
 95  
 
 96  
     public boolean isIgnored(String propertyName)
 97  
     {
 98  0
         if (greedyIgnore)
 99  
         {
 100  0
             return extra.isIgnored(propertyName) || delegate.isIgnored(propertyName);
 101  
         }
 102  
         else
 103  
         {
 104  0
             return extra.isIgnored(propertyName) && delegate.isIgnored(propertyName);            
 105  
         }
 106  
     }
 107  
 
 108  
     public boolean isReference(String attributeName)
 109  
     {
 110  0
         return extra.isReference(attributeName) || delegate.isReference(attributeName);
 111  
     }
 112  
 
 113  
     public SingleProperty getSingleProperty(String propertyName)
 114  
     {
 115  0
         return new SinglePropertyWrapper(propertyName, this);
 116  
     }
 117  
 
 118  
     public String translateName(String oldName)
 119  
     {
 120  0
         return extra.translateName(delegate.translateName(oldName));
 121  
     }
 122  
 
 123  
     public Object translateValue(String name, String value)
 124  
     {
 125  0
         Object intermediate = delegate.translateValue(name, value);
 126  0
         if (intermediate != null && intermediate.equals(value))
 127  
         {
 128  0
             return extra.translateValue(name, value);
 129  
         }
 130  
         else
 131  
         {
 132  0
             return intermediate;
 133  
         }
 134  
     }
 135  
 
 136  
 }