Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.vmdb.hl7
Class HL7Segment  view HL7Segment download HL7Segment.java

java.lang.Object
  extended byorg.vmdb.hl7.HL7Object
      extended byorg.vmdb.hl7.HL7Segment
Direct Known Subclasses:
CTDSegment, CTISegment, DSCSegment, ERRSegment, FT1Segment, MSASegment, MSHSegment, NK1Segment, NTESegment, OBRSegment, OBXSegment, ORCSegment, PD1Segment, PIDSegment, PV1Segment, PV2Segment, QAKSegment, QPDSegment, RCPSegment

public class HL7Segment
extends HL7Object

Base Class for All Types of HL7 Segments.

Description: HL7 Network Connectivity For VMDB.

Copyright: Copyright (c) 2002-2003.

Company: M&M Informatics.

A segment is a collection of related fields whose positions are specified in the segment rule. The primary function of the base class is to handle the complex processes of parsing and building segments from and to HL7 and XML. Each derived class provides a rule. The base class passes that rule to a RuleParser object which acts as a director with calls back to this object to read the input string, add fields, etc..

The base segment class also provides the mechanics for accessing fields by position based upon an index. Most of the class is made up of a huge variety of methods for getting, setting, and listing fields. These are normally intended to be used by derived classes to implement named accessor methods. In most cases, an application should use these higher-level set, get, and list methods that provide more segment and message specific access. The base getField() and setField() methods are made public to provide the ability to extend messages to any of the infinite possible variations allowed under HL7.

Version:
1.0

Field Summary
protected  int iMaxFields
           
protected  HL7SegmentContainer msgParent
           
protected  StringList slFields
           
protected  java.lang.String sNextField
           
private  java.lang.String sNm
           
private  java.lang.String sRl
           
protected  java.util.Vector vFields
           
 
Fields inherited from class org.vmdb.hl7.HL7Object
COMP_SEP, ESC_SEP, FIELD_SEP, REP_SEP, sName, sRule, sSeparators, SUB_SEP
 
Constructor Summary
protected HL7Segment()
           
  HL7Segment(HL7SegmentContainer msgParent)
          Construct a segment as part of a specific message or loop.
 
Method Summary
protected  void addEmptyFields(int iFieldNo)
           
protected  boolean addField(HL7Element fField)
           
(package private)  void addField(java.lang.String sFieldName, java.lang.String sFieldType, boolean bRepeatable)
          Add a new field in the specified name and type, at the specified location.
This is only to be called by the rule parser object acting as director to add a field of the correct type and name based on the rule string.
 void clearField(int iFieldNo)
          Clear the value in the specified field and remove any components and subcomponents.
(package private) static HL7Segment fromString(java.lang.String sSegment, HL7SegmentContainer msgParent)
          Factory method to read an HL7 segment as a delimited string and produce a segment object of appropriate subclass.
 HL7Element getField(int iFieldNo)
          Get Field in Segment by position as named in HL7, i.e., 1 based index (zero is the segment name).

If this is a repeating field, returns the first value.
 java.lang.String getFieldValue(int iFieldNo)
          Get Field Value in Segment by position as named in HL7, i.e., 1 based index.
(package private)  void initialize()
           
 java.util.Iterator iterator()
          Get an Iterator over the HL7Element derived objects that make up this segment.
 java.util.Iterator listFields(int iFieldNo)
          Get Iterator over all instances of a repeatable Field in Segment by position as named in HL7, i.e., 1 based index (zero is the segment name).

(package private)  boolean processField(java.lang.String sField, java.lang.String sType, boolean bRepeatable)
          Add a new field in the specified name and type, at the specified location with the data read from the input data stream.
This is only to be called by the rule parser object acting as director to add a field of the correct type and name based on the rule string.
(package private)  boolean readString(java.lang.String sSegment)
           
(package private)  boolean segmentComplete()
           
 void setField(HL7Element eField, int iFieldNo)
          Set the field at position specified to the HL7Element derived object provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors.
 void setField(HL7Element eField, int iFieldNo, boolean bAdd)
          Set the field at position specified to the HL7Element derived object provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors.
 void setField(HL7Element eField, java.lang.String sFieldName)
          Set the field at position specified to the HL7Element derived object provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors.
 void setField(HL7Element eField, java.lang.String sFieldName, boolean bRepeatable)
          Set the field at position specified to the HL7Element derived object provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors.
 void setField(java.lang.String sValue, int iFieldNo)
          Set the field at position specified to a SimpleElement with the value provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors.
 void setField(java.lang.String sValue, int iFieldNo, boolean bAdd)
          Set the field at position specified to a SimpleElement with the value provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors.
 void setField(java.lang.String sField, java.lang.String sFieldName)
          Set the field at position specified to a SimpleElement with the value provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors.
protected  void setParent(HL7SegmentContainer msgParent)
           
 java.lang.String toString()
          Output this segment as an HL7 String.
 java.lang.String toXML(int iDepth)
          Output the this segment as XML.

Output is the DOM element for that segment and all its contained objects.
 
Methods inherited from class org.vmdb.hl7.HL7Object
getName, getRule, getSeparator, getSeparators, setName, setRule, setSeparators
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

