View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2007 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.impl.wsdl;
14  
15  import java.util.Map;
16  
17  import com.eviware.soapui.config.ModelItemConfig;
18  import com.eviware.soapui.config.PropertiesTypeConfig;
19  import com.eviware.soapui.impl.wsdl.support.XmlBeansPropertiesTestPropertyHolder;
20  import com.eviware.soapui.model.ModelItem;
21  import com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils;
22  import com.eviware.soapui.model.testsuite.TestProperty;
23  import com.eviware.soapui.model.testsuite.TestPropertyListener;
24  
25  public abstract class AbstractTestPropertyHolderWsdlModelItem<T extends ModelItemConfig> extends AbstractWsdlModelItem<T> 
26  	implements MutableTestPropertyHolder 
27  {
28  	private XmlBeansPropertiesTestPropertyHolder propertyHolderSupport;
29  	 
30  	protected AbstractTestPropertyHolderWsdlModelItem( T config, ModelItem parent, String icon )
31  	{
32  		super( config, parent, icon );
33  	}
34  	
35  	protected void setPropertiesConfig( PropertiesTypeConfig config )
36  	{
37  		if( propertyHolderSupport == null )
38  			propertyHolderSupport = new XmlBeansPropertiesTestPropertyHolder( this, config );
39  		else
40  			propertyHolderSupport.resetPropertiesConfig( config );
41  	}
42  
43  	public TestProperty addProperty( String name )
44  	{
45  		return propertyHolderSupport.addProperty( name );
46  	}
47  
48  	public void addTestPropertyListener( TestPropertyListener listener )
49  	{
50  		propertyHolderSupport.addTestPropertyListener( listener );
51  	}
52  
53  	public TestProperty getProperty( String name )
54  	{
55  		return propertyHolderSupport.getProperty( name );
56  	}
57  
58  	public String[] getPropertyNames()
59  	{
60  		return propertyHolderSupport.getPropertyNames();
61  	}
62  
63  	public String getPropertyValue( String name )
64  	{
65  		return propertyHolderSupport.getPropertyValue( name );
66  	}
67  
68  	public void removeProperty( String propertyName )
69  	{
70  		propertyHolderSupport.removeProperty( propertyName );
71  	}
72  
73  	public void removeTestPropertyListener( TestPropertyListener listener )
74  	{
75  		propertyHolderSupport.removeTestPropertyListener( listener );
76  	}
77  
78  	public void setPropertyValue( String name, String value )
79  	{
80  		propertyHolderSupport.setPropertyValue( name, value );
81  	}
82  
83  	public boolean renameProperty( String name, String newName )
84  	{
85  		return PropertyExpansionUtils.renameProperty( propertyHolderSupport, getProperty( name ), newName, this ) != null;
86  //		propertyHolderSupport.renameProperty( name, newName );
87  	}
88  
89  	public Map<String, TestProperty> getProperties()
90  	{
91  		return propertyHolderSupport.getProperties();
92  	}
93  
94  	public boolean hasProperty( String name )
95  	{
96  		return propertyHolderSupport.hasProperty( name );
97  	}
98  
99  	public ModelItem getModelItem()
100 	{
101 		return this;
102 	}
103 }