forked from openmrs/openmrs-module-attachments
/
AttachmentComplexData2_0.java
43 lines (35 loc) · 1.22 KB
/
AttachmentComplexData2_0.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package org.openmrs.module.attachments.obs;
import org.apache.commons.lang.StringUtils;
import org.openmrs.module.attachments.AttachmentsConstants;
import org.openmrs.obs.ComplexData;
public class AttachmentComplexData2_0 extends BaseComplexData implements AttachmentComplexData {
private static final long serialVersionUID = 1L;
private String instructions = ValueComplex.INSTRUCTIONS_NONE;
/**
* @param instructions Custom instructions to be processed by {@link DefaultAttachmentHandler}.
* @param mimeType Same as HTTP content type, @see
* <a href= "http://www.sitepoint.com/web-foundations/mime-types-complete-list/"/>
*/
public AttachmentComplexData2_0(String instructions, String title, Object data, String mimeType) {
super(title, data);
if (!StringUtils.isEmpty(mimeType)) {
this.setMimeType(mimeType);
} else {
this.setMimeType(AttachmentsConstants.UNKNOWN_MIME_TYPE);
}
if (!StringUtils.isEmpty(instructions)) {
this.instructions = instructions;
}
}
public AttachmentComplexData2_0(String title, Object data) {
this("", title, data, "");
}
@Override
public String getInstructions() {
return instructions;
}
@Override
public ComplexData asComplexData() {
return this;
}
}