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.support.action.support;
14  
15  import java.util.ArrayList;
16  import java.util.Collection;
17  
18  import com.eviware.soapui.model.ModelItem;
19  import com.eviware.soapui.support.action.SoapUIActionMapping;
20  
21  /***
22   * A list of SoapUIActionMappings
23   * 
24   * @author ole.matzura
25   */
26  
27  public class SoapUIActionMappingList<T extends ModelItem> extends ArrayList<SoapUIActionMapping<T>>
28  {
29  	public SoapUIActionMappingList()
30  	{
31  		super();
32  	}
33  
34  	public SoapUIActionMappingList( Collection<? extends SoapUIActionMapping<T>> arg0 )
35  	{
36  		super( arg0 );
37  	}
38  	
39  	public int getMappingIndex( String id )
40  	{
41  		for( int c = 0; c < size(); c++ )
42  		{
43  			if( get( c ).getAction().getName().equals( id ))
44  				return c;
45  		}
46  		
47  		return -1;
48  	}
49  	
50  	public SoapUIActionMapping<T> getMapping( String id )
51  	{
52  		for( SoapUIActionMapping<T> mapping : this )
53  		{
54  			if( mapping.getAction().getName().equals( id ))
55  				return mapping;
56  		}
57  		
58  		return null;
59  	}
60  }