Class HapiContextFactory

java.lang.Object
org.openehealth.ipf.commons.ihe.hl7v2.definitions.HapiContextFactory

public class HapiContextFactory extends Object
This factory creates HapiContext instances that are required to derive ModelClassFactory and ValidationContext valid for the given HL7v2 transaction.

By default, the HapiContext defines the transaction-specific conformance profile and profile store, and disables validation during parsing.

  • Constructor Details

    • HapiContextFactory

      public HapiContextFactory()
  • Method Details

    • setIdGenerator

      public static void setIdGenerator(IDGenerator generator)
      Allows to globally set the IDGenerator that generates IDs for new HL7 messages from new HapiContext instances. This does not affect the ID generation of already created HapiContexts nor does it do any cleanup of the previous generator.
      Parameters:
      generator - global ID generator
    • createHapiContext

      public static HapiContext createHapiContext()
      Returns a default HapiContext
      Returns:
      default HapiContext
    • createHapiContext

      public static HapiContext createHapiContext(ModelClassFactory modelClassFactory)
      Returns a HapiContext for the provided model class factory
      Parameters:
      modelClassFactory - model clas factory
      Returns:
      HapiContext
    • createHapiContext

      public static HapiContext createHapiContext(org.openehealth.ipf.gazelle.validation.profile.HL7v2Transactions transactions)
      Returns a HapiContext for the provided HL7v2 transaction, using a default HL7 model
      Parameters:
      transactions - profile enumeration
      Returns:
      HapiContext
    • createHapiContext

      public static HapiContext createHapiContext(ModelClassFactory modelClassFactory, org.openehealth.ipf.gazelle.validation.profile.HL7v2Transactions transactions)
      Returns a HapiContext for the provided HL7v2 transaction, using a custom HL7 model.
      Parameters:
      modelClassFactory - transaction-specific model-class factory
      transactions - profile enumeration
      Returns:
      HapiContext
    • createHapiContext

      public static HapiContext createHapiContext(ModelClassFactory modelClassFactory, ValidationRuleBuilder validationRuleBuilder, ProfileStore profileStore)
      Parameters:
      modelClassFactory - transaction-specific model-class factory
      validationRuleBuilder - validation rule builder
      profileStore - profile store
      Returns:
      HapiContext