1 | |
|
2 | |
|
3 | |
|
4 | |
package ca.uhn.hl7v2.protocol.impl; |
5 | |
|
6 | |
import java.util.Map; |
7 | |
|
8 | |
import ca.uhn.hl7v2.HL7Exception; |
9 | |
import ca.uhn.hl7v2.app.Application; |
10 | |
import ca.uhn.hl7v2.app.ApplicationException; |
11 | |
import ca.uhn.hl7v2.model.Message; |
12 | |
import ca.uhn.hl7v2.protocol.ReceivingApplication; |
13 | |
import ca.uhn.hl7v2.protocol.ReceivingApplicationException; |
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
public class AppWrapper implements ReceivingApplication<Message> { |
23 | |
|
24 | |
private Application myApplication; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | 0 | public AppWrapper(Application theApplication) { |
30 | 0 | myApplication = theApplication; |
31 | 0 | } |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
public Message processMessage(Message theMessage, Map<String, Object> theMetadata) |
37 | |
throws ReceivingApplicationException, HL7Exception { |
38 | |
Message result; |
39 | |
try { |
40 | 0 | result = myApplication.processMessage(theMessage); |
41 | 0 | } catch (ApplicationException e) { |
42 | 0 | throw new ReceivingApplicationException(e); |
43 | 0 | } |
44 | |
|
45 | 0 | return result; |
46 | |
} |
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
public boolean canProcess(Message theMessage) { |
52 | 0 | return myApplication.canProcess(theMessage); |
53 | |
} |
54 | |
|
55 | |
} |