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:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Hl7v2Based()
Default constructor, for serialization purposes only.protected
Hl7v2Based(C hapiObject)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description C
getHapiObject()
protected static Integer
getIntegerValue(Primitive p)
protected static Long
getLongValue(Primitive p)
boolean
isEmpty()
static <C extends Composite,T extends Hl7v2Based<C>>
Tparse(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
render()
Renders this XDS model object using the XDS-specificHL7 v2 renderer
, i.e.static String
render(Hl7v2Based xdsModelObject)
Renders the given XDS model object as an HL7 v2 element according to the XDS specification, i.e.protected static void
setAssigningAuthority(AssigningAuthority assigningAuthority, HD target)
Helper method used for copying data elements of an assigning authority.protected static void
setValue(Primitive p, Integer value)
protected static void
setValue(Primitive p, String value)
-
-
-
Field Detail
-
MESSAGE
protected static final Message MESSAGE
-
-
Constructor Detail
-
Hl7v2Based
protected Hl7v2Based()
Default constructor, for serialization purposes only.
-
Hl7v2Based
protected Hl7v2Based(C hapiObject)
Constructor.- Parameters:
hapiObject
- HAPI composite object.
-
-
Method Detail
-
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 isnull
or empty.
-
render
protected String render()
Renders this XDS model object using the XDS-specificHL7 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 isnull
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.
-
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.
-
-