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 PES message segment.
/// This segment has the following fields:<ol>
///<li>PES-1: Sender Organization Name (XON)</li>
///<li>PES-2: Sender Individual Name (XCN)</li>
///<li>PES-3: Sender Address (XAD)</li>
///<li>PES-4: Sender Telephone (XTN)</li>
///<li>PES-5: Sender Event Identifier (EI)</li>
///<li>PES-6: Sender Sequence Number (NM)</li>
///<li>PES-7: Sender Event Description (FT)</li>
///<li>PES-8: Sender Comment (FT)</li>
///<li>PES-9: Sender Aware Date/Time (TS)</li>
///<li>PES-10: Event Report Date (TS)</li>
///<li>PES-11: Event Report Timing/Type (ID)</li>
///<li>PES-12: Event Report Source (ID)</li>
///<li>PES-13: Event Reported To (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 PES : AbstractSegment {
/**
* Creates a PES (Product Experience Sender) segment object that belongs to the given
* message.
*/
public PES(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(XON), false, 0, 250, new System.Object[]{message}, "Sender Organization Name");
this.add(typeof(XCN), false, 0, 250, new System.Object[]{message}, "Sender Individual Name");
this.add(typeof(XAD), false, 0, 250, new System.Object[]{message}, "Sender Address");
this.add(typeof(XTN), false, 0, 250, new System.Object[]{message}, "Sender Telephone");
this.add(typeof(EI), false, 1, 75, new System.Object[]{message}, "Sender Event Identifier");
this.add(typeof(NM), false, 1, 2, new System.Object[]{message}, "Sender Sequence Number");
this.add(typeof(FT), false, 0, 600, new System.Object[]{message}, "Sender Event Description");
this.add(typeof(FT), false, 1, 600, new System.Object[]{message}, "Sender Comment");
this.add(typeof(TS), false, 1, 26, new System.Object[]{message}, "Sender Aware Date/Time");
this.add(typeof(TS), true, 1, 26, new System.Object[]{message}, "Event Report Date");
this.add(typeof(ID), false, 2, 3, new System.Object[]{message, 234}, "Event Report Timing/Type");
this.add(typeof(ID), false, 1, 1, new System.Object[]{message, 235}, "Event Report Source");
this.add(typeof(ID), false, 0, 1, new System.Object[]{message, 236}, "Event Reported To");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns a single repetition of Sender Organization Name(PES-1).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public XON GetSenderOrganizationName(int rep)
{
XON ret = null;
try
{
IType t = this.GetField(1, rep);
ret = (XON)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 Sender Organization Name (PES-1).
///</summary>
public XON[] GetSenderOrganizationName() {
XON[] ret = null;
try {
IType[] t = this.GetField(1);
ret = new XON[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (XON)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 Sender Organization Name (PES-1).
///</summary>
public int SenderOrganizationNameRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(1);
}
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 Sender Individual Name(PES-2).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public XCN GetSenderIndividualName(int rep)
{
XCN ret = null;
try
{
IType t = this.GetField(2, rep);
ret = (XCN)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 Sender Individual Name (PES-2).
///</summary>
public XCN[] GetSenderIndividualName() {
XCN[] ret = null;
try {
IType[] t = this.GetField(2);
ret = new XCN[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (XCN)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 Sender Individual Name (PES-2).
///</summary>
public int SenderIndividualNameRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(2);
}
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 Sender Address(PES-3).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public XAD GetSenderAddress(int rep)
{
XAD ret = null;
try
{
IType t = this.GetField(3, rep);
ret = (XAD)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 Sender Address (PES-3).
///</summary>
public XAD[] GetSenderAddress() {
XAD[] ret = null;
try {
IType[] t = this.GetField(3);
ret = new XAD[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (XAD)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 Sender Address (PES-3).
///</summary>
public int SenderAddressRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(3);
}
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 Sender Telephone(PES-4).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public XTN GetSenderTelephone(int rep)
{
XTN ret = null;
try
{
IType t = this.GetField(4, rep);
ret = (XTN)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 Sender Telephone (PES-4).
///</summary>
public XTN[] GetSenderTelephone() {
XTN[] ret = null;
try {
IType[] t = this.GetField(4);
ret = new XTN[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (XTN)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 Sender Telephone (PES-4).
///</summary>
public int SenderTelephoneRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(4);
}
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 Sender Event Identifier(PES-5).
///</summary>
public EI SenderEventIdentifier
{
get{
EI ret = null;
try
{
IType t = this.GetField(5, 0);
ret = (EI)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 Sender Sequence Number(PES-6).
///</summary>
public NM SenderSequenceNumber
{
get{
NM ret = null;
try
{
IType t = this.GetField(6, 0);
ret = (NM)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 Sender Event Description(PES-7).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public FT GetSenderEventDescription(int rep)
{
FT ret = null;
try
{
IType t = this.GetField(7, rep);
ret = (FT)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 Sender Event Description (PES-7).
///</summary>
public FT[] GetSenderEventDescription() {
FT[] ret = null;
try {
IType[] t = this.GetField(7);
ret = new FT[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (FT)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 Sender Event Description (PES-7).
///</summary>
public int SenderEventDescriptionRepetitionsUsed
{
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);
}
}
}
///<summary>
/// Returns Sender Comment(PES-8).
///</summary>
public FT SenderComment
{
get{
FT ret = null;
try
{
IType t = this.GetField(8, 0);
ret = (FT)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 Sender Aware Date/Time(PES-9).
///</summary>
public TS SenderAwareDateTime
{
get{
TS ret = null;
try
{
IType t = this.GetField(9, 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 Event Report Date(PES-10).
///</summary>
public TS EventReportDate
{
get{
TS ret = null;
try
{
IType t = this.GetField(10, 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 a single repetition of Event Report Timing/Type(PES-11).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public ID GetEventReportTimingType(int rep)
{
ID ret = null;
try
{
IType t = this.GetField(11, 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 Event Report Timing/Type (PES-11).
///</summary>
public ID[] GetEventReportTimingType() {
ID[] ret = null;
try {
IType[] t = this.GetField(11);
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 Event Report Timing/Type (PES-11).
///</summary>
public int EventReportTimingTypeRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(11);
}
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 Event Report Source(PES-12).
///</summary>
public ID EventReportSource
{
get{
ID ret = null;
try
{
IType t = this.GetField(12, 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 Event Reported To(PES-13).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public ID GetEventReportedTo(int rep)
{
ID ret = null;
try
{
IType t = this.GetField(13, 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 Event Reported To (PES-13).
///</summary>
public ID[] GetEventReportedTo() {
ID[] ret = null;
try {
IType[] t = this.GetField(13);
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 Event Reported To (PES-13).
///</summary>
public int EventReportedToRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(13);
}
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);
}
}
}
}}
|