1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import org.apache.xmlbeans.SchemaType;
19
20 import com.eviware.soapui.model.iface.Attachment;
21 import com.eviware.soapui.model.iface.MessagePart;
22
23 /***
24 * Descriptor for attachments
25 *
26 * @author Ole.Matzura
27 */
28
29 public final class HttpAttachmentPart extends MessagePart.AttachmentPart
30 {
31 public static final String ANONYMOUS_NAME = "<anonymous>";
32 private String name;
33 private List<String> contentTypes = new ArrayList<String>();
34 private Attachment.AttachmentType type;
35 private boolean anonymous;
36 private SchemaType schemaType;
37
38 public HttpAttachmentPart()
39 {
40 anonymous = true;
41 name = ANONYMOUS_NAME;
42 type = Attachment.AttachmentType.UNKNOWN;
43 }
44
45 public HttpAttachmentPart( String name, List<String> types )
46 {
47 super();
48 this.name = name;
49
50 if( types != null )
51 contentTypes.addAll( types );
52 }
53
54 public HttpAttachmentPart( String name, String type )
55 {
56 this.name = name;
57 if( type != null )
58 contentTypes.add( type );
59 }
60
61 public String[] getContentTypes()
62 {
63 return contentTypes.toArray( new String[contentTypes.size()] );
64 }
65
66 public String getName()
67 {
68 return name;
69 }
70
71 public void addContentType( String contentType )
72 {
73 contentTypes.add( contentType );
74 }
75
76 public Attachment.AttachmentType getAttachmentType()
77 {
78 return type;
79 }
80
81 public void setType( Attachment.AttachmentType type )
82 {
83 this.type = type;
84 }
85
86 public String getDescription()
87 {
88 return name + " attachment; [" + getContentTypes() + "]";
89 }
90
91 public boolean isAnonymous()
92 {
93 return anonymous;
94 }
95
96 public SchemaType getSchemaType()
97 {
98 return schemaType;
99 }
100
101 public void setSchemaType( SchemaType schemaType )
102 {
103 this.schemaType = schemaType;
104 }
105 }