01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * 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.operation;
14:
15: import com.eviware.soapui.impl.wsdl.WsdlOperation;
16: import com.eviware.soapui.impl.wsdl.WsdlRequest;
17: import com.eviware.soapui.settings.WsdlSettings;
18: import com.eviware.soapui.support.UISupport;
19: import com.eviware.soapui.support.action.support.AbstractSoapUIAction;
20:
21: /**
22: * Adds a new WsdlRequest to a WsdlOperation
23: *
24: * @author Ole.Matzura
25: */
26:
27: public class NewRequestAction extends
28: AbstractSoapUIAction<WsdlOperation> {
29: public final static String SOAPUI_ACTION_ID = "NewRequestAction";
30:
31: public NewRequestAction() {
32: super ("New request", "Creates a new request for this operation");
33: }
34:
35: public void perform(WsdlOperation operation, Object param) {
36: String name = UISupport.prompt("Specify name of request",
37: "New request", "Request "
38: + (operation.getRequestCount() + 1));
39: if (name == null)
40: return;
41:
42: boolean createOptional = operation
43: .getSettings()
44: .getBoolean(
45: WsdlSettings.XML_GENERATION_ALWAYS_INCLUDE_OPTIONAL_ELEMENTS);
46: if (!createOptional)
47: createOptional = UISupport.confirm(
48: "Create optional elements in schema?",
49: "Create Request");
50:
51: WsdlRequest newRequest = operation.addNewRequest(name);
52: String requestContent = operation.createRequest(createOptional);
53: if (requestContent != null) {
54: newRequest.setRequestContent(requestContent);
55: }
56:
57: UISupport.showDesktopPanel(newRequest);
58: }
59: }
|