Skip to content

Commit

Permalink
passing engine
Browse files Browse the repository at this point in the history
Signed-off-by: ayushgarg0694 <ayushgarg0694@gmail.com>
  • Loading branch information
ayushgarg0694 authored and LisaWellman committed Jan 14, 2022
1 parent ab6f3cf commit b78540c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public String convert(String hl7MessageData) {
public String convert(String hl7MessageData, ConverterOptions options) {

HL7MessageEngine engine = getMessageEngine(options);
Bundle bundle = convertToBundle(hl7MessageData, options);
Bundle bundle = convertToBundle(hl7MessageData, options, engine);
return engine.getFHIRContext().encodeResourceToString(bundle);
}

Expand All @@ -127,14 +127,16 @@ public String convert(String hl7MessageData, ConverterOptions options) {
*
* @param hl7MessageData Message to convert
* @param options Options for conversion
*
* @param engine Hl7Message engine
* @return Bundle {@link Bundle} resource.
* @throws UnsupportedOperationException - if message type is not supported
*/
public Bundle convertToBundle(String hl7MessageData, ConverterOptions options) {
public Bundle convertToBundle(String hl7MessageData, ConverterOptions options, HL7MessageEngine engine) {
Preconditions.checkArgument(StringUtils.isNotBlank(hl7MessageData),
"Input HL7 message cannot be blank");
HL7MessageEngine engine = getMessageEngine(options);
if(engine == null) {
engine = getMessageEngine(options);
}

Message hl7message = getHl7Message(hl7MessageData);
if (hl7message != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void test_patient_encounter_bundle_return() throws IOException {
"MRG|MR2^^^XYZ\n";

HL7ToFHIRConverter ftv = new HL7ToFHIRConverter();
Bundle b = ftv.convertToBundle(hl7message, OPTIONS);
Bundle b = ftv.convertToBundle(hl7message, OPTIONS, null);

assertThat(b.getType()).isEqualTo(BundleType.COLLECTION);

Expand Down

0 comments on commit b78540c

Please sign in to comment.