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 RCP message segment.
/// This segment has the following fields:<ol>
///<li>RCP-1: Query Priority (ID)</li>
///<li>RCP-2: Quantity Limited Request (CQ)</li>
///<li>RCP-3: Response Modality (CE)</li>
///<li>RCP-4: Execution and Delivery Time (TS)</li>
///<li>RCP-5: Modify Indicator (ID)</li>
///<li>RCP-6: Sort-by Field (SRT)</li>
///<li>RCP-7: Segment group inclusion (ID)</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 RCP : AbstractSegment {
/**
* Creates a RCP (Response Control Parameter) segment object that belongs to the given
* message.
*/
public RCP(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(ID), false, 1, 1, new System.Object[]{message, 91}, "Query Priority");
this.add(typeof(CQ), false, 1, 10, new System.Object[]{message}, "Quantity Limited Request");
this.add(typeof(CE), false, 1, 250, new System.Object[]{message}, "Response Modality");
this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "Execution and Delivery Time");
this.add(typeof(ID), false, 1, 1, new System.Object[]{message, 395}, "Modify Indicator");
this.add(typeof(SRT), false, 0, 512, new System.Object[]{message}, "Sort-by Field");
this.add(typeof(ID), false, 0, 256, new System.Object[]{message, 0}, "Segment group inclusion");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns Query Priority(RCP-1).
///</summary>
public ID QueryPriority
{
get{
ID ret = null;
try
{
IType t = this.GetField(1, 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 Quantity Limited Request(RCP-2).
///</summary>
public CQ QuantityLimitedRequest
{
get{
CQ ret = null;
try
{
IType t = this.GetField(2, 0);
ret = (CQ)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 Response Modality(RCP-3).
///</summary>
public CE ResponseModality
{
get{
CE ret = null;
try
{
IType t = this.GetField(3, 0);
ret = (CE)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 Execution and Delivery Time(RCP-4).
///</summary>
public TS ExecutionAndDeliveryTime
{
get{
TS ret = null;
try
{
IType t = this.GetField(4, 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 Modify Indicator(RCP-5).
///</summary>
public ID ModifyIndicator
{
get{
ID ret = null;
try
{
IType t = this.GetField(5, 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 a single repetition of Sort-by Field(RCP-6).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public SRT GetSortByField(int rep)
{
SRT ret = null;
try
{
IType t = this.GetField(6, rep);
ret = (SRT)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 Sort-by Field (RCP-6).
///</summary>
public SRT[] GetSortByField() {
SRT[] ret = null;
try {
IType[] t = this.GetField(6);
ret = new SRT[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (SRT)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 Sort-by Field (RCP-6).
///</summary>
public int SortByFieldRepetitionsUsed
{
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 a single repetition of Segment group inclusion(RCP-7).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public ID GetSegmentGroupInclusion(int rep)
{
ID ret = null;
try
{
IType t = this.GetField(7, rep);
ret = (ID)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 Segment group inclusion (RCP-7).
///</summary>
public ID[] GetSegmentGroupInclusion() {
ID[] ret = null;
try {
IType[] t = this.GetField(7);
ret = new ID[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (ID)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 Segment group inclusion (RCP-7).
///</summary>
public int SegmentGroupInclusionRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(7);
}
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);
}
}
}
}}
|