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 ERR message segment.
/// This segment has the following fields:<ol>
///<li>ERR-1: Error Code and Location (ELD)</li>
///<li>ERR-2: Error Location (ERL)</li>
///<li>ERR-3: HL7 Error Code (CWE)</li>
///<li>ERR-4: Severity (ID)</li>
///<li>ERR-5: Application Error Code (CWE)</li>
///<li>ERR-6: Application Error Parameter (ST)</li>
///<li>ERR-7: Diagnostic Information (TX)</li>
///<li>ERR-8: User Message (TX)</li>
///<li>ERR-9: Inform Person Indicator (IS)</li>
///<li>ERR-10: Override Type (CWE)</li>
///<li>ERR-11: Override Reason Code (CWE)</li>
///<li>ERR-12: Help Desk Contact Point (XTN)</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 ERR : AbstractSegment {
/**
* Creates a ERR (Error) segment object that belongs to the given
* message.
*/
public ERR(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(ELD), false, 0, 493, new System.Object[]{message}, "Error Code and Location");
this.add(typeof(ERL), false, 0, 18, new System.Object[]{message}, "Error Location");
this.add(typeof(CWE), true, 1, 705, new System.Object[]{message}, "HL7 Error Code");
this.add(typeof(ID), true, 1, 2, new System.Object[]{message, 516}, "Severity");
this.add(typeof(CWE), false, 1, 705, new System.Object[]{message}, "Application Error Code");
this.add(typeof(ST), false, 10, 80, new System.Object[]{message}, "Application Error Parameter");
this.add(typeof(TX), false, 1, 2048, new System.Object[]{message}, "Diagnostic Information");
this.add(typeof(TX), false, 1, 250, new System.Object[]{message}, "User Message");
this.add(typeof(IS), false, 0, 20, new System.Object[]{message, 517}, "Inform Person Indicator");
this.add(typeof(CWE), false, 1, 705, new System.Object[]{message}, "Override Type");
this.add(typeof(CWE), false, 0, 705, new System.Object[]{message}, "Override Reason Code");
this.add(typeof(XTN), false, 0, 652, new System.Object[]{message}, "Help Desk Contact Point");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns a single repetition of Error Code and Location(ERR-1).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public ELD GetErrorCodeAndLocation(int rep)
{
ELD ret = null;
try
{
IType t = this.GetField(1, rep);
ret = (ELD)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 Error Code and Location (ERR-1).
///</summary>
public ELD[] GetErrorCodeAndLocation() {
ELD[] ret = null;
try {
IType[] t = this.GetField(1);
ret = new ELD[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (ELD)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 Error Code and Location (ERR-1).
///</summary>
public int ErrorCodeAndLocationRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(1);
}
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 a single repetition of Error Location(ERR-2).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public ERL GetErrorLocation(int rep)
{
ERL ret = null;
try
{
IType t = this.GetField(2, rep);
ret = (ERL)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 Error Location (ERR-2).
///</summary>
public ERL[] GetErrorLocation() {
ERL[] ret = null;
try {
IType[] t = this.GetField(2);
ret = new ERL[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (ERL)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 Error Location (ERR-2).
///</summary>
public int ErrorLocationRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(2);
}
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 HL7 Error Code(ERR-3).
///</summary>
public CWE HL7ErrorCode
{
get{
CWE ret = null;
try
{
IType t = this.GetField(3, 0);
ret = (CWE)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 Severity(ERR-4).
///</summary>
public ID Severity
{
get{
ID ret = null;
try
{
IType t = this.GetField(4, 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 Application Error Code(ERR-5).
///</summary>
public CWE ApplicationErrorCode
{
get{
CWE ret = null;
try
{
IType t = this.GetField(5, 0);
ret = (CWE)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 Application Error Parameter(ERR-6).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public ST GetApplicationErrorParameter(int rep)
{
ST ret = null;
try
{
IType t = this.GetField(6, rep);
ret = (ST)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 Application Error Parameter (ERR-6).
///</summary>
public ST[] GetApplicationErrorParameter() {
ST[] ret = null;
try {
IType[] t = this.GetField(6);
ret = new ST[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (ST)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 Application Error Parameter (ERR-6).
///</summary>
public int ApplicationErrorParameterRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(6);
}
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 Diagnostic Information(ERR-7).
///</summary>
public TX DiagnosticInformation
{
get{
TX ret = null;
try
{
IType t = this.GetField(7, 0);
ret = (TX)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 User Message(ERR-8).
///</summary>
public TX UserMessage
{
get{
TX ret = null;
try
{
IType t = this.GetField(8, 0);
ret = (TX)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 Inform Person Indicator(ERR-9).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public IS GetInformPersonIndicator(int rep)
{
IS ret = null;
try
{
IType t = this.GetField(9, rep);
ret = (IS)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 Inform Person Indicator (ERR-9).
///</summary>
public IS[] GetInformPersonIndicator() {
IS[] ret = null;
try {
IType[] t = this.GetField(9);
ret = new IS[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (IS)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 Inform Person Indicator (ERR-9).
///</summary>
public int InformPersonIndicatorRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(9);
}
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 Override Type(ERR-10).
///</summary>
public CWE OverrideType
{
get{
CWE ret = null;
try
{
IType t = this.GetField(10, 0);
ret = (CWE)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 Override Reason Code(ERR-11).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public CWE GetOverrideReasonCode(int rep)
{
CWE ret = null;
try
{
IType t = this.GetField(11, rep);
ret = (CWE)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 Override Reason Code (ERR-11).
///</summary>
public CWE[] GetOverrideReasonCode() {
CWE[] ret = null;
try {
IType[] t = this.GetField(11);
ret = new CWE[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (CWE)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 Override Reason Code (ERR-11).
///</summary>
public int OverrideReasonCodeRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(11);
}
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 a single repetition of Help Desk Contact Point(ERR-12).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public XTN GetHelpDeskContactPoint(int rep)
{
XTN ret = null;
try
{
IType t = this.GetField(12, rep);
ret = (XTN)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 Help Desk Contact Point (ERR-12).
///</summary>
public XTN[] GetHelpDeskContactPoint() {
XTN[] ret = null;
try {
IType[] t = this.GetField(12);
ret = new XTN[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (XTN)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 Help Desk Contact Point (ERR-12).
///</summary>
public int HelpDeskContactPointRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(12);
}
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);
}
}
}
}}
|