I am using the HAPI version 2.5 library.
//instantiate a PipeParser, which handles the "traditional encoding"
      ModelClassFactory cfm=new CustomModelClassFactory("com.hss.customodel");
      Parser pipeParser = new PipeParser(cfm);
      int count=0;
      HapiContext context=new DefaultHapiContext(cfm);
      context.setModelClassFactory(cfm);
      try{
         Message m=pipeParser.parse(ackMessageString);
         System.out.println("My message  is "+m.printStructure());

      }catch(Exception e){
         e.printStackTrace();
      }

The logs show that the DefaultModelFactory is being used instead of the 
CustomModelFactory. Further proof is that I can change the package name to one 
that doesn't exist with no exceptions thrown.


Here is a sample of the log output:

10:03:20,649 DEBUG [main] DefaultModelClassFactory:330 - Loaded: 
ca.uhn.hl7v2.model.v25.message.MFN_M01 class: class 
ca.uhn.hl7v2.model.v25.message.MFN_M01
10:03:20,696 DEBUG [main] MessageIterator:178 - Creating non standard segment 
ZP1 on group: MF
10:03:20,696 DEBUG [main] DefaultModelClassFactory:326 - Trying to load: 
ca.uhn.hl7v2.model.v25.segment.ZP1
10:03:20,696 DEBUG [main] DefaultModelClassFactory:334 - Failed to load: 
ca.uhn.hl7v2.model.v25.segment.ZP1


Many thanks.
------------------------------------------------------------------------------
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to