All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ca.uhn.hl7v2.model.v26.segment.CTD Maven / Gradle / Ivy

There is a newer version: 2.3
Show newest version
/*
 * This class is an auto-generated source file for a HAPI
 * HL7 v2.x standard structure class.
 *
 * For more information, visit: http://hl7api.sourceforge.net/
 */

package ca.uhn.hl7v2.model.v26.segment;

// import ca.uhn.hl7v2.model.v26.group.*;
import ca.uhn.hl7v2.model.v26.datatype.*;
import ca.uhn.log.HapiLogFactory;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.parser.ModelClassFactory;
import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
import ca.uhn.hl7v2.model.AbstractMessage;
import ca.uhn.hl7v2.model.Group;
import ca.uhn.hl7v2.model.Type;
import ca.uhn.hl7v2.model.AbstractSegment;
import ca.uhn.hl7v2.model.Varies;

/**
 *

Represents an HL7 CTD message segment (Contact Data). * This segment has the following fields:

*
    *
  • CTD-1: Contact Role (CWE) repeating *
  • CTD-2: Contact Name (XPN) optional repeating *
  • CTD-3: Contact Address (XAD) optional repeating *
  • CTD-4: Contact Location (PL) optional *
  • CTD-5: Contact Communication Information (XTN) optional repeating *
  • CTD-6: Preferred Method of Contact (CWE) optional *
  • CTD-7: Contact Identifiers (PLN) optional repeating *
*/ public class CTD extends AbstractSegment { /** * Creates a new CTD segment */ public CTD(Group parent, ModelClassFactory factory) { super(parent, factory); init(factory); } private void init(ModelClassFactory factory) { try { this.add(CWE.class, true, 0, 705, new Object[]{ getMessage(), new Integer(131) }, "Contact Role"); this.add(XPN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Contact Name"); this.add(XAD.class, false, 0, 2915, new Object[]{ getMessage(), new Integer(0) }, "Contact Address"); this.add(PL.class, false, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Contact Location"); this.add(XTN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Contact Communication Information"); this.add(CWE.class, false, 1, 705, new Object[]{ getMessage(), new Integer(185) }, "Preferred Method of Contact"); this.add(PLN.class, false, 0, 100, new Object[]{ getMessage(), new Integer(338) }, "Contact Identifiers"); } catch(HL7Exception e) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating CTD - this is probably a bug in the source code generator.", e); } } /** * Returns all repetitions of Contact Role (CTD-1). */ public CWE[] getContactRole() { CWE[] ret = null; try { Type[] t = this.getField(1); ret = new CWE[t.length]; for (int i = 0; i < ret.length; i++) { ret[i] = (CWE)t[i]; } } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a count of the current number of repetitions of Contact Role (CTD-1). * This method does not create a repetition, so if no repetitions have currently been defined or accessed, * it will return zero. */ public int getContactRoleReps() { CWE[] ret = null; try { Type[] t = this.getField(1); return t.length; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } } /** * Returns a specific repetition of * CTD-1: "Contact Role" - creates it if necessary * * @param rep The repetition index (0-indexed) */ public CWE getContactRole(int rep) { CWE ret = null; try { Type t = this.getField(1, rep); ret = (CWE)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a specific repetition of * CTD-1: "Contact Role" - creates it if necessary * * @param rep The repetition index (0-indexed) */ public CWE getCtd1_ContactRole(int rep) { CWE ret = null; try { Type t = this.getField(1, rep); ret = (CWE)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a count of the current number of repetitions of Contact Role (CTD-1). * This method does not create a repetition, so if no repetitions have currently been defined or accessed, * it will return zero. */ public int getCtd1_ContactRoleReps() { CWE[] ret = null; try { Type[] t = this.getField(1); return t.length; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } } /** * Inserts a repetition of * CTD-1: "Contact Role" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public CWE insertContactRole(int rep) throws HL7Exception { return (CWE) super.insertRepetition(1, rep); } /** * Inserts a repetition of * CTD-1: "Contact Role" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public CWE insertCtd1_ContactRole(int rep) throws HL7Exception { return (CWE) super.insertRepetition(1, rep); } /** * Removes a repetition of * CTD-1: "Contact Role" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public CWE removeContactRole(int rep) throws HL7Exception { return (CWE) super.removeRepetition(1, rep); } /** * Removes a repetition of * CTD-1: "Contact Role" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public CWE removeCtd1_ContactRole(int rep) throws HL7Exception { return (CWE) super.removeRepetition(1, rep); } /** * Returns all repetitions of Contact Name (CTD-2). */ public XPN[] getContactName() { XPN[] ret = null; try { Type[] t = this.getField(2); ret = new XPN[t.length]; for (int i = 0; i < ret.length; i++) { ret[i] = (XPN)t[i]; } } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a count of the current number of repetitions of Contact Name (CTD-2). * This method does not create a repetition, so if no repetitions have currently been defined or accessed, * it will return zero. */ public int getContactNameReps() { XPN[] ret = null; try { Type[] t = this.getField(2); return t.length; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } } /** * Returns a specific repetition of * CTD-2: "Contact Name" - creates it if necessary * * @param rep The repetition index (0-indexed) */ public XPN getContactName(int rep) { XPN ret = null; try { Type t = this.getField(2, rep); ret = (XPN)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a specific repetition of * CTD-2: "Contact Name" - creates it if necessary * * @param rep The repetition index (0-indexed) */ public XPN getCtd2_ContactName(int rep) { XPN ret = null; try { Type t = this.getField(2, rep); ret = (XPN)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a count of the current number of repetitions of Contact Name (CTD-2). * This method does not create a repetition, so if no repetitions have currently been defined or accessed, * it will return zero. */ public int getCtd2_ContactNameReps() { XPN[] ret = null; try { Type[] t = this.getField(2); return t.length; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } } /** * Inserts a repetition of * CTD-2: "Contact Name" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public XPN insertContactName(int rep) throws HL7Exception { return (XPN) super.insertRepetition(2, rep); } /** * Inserts a repetition of * CTD-2: "Contact Name" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public XPN insertCtd2_ContactName(int rep) throws HL7Exception { return (XPN) super.insertRepetition(2, rep); } /** * Removes a repetition of * CTD-2: "Contact Name" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public XPN removeContactName(int rep) throws HL7Exception { return (XPN) super.removeRepetition(2, rep); } /** * Removes a repetition of * CTD-2: "Contact Name" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public XPN removeCtd2_ContactName(int rep) throws HL7Exception { return (XPN) super.removeRepetition(2, rep); } /** * Returns all repetitions of Contact Address (CTD-3). */ public XAD[] getContactAddress() { XAD[] ret = null; try { Type[] t = this.getField(3); ret = new XAD[t.length]; for (int i = 0; i < ret.length; i++) { ret[i] = (XAD)t[i]; } } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a count of the current number of repetitions of Contact Address (CTD-3). * This method does not create a repetition, so if no repetitions have currently been defined or accessed, * it will return zero. */ public int getContactAddressReps() { XAD[] ret = null; try { Type[] t = this.getField(3); return t.length; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } } /** * Returns a specific repetition of * CTD-3: "Contact Address" - creates it if necessary * * @param rep The repetition index (0-indexed) */ public XAD getContactAddress(int rep) { XAD ret = null; try { Type t = this.getField(3, rep); ret = (XAD)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a specific repetition of * CTD-3: "Contact Address" - creates it if necessary * * @param rep The repetition index (0-indexed) */ public XAD getCtd3_ContactAddress(int rep) { XAD ret = null; try { Type t = this.getField(3, rep); ret = (XAD)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a count of the current number of repetitions of Contact Address (CTD-3). * This method does not create a repetition, so if no repetitions have currently been defined or accessed, * it will return zero. */ public int getCtd3_ContactAddressReps() { XAD[] ret = null; try { Type[] t = this.getField(3); return t.length; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } } /** * Inserts a repetition of * CTD-3: "Contact Address" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public XAD insertContactAddress(int rep) throws HL7Exception { return (XAD) super.insertRepetition(3, rep); } /** * Inserts a repetition of * CTD-3: "Contact Address" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public XAD insertCtd3_ContactAddress(int rep) throws HL7Exception { return (XAD) super.insertRepetition(3, rep); } /** * Removes a repetition of * CTD-3: "Contact Address" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public XAD removeContactAddress(int rep) throws HL7Exception { return (XAD) super.removeRepetition(3, rep); } /** * Removes a repetition of * CTD-3: "Contact Address" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public XAD removeCtd3_ContactAddress(int rep) throws HL7Exception { return (XAD) super.removeRepetition(3, rep); } /** * Returns * CTD-4: "Contact Location" - creates it if necessary */ public PL getContactLocation() { PL ret = null; try { Type t = this.getField(4, 0); ret = (PL)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * CTD-4: "Contact Location" - creates it if necessary */ public PL getCtd4_ContactLocation() { PL ret = null; try { Type t = this.getField(4, 0); ret = (PL)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns all repetitions of Contact Communication Information (CTD-5). */ public XTN[] getContactCommunicationInformation() { XTN[] ret = null; try { Type[] t = this.getField(5); ret = new XTN[t.length]; for (int i = 0; i < ret.length; i++) { ret[i] = (XTN)t[i]; } } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a count of the current number of repetitions of Contact Communication Information (CTD-5). * This method does not create a repetition, so if no repetitions have currently been defined or accessed, * it will return zero. */ public int getContactCommunicationInformationReps() { XTN[] ret = null; try { Type[] t = this.getField(5); return t.length; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } } /** * Returns a specific repetition of * CTD-5: "Contact Communication Information" - creates it if necessary * * @param rep The repetition index (0-indexed) */ public XTN getContactCommunicationInformation(int rep) { XTN ret = null; try { Type t = this.getField(5, rep); ret = (XTN)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a specific repetition of * CTD-5: "Contact Communication Information" - creates it if necessary * * @param rep The repetition index (0-indexed) */ public XTN getCtd5_ContactCommunicationInformation(int rep) { XTN ret = null; try { Type t = this.getField(5, rep); ret = (XTN)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a count of the current number of repetitions of Contact Communication Information (CTD-5). * This method does not create a repetition, so if no repetitions have currently been defined or accessed, * it will return zero. */ public int getCtd5_ContactCommunicationInformationReps() { XTN[] ret = null; try { Type[] t = this.getField(5); return t.length; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } } /** * Inserts a repetition of * CTD-5: "Contact Communication Information" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public XTN insertContactCommunicationInformation(int rep) throws HL7Exception { return (XTN) super.insertRepetition(5, rep); } /** * Inserts a repetition of * CTD-5: "Contact Communication Information" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public XTN insertCtd5_ContactCommunicationInformation(int rep) throws HL7Exception { return (XTN) super.insertRepetition(5, rep); } /** * Removes a repetition of * CTD-5: "Contact Communication Information" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public XTN removeContactCommunicationInformation(int rep) throws HL7Exception { return (XTN) super.removeRepetition(5, rep); } /** * Removes a repetition of * CTD-5: "Contact Communication Information" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public XTN removeCtd5_ContactCommunicationInformation(int rep) throws HL7Exception { return (XTN) super.removeRepetition(5, rep); } /** * Returns * CTD-6: "Preferred Method of Contact" - creates it if necessary */ public CWE getPreferredMethodOfContact() { CWE ret = null; try { Type t = this.getField(6, 0); ret = (CWE)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * CTD-6: "Preferred Method of Contact" - creates it if necessary */ public CWE getCtd6_PreferredMethodOfContact() { CWE ret = null; try { Type t = this.getField(6, 0); ret = (CWE)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns all repetitions of Contact Identifiers (CTD-7). */ public PLN[] getContactIdentifiers() { PLN[] ret = null; try { Type[] t = this.getField(7); ret = new PLN[t.length]; for (int i = 0; i < ret.length; i++) { ret[i] = (PLN)t[i]; } } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a count of the current number of repetitions of Contact Identifiers (CTD-7). * This method does not create a repetition, so if no repetitions have currently been defined or accessed, * it will return zero. */ public int getContactIdentifiersReps() { PLN[] ret = null; try { Type[] t = this.getField(7); return t.length; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } } /** * Returns a specific repetition of * CTD-7: "Contact Identifiers" - creates it if necessary * * @param rep The repetition index (0-indexed) */ public PLN getContactIdentifiers(int rep) { PLN ret = null; try { Type t = this.getField(7, rep); ret = (PLN)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a specific repetition of * CTD-7: "Contact Identifiers" - creates it if necessary * * @param rep The repetition index (0-indexed) */ public PLN getCtd7_ContactIdentifiers(int rep) { PLN ret = null; try { Type t = this.getField(7, rep); ret = (PLN)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a count of the current number of repetitions of Contact Identifiers (CTD-7). * This method does not create a repetition, so if no repetitions have currently been defined or accessed, * it will return zero. */ public int getCtd7_ContactIdentifiersReps() { PLN[] ret = null; try { Type[] t = this.getField(7); return t.length; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } } /** * Inserts a repetition of * CTD-7: "Contact Identifiers" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public PLN insertContactIdentifiers(int rep) throws HL7Exception { return (PLN) super.insertRepetition(7, rep); } /** * Inserts a repetition of * CTD-7: "Contact Identifiers" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public PLN insertCtd7_ContactIdentifiers(int rep) throws HL7Exception { return (PLN) super.insertRepetition(7, rep); } /** * Removes a repetition of * CTD-7: "Contact Identifiers" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public PLN removeContactIdentifiers(int rep) throws HL7Exception { return (PLN) super.removeRepetition(7, rep); } /** * Removes a repetition of * CTD-7: "Contact Identifiers" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public PLN removeCtd7_ContactIdentifiers(int rep) throws HL7Exception { return (PLN) super.removeRepetition(7, rep); } /** {@inheritDoc} */ protected Type createNewTypeWithoutReflection(int field) { switch (field) { case 0: return new CWE(getMessage()); case 1: return new XPN(getMessage()); case 2: return new XAD(getMessage()); case 3: return new PL(getMessage()); case 4: return new XTN(getMessage()); case 5: return new CWE(getMessage()); case 6: return new PLN(getMessage()); default: return null; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy