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 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 HttpAttachmentPart extends MessagePart.AttachmentPart
28 {
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 HttpAttachmentPart()
36 {
37 anonymous = true;
38 name = ANONYMOUS_NAME;
39 }
40
41 public HttpAttachmentPart(String name, List<String> types )
42 {
43 super();
44 this.name = name;
45
46 if( types != null )
47 contentTypes.addAll( types );
48 }
49
50 public HttpAttachmentPart( String name, String type )
51 {
52 this.name = name;
53 if( type != null )
54 contentTypes.add( type );
55 }
56
57 public String[] getContentTypes()
58 {
59 return contentTypes.toArray( new String[contentTypes.size()] );
60 }
61
62 public String getName()
63 {
64 return name;
65 }
66
67 public void addContentType( String contentType )
68 {
69 contentTypes.add( contentType );
70 }
71
72 public Attachment.AttachmentType getAttachmentType()
73 {
74 return type;
75 }
76
77 public void setType(Attachment.AttachmentType type)
78 {
79 this.type = type;
80 }
81
82 public String getDescription()
83 {
84 return name + " attachment; [" + getContentTypes() + "]";
85 }
86
87 public boolean isAnonymous()
88 {
89 return anonymous;
90 };
91 }