Class Hl7v2Based<C extends ca.uhn.hl7v2.model.Composite>

java.lang.Object
org.openehealth.ipf.commons.ihe.xds.core.metadata.Hl7v2Based<C>
Type Parameters:
C - HAPI composite type which corresponds to the HL7 v2 element.
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Address, AssigningAuthority, Code, Identifiable, Name, Organization, Person, ReferenceId, Telecom

public abstract class Hl7v2Based<C extends ca.uhn.hl7v2.model.Composite> extends Object implements Serializable
An XDS model object backed up by an HL7 v2 element.
Author:
Dmytro Rud
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Hl7v2Based.Holder<T extends ca.uhn.hl7v2.model.Type>
    Fake enclosing element for an HL7 v2 sub-component, necessary for correct rendering and parsing.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final ca.uhn.hl7v2.model.Message
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Default constructor, for serialization purposes only.
    protected
    Hl7v2Based(C hapiObject)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    protected static Integer
    getIntegerValue(ca.uhn.hl7v2.model.Primitive p)
     
    protected static Long
    getLongValue(ca.uhn.hl7v2.model.Primitive p)
     
    boolean
     
    static <C extends ca.uhn.hl7v2.model.Composite, T extends Hl7v2Based<C>>
    T
    parse(String hl7String, Class<T> xdsModelClass)
    Parses the given HL7 v2 element into an XDS simplified model object.
    static String
    rawRender(Hl7v2Based<?> xdsModelObject)
    Renders the given XDS model object as an HL7 v2 element without applying IHE TF rules regarding unwanted components.
    protected String
    Renders this XDS model object using the XDS-specific HL7 v2 renderer, i.e. with applying IHE TF rules regarding unwanted components.
    static String
    render(Hl7v2Based<?> xdsModelObject)
    Renders the given XDS model object as an HL7 v2 element according to the XDS specification, i.e. with applying IHE TF rules regarding unwanted components.
    protected static void
    setAssigningAuthority(AssigningAuthority assigningAuthority, ca.uhn.hl7v2.model.v25.datatype.HD target)
    Helper method used for copying data elements of an assigning authority.
    protected static void
    setValue(ca.uhn.hl7v2.model.Primitive p, Integer value)
     
    protected static void
    setValue(ca.uhn.hl7v2.model.Primitive p, String value)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MESSAGE

      protected static final ca.uhn.hl7v2.model.Message MESSAGE
  • Constructor Details

    • Hl7v2Based

      protected Hl7v2Based()
      Default constructor, for serialization purposes only.
    • Hl7v2Based

      protected Hl7v2Based(C hapiObject)
      Constructor.
      Parameters:
      hapiObject - HAPI composite object.
  • Method Details

    • parse

      public static <C extends ca.uhn.hl7v2.model.Composite, T extends Hl7v2Based<C>> T parse(String hl7String, Class<T> xdsModelClass)
      Parses the given HL7 v2 element into an XDS simplified model object.
      Type Parameters:
      C - class of HAPI composite object which should hold the HL7 element.
      T - class of XDS model object.
      Parameters:
      hl7String - HL7 v2 element as a String.
      xdsModelClass - class of the XDS model object to be generates.
      Returns:
      generated XDS model object or null when the given HL7 v2 element is null or empty.
    • render

      protected String render()
      Renders this XDS model object using the XDS-specific HL7 v2 renderer, i.e. with applying IHE TF rules regarding unwanted components.
      Returns:
      HL7 v2 representation of this XDS model object, may be an empty String.
    • render

      public static String render(Hl7v2Based<?> xdsModelObject)
      Renders the given XDS model object as an HL7 v2 element according to the XDS specification, i.e. with applying IHE TF rules regarding unwanted components.
      Parameters:
      xdsModelObject - XDS model object.
      Returns:
      HL7 v2 representation of the given object, or null when the given object is null or empty.
    • rawRender

      public static String rawRender(Hl7v2Based<?> xdsModelObject)
      Renders the given XDS model object as an HL7 v2 element without applying IHE TF rules regarding unwanted components.
      Parameters:
      xdsModelObject - XDS model object.
      Returns:
      HL7 v2 representation of the given object, or an empty string when the given object is null or empty.
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if this XDS model object does not contain any usable data.
    • getHapiObject

      public C getHapiObject()
      Returns:
      HAPI composite holding the HL7 v2 element which corresponds to this XDS model object.
    • setValue

      protected static void setValue(ca.uhn.hl7v2.model.Primitive p, String value)
    • setValue

      protected static void setValue(ca.uhn.hl7v2.model.Primitive p, Integer value)
    • getIntegerValue

      protected static Integer getIntegerValue(ca.uhn.hl7v2.model.Primitive p)
    • getLongValue

      protected static Long getLongValue(ca.uhn.hl7v2.model.Primitive p)
    • setAssigningAuthority

      protected static void setAssigningAuthority(AssigningAuthority assigningAuthority, ca.uhn.hl7v2.model.v25.datatype.HD target)
      Helper method used for copying data elements of an assigning authority.
      Parameters:
      assigningAuthority - source assigning authority.
      target - target HL7 v2 HD element.