1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.submit;
14
15 import com.eviware.soapui.model.ModelItem;
16 import com.eviware.soapui.model.iface.MessageExchange;
17 import com.eviware.soapui.support.types.StringToStringMap;
18 import com.eviware.soapui.support.xml.XmlUtils;
19
20 public abstract class AbstractMessageExchange<T extends ModelItem> implements MessageExchange
21 {
22 protected StringToStringMap properties;
23 private String[] messages;
24 private T modelItem;
25
26 public AbstractMessageExchange( T modelItem )
27 {
28 super();
29 this.modelItem = modelItem;
30 }
31
32 public T getModelItem()
33 {
34 return modelItem;
35 }
36
37 public String getRequestContentAsXml()
38 {
39 if( hasRequest( true ) && XmlUtils.seemsToBeXml( getRequestContent() ) )
40 return getRequestContent();
41 else
42 return "<not-xml/>";
43 }
44
45 public String getResponseContentAsXml()
46 {
47 if( hasResponse() && XmlUtils.seemsToBeXml( getResponseContent() ) )
48 return getResponseContent();
49 else
50 return null;
51 }
52
53 public void addProperty( String name, String value )
54 {
55 if( properties == null )
56 properties = new StringToStringMap();
57
58 properties.put( name, value );
59 }
60
61 public String getProperty( String name )
62 {
63 return properties.get( name );
64 }
65
66 public StringToStringMap getProperties()
67 {
68 return properties;
69 }
70
71 public String[] getMessages()
72 {
73 return messages;
74 }
75
76 public void setMessages( String[] messages )
77 {
78 this.messages = messages;
79 }
80
81 }