/*******************************************************************************
 *  Copyright 2017 Centre for Development of Advanced Computing(C-DAC), Pune
 *  
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  
 *    http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *******************************************************************************/
package cdac.medinfo.sdk.hl7282.baselibs.segments;

import cdac.medinfo.sdk.hl7282.baselibs.CWE;
import cdac.medinfo.sdk.hl7282.baselibs.CX;
import cdac.medinfo.sdk.hl7282.baselibs.DTM;
import cdac.medinfo.sdk.hl7282.baselibs.EI;
import cdac.medinfo.sdk.hl7282.baselibs.FN;
import cdac.medinfo.sdk.hl7282.baselibs.HD;
import cdac.medinfo.sdk.hl7282.baselibs.XCN;
import cdac.medinfo.sdk.hl7282.commoninterface.IDataType;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.exceptions.FieldMissingException;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidSegmentException;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;
import cdac.medinfo.sdk.hl7282.utils.SingleCollection;

/**
 * CSR - Clinical Study Registration Segment.<p>
 * The CSR segment contains fundamental administrative and regulatory information 
 * required to document a patient's enrollment on a clinical trial. This segment 
 * is all that is required if one needs to message another system that an 
 * enrollment has taken place, i.e., from clinical trials to pharmacy, accounting or order entry systems.
 * <p>Represents an HL7 CSR message segment. 
 * This segment has the following fields:</p><p>
 * CSR-1: Sponsor Study ID (EI)<b>Required</b><br> 
 * CSR-2: Alternate Study ID (EI)<b>Optional</b><br> 
 * CSR-3: Institution Registering the Patient (CWE)<b>Optional</b><br> 
 * CSR-4: Sponsor Patient ID (CX)<b>Required</b><br> 
 * CSR-5: Alternate Patient ID - CSR (CX)<b>Optional</b><br> 
 * CSR-6: Date/Time Of Patient Study Registration (DTM)<b>Required</b><br> 
 * CSR-7: Person Performing Study Registration (XCN)<b>Optional</b><br> 
 * CSR-8: Study Authorizing Provider (XCN)<b>Required</b><br> 
 * CSR-9: Date/time Patient Study Consent Signed (DTM)<b>Conditional</b><br> 
 * CSR-10: Patient Study Eligibility Status (CWE)<b>Conditional</b><br> 
 * CSR-11: Study Randomization Date/time (DTM)<b>Optional</b><br> 
 * CSR-12: Randomized Study Arm (CWE)<b>Optional</b><br> 
 * CSR-13: Stratum for Study Randomization (CWE)<b>Optional</b><br> 
 * CSR-14: Patient Evaluability Status (CWE)<b>Conditional</b><br> 
 * CSR-15: Date/time Ended Study (DTM)<b>Conditional</b><br> 
 * CSR-16: Reason Ended Study (CWE)<b>Conditional</b><br><p>
 * This class provides mechanism to validate message against HL7 v 2.8.2 standard.
 * The class provides accessors & mutators for the elements mentioned above.
 * The class has validate method which validates Message against HL7 v 2.8.2 standard.
 *
 * <p>User can also create Segment through {@link SegmentFactory}
 */
 public class CSR extends Segment    
{
	

	/**
	 * Constructs the CSR segment.
	 */
	public CSR()
	{super(EnumSegments.HL7_SEG_CSR);
	}

	//Integer values used in getter/setter is unique item id defined 
	//for each attribute.

