Class Hl7v2Based<C extends 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 Composite> extends Object implements Serializable
An XDS model object backed up by an HL7 v2 element.
Author:
Dmytro Rud
See Also:
  • Field Details

    • MESSAGE

      protected static final 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 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(Primitive p, String value)
    • setValue

      protected static void setValue(Primitive p, Integer value)
    • getIntegerValue

      protected static Integer getIntegerValue(Primitive p)
    • getLongValue

      protected static Long getLongValue(Primitive p)
    • setAssigningAuthority

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