org.eclipse.ohf.ihe.common.hl7v2.message
Class PixPdqMessageUtilities

java.lang.Object
  extended by org.eclipse.ohf.ihe.common.hl7v2.message.PixPdqMessageUtilities

public class PixPdqMessageUtilities
extends java.lang.Object


Constructor Summary
PixPdqMessageUtilities()
           
 
Method Summary
static java.lang.String getCurrentDateTimeString()
          Generate standard formatted date/time.
static java.lang.String[] getFieldComponents(org.eclipse.ohf.hl7v2.core.message.model.Segment seg, int fieldIndex)
          Generic call retrieving all components in a field.
static java.lang.String[] getFieldComponentsInRepeat(org.eclipse.ohf.hl7v2.core.message.model.Segment seg, int fieldIndex, int repeatIndex)
          Generic call retrieving all components in a field for a specified repeat.
static java.lang.String getHL7Field(org.eclipse.ohf.hl7v2.core.message.model.Field fld)
          Display field as HL7 "|" delimited string.
static java.lang.String getHL7Segment(org.eclipse.ohf.hl7v2.core.message.model.Segment seg)
          Display segment as HL7 "|" delimited string.
static java.lang.String getRandomFieldValue(int length)
          Generate random numbers for message object fields.
static int getRepeatCount(org.eclipse.ohf.hl7v2.core.message.model.Segment seg, int fieldIndex)
          Generic call retrieving the number of nonempty repeats in a field.
static boolean isHDParamValid(java.lang.String namespaceId, java.lang.String universalId, java.lang.String universalIdType)
          Test HD datatype input valid.
static java.lang.String msgToString(org.eclipse.ohf.hl7v2.core.message.model.Message msg)
          Write message object to verticalbar string.
static org.eclipse.ohf.hl7v2.core.message.model.Message stringToMsg(java.lang.String hl7)
          Write verticalbar string to message object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PixPdqMessageUtilities

public PixPdqMessageUtilities()
Method Detail

msgToString

public static java.lang.String msgToString(org.eclipse.ohf.hl7v2.core.message.model.Message msg)
                                    throws PixPdqMessageException
Write message object to verticalbar string.

Parameters:
msg -
Returns:
message data in verticalbar format string
Throws:
PixPdqMessageException

stringToMsg

public static org.eclipse.ohf.hl7v2.core.message.model.Message stringToMsg(java.lang.String hl7)
                                                                    throws PixPdqMessageException
Write verticalbar string to message object.

Parameters:
hl7 - - hl7v2 message
Returns:
Message
Throws:
PixPdqMessageException

getCurrentDateTimeString

public static java.lang.String getCurrentDateTimeString()
Generate standard formatted date/time.

Returns:
current date/time in YYYYMMDDHHMMSS.TZ

getRandomFieldValue

public static java.lang.String getRandomFieldValue(int length)
Generate random numbers for message object fields.

Parameters:
length -
Returns:
random numeric string

getHL7Segment

public static java.lang.String getHL7Segment(org.eclipse.ohf.hl7v2.core.message.model.Segment seg)
Display segment as HL7 "|" delimited string. Sample code returns the 1st MSH segment: Segment seg = msg.getSegments().getByCodeAndIndex("MSH", 1); String hl7 = ClientUtilities.getHL7Segment(seg);

Parameters:
seg -
Returns:
hl7 "|" delimited string

getHL7Field

public static java.lang.String getHL7Field(org.eclipse.ohf.hl7v2.core.message.model.Field fld)
Display field as HL7 "|" delimited string. Sample code returns the 3rd field (SendingApplication) in the 1st MSH segment: Field fld = msg.getSegments().getByCodeAndIndex("MSA", 1).forceField(2); String hl7 = ClientUtilities.getHL7Field(fld);

Parameters:
fld -
Returns:
hl7 "|" delimited string

getFieldComponents

public static java.lang.String[] getFieldComponents(org.eclipse.ohf.hl7v2.core.message.model.Segment seg,
                                                    int fieldIndex)
                                             throws PixPdqMessageException
Generic call retrieving all components in a field. If the field has repeats, returns primary repeat (index 0). Use getFieldComponentsInRepeat() instead to specify a particular repeat to return.

Parameters:
seg - - Segment (ex Segment seg = msg.getSegments().getByCodeAndIndex("MSH", 1))
fieldIndex - - int (ex 2 to access "MSH-3")
Returns:
String array with all components in field
Throws:
PixPdqMessageException

getRepeatCount

public static int getRepeatCount(org.eclipse.ohf.hl7v2.core.message.model.Segment seg,
                                 int fieldIndex)
                          throws PixPdqMessageException
Generic call retrieving the number of nonempty repeats in a field.

Parameters:
seg - - Segment (ex Segment seg = msg.getSegments().getByCodeAndIndex("MSH", 1))
fieldIndex - - int (ex 2 to access "MSH-3")
Returns:
String array with all components in field
Throws:
PixPdqMessageException

getFieldComponentsInRepeat

public static java.lang.String[] getFieldComponentsInRepeat(org.eclipse.ohf.hl7v2.core.message.model.Segment seg,
                                                            int fieldIndex,
                                                            int repeatIndex)
                                                     throws PixPdqMessageException
Generic call retrieving all components in a field for a specified repeat.

Parameters:
seg - - Segment (ex Segment seg = msg.getSegments().getByCodeAndIndex("MSH", 1))
fieldIndex -
repeatIndex -
Returns:
String
Throws:
PixPdqMessageException

isHDParamValid

public static boolean isHDParamValid(java.lang.String namespaceId,
                                     java.lang.String universalId,
                                     java.lang.String universalIdType)
Test HD datatype input valid.

Parameters:
namespaceId - (assigningAuthority > namespaceId)
universalId - (assigningAuthority > universalId)
universalIdType - (assigningAuthority > universalIdType)
Returns:
boolean