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 ADR_A19 message structure (see chapter 3.3.19). This structure contains the
/// following elements:
///<ol>
///<li>0: MSH (Message Header) </li>
///<li>1: SFT (Software Segment) optional repeating</li>
///<li>2: MSA (Message Acknowledgment) </li>
///<li>3: ERR (Error) optional </li>
///<li>4: QAK (Query Acknowledgment) optional </li>
///<li>5: QRD (Original-Style Query Definition) </li>
///<li>6: QRF (Original style query filter) optional </li>
///<li>7: ADR_A19_QUERY_RESPONSE (a Group object) repeating</li>
///<li>8: DSC (Continuation Pointer) optional </li>
///</ol>
///</summary>
[Serializable]
public class ADR_A19 : AbstractMessage {
///<summary>
/// Creates a new ADR_A19 Group with custom IModelClassFactory.
///</summary>
public ADR_A19(IModelClassFactory factory) : base(factory){
init(factory);
}
///<summary>
/// Creates a new ADR_A19 Group with DefaultModelClassFactory.
///</summary>
public ADR_A19() : base(new DefaultModelClassFactory()) {
init(new DefaultModelClassFactory());
}
///<summary>
/// initalize method for ADR_A19. This does the segment setup for the message.
///</summary>
private void init(IModelClassFactory factory) {
try {
this.add(typeof(MSH), true, false);
this.add(typeof(SFT), false, true);
this.add(typeof(MSA), true, false);
this.add(typeof(ERR), false, false);
this.add(typeof(QAK), false, false);
this.add(typeof(QRD), true, false);
this.add(typeof(QRF), false, false);
this.add(typeof(ADR_A19_QUERY_RESPONSE), true, true);
this.add(typeof(DSC), false, false);
} catch(HL7Exception e) {
HapiLogFactory.getHapiLog(GetType()).error("Unexpected error creating ADR_A19 - 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 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 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 ERR (Error) - creates it if necessary
///</summary>
public ERR ERR {
get{
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 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 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;
}
}
///<summary>
/// Returns first repetition of ADR_A19_QUERY_RESPONSE (a Group object) - creates it if necessary
///</summary>
public ADR_A19_QUERY_RESPONSE GetQUERY_RESPONSE() {
ADR_A19_QUERY_RESPONSE ret = null;
try {
ret = (ADR_A19_QUERY_RESPONSE)this.GetStructure("QUERY_RESPONSE");
} 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 ADR_A19_QUERY_RESPONSE
/// * (a Group object) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public ADR_A19_QUERY_RESPONSE GetQUERY_RESPONSE(int rep) {
return (ADR_A19_QUERY_RESPONSE)this.GetStructure("QUERY_RESPONSE", rep);
}
/**
* Returns the number of existing repetitions of ADR_A19_QUERY_RESPONSE
*/
public int QUERY_RESPONSERepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("QUERY_RESPONSE").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 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;
}
}
}
}
|