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;
14:
15: import java.util.ArrayList;
16: import java.util.List;
17:
18: import com.eviware.soapui.model.iface.Attachment;
19: import com.eviware.soapui.model.iface.MessagePart;
20:
21: /**
22: * Descriptor for attachments
23: *
24: * @author Ole.Matzura
25: */
26:
27: public final class WsdlAttachmentPart extends
28: MessagePart.AttachmentPart {
29: public static final String ANONYMOUS_NAME = "<anonymous>";
30: private String name;
31: private List<String> contentTypes = new ArrayList<String>();
32: private Attachment.AttachmentType type;
33: private boolean anonymous;
34:
35: public WsdlAttachmentPart() {
36: anonymous = true;
37: name = ANONYMOUS_NAME;
38: }
39:
40: public WsdlAttachmentPart(String name, List<String> types) {
41: super ();
42: this .name = name;
43:
44: if (types != null)
45: contentTypes.addAll(types);
46: }
47:
48: public WsdlAttachmentPart(String name, String type) {
49: this .name = name;
50: if (type != null)
51: contentTypes.add(type);
52: }
53:
54: public String[] getContentTypes() {
55: return contentTypes.toArray(new String[contentTypes.size()]);
56: }
57:
58: public String getName() {
59: return name;
60: }
61:
62: public void addContentType(String contentType) {
63: contentTypes.add(contentType);
64: }
65:
66: public Attachment.AttachmentType getAttachmentType() {
67: return type;
68: }
69:
70: public void setType(Attachment.AttachmentType type) {
71: this .type = type;
72: }
73:
74: public String getDescription() {
75: return name + " attachment; [" + getContentTypes() + "]";
76: }
77:
78: public boolean isAnonymous() {
79: return anonymous;
80: };
81: }
|