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 CM0 message segment.
/// This segment has the following fields:<ol>
///<li>CM0-1: Set ID - CM0 (SI)</li>
///<li>CM0-2: Sponsor Study ID (EI)</li>
///<li>CM0-3: Alternate Study ID (EI)</li>
///<li>CM0-4: Title of Study (ST)</li>
///<li>CM0-5: Chairman of Study (XCN)</li>
///<li>CM0-6: Last IRB Approval Date (DT)</li>
///<li>CM0-7: Total Accrual to Date (NM)</li>
///<li>CM0-8: Last Accrual Date (DT)</li>
///<li>CM0-9: Contact for Study (XCN)</li>
///<li>CM0-10: Contact's Telephone Number (XTN)</li>
///<li>CM0-11: Contact's Address (XAD)</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 CM0 : AbstractSegment {
/**
* Creates a CM0 (Clinical Study Master) segment object that belongs to the given
* message.
*/
public CM0(IGroup parent, IModelClassFactory factory) : base(parent,factory) {
IMessage message = Message;
try {
this.add(typeof(SI), false, 1, 4, new System.Object[]{message}, "Set ID - CM0");
this.add(typeof(EI), true, 1, 60, new System.Object[]{message}, "Sponsor Study ID");
this.add(typeof(EI), false, 3, 60, new System.Object[]{message}, "Alternate Study ID");
this.add(typeof(ST), true, 1, 300, new System.Object[]{message}, "Title of Study");
this.add(typeof(XCN), false, 0, 250, new System.Object[]{message}, "Chairman of Study");
this.add(typeof(DT), false, 1, 8, new System.Object[]{message}, "Last IRB Approval Date");
this.add(typeof(NM), false, 1, 8, new System.Object[]{message}, "Total Accrual to Date");
this.add(typeof(DT), false, 1, 8, new System.Object[]{message}, "Last Accrual Date");
this.add(typeof(XCN), false, 0, 250, new System.Object[]{message}, "Contact for Study");
this.add(typeof(XTN), false, 1, 250, new System.Object[]{message}, "Contact's Telephone Number");
this.add(typeof(XAD), false, 0, 250, new System.Object[]{message}, "Contact's Address");
} catch (HL7Exception he) {
HapiLogFactory.getHapiLog(GetType()).error("Can't instantiate " + GetType().Name, he);
}
}
///<summary>
/// Returns Set ID - CM0(CM0-1).
///</summary>
public SI SetIDCM0
{
get{
SI ret = null;
try
{
IType t = this.GetField(1, 0);
ret = (SI)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 Sponsor Study ID(CM0-2).
///</summary>
public EI SponsorStudyID
{
get{
EI ret = null;
try
{
IType t = this.GetField(2, 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 a single repetition of Alternate Study ID(CM0-3).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public EI GetAlternateStudyID(int rep)
{
EI ret = null;
try
{
IType t = this.GetField(3, rep);
ret = (EI)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 Alternate Study ID (CM0-3).
///</summary>
public EI[] GetAlternateStudyID() {
EI[] ret = null;
try {
IType[] t = this.GetField(3);
ret = new EI[t.Length];
for (int i = 0; i < ret.Length; i++) {
ret[i] = (EI)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 Alternate Study ID (CM0-3).
///</summary>
public int AlternateStudyIDRepetitionsUsed
{
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 Title of Study(CM0-4).
///</summary>
public ST TitleOfStudy
{
get{
ST ret = null;
try
{
IType t = this.GetField(4, 0);
ret = (ST)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 Chairman of Study(CM0-5).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public XCN GetChairmanOfStudy(int rep)
{
XCN ret = null;
try
{
IType t = this.GetField(5, 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 Chairman of Study (CM0-5).
///</summary>
public XCN[] GetChairmanOfStudy() {
XCN[] ret = null;
try {
IType[] t = this.GetField(5);
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 Chairman of Study (CM0-5).
///</summary>
public int ChairmanOfStudyRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(5);
}
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 Last IRB Approval Date(CM0-6).
///</summary>
public DT LastIRBApprovalDate
{
get{
DT ret = null;
try
{
IType t = this.GetField(6, 0);
ret = (DT)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 Total Accrual to Date(CM0-7).
///</summary>
public NM TotalAccrualToDate
{
get{
NM ret = null;
try
{
IType t = this.GetField(7, 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 Last Accrual Date(CM0-8).
///</summary>
public DT LastAccrualDate
{
get{
DT ret = null;
try
{
IType t = this.GetField(8, 0);
ret = (DT)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 Contact for Study(CM0-9).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public XCN GetContactForStudy(int rep)
{
XCN ret = null;
try
{
IType t = this.GetField(9, 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 Contact for Study (CM0-9).
///</summary>
public XCN[] GetContactForStudy() {
XCN[] ret = null;
try {
IType[] t = this.GetField(9);
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 Contact for Study (CM0-9).
///</summary>
public int ContactForStudyRepetitionsUsed
{
get{
try {
return GetTotalFieldRepetitionsUsed(9);
}
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 Contact's Telephone Number(CM0-10).
///</summary>
public XTN ContactSTelephoneNumber
{
get{
XTN ret = null;
try
{
IType t = this.GetField(10, 0);
ret = (XTN)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 Contact's Address(CM0-11).
/// throws HL7Exception if the repetition number is invalid.
/// <param name="rep">The repetition number (this is a repeating field)</param>
///</summary>
public XAD GetContactSAddress(int rep)
{
XAD ret = null;
try
{
IType t = this.GetField(11, 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 Contact's Address (CM0-11).
///</summary>
public XAD[] GetContactSAddress() {
XAD[] ret = null;
try {
IType[] t = this.GetField(11);
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 Contact's Address (CM0-11).
///</summary>
public int ContactSAddressRepetitionsUsed
{
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);
}
}
}
}}
|