using System;
using NHapi.Base;
using NHapi.Base.Parser;
using NHapi.Base.Model;
using NHapi.Model.V251.Datatype;
using NHapi.Base.Log;
namespace NHapi.Model.V251.Segment{
///<summary>
/// Represents an HL7 LRL message segment.
/// This segment has the following fields:<ol>
///<li>LRL-1: Primary Key Value - LRL (PL)</li>
///<li>LRL-2: Segment Action Code (ID)</li>
///<li>LRL-3: Segment Unique Key (EI)</li>
///<li>LRL-4: Location Relationship ID (CE)</li>
///<li>LRL-5: Organizational Location Relationship Value (XON)</li>
///<li>LRL-6: Patient Location Relationship Value (PL)</li>
///</ol>
/// The get...() methods return data from individual fields. These methods
/// do not throw exceptions and may therefore have to handle exceptions internally.
/// If an exception is handled internally, it is logged and null is returned.
/// This is not expected to happen - if it does happen this indicates not so much
/// an exceptional circumstance as a bug in the code for this class.
///</summary>
[Serializable]
public class LRL : AbstractSegment {
/**
* Creates a LRL (Location Relationship) segment object that belongs to the given
* message.
*/
public LRL(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(PL), true, 1, 200, new System.Object[]{message}, "Primary Key Value - LRL");
this.add(typeof(ID), false, 1, 3, new System.Object[]{message, 206}, "Segment Action Code");
this.add(typeof(EI), false, 1, 80, new System.Object[]{message}, "Segment Unique Key");
this.add(typeof(CE), true, 1, 250, new System.Object[]{message}, "Location Relationship ID");
this.add(typeof(XON), false, 0, 250, new System.Object[]{message}, "Organizational Location Relationship Value");
this.add(typeof(PL), false, 1, 80, new System.Object[]{message}, "Patient Location Relationship Value");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns Primary Key Value - LRL(LRL-1).
///</summary>
public PL PrimaryKeyValueLRL
{
get{
PL ret = null;
try
{
IType t = this.GetField(1, 0);
ret = (PL)t;
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
}
///<summary>
/// Returns Segment Action Code(LRL-2).
///</summary>
public ID SegmentActionCode
{
get{
ID ret = null;
try
{
IType t = this.GetField(2, 0);
ret = (ID)t;
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
}
///<summary>
/// Returns Segment Unique Key(LRL-3).
///</summary>
public EI SegmentUniqueKey
{
get{
EI ret = null;
try
{
IType t = this.GetField(3, 0);
ret = (EI)t;
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
}
///<summary>
/// Returns Location Relationship ID(LRL-4).
///</summary>
public CE LocationRelationshipID
{
get{
CE ret = null;
try
{
IType t = this.GetField(4, 0);
ret = (CE)t;
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
}
///<summary>
/// Returns a single repetition of Organizational Location Relationship Value(LRL-5).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public XON GetOrganizationalLocationRelationshipValue(int rep)
{
XON ret = null;
try
{
IType t = this.GetField(5, rep);
ret = (XON)t;
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
///<summary>
/// Returns all repetitions of Organizational Location Relationship Value (LRL-5).
///</summary>
public XON[] GetOrganizationalLocationRelationshipValue() {
XON[] ret = null;
try {
IType[] t = this.GetField(5);
ret = new XON[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (XON)t[i];
}
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception cce) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new System.Exception("An unexpected error ocurred", cce);
}
return ret;
}
///<summary>
/// Returns the total repetitions of Organizational Location Relationship Value (LRL-5).
///</summary>
public int OrganizationalLocationRelationshipValueRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(5);
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(this.GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception cce) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", cce);
throw new System.Exception("An unexpected error ocurred", cce);
}
}
}
///<summary>
/// Returns Patient Location Relationship Value(LRL-6).
///</summary>
public PL PatientLocationRelationshipValue
{
get{
PL ret = null;
try
{
IType t = this.GetField(6, 0);
ret = (PL)t;
}
catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", he);
throw new System.Exception("An unexpected error ocurred", he);
} catch (System.Exception ex) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex);
throw new System.Exception("An unexpected error ocurred", ex);
}
return ret;
}
}
}}
|