Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ModelClassFactory |
|
| 1.0;1 |
1 | /* | |
2 | * Created on 21-Apr-2005 | |
3 | */ | |
4 | package ca.uhn.hl7v2.parser; | |
5 | ||
6 | import java.io.Serializable; | |
7 | ||
8 | import ca.uhn.hl7v2.HL7Exception; | |
9 | import ca.uhn.hl7v2.Version; | |
10 | import ca.uhn.hl7v2.model.Group; | |
11 | import ca.uhn.hl7v2.model.Message; | |
12 | import ca.uhn.hl7v2.model.Segment; | |
13 | import ca.uhn.hl7v2.model.Type; | |
14 | ||
15 | /** | |
16 | * Looks up classes for message model components (e.g. concrete implementations of Message, Group, | |
17 | * Segment). A custom factory can be used to point to custom model components. | |
18 | * | |
19 | * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a> | |
20 | * @version $Revision: 1.3 $ updated on $Date: 2009-10-03 15:25:46 $ by $Author: jamesagnew $ | |
21 | */ | |
22 | public interface ModelClassFactory extends Serializable { | |
23 | ||
24 | /** | |
25 | * @param theName name of message | |
26 | * @param theVersion HL7 version | |
27 | * @param isExplicit true if the structure was specified explicitly in MSH-9-3, false if it was | |
28 | * inferred from MSH-9-1 and MSH-9-2. If false, a lookup may be performed to find an | |
29 | * alternate structure corresponding to that message type and event. | |
30 | * @return a class that implements the specified message | |
31 | * @throws HL7Exception if the version if not recognized or an appropriate class can not be | |
32 | * found | |
33 | */ | |
34 | public Class<? extends Message> getMessageClass(String theName, String theVersion, | |
35 | boolean isExplicit) throws HL7Exception; | |
36 | ||
37 | /** | |
38 | * Retrieves a message class by looking in a specific java package for the message type. | |
39 | * | |
40 | * @param theName The message structure type (e.g. "ADT_A01") | |
41 | * @param theVersion The HL7 version (e.g. "2.3.1") | |
42 | * @param isExplicit If false, the message structure is looked up using | |
43 | * {@link Parser#getMessageStructureForEvent(String, String)} and converted to the | |
44 | * appropriate structure type. For example, "ADT_A04" would be converted to "ADT_A01" | |
45 | * because the A04 trigger uses the A01 message structure according to HL7. | |
46 | * @param packageName The package name to use. Note that if the message type can't be found in | |
47 | * this package, HAPI will return the standard type returned by | |
48 | * {@link #getMessageClass(String, String, boolean)} | |
49 | * @return message class | |
50 | * @since 2.0 | |
51 | */ | |
52 | public Class<? extends Message> getMessageClassInASpecificPackage(String theName, | |
53 | String theVersion, boolean isExplicit, String packageName) throws HL7Exception; | |
54 | ||
55 | /** | |
56 | * @param theName name of group | |
57 | * @param theVersion HL7 version | |
58 | * @return a class that implements the specified group | |
59 | * @throws HL7Exception if the version if not recognized or an appropriate class can not be | |
60 | * found | |
61 | */ | |
62 | public Class<? extends Group> getGroupClass(String theName, String theVersion) | |
63 | throws HL7Exception; | |
64 | ||
65 | /** | |
66 | * @param theName name of segment | |
67 | * @param theVersion HL7 version | |
68 | * @return a class that implements the specified segment | |
69 | * @throws HL7Exception if the version if not recognized or an appropriate class can not be | |
70 | * found | |
71 | */ | |
72 | public Class<? extends Segment> getSegmentClass(String theName, String theVersion) | |
73 | throws HL7Exception; | |
74 | ||
75 | /** | |
76 | * @param theName name of type | |
77 | * @param theVersion HL7 version | |
78 | * @return a class that implements the specified type | |
79 | * @throws HL7Exception if the version if not recognized or an appropriate class can not be | |
80 | * found | |
81 | */ | |
82 | public Class<? extends Type> getTypeClass(String theName, String theVersion) | |
83 | throws HL7Exception; | |
84 | ||
85 | /** | |
86 | * @param eventName event name | |
87 | * @param version HL7 version | |
88 | * @return message structure name for the eventName and version or <code>null</code> if none | |
89 | * could be found | |
90 | * @throws HL7Exception if the version is unknown or the message structure list is inaccessible | |
91 | */ | |
92 | public String getMessageStructureForEvent(String eventName, Version version) | |
93 | throws HL7Exception; | |
94 | } |