using System;
using NHapi.Base.Log;
using NHapi.Model.V251.Group;
using NHapi.Model.V251.Segment;
using NHapi.Base;
using NHapi.Base.Parser;
using NHapi.Base.Model;
namespace NHapi.Model.V251.Message{
///<summary>
/// Represents a RTB_Z74 message structure (see chapter 4.6.2). This structure contains the
/// following elements:
///<ol>
///<li>0: MSH (Message Header) </li>
///<li>1: MSA (Message Acknowledgment) </li>
///<li>2: ERR (Error) optional repeating</li>
///<li>3: SFT (Software Segment) optional repeating</li>
///<li>4: QAK (Query Acknowledgment) </li>
///<li>5: QPD (Query Parameter Definition) </li>
///<li>6: RTB_Z74_ROW_DEFINITION (a Group object) optional </li>
///<li>7: DSC (Continuation Pointer) optional </li>
///</ol>
///</summary>
[Serializable]
public class RTB_Z74 : AbstractMessage {
///<summary>
/// Creates a new RTB_Z74 Group with custom IModelClassFactory.
///</summary>
public RTB_Z74(IModelClassFactory factory) : base(factory){
init(factory);
}
///<summary>
/// Creates a new RTB_Z74 Group with DefaultModelClassFactory.
///</summary>
public RTB_Z74() : base(new DefaultModelClassFactory()) {
init(new DefaultModelClassFactory());
}
///<summary>
/// initalize method for RTB_Z74. This does the segment setup for the message.
///</summary>
private void init(IModelClassFactory factory) {
try {
this.add(typeof(MSH), true, false);
this.add(typeof(MSA), true, false);
this.add(typeof(ERR), false, true);
this.add(typeof(SFT), false, true);
this.add(typeof(QAK), true, false);
this.add(typeof(QPD), true, false);
this.add(typeof(RTB_Z74_ROW_DEFINITION), false, false);
this.add(typeof(DSC), false, false);
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error creating RTB_Z74 - this is probably a bug in the source code generator.", e);
}
}
///<summary>
/// Returns MSH (Message Header) - creates it if necessary
///</summary>
public MSH MSH {
get{
MSH ret = null;
try {
ret = (MSH)this.GetStructure("MSH");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns MSA (Message Acknowledgment) - creates it if necessary
///</summary>
public MSA MSA {
get{
MSA ret = null;
try {
ret = (MSA)this.GetStructure("MSA");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns first repetition of ERR (Error) - creates it if necessary
///</summary>
public ERR GetERR() {
ERR ret = null;
try {
ret = (ERR)this.GetStructure("ERR");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of ERR
/// * (Error) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public ERR GetERR(int rep) {
return (ERR)this.GetStructure("ERR", rep);
}
/**
* Returns the number of existing repetitions of ERR
*/
public int ERRRepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("ERR").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.getHapiLog(GetType()).error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
///<summary>
/// Returns first repetition of SFT (Software Segment) - creates it if necessary
///</summary>
public SFT GetSFT() {
SFT ret = null;
try {
ret = (SFT)this.GetStructure("SFT");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of SFT
/// * (Software Segment) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public SFT GetSFT(int rep) {
return (SFT)this.GetStructure("SFT", rep);
}
/**
* Returns the number of existing repetitions of SFT
*/
public int SFTRepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("SFT").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.getHapiLog(GetType()).error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
///<summary>
/// Returns QAK (Query Acknowledgment) - creates it if necessary
///</summary>
public QAK QAK {
get{
QAK ret = null;
try {
ret = (QAK)this.GetStructure("QAK");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns QPD (Query Parameter Definition) - creates it if necessary
///</summary>
public QPD QPD {
get{
QPD ret = null;
try {
ret = (QPD)this.GetStructure("QPD");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns RTB_Z74_ROW_DEFINITION (a Group object) - creates it if necessary
///</summary>
public RTB_Z74_ROW_DEFINITION ROW_DEFINITION {
get{
RTB_Z74_ROW_DEFINITION ret = null;
try {
ret = (RTB_Z74_ROW_DEFINITION)this.GetStructure("ROW_DEFINITION");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns DSC (Continuation Pointer) - creates it if necessary
///</summary>
public DSC DSC {
get{
DSC ret = null;
try {
ret = (DSC)this.GetStructure("DSC");
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
}
}
|