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 QRY message structure (see chapter 9.8.1). This structure contains the
/// following elements:
///<ol>
///<li>0: MSH (Message Header) </li>
///<li>1: QRD (Original-Style Query Definition) </li>
///<li>2: QRF (Original style query filter) optional </li>
///</ol>
///</summary>
[Serializable]
public class QRY : AbstractMessage {
///<summary>
/// Creates a new QRY Group with custom IModelClassFactory.
///</summary>
public QRY(IModelClassFactory factory) : base(factory){
init(factory);
}
///<summary>
/// Creates a new QRY Group with DefaultModelClassFactory.
///</summary>
public QRY() : base(new DefaultModelClassFactory()) {
init(new DefaultModelClassFactory());
}
///<summary>
/// initalize method for QRY. This does the segment setup for the message.
///</summary>
private void init(IModelClassFactory factory) {
try {
this.add(typeof(MSH), true, false);
this.add(typeof(QRD), true, false);
this.add(typeof(QRF), false, false);
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error creating QRY - 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 QRD (Original-Style Query Definition) - creates it if necessary
///</summary>
public QRD QRD {
get{
QRD ret = null;
try {
ret = (QRD)this.GetStructure("QRD");
} 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 QRF (Original style query filter) - creates it if necessary
///</summary>
public QRF QRF {
get{
QRF ret = null;
try {
ret = (QRF)this.GetStructure("QRF");
} 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;
}
}
}
}
|