vFields

protected java.util.Vector vFields

iMaxFields

protected int iMaxFields

msgParent

protected HL7SegmentContainer msgParent

sNextField

protected java.lang.String sNextField

slFields

protected StringList slFields

sNm

private java.lang.String sNm

sRl

private java.lang.String sRl
Constructor Detail

HL7Segment

protected HL7Segment()

HL7Segment

public HL7Segment(HL7SegmentContainer msgParent)
Construct a segment as part of a specific message or loop.

Method Detail

setParent

protected void setParent(HL7SegmentContainer msgParent)

addField

protected boolean addField(HL7Element fField)

iterator

public java.util.Iterator iterator()
Get an Iterator over the HL7Element derived objects that make up this segment.


fromString

static HL7Segment fromString(java.lang.String sSegment,
                             HL7SegmentContainer msgParent)
Factory method to read an HL7 segment as a delimited string and produce a segment object of appropriate subclass.


readString

boolean readString(java.lang.String sSegment)

initialize

void initialize()

addEmptyFields

protected void addEmptyFields(int iFieldNo)

toString

public java.lang.String toString()
Output this segment as an HL7 String.


toXML

public java.lang.String toXML(int iDepth)
Output the this segment as XML.

Output is the DOM element for that segment and all its contained objects.

Overrides:
toXML in class HL7Object

segmentComplete

boolean segmentComplete()

addField

void addField(java.lang.String sFieldName,
              java.lang.String sFieldType,
              boolean bRepeatable)
Add a new field in the specified name and type, at the specified location.
This is only to be called by the rule parser object acting as director to add a field of the correct type and name based on the rule string. Lacking a "friend" access permission setting, this is restricted to package access.


processField

boolean processField(java.lang.String sField,
                     java.lang.String sType,
                     boolean bRepeatable)
               throws MalformedFieldException,
                      MalformedSegmentException
Add a new field in the specified name and type, at the specified location with the data read from the input data stream.
This is only to be called by the rule parser object acting as director to add a field of the correct type and name based on the rule string. Lacking a "friend" access permission setting, this is restricted to package access.


setField

public void setField(HL7Element eField,
                     java.lang.String sFieldName,
                     boolean bRepeatable)
              throws java.lang.NumberFormatException,
                     java.lang.ArrayIndexOutOfBoundsException,
                     MalformedSegmentException
Set the field at position specified to the HL7Element derived object provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors. Based on HL7 field number i.e., 1 based index.


setField

public void setField(HL7Element eField,
                     java.lang.String sFieldName)
              throws java.lang.NumberFormatException,
                     java.lang.ArrayIndexOutOfBoundsException,
                     MalformedSegmentException
Set the field at position specified to the HL7Element derived object provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors. Based on HL7 field number i.e., 1 based index.


setField

public void setField(java.lang.String sField,
                     java.lang.String sFieldName)
              throws java.lang.NumberFormatException,
                     java.lang.ArrayIndexOutOfBoundsException,
                     MalformedSegmentException
Set the field at position specified to a SimpleElement with the value provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors. Based on HL7 field number i.e., 1 based index.


setField

public void setField(HL7Element eField,
                     int iFieldNo,
                     boolean bAdd)
              throws java.lang.ArrayIndexOutOfBoundsException,
                     MalformedSegmentException
Set the field at position specified to the HL7Element derived object provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors. Based on HL7 field number i.e., 1 based index.


setField

public void setField(HL7Element eField,
                     int iFieldNo)
              throws java.lang.ArrayIndexOutOfBoundsException,
                     MalformedSegmentException
Set the field at position specified to the HL7Element derived object provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors. Based on HL7 field number i.e., 1 based index.


setField

public void setField(java.lang.String sValue,
                     int iFieldNo,
                     boolean bAdd)
              throws java.lang.ArrayIndexOutOfBoundsException,
                     MalformedSegmentException
Set the field at position specified to a SimpleElement with the value provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors. Based on HL7 field number i.e., 1 based index.


setField

public void setField(java.lang.String sValue,
                     int iFieldNo)
              throws java.lang.ArrayIndexOutOfBoundsException
Set the field at position specified to a SimpleElement with the value provided.

The following allow set and get by position and will be used by named segment subclasses for their setters and accessors. Based on HL7 field number i.e., 1 based index.


clearField

public void clearField(int iFieldNo)
                throws java.lang.ArrayIndexOutOfBoundsException
Clear the value in the specified field and remove any components and subcomponents.


getField

public HL7Element getField(int iFieldNo)
                    throws java.lang.ArrayIndexOutOfBoundsException
Get Field in Segment by position as named in HL7, i.e., 1 based index (zero is the segment name).

If this is a repeating field, returns the first value.


listFields

public java.util.Iterator listFields(int iFieldNo)
                              throws java.lang.ArrayIndexOutOfBoundsException
Get Iterator over all instances of a repeatable Field in Segment by position as named in HL7, i.e., 1 based index (zero is the segment name).


getFieldValue

public java.lang.String getFieldValue(int iFieldNo)
                               throws java.lang.ArrayIndexOutOfBoundsException
Get Field Value in Segment by position as named in HL7, i.e., 1 based index.