	/**
	 * Retrieves the Alternate Patient ID CSR.
	 * This field may be the sending application's patient identification.
	 * @return CX - alternatePatientID_CSR
	 */
	public CX getAlternatePatientID_CSR() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1039);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CX)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Alternate Study ID.
	 * This field contains an alternate identifier that may be use as agreed upon by messaging parties.  
	 * @return EI - alternateStudyID
	 */
	public EI getAlternateStudyID() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1036);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Date time Ended Study.
	 * This field contains the date of the patient completes or is otherwise remove from the study.  
	 * @return DTM - datetimeEndedStudy
	 */
	public DTM getDatetimeEndedStudy() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1049);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Date Time Of Patient Study Registration.
	 * This field contains the healthcare facility employee who actually phoned, 
	 * submitted a form, or interactively registered the patient on the clinical trial. 
	 * @return DTM - dateTimeOfPatientStudyRegistration
	 */
	public DTM getDateTimeOfPatientStudyRegistration() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1040);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Date time Patient Study Consent Signed.
	 * This field contains the consent form signing date is collected to provide a 
	 * checkpoint that the consent form is obtained. 
	 * @return DTM - datetimePatientStudyConsentSigned
	 */
	public DTM getDatetimePatientStudyConsentSigned() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1043);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Institution Registering the Patient.
	 * This field distinguishes the institution where registration occurred. 
	 * @return CWE - institutionRegisteringthePatient
	 */
	public CWE getInstitutionRegisteringthePatient() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1037);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Patient Evaluability Status.
	 * This field categorizes the inclusion of this patient's data for various analyses.  
	 * @return CWE - patientEvaluabilityStatus
	 */
	public CWE getPatientEvaluabilityStatus() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1048);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Patient Study Eligibility Status.
	 * This field indicates whether the patient is an appropriate candidate for the trial or not.  
	 * @return CWE - patientStudyEligibilityStatus
	 */
	public CWE getPatientStudyEligibilityStatus() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1044);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Person Performing Study Registration.
	 * @return ISingleCollection<XCN> - personPerformingStudyRegistration
	 */
	public ISingleCollection<XCN> getPersonPerformingStudyRegistration() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1041);
		ISingleCollection<XCN> objDataList = new SingleCollection<XCN>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				XCN objXCN = (XCN)objDataType;
				objDataList.add(objXCN);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Randomized Study Arm.
	 * This field contains codes that must be developed by users.
	 * @return ISingleCollection<CWE> - randomizedStudyArm
	 */
	public ISingleCollection<CWE> getRandomizedStudyArm() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1046);
		ISingleCollection<CWE> objDataList = new SingleCollection<CWE>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				CWE objCWE = (CWE)objDataType;
				objDataList.add(objCWE);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Reason Ended Study.
	 * @return CWE - reasonEndedStudy
	 */
	public CWE getReasonEndedStudy() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1050);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Sponsor Patient ID.
	 * This field contains the main patient identification for the study.  
	 * @return CX - sponsorPatientID
	 */
	public CX getSponsorPatientID() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1038);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CX)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Sponsor Study ID.
	 * This field contains the universal identifier for the clinical trial.  
	 * @return EI - sponsorStudyID
	 */
	public EI getSponsorStudyID() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1011);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Stratum for Study Randomization.
	 * @return ISingleCollection<CWE> - stratumforStudyRandomization
	 */
	public ISingleCollection<CWE> getStratumforStudyRandomization() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1047);
		ISingleCollection<CWE> objDataList = new SingleCollection<CWE>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				CWE objCWE = (CWE)objDataType;
				objDataList.add(objCWE);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Study Authorizing Provider.
	 * This field contains the healthcare provider, generally the attending physician,
	 * who is accountable that the patient is eligible for the trial and have signed an informed consent.
	 * @return ISingleCollection<XCN> - studyAuthorizingProvider
	 */
	public ISingleCollection<XCN> getStudyAuthorizingProvider() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1042);
		ISingleCollection<XCN> objDataList = new SingleCollection<XCN>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				XCN objXCN = (XCN)objDataType;
				objDataList.add(objXCN);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Study Randomization Date time.
	 * This field contains the date the patient is randomize.  
	 * @return ISingleCollection<DTM> - studyRandomizationDatetime
	 */
	public ISingleCollection<DTM> getStudyRandomizationDatetime() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1045);
		ISingleCollection<DTM> objDataList = new SingleCollection<DTM>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				DTM objDTM = (DTM)objDataType;
				objDataList.add(objDTM);
			}
		}
		return objDataList;
	}

	/**
	 * Set the Alternate Patient ID CSR.
	 * This field may be the sending application's patient identification.
	 * @param strIDNumber Specifies the value of the identifier itself.
	 * @param strCheckDigit It is part of the identifying number used in the sending application. 
	 * @param strCheckDigitScheme Contains the code identifying the check digit scheme employed.
	 * 								Suggested Values NP,ISO,M10,M11.[Refer table No.0061].
	 * @param objAssigningAuthority The assigning authority is a unique name of the system (or organization or agency 
	 * 									or department) that creates the data. . 
	 * @param strIdentifierTypeCode Specifies a code corresponding to the type of identifier.In some cases, this code may be
	 * 								 used as a qualifier to the "Assigning authority" component.[Refer table No 0203]
	 * @param objAssigningFacility Specifies the place or location identifier where the identifier was first assigned 
	 * 									to the patient. 
	 * @param strEffectiveDate Specifies the first date, if known, on which the address is valid and active.
	 * @param strExpirationDate Specifies the last date, if known, on which the address is valid and active.
	 * @param objAssigningJurisdiction Specifies the geo-political body that assigned the identifier. 
	 * @param objAssigningAgencyOrDepartment Specifies agency or department that assigned the identifier. 
	 */ 
	public void setAlternatePatientID_CSR (String strIDNumber,String strCheckDigit, String strCheckDigitScheme, HD objAssigningAuthority,
			String strIdentifierTypeCode,HD objAssigningFacility,String strEffectiveDate,String strExpirationDate, 
			CWE objAssigningJurisdiction, CWE objAssigningAgencyOrDepartment, String strSecurityCheck, String strSecurityCheckScheme)
	{
		CX cx  = (CX)getDataElement(1039);
		cx.setIdNumber(strIDNumber);
		cx.setCheckDigit(strCheckDigit);
		cx.setCheckDigitScheme(strCheckDigitScheme);
		cx.setAssigningAuthority(objAssigningAuthority);
		cx.setIdentifierTypeCode(strIdentifierTypeCode);
		cx.setAssigningFacility(objAssigningFacility);
		cx.setEffectiveDate(strEffectiveDate);
		cx.setExpirationDate(strExpirationDate);
		cx.setAssigningJurisdiction(objAssigningJurisdiction);
		cx.setAssigningAgencyOrDepartment(objAssigningAgencyOrDepartment); 
		cx.setSecurityCheck(strCheckDigit);
		cx.setSecurityCheckScheme(strSecurityCheckScheme);
		setAlternatePatientID_CSR(cx);

	} 

	/** 
	 * Set the Alternate Patient ID CSR.
	 * This field may be the sending application's patient identification.
	 * @param objalternatePatientID_CSR Object of Alternate Patient ID CSR.
	 */ 
	public void setAlternatePatientID_CSR(CX objalternatePatientID_CSR)
	{
		setDataType(1039,objalternatePatientID_CSR);

	}
	/**
	 * Set the Alternate Study ID.
	 * This field contains an alternate identifier that may be use as agreed upon by messaging parties.  
	 * @param strEntityIdentifier Specifies defined by a hierarchic designator, represented by components 2 through 4.
	 * 								[Reference Section 2.A.33, "HD - hierarchic designator".] 
	 * @param strNamespaceId Specifies  the HL7 identifier for the user-defined table of values for this component.
	 * 						   [Refer to User-defined Table 0363 - Assigning authority] 	 
	 * @param strUniversalId Specifies string formatted according to the scheme defined by the component, 
	 * 							<universal ID type> (UID type). 
	 * @param strUniversalIdType Specifies  the interpretation of the second component of the HD. 
	 */ 
	public void setAlternateStudyID (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI alternateStudyID  = (EI)getDataElement(1036);
		alternateStudyID.setEntityIdentifier(strEntityIdentifier);
		alternateStudyID.setNamespaceId(strNamespaceId);
		alternateStudyID.setUniversalId(strUniversalId);
		alternateStudyID.setUniversalIdType(strUniversalIdType); 
		setAlternateStudyID(alternateStudyID);

	} 

	/** 
	 * Set the Alternate Study ID.
	 * This field contains an alternate identifier that may be use as agreed upon by messaging parties.  
	 * @param objalternateStudyID Object of Alternate Study ID.
	 */ 
	public void setAlternateStudyID(EI objalternateStudyID)
	{
		setDataType(1036,objalternateStudyID);

	}
	/**
	 * Set the Date time Ended Study.
	 * This field contains the date of the patient completes or is otherwise remove from the study.
	 * @param strTime Specifies a point in time using a 24-hour clock notation.	 
	 */ 
	public void setDatetimeEndedStudy (String strTime) 
	{
		DTM datetimeEndedStudy  = (DTM)getDataElement(1049);
		datetimeEndedStudy.setValue(strTime);		 
		setDatetimeEndedStudy(datetimeEndedStudy);
	} 

	/** 
	 * Set the Date time Ended Study.
	 * This field contains the date of the patient completes or is otherwise remove from the study.
	 * @param objdatetimeEndedStudy Object of Date time Ended Study.
	 */ 
	public void setDatetimeEndedStudy(DTM objdatetimeEndedStudy)
	{
		setDataType(1049,objdatetimeEndedStudy);

	}
	/**
	 * Set the Date Time Of Patient Study Registration.
	 * This field contains the healthcare facility employee who actually phoned, 
	 * submitted a form, or interactively registered the patient on the clinical trial.
	 * @param strTime Specifies a point in time using a 24-hour clock notation.	 
	 */ 
	public void setDateTimeOfPatientStudyRegistration (String strTime) 
	{
		DTM dateTimeOfPatientStudyRegistration  = (DTM)getDataElement(1040);
		dateTimeOfPatientStudyRegistration.setValue(strTime);		 
		setDateTimeOfPatientStudyRegistration(dateTimeOfPatientStudyRegistration);

	} 

	/** 
	 * Set the Date Time Of Patient Study Registration.
	 * This field contains the healthcare facility employee who actually phoned, 
	 * submitted a form, or interactively registered the patient on the clinical trial.
	 * @param objdateTimeOfPatientStudyRegistration Object of Date Time Of Patient Study Registration.
	 */ 
	public void setDateTimeOfPatientStudyRegistration(DTM objdateTimeOfPatientStudyRegistration)
	{
		setDataType(1040,objdateTimeOfPatientStudyRegistration);

	}
	/**
	 * Set the Date time Patient Study Consent Signed.
	 * This field contains the consent form signing date is collected to provide a 
	 * checkpoint that the consent form is obtained.
	 * @param strTime Specifies a point in time using a 24-hour clock notation.	 
	 */ 
	public void setDatetimePatientStudyConsentSigned (String strTime) 
	{
		DTM datetimePatientStudyConsentSigned  = (DTM)getDataElement(1043);
		datetimePatientStudyConsentSigned.setValue(strTime);		 
		setDatetimePatientStudyConsentSigned(datetimePatientStudyConsentSigned);

	} 

	/** 
	 * Set the Date time Patient Study Consent Signed.
	 * This field contains the consent form signing date is collected to provide a 
	 * checkpoint that the consent form is obtained.
	 * @param objdatetimePatientStudyConsentSigned Object of Date time Patient Study Consent Signed.
	 */ 
	public void setDatetimePatientStudyConsentSigned(DTM objdatetimePatientStudyConsentSigned)
	{
		setDataType(1043,objdatetimePatientStudyConsentSigned);

	}
	/**
	 * Set the Institution Registering the Patient.
	 * This field distinguishes the institution where registration occurred. 
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */	
	public void setInstitutionRegisteringthePatient (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1037);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setInstitutionRegisteringthePatient(cwe);

	} 

	/** 
	 * Set the Institution Registering the Patient.
	 * This field distinguishes the institution where registration occurred. 
	 * @param objinstitutionRegisteringthePatient Object of Institution Registering the Patient.
	 */ 
	public void setInstitutionRegisteringthePatient(CWE objinstitutionRegisteringthePatient)
	{
		setDataType(1037,objinstitutionRegisteringthePatient);

	}
	/**
	 * Set the Patient Evaluability Status.
	 * This field categorizes the inclusion of this patient's data for various analyses.  
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */
	public void setPatientEvaluabilityStatus (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1048);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setPatientEvaluabilityStatus(cwe);

	} 

	/** 
	 * Set the Patient Evaluability Status.
	 * This field categorizes the inclusion of this patient's data for various analyses.  
	 * @param objpatientEvaluabilityStatus Object of Patient Evaluability Status.
	 */ 
	public void setPatientEvaluabilityStatus(CWE objpatientEvaluabilityStatus)
	{
		setDataType(1048,objpatientEvaluabilityStatus);

	}
	/**
	 * Set the Patient Study Eligibility Status.
	 * This field indicates whether the patient is an appropriate candidate for the trial or not.  
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */	 
	public void setPatientStudyEligibilityStatus (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1044);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setPatientStudyEligibilityStatus(cwe);

	} 

	/** 
	 * Set the Patient Study Eligibility Status.
	 * This field indicates whether the patient is an appropriate candidate for the trial or not.  
	 * @param objpatientStudyEligibilityStatus Object of Patient Study Eligibility Status.
	 */ 
	public void setPatientStudyEligibilityStatus(CWE objpatientStudyEligibilityStatus)
	{
		setDataType(1044,objpatientStudyEligibilityStatus);

	}
	/**
	 * Add the Person Performing Study Registration.
	 * This field contains the healthcare facility employee who actually phoned, submitted a form, or interactively registered the patient on the clinical trial.
	 * @param strIDNumber Refers to the coded ID according to a user-defined table.
	 * @param objFamilyName Specifies the surname of a person.
	 * @param strGivenName Specifies First name.
	 * @param strSecondAndFurtherGivenNamesOrInitialsThereof Specifies multiple middle names that may be included by 
	 * 														   separating them with spaces.
	 * @param strSuffix Used to specify a name suffix (e.g., Jr. or III).
	 * @param strPrefix Used to specify a name prefix (e.g., Dr.).
	 * @param strSourceTable Used as the HL7 identifier for the user-defined table of values for this component. [Refer User-defined Table 0297 - CN ID.]
	 * @param objAssigningAuthority Specifies a unique identifier of the system (or organization or agency of department)
	 * 								  that creates the data. [Refer User-defined Table 0363 - Assigning authority]
	 * @param strNameTypeCode Specifies a code that represents the type of name. 
	 * @param strIdentifierCheckDigit Specifies part of the identifying number used in the sending application. 
	 * @param strCheckDigitScheme Specifies the code identifying the check digit scheme employed.[Refer HL7 Table 0061 - Check digit scheme].
	 * @param strIdentifierTypeCode Specifies A code corresponding to the type of identifier.[Refer HL7 Table 0203 - Identifier type].
	 * @param objAssigningFacility Specifies the place or location identifier where the identifier was first assigned to the person
	 * @param strNameRepresentationCode Provides an indication of the representation provided by the data item.  
	 * @param objNameContext Designates the context in which a name is used. [Refer User-defined Table 0448 ]
	 * @param strNameAssemblyOrder Specifies a code that represents the preferred display order of the components of this person name. Suggested values are G,F[Refer table 0444.]
	 * @param strEffectiveDate Specifies the first date, if known, on which the address is valid and active.
	 * @param strExpirationDate Specifies the last date, if known, on which the address is valid and active.
	 * @param strProfessionalSuffix Used to specify an abbreviation, or a string of abbreviations, denoting qualifications that support the person's profession, (e.g., licenses).
	 * @param objAssigningJurisdiction Specifies the geo-political body that assigned the identifier.
	 * @param objAssigningAgencyOrDepratment Specifies the agency or department that assigned the identifier
	 * @param strSecurityCheck Specifies the version code that may be assigned to the person identifier
	 * @param strSecurityCheckScheme Specifies the check digit scheme.
	 */ 
	public void addPersonPerformingStudyRegistration(String strIDNumber,FN objFamilyName,String strGivenName,String strSecondAndFurtherGivenNamesOrInitialsThereof,
			String 	strSuffix,String strPrefix,CWE objSourceTable,HD objAssigningAuthority,
			String strNameTypeCode,String strIdentifierCheckDigit,String strCheckDigitScheme,String strIdentifierTypeCode,
			HD objAssigningFacility,String strNameRepresentationCode,CWE objNameContext,
			String strNameAssemblyOrder, String strEffectiveDate,String strExpirationDate,String strProfessionalSuffix,
			CWE objAssigningJurisdiction,CWE objAssigningAgencyOrDepratment, String strSecurityCheck, String strSecurityCheckScheme)
	{
		XCN xcn  = (XCN)getDataElement(1041);
		xcn.setIdNumber(strIDNumber);
		xcn.setFamilyName(objFamilyName);
		xcn.setGivenName(strGivenName);
		xcn.setSecondNameOrInitials(strSecondAndFurtherGivenNamesOrInitialsThereof);
		xcn.setSuffix(strSuffix);
		xcn.setPrefix(strPrefix);
 
		xcn.setSourceTable(objSourceTable);
		xcn.setAssigningAuthority(objAssigningAuthority);
		xcn.setNameTypeCode(strNameTypeCode);
		xcn.setIdentifierCheckDigit(strIdentifierCheckDigit);
		xcn.setCheckDigitScheme(strCheckDigitScheme);
		xcn.setIdentifierTypeCode(strIdentifierTypeCode);
		xcn.setAssigningFacility(objAssigningFacility);
		xcn.setNameRepresentationCode(strNameRepresentationCode);
		xcn.setNameContext(objNameContext);
 
		xcn.setNameAssemblyOrder(strNameAssemblyOrder);
		xcn.setEffectiveDate(strEffectiveDate);
		xcn.setExpirationDate(strExpirationDate);
		xcn.setProfessionalSuffix(strProfessionalSuffix);
		xcn.setAssigningJurisdiction(objAssigningJurisdiction);
		xcn.setAssigningAgencyOrDepartment(objAssigningAgencyOrDepratment); 
		xcn.setSecurityCheck(strSecurityCheck);
		xcn.setSecurityCheckScheme(strSecurityCheckScheme);
		addPersonPerformingStudyRegistration(xcn);
	}

	/**
	 * Add the Person Performing Study Registration.
	 * This field contains the healthcare facility employee who actually phoned, submitted a form, or interactively registered the patient on the clinical trial.
	 * @param objpersonPerformingStudyRegistration Object of Person Performing Study Registration.
	 */
	public void addPersonPerformingStudyRegistration(XCN objpersonPerformingStudyRegistration)
	{
		addDataType(1041,objpersonPerformingStudyRegistration);
	}

	/**
	 * Set the Person Performing Study Registration.
	 * @param objpersonPerformingStudyRegistrationList List of Person Performing Study Registration.
	 */
	@SuppressWarnings("unchecked")
	public void setPersonPerformingStudyRegistration(ISingleCollection<XCN> objpersonPerformingStudyRegistrationList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objpersonPerformingStudyRegistrationList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1041,objCollection);
	}

	/**
	 * Add the Randomized Study Arm.
	 * This field contains codes that must be developed by users.
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */
	public void addRandomizedStudyArm(String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1046);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID);
		addRandomizedStudyArm(cwe);
	}

	/**
	 * Add the Randomized Study Arm.
	 * This field contains codes that must be developed by users.
	 * @param objrandomizedStudyArm Object of Randomized Study Arm.
	 */
	public void addRandomizedStudyArm(CWE objrandomizedStudyArm)
	{
		addDataType(1046,objrandomizedStudyArm);
	}

	/**
	 * Set the Randomized Study Arm.
	 * This field contains codes that must be developed by users.
	 * @param objrandomizedStudyArmList List of Randomized Study Arm.
	 */
	@SuppressWarnings("unchecked")
	public void setRandomizedStudyArm(ISingleCollection<CWE> objrandomizedStudyArmList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objrandomizedStudyArmList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1046,objCollection);
	}

	/**
	 * Set the Reason Ended Study.
	 * This information is important for quality control and data analysis.  The coding systems will vary among trials.
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */	 
	public void setReasonEndedStudy (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1050);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID);
		setReasonEndedStudy(cwe);

	} 

	/** 
	 * Set the Reason Ended Study.
	 * @param objreasonEndedStudy Object of Reason Ended Study.
	 */ 
	public void setReasonEndedStudy(CWE objreasonEndedStudy)
	{
		setDataType(1050,objreasonEndedStudy);

	}
	/**
	 * Set the Sponsor Patient ID.
	 * This field contains the main patient identification for the study.
	 * @param strIDNumber Specifies the value of the identifier itself.
	 * @param strCheckDigit It is part of the identifying number used in the sending application. 
	 * @param strCheckDigitScheme Contains the code identifying the check digit scheme employed.
	 * 								Suggested Values NP,ISO,M10,M11.[Refer table No.0061].
	 * @param objAssigningAuthority The assigning authority is a unique name of the system (or organization or agency 
	 * 									or department) that creates the data. . 
	 * @param strIdentifierTypeCode Specifies a code corresponding to the type of identifier.In some cases, this code may be
	 * 								 used as a qualifier to the "Assigning authority" component.[Refer table No 0203]
	 * @param objAssigningFacility Specifies the place or location identifier where the identifier was first assigned 
	 * 									to the patient. 
	 * @param strEffectiveDate Specifies the first date, if known, on which the address is valid and active.
	 * @param strExpirationDate Specifies the last date, if known, on which the address is valid and active.
	 * @param objAssigningJurisdiction Specifies the geo-political body that assigned the identifier. 
	 * @param objAssigningAgencyOrDepartment Specifies agency or department that assigned the identifier. 
	 * @param strSecurityCheck is used to communicate the version code. 
	 * @param objSecurityCheckSCheme is used to transmit information intended to validate veracity of the supplied identifier
	 */
	public void setSponsorPatientID (String strIDNumber,String strCheckDigit, String strCheckDigitScheme, HD objAssigningAuthority,
			String strIdentifierTypeCode,HD objAssigningFacility,String strEffectiveDate,String strExpirationDate, 
			CWE objAssigningJurisdiction, CWE objAssigningAgencyOrDepartment, String strSecurityCheck, String strSecurityCheckScheme)
	{
		CX cx  = (CX)getDataElement(1038);
		cx.setIdNumber(strIDNumber);
		cx.setCheckDigit(strCheckDigit);
		cx.setCheckDigitScheme(strCheckDigitScheme);
		cx.setAssigningAuthority(objAssigningAuthority);
		cx.setIdentifierTypeCode(strIdentifierTypeCode);
		cx.setAssigningFacility(objAssigningFacility);
		cx.setEffectiveDate(strEffectiveDate);
		cx.setExpirationDate(strExpirationDate);
		cx.setAssigningJurisdiction(objAssigningJurisdiction);
		cx.setAssigningAgencyOrDepartment(objAssigningAgencyOrDepartment); 
		cx.setSecurityCheck(strCheckDigit);
		cx.setSecurityCheckScheme(strSecurityCheckScheme);
		setSponsorPatientID(cx);

	} 

	/** 
	 * Set the Sponsor Patient ID.
	 * This field contains the main patient identification for the study.
	 * @param objsponsorPatientID Object of Sponsor Patient ID.
	 */ 
	public void setSponsorPatientID(CX objsponsorPatientID)
	{
		setDataType(1038,objsponsorPatientID);

	}
	/**
	 * Set the Sponsor Study ID.
	 * This field contains the universal identifier for the clinical trial.  
	 * @param strEntityIdentifier Specifies defined by a hierarchic designator, represented by components 2 through 4.
	 * 								[Reference Section 2.A.33, "HD - hierarchic designator".] 
	 * @param strNamespaceId Specifies  the HL7 identifier for the user-defined table of values for this component.
	 * 						   [Refer to User-defined Table 0363 - Assigning authority] 	 
	 * @param strUniversalId Specifies string formatted according to the scheme defined by the component, 
	 * 							<universal ID type> (UID type). 
	 * @param strUniversalIdType Specifies  the interpretation of the second component of the HD. 
	 */ 
	public void setSponsorStudyID (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI sponsorStudyID  = (EI)getDataElement(1011);
		sponsorStudyID.setEntityIdentifier(strEntityIdentifier);
		sponsorStudyID.setNamespaceId(strNamespaceId);
		sponsorStudyID.setUniversalId(strUniversalId);
		sponsorStudyID.setUniversalIdType(strUniversalIdType); 
		setSponsorStudyID(sponsorStudyID);

	} 

	/** 
	 * Set the Sponsor Study ID.
	 * This field contains the universal identifier for the clinical trial.  
	 * @param objsponsorStudyID Object of Sponsor Study ID. 
	 */ 
	public void setSponsorStudyID(EI objsponsorStudyID)
	{
		setDataType(1011,objsponsorStudyID);

	}
	/**
	 * Add the Stratum for Study Randomization.
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */
	public void addStratumforStudyRandomization(String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1047);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID);
		addStratumforStudyRandomization(cwe);
	}

	/**
	 * Add the Stratum for Study Randomization.
	 * @param objstratumforStudyRandomization Object of Stratum for Study Randomization.
	 */
	public void addStratumforStudyRandomization(CWE objstratumforStudyRandomization)
	{
		addDataType(1047,objstratumforStudyRandomization);
	}

	/**
	 * Set the Stratum for Study Randomization.
	 * @param objstratumforStudyRandomizationList List of Stratum for Study Randomization.
	 */
	@SuppressWarnings("unchecked")
	public void setStratumforStudyRandomization(ISingleCollection<CWE> objstratumforStudyRandomizationList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objstratumforStudyRandomizationList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1047,objCollection);
	}

	/**
	 * Add the Study Authorizing Provider.
	 * This field contains the healthcare provider, generally the attending physician,
	 * who is accountable that the patient is eligible for the trial and have signed an informed consent.
	 * @param strIDNumber Refers to the coded ID according to a user-defined table
	 * @param objFamilyName Specifies the surname of a person.
	 * @param strGivenName Specifies First name.
	 * @param strSecondAndFurtherGivenNamesOrInitialsThereof Specifies multiple middle names that may be included by 
	 * 														   separating them with spaces.
	 * @param strSuffix Used to specify a name suffix (e.g., Jr. or III).
	 * @param strPrefix Used to specify a name prefix (e.g., Dr.).
	 * @param strSourceTable Used as the HL7 identifier for the user-defined table of values for this component. [Refer User-defined Table 0297 - CN ID.]
	 * @param objAssigningAuthority Specifies a unique identifier of the system (or organization or agency of department)
	 * 								  that creates the data. [Refer User-defined Table 0363 - Assigning authority]
	 * @param strNameTypeCode Specifies a code that represents the type of name. 
	 * @param strIdentifierCheckDigit Specifies part of the identifying number used in the sending application. 
	 * @param strCheckDigitScheme Specifies the code identifying the check digit scheme employed.[Refer HL7 Table 0061 - Check digit scheme].
	 * @param strIdentifierTypeCode Specifies A code corresponding to the type of identifier.[Refer HL7 Table 0203 - Identifier type].
	 * @param objAssigningFacility Specifies the place or location identifier where the identifier was first assigned to the person
	 * @param strNameRepresentationCode Provides an indication of the representation provided by the data item.  
	 * @param objNameContext Designates the context in which a name is used. [Refer User-defined Table 0448 ]
	 * @param strNameAssemblyOrder Specifies a code that represents the preferred display order of the components of this person name. Suggested values are G,F[Refer table 0444.]
	 * @param strEffectiveDate Specifies the first date, if known, on which the address is valid and active.
	 * @param strExpirationDate Specifies the last date, if known, on which the address is valid and active.
	 * @param strProfessionalSuffix Used to specify an abbreviation, or a string of abbreviations, denoting qualifications that support the person's profession, (e.g., licenses).
	 * @param objAssigningJurisdiction Specifies the geo-political body that assigned the identifier.
	 * @param objAssigningAgencyOrDepratment Specifies the agency or department that assigned the identifier
	 * @param strSecurityCheck Specifies the version code that may be assigned to the person identifier
	 * @param strSecurityCheckScheme Specifies the check digit scheme.
	 */
	public void addStudyAuthorizingProvider(String strIDNumber,FN objFamilyName,String strGivenName,String strSecondAndFurtherGivenNamesOrInitialsThereof,
			String 	strSuffix,String strPrefix,CWE objSourceTable,HD objAssigningAuthority,
			String strNameTypeCode,String strIdentifierCheckDigit,String strCheckDigitScheme,String strIdentifierTypeCode,
			HD objAssigningFacility,String strNameRepresentationCode,CWE objNameContext,
			String strNameAssemblyOrder, String strEffectiveDate,String strExpirationDate,String strProfessionalSuffix,
			CWE objAssigningJurisdiction,CWE objAssigningAgencyOrDepratment, String strSecurityCheck, String strSecurityCheckScheme)
	{
		XCN xcn  = (XCN)getDataElement(1042);
		xcn.setIdNumber(strIDNumber);
		xcn.setFamilyName(objFamilyName);
		xcn.setGivenName(strGivenName);
		xcn.setSecondNameOrInitials(strSecondAndFurtherGivenNamesOrInitialsThereof);
		xcn.setSuffix(strSuffix);
		xcn.setPrefix(strPrefix);
 
		xcn.setSourceTable(objSourceTable);
		xcn.setAssigningAuthority(objAssigningAuthority);
		xcn.setNameTypeCode(strNameTypeCode);
		xcn.setIdentifierCheckDigit(strIdentifierCheckDigit);
		xcn.setCheckDigitScheme(strCheckDigitScheme);
		xcn.setIdentifierTypeCode(strIdentifierTypeCode);
		xcn.setAssigningFacility(objAssigningFacility);
		xcn.setNameRepresentationCode(strNameRepresentationCode);
		xcn.setNameContext(objNameContext);
 
		xcn.setNameAssemblyOrder(strNameAssemblyOrder);
		xcn.setEffectiveDate(strEffectiveDate);
		xcn.setExpirationDate(strExpirationDate);
		xcn.setProfessionalSuffix(strProfessionalSuffix);
		xcn.setAssigningJurisdiction(objAssigningJurisdiction);
		xcn.setAssigningAgencyOrDepartment(objAssigningAgencyOrDepratment); 
		xcn.setSecurityCheck(strSecurityCheck);
		xcn.setSecurityCheckScheme(strSecurityCheckScheme);
		addStudyAuthorizingProvider(xcn);
	}

	/**
	 * Add the Study Authorizing Provider.
	 * This field contains the healthcare provider, generally the attending physician,
	 * who is accountable that the patient is eligible for the trial and have signed an informed consent.
	 * @param objstudyAuthorizingProvider Object of Study Authorizing Provider.
	 */
	public void addStudyAuthorizingProvider(XCN objstudyAuthorizingProvider)
	{
		addDataType(1042,objstudyAuthorizingProvider);
	}

	/**
	 * Set the Study Authorizing Provider.
	 * This field contains the healthcare provider, generally the attending physician,
	 * who is accountable that the patient is eligible for the trial and have signed an informed consent.
	 * @param objstudyAuthorizingProviderList List of Study Authorizing Provider.
	 */
	@SuppressWarnings("unchecked")
	public void setStudyAuthorizingProvider(ISingleCollection<XCN> objstudyAuthorizingProviderList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objstudyAuthorizingProviderList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1042,objCollection);
	}

	/**
	 * Add the Study Randomization Date time.
	 * This field contains the date the patient is randomize.
	 * @param strTime Specifies a point in time using a 24-hour clock notation.	 
	 */	
	public void addStudyRandomizationDatetime(String strTime) 
	{
		DTM studyRandomizationDatetime  = (DTM)getDataElement(1045);
		studyRandomizationDatetime.setValue(strTime);		
		addStudyRandomizationDatetime(studyRandomizationDatetime);
	}

	/**
	 * Add the Study Randomization Date time.
	 * This field contains the date the patient is randomize.
	 * @param studyRandomizationDatetime Object of Study Randomization Date time.
	 */
	public void addStudyRandomizationDatetime(DTM studyRandomizationDatetime)
	{
		addDataType(1045,studyRandomizationDatetime);
	}

	/**
	 * Set the Study Randomization Date time.
	 * This field contains the date the patient is randomize.
	 * @param studyRandomizationDatetimeList List of Study Randomization Date time.
	 */
	@SuppressWarnings("unchecked")
	public void setStudyRandomizationDatetime(ISingleCollection<DTM> studyRandomizationDatetimeList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)studyRandomizationDatetimeList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1045,objCollection);
	}

	/**
	 * Validates HL7 Message objects .
	 * Validate method checks for validation each and every segments in side the Message object against specified message Structure. 
	 * Validation checks include optionality of segment or group.
	 * It also verifies the number of times segment or group is repeated in message.
	 * e.g 
	 * {PSH} while parsing PSH segment validate method will check for its mandatory presence.
	 * [PSH] in this case validate will throw exception if one tries to enter more than one PSH segment. 
	 * @return boolean - true or false.
	 * @throws InvalidSegmentException Thrown when Segment Validation Fails.
	 */
	public boolean validate() throws InvalidSegmentException
	{
		/*
		 * Sponsor Study ID,Sponsor Patient ID ,Date/Time Of Patient Study Registration,Study Authorizing Provider 
		 * are required fields.
		 */
		try
		{
			/*
			 * Date/time Patient Study Consent Signed,Patient Study Eligibility Status,Patient Evaluability Status
			 * Date/time Ended Study,Reason Ended Study
			 */

			/*
			 * Condidion Rule:Date/time Patient Study Consent Signed
			 * 			This field is required for the patient registration trigger event (C01). 
			 * Condidion Rule:Patient Study Eligibility Status
			 * 			This field is required for the patient registration trigger event (C01).
			 * Condidion Rule:Patient Evaluability Status
			 * 			This field is required for the off study trigger event (C04).
			 * Condidion Rule:Date/Time Ended Study   
			 * 			This field is required for the off study event (C04).
			 * Conditoin Rule:Reason Ended Study   
			 * 			This field is required for the off study trigger event (C04).
			 */
			super.validate();

			return true;
		}
		catch(FieldMissingException ex)
		{
			throw new InvalidSegmentException(enumSegments.getValue(),ex);
		}
	}
}