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 BHS message segment.
/// This segment has the following fields:<ol>
///<li>BHS-1: Batch Field Separator (ST)</li>
///<li>BHS-2: Batch Encoding Characters (ST)</li>
///<li>BHS-3: Batch Sending Application (HD)</li>
///<li>BHS-4: Batch Sending Facility (HD)</li>
///<li>BHS-5: Batch Receiving Application (HD)</li>
///<li>BHS-6: Batch Receiving Facility (HD)</li>
///<li>BHS-7: Batch Creation Date/Time (TS)</li>
///<li>BHS-8: Batch Security (ST)</li>
///<li>BHS-9: Batch Name/ID/Type (ST)</li>
///<li>BHS-10: Batch Comment (ST)</li>
///<li>BHS-11: Batch Control ID (ST)</li>
///<li>BHS-12: Reference Batch Control ID (ST)</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 BHS : AbstractSegment {
/**
* Creates a BHS (Batch Header) segment object that belongs to the given
* message.
*/
public BHS(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(ST), true, 1, 1, new System.Object[]{message}, "Batch Field Separator");
this.add(typeof(ST), true, 1, 3, new System.Object[]{message}, "Batch Encoding Characters");
this.add(typeof(HD), false, 1, 227, new System.Object[]{message}, "Batch Sending Application");
this.add(typeof(HD), false, 1, 227, new System.Object[]{message}, "Batch Sending Facility");
this.add(typeof(HD), false, 1, 227, new System.Object[]{message}, "Batch Receiving Application");
this.add(typeof(HD), false, 1, 227, new System.Object[]{message}, "Batch Receiving Facility");
this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "Batch Creation Date/Time");
this.add(typeof(ST), false, 1, 40, new System.Object[]{message}, "Batch Security");
this.add(typeof(ST), false, 1, 20, new System.Object[]{message}, "Batch Name/ID/Type");
this.add(typeof(ST), false, 1, 80, new System.Object[]{message}, "Batch Comment");
this.add(typeof(ST), false, 1, 20, new System.Object[]{message}, "Batch Control ID");
this.add(typeof(ST), false, 1, 20, new System.Object[]{message}, "Reference Batch Control ID");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns Batch Field Separator(BHS-1).
///</summary>
public ST BatchFieldSeparator
{
get{
ST ret = null;
try
{
IType t = this.GetField(1, 0);
ret = (ST)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 Batch Encoding Characters(BHS-2).
///</summary>
public ST BatchEncodingCharacters
{
get{
ST ret = null;
try
{
IType t = this.GetField(2, 0);
ret = (ST)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 Batch Sending Application(BHS-3).
///</summary>
public HD BatchSendingApplication
{
get{
HD ret = null;
try
{
IType t = this.GetField(3, 0);
ret = (HD)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 Batch Sending Facility(BHS-4).
///</summary>
public HD BatchSendingFacility
{
get{
HD ret = null;
try
{
IType t = this.GetField(4, 0);
ret = (HD)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 Batch Receiving Application(BHS-5).
///</summary>
public HD BatchReceivingApplication
{
get{
HD ret = null;
try
{
IType t = this.GetField(5, 0);
ret = (HD)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 Batch Receiving Facility(BHS-6).
///</summary>
public HD BatchReceivingFacility
{
get{
HD ret = null;
try
{
IType t = this.GetField(6, 0);
ret = (HD)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 Batch Creation Date/Time(BHS-7).
///</summary>
public TS BatchCreationDateTime
{
get{
TS ret = null;
try
{
IType t = this.GetField(7, 0);
ret = (TS)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 Batch Security(BHS-8).
///</summary>
public ST BatchSecurity
{
get{
ST ret = null;
try
{
IType t = this.GetField(8, 0);
ret = (ST)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 Batch Name/ID/Type(BHS-9).
///</summary>
public ST BatchNameIDType
{
get{
ST ret = null;
try
{
IType t = this.GetField(9, 0);
ret = (ST)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 Batch Comment(BHS-10).
///</summary>
public ST BatchComment
{
get{
ST ret = null;
try
{
IType t = this.GetField(10, 0);
ret = (ST)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 Batch Control ID(BHS-11).
///</summary>
public ST BatchControlID
{
get{
ST ret = null;
try
{
IType t = this.GetField(11, 0);
ret = (ST)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 Reference Batch Control ID(BHS-12).
///</summary>
public ST ReferenceBatchControlID
{
get{
ST ret = null;
try
{
IType t = this.GetField(12, 0);
ret = (ST)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;
}
}
}}
|