ca.uhn.hl7v2.model
Interface Group

All Superinterfaces:
java.io.Serializable, Structure
All Known Subinterfaces:
Message
All Known Implementing Classes:
AbstractGroup, AbstractMessage, GenericGroup, GenericMessage, GenericMessage.UnknownVersion, GenericMessage.V21, GenericMessage.V22, GenericMessage.V23, GenericMessage.V231, GenericMessage.V24, GenericMessage.V25, GenericMessage.V251, GenericMessage.V26

public interface Group
extends Structure

An abstraction representing >1 message parts which may repeated together. An implementation of Group should enforce contraints about on the contents of the group and throw an exception if an attempt is made to add a Structure that the Group instance does not recognize.

Author:
Bryan Tripp (bryan_tripp@sourceforge.net)

Method Summary
 java.lang.String addNonstandardSegment(java.lang.String name)
          Expands the group definition to include a segment that is not defined by HL7 to be part of this group (eg an unregistered Z segment).
 java.lang.String addNonstandardSegment(java.lang.String name, int theIndex)
          Expands the group definition to include a segment that is not defined by HL7 to be part of this group (eg an unregistered Z segment).
 Structure get(java.lang.String name)
          Returns the named structure.
 Structure get(java.lang.String name, int rep)
          Returns a particular repetition of the named Structure.
 Structure[] getAll(java.lang.String name)
          Returns an array of Structure objects by name.
 java.lang.Class getClass(java.lang.String name)
          Returns the Class of the Structure at the given name index.
 java.lang.String[] getNames()
          Returns an ordered array of the names of the Structures in this Group.
 boolean isRepeating(java.lang.String name)
          Returns true if the named structure is repeating.
 boolean isRequired(java.lang.String name)
          Returns true if the named structure is required.
 
Methods inherited from interface ca.uhn.hl7v2.model.Structure
getMessage, getName, getParent
 

Method Detail

getAll

Structure[] getAll(java.lang.String name)
                   throws HL7Exception
Returns an array of Structure objects by name. For example, if the Group contains an MSH segment and "MSH" is supplied then this call would return a 1-element array containing the MSH segment. Multiple elements are returned when the segment or group repeats. The array may be empty if no repetitions have been accessed yet using the get(...) methods.

Throws:
HL7Exception - if the named Structure is not part of this Group.

get

Structure get(java.lang.String name)
              throws HL7Exception
Returns the named structure. If this Structure is repeating then the first repetition is returned. Creates the Structure if necessary.

Throws:
HL7Exception - if the named Structure is not part of this Group.

get

Structure get(java.lang.String name,
              int rep)
              throws HL7Exception
Returns a particular repetition of the named Structure. If the given repetition number is one greater than the existing number of repetitions then a new Structure is created.

Throws:
HL7Exception - if the named Structure is not part of this group, if the structure is not repeatable and the given rep is > 0, or if the given repetition number is more than one greater than the existing number of repetitions.

isRequired

boolean isRequired(java.lang.String name)
                   throws HL7Exception
Returns true if the named structure is required.

Throws:
HL7Exception

isRepeating

boolean isRepeating(java.lang.String name)
                    throws HL7Exception
Returns true if the named structure is repeating.

Throws:
HL7Exception

getNames

java.lang.String[] getNames()
Returns an ordered array of the names of the Structures in this Group. These names can be used to iterate through the group using repeated calls to get(name).


getClass

java.lang.Class getClass(java.lang.String name)
Returns the Class of the Structure at the given name index.


addNonstandardSegment

java.lang.String addNonstandardSegment(java.lang.String name)
                                       throws HL7Exception
Expands the group definition to include a segment that is not defined by HL7 to be part of this group (eg an unregistered Z segment). The new segment is slotted at the end of the group. Thenceforward if such a segment is encountered it will be parsed into this location. If the segment name is unrecognized a GenericSegment is used. The segment is defined as repeating and not required.

Throws:
HL7Exception

addNonstandardSegment

java.lang.String addNonstandardSegment(java.lang.String name,
                                       int theIndex)
                                       throws HL7Exception
Expands the group definition to include a segment that is not defined by HL7 to be part of this group (eg an unregistered Z segment).

Parameters:
The - index (zero-indexed) at which to insert this segment
Throws:
HL7Exception


Copyright © 2001-2011 University Health Network. All Rights Reserved.