View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2010 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.actions.project;
14  
15  import com.eviware.soapui.SoapUI;
16  import com.eviware.soapui.impl.wsdl.WsdlProject;
17  import com.eviware.soapui.impl.wsdl.submit.transports.jms.util.HermesUtils;
18  import com.eviware.soapui.support.action.SoapUIActionGroup;
19  import com.eviware.soapui.support.action.support.AbstractSoapUIActionGroup;
20  import com.eviware.soapui.support.action.support.SoapUIActionMappingList;
21  
22  /***
23   * SoapUIActionGroup for WsdlProjects, returns different actions depending on if
24   * the project is disabled or not.
25   * 
26   * @author ole.matzura
27   */
28  
29  public class WsdlProjectSoapUIActionGroup extends AbstractSoapUIActionGroup<WsdlProject>
30  {
31  	public WsdlProjectSoapUIActionGroup( String id, String name )
32  	{
33  		super( id, name );
34  	}
35  
36  	public SoapUIActionMappingList<WsdlProject> getActionMappings( WsdlProject project )
37  	{
38  		if( project.isDisabled() )
39  		{
40  			SoapUIActionGroup<WsdlProject> actionGroup = SoapUI.getActionRegistry().getActionGroup(
41  					"DisabledWsdlProjectActions" );
42  			return actionGroup.getActionMappings( project );
43  		}
44  		else if( !project.isOpen() )
45  		{
46  			if( project.getEncrypted() != 0 )
47  			{
48  				SoapUIActionGroup<WsdlProject> actionGroup = SoapUI.getActionRegistry().getActionGroup(
49  						"EncryptedWsdlProjectActions" );
50  				return actionGroup.getActionMappings( project );
51  			}
52  			else
53  			{
54  				SoapUIActionGroup<WsdlProject> actionGroup = SoapUI.getActionRegistry().getActionGroup(
55  						"ClosedWsdlProjectActions" );
56  				return actionGroup.getActionMappings( project );
57  			}
58  		}
59  		else
60  		{
61  			SoapUIActionGroup<WsdlProject> actionGroup = SoapUI.getActionRegistry().getActionGroup(
62  					"EnabledWsdlProjectActions" );
63  			SoapUIActionMappingList<WsdlProject> mappings = actionGroup.getActionMappings( project );
64  
65  			mappings.getMapping( SaveProjectAction.SOAPUI_ACTION_ID ).setEnabled(
66  					!project.isRemote() && project.getPath() != null );
67  			mappings.getMapping( StartHermesJMS.SOAPUI_ACTION_ID ).setEnabled( HermesUtils.isHermesJMSSupported() );
68  
69  			return mappings;
70  		}
71  	}
72  }