/*******************************************************************************
 *  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.DR;
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.ID;
import cdac.medinfo.sdk.hl7282.baselibs.NM;
import cdac.medinfo.sdk.hl7282.baselibs.SAD;
import cdac.medinfo.sdk.hl7282.baselibs.SI;
import cdac.medinfo.sdk.hl7282.baselibs.XAD;
import cdac.medinfo.sdk.hl7282.baselibs.XCN;
import cdac.medinfo.sdk.hl7282.baselibs.XON;
import cdac.medinfo.sdk.hl7282.baselibs.XTN;
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;

/**
 * REL - Clinical Relationship Segment<p>
 * Clinical Relationship segment contains the data necessary to relate two data elements within and/or external to the message at run-time. 
 * It also includes information about the relationship.
 * <p>Represents an HL7 REL message segment. 
 * This segment has the following fields:</p><p>
 * REL-1: Set ID - REL (SI)<b>Conditional</b><br> 
 * REL-2: Relationship Type (CWE)<b>Required</b><br> 
 * REL-3: This Relationship Instance Identifier (EI)<b>Required</b><br> 
 * REL-4: Source Information Instance Identifier (EI)<b>Required</b><br> 
 * REL-5: Target Information Instance Identifier (EI)<b>Required</b><br> 
 * REL-6: Asserting Entity Instance ID (EI)<b>Optional</b><br>
 * REL-7: Asserting Person (XCN)<b>Optional</b><br>
 * REL-8: Asserting Organization (XON)<b>Optional</b><br>
 * REL-9: Assertor Address (XAD)<b>Optional</b><br>
 * REL-10: Assertor Contact (XTN)<b>Optional</b><br>
 * REL-11: Assertion Date Range (DR)<b>Optional</b><br>
 * REL-12: Negation Indicator (ID)<b>Optional</b><br>
 * REL-13: Certainty of Relationship (CWE)<b>Optional</b><br>
 * REL-14: Priority No (NM)<b>Optional</b><br>
 * REL-15: Priority Sequence No (NM)<b>Optional</b><br>
 * REL-16: Separability Indicator (ID)<b>Optional</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 REL extends Segment    
{
	


	/**
	 * Constucts the VAR segment.
	 */
	public REL()
	{
		super(EnumSegments.HL7_SEG_REL);
	}

	/**
	 * Retrieves the Set ID REL.
	 * @return SI - setID_REL
	 */
	public SI getSetID_REL() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2240);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SI)objDataCollection.elementAt(0);
		else
			return null;
	}
	/**
	 * Retrieves the Relationship Type.  
	 * @return CWE - relationshipType.
	 */
	public CWE getRelationshipType() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2241);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the This Relationship Instance Identifier.
	 * @return EI - thisRelationshipInstanceIdentifier
	 */
	public EI getThisRelationshipInstanceIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2242);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}
	/**
	 * Retrieves the Source Information Instance Identifier.
	 * @return EI - sourceInformationInstanceIdentifier
	 */
	public EI getSourceInformationInstanceIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2243);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Target Information Instance Identifier.
	 * @return EI - target Information Instance Identifier.
	 */
	public EI getTargetInformationInstanceIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2244);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Asserting Entity Instance ID.
	 * @return EI - assertingEntityInstanceID.
	 */
	public EI getAssertingEntityInstanceID() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2245);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/** 
	 * Retrieves the Asserting Person.
	 * This field contains the Identifier details of the Person who asserted the relationship.
	 * @return XCN - assertingPerson.
	 */ 
	public XCN getAssertingPerson()
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2246);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (XCN)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/** 
	 * Retrieves the Asserting Organization.
	 * This field contains the Identifier details of the Organization that asserted the relationship.
	 * @return XON - assertingOrganization.
	 */ 
	public XON getAssertingOrganization()
	{		
		ISingleCollection<IDataType> objDataCollection =getDataType(2247);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (XON)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/** Retrieves the Assertor Address. 
	 * @return XAD - assertorAddress.
	 */ 
	public XAD getAssertorAddress()
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2248);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (XAD)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Assertor Contact.
	 * This field contains the address of the Person or Organization that asserted the relationship.
	 * @return XTN - assertorContact
	 */
	public XTN getAssertorContact() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2249);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (XTN)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Assertion Date Range.  
	 * @return DR - assertionDateRange
	 */
	public DR getAssertionDateRange() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2250);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DR)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Negation Indicator. 
	 * @return ID - negationIndicator
	 */
	public ID getActionCode() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2251);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Certainty of Relationship.  
	 * @return CWE - certaintyofRelationship.
	 */
	public CWE getCertaintyofRelationship() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2252);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Priority No.
	 * This field contains the priority number as used, for example, in relative ordering, plans, and workflows.  
	 * @return NM - priorityNo
	 */
	public NM getPriorityNo() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2253);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (NM)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	
	/**
	 * Retrieves the Priority Sequence No.
	 * This field contains the priority sequence number as used, for example, in relative preference for consideration.  
	 * @return NM - prioritySequenceNo.
	 */
	public NM getPrioritySequenceNo() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2254);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (NM)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Separability Indicator.
	 * This field indicates whether source and target can be interpreted independently.  
	 * @return ID - separabilityIndicator
	 */
	public ID getSeparabilityIndicator() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2255);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Negation Indicator.
	 * This field contains the date range relevant to the assertion of the relationship. 
	 * @param strNegationIndicator Specifies the the intent of the message    
	 */
	public ID getNegationIndicator() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2251);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/** Set the Source Information Instance Identifier.
	 * @param objSourceInformationInstanceIdentifier.   
	 */ 
	public void setVarianceInstanceID(EI objSourceInformationInstanceIdentifier)
	{
		setDataType(2242,objSourceInformationInstanceIdentifier);

	}

	/**
	 * Set the Set ID REL.
	 * @param strSetID_REL This field contains the Set ID of the specific relationship Record.
	 */	
	public void setSetID_REL(String strSetID_REL) 
	{
		SI setID_REL  = (SI)getDataElement(2240);
		setID_REL.setValue(strSetID_REL);
		setSetID_REL(setID_REL);
	}

	/** 
	 * Set the Set ID REL.
	 * @param objSetID_REL Object of Set ID REL. 
	 */ 
	public void setSetID_REL(SI objSetID_REL)
	{
		setDataType(2240,objSetID_REL);

	}

	/**
	 * Set the Relationship Type.
	 * This field contains the type of the relationship.
	 * @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 setRelationshipType (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(2241);
		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);
		setRelationshipType(cwe);

	} 

	/**
	 * Set the RelationshipType.
	 * This field contains the type of the relationship.
	 * @param objRelationshipType.
	 */ 
	public void setRelationshipType(CWE objRelationshipType)
	{
		setDataType(2241,objRelationshipType);
	}
	
	/**
	 * Set the This Relationship Instance Identifier.
	 * This field contains the instance identifier of this relationship.
	 * @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 setThisRelationshipInstanceIdentifier (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI ei  = (EI)getDataElement(2242);
		ei.setEntityIdentifier(strEntityIdentifier);
		ei.setNamespaceId(strNamespaceId);
		ei.setUniversalId(strUniversalId);
		ei.setUniversalIdType(strUniversalIdType); 
		setThisRelationshipInstanceIdentifier(ei);

	} 

	/** 
	 * Set the This Relationship Instance Identifier.
	 * This field contains the instance identifier of this relationship.
	 * @param objThisRelationshipInstanceIdentifier
	 */ 
	public void setThisRelationshipInstanceIdentifier(EI objThisRelationshipInstanceIdentifier)
	{
		setDataType(2242,objThisRelationshipInstanceIdentifier);

	}
	
	/**
	 * Set the Source Information Instance Identifier.
	 * This field contains the Instance ID of the Source Segment.
	 * @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 setSourceInformationInstanceIdentifier (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI ei  = (EI)getDataElement(2243);
		ei.setEntityIdentifier(strEntityIdentifier);
		ei.setNamespaceId(strNamespaceId);
		ei.setUniversalId(strUniversalId);
		ei.setUniversalIdType(strUniversalIdType); 
		setSourceInformationInstanceIdentifier(ei);

	} 

	/** 
	 * Set the Source Information Instance Identifier.
	 * This field contains the Instance ID of the Source Segment.
	 * @param objSourceInformationInstanceIdentifier
	 */ 
	public void setSourceInformationInstanceIdentifier(EI objSourceInformationInstanceIdentifier)
	{
		setDataType(2243,objSourceInformationInstanceIdentifier);

	}
	
	/**
	 * Set the Target Information Instance Identifier.
	 * This field contains the Instance ID of the Target Segment.
	 * @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 setTargetInformationInstanceIdentifier (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI ei  = (EI)getDataElement(2244);
		ei.setEntityIdentifier(strEntityIdentifier);
		ei.setNamespaceId(strNamespaceId);
		ei.setUniversalId(strUniversalId);
		ei.setUniversalIdType(strUniversalIdType); 
		setTargetInformationInstanceIdentifier(ei);

	} 

	/** 
	 * Set the Target Information Instance Identifier.
	 * This field contains the Instance ID of the Target Segment.
	 * @param objTargetInformationInstanceIdentifier.
	 */ 
	public void setTargetInformationInstanceIdentifier (EI objTargetInformationInstanceIdentifier)
	{
		setDataType(2244,objTargetInformationInstanceIdentifier);

	}
	
	/**
	 * Set the Asserting Entity Instance ID.
	 * This field contains the Instance ID of the Person or Organization that asserted the relationship.
	 * @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 setAssertingEntityInstanceID (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI ei  = (EI)getDataElement(2245);
		ei.setEntityIdentifier(strEntityIdentifier);
		ei.setNamespaceId(strNamespaceId);
		ei.setUniversalId(strUniversalId);
		ei.setUniversalIdType(strUniversalIdType); 
		setAssertingEntityInstanceID(ei);

	} 

	/** 
	 * Set the Asserting Entity Instance ID.
	 * This field contains the Instance ID of the Person or Organization that asserted the relationship.
	 * @param objAssertingEntityInstanceID.
	 */ 
	public void setAssertingEntityInstanceID(EI objAssertingEntityInstanceID)
	{
		setDataType(2245,objAssertingEntityInstanceID);

	}
	
	
	/**
	 * Set the Asserting Person.
	 * This field contains the Identifier details of the Person who asserted the relationship.  
	 * @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 setAssertingPerson  (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(2246);
		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);
		setAssertingPerson(xcn);

	} 
	/** 
	 * Set the Asserting Person.
	 * This field contains the Identifier details of the Person who asserted the relationship.
	 * @param objAssertingPerson Used as Performing Organization Name.
	 */ 
	public void setAssertingPerson(XCN objAssertingPerson)
	{
		setDataType(2246,objAssertingPerson);
	}
	
	/** Set the Asserting Organization.
	 * This field contains the Identifier details of the Organization that asserted the relationship.    
     * @param strOrganizationName Specifies name of the specified organization.
	 * @param strOrganizationNameTypeCode Specifies a code that represents the type of name i.e., legal name, display name.
	 * 										Suggested Values A,L,D,SL.[Refer to table No.0204]  
	 * @param objAssigningAuthority Specifies The assigning authority is a unique identifier of the system 
	 * 									(or organization or agency or department) that creates the data. 
	 * @param strIdentifierTypeCode Specifies a code corresponding to the type of identifier. 
	 * @param objAssigningFacility Specifies The place or location identifier where the identifier was first assigned to the person. 
	 * @param strNameRepresentationCode Specifies representations of the same name/address Suggested values are I,A,P [Refer table 0465] 
	 * @param strOrganizationIdentifier This component contains the sequence of characters (the code) that uniquely 
	 * 									  identifies the item being referenced by XON.1 Organization Name. 
	 * 									  This component replaces XON.3 ID Number as of v 2.5.
	 */ 
	public void setAssertingOrganization(String strOrganizationName, CWE objOrganizationNameTypeCode,
			 HD objAssigningAuthority,
			String strIdentifierTypeCode, HD objAssigningFacility, String strNameRepresentationCode,
			String strOrganizationIdentifier)
	{
		XON xon  = (XON)getDataElement(2247);
		xon.setOrganizationName(strOrganizationName);
		xon.setOrganizationNameTypeCode(objOrganizationNameTypeCode);
		xon.setAssigningAuthority(objAssigningAuthority);
		xon.setIdentifierTypeCode(strIdentifierTypeCode);
		xon.setAssigningFacility(objAssigningFacility);
		xon.setNameRepresentationCode(strNameRepresentationCode);
		xon.setOrganizationIdentifier(strOrganizationIdentifier);
		setAssertingOrganization(xon);

	} 
	/**  Set the Asserting Organization.
	 * This field contains the Identifier details of the Organization that asserted the relationship.
	 * @param objAssertingOrganization Used as Performing Organization Name.
	 */ 
	public void setAssertingOrganization(XON objAssertingOrganization)
	{
		setDataType(2247,objAssertingOrganization);
	}
	
	/**
	 * Set the Assertor Address.
	 * This field contains the address of the Person or Organization that asserted the relationship.  
	 * @param objStreetAddress Specifies the street address.
	 * @param strOtherDesignation Specifies the Second line of address. 
	 * @param strCity The city, or district or place where the addressee is located. 
	 * @param strStateOrProvince Specifies the state or province where the addressee is located.
	 * @param strZipOrPostalCode Specifies the zip or postal code where the addressee is located. 
	 * @param strCountry Specifies the country where the addressee is located.
	 * @param strAddressType Specifies the kind or type of address.
	 * @param strOtherGeographicDesignation Specifies any other geographic designation. 
	 * @param objCountyParishCode Specifies a code that represents the county in which the specified address resides. 
	 * @param objCensusTract Specifies a code that represents the census tract in which the specified address resides. 
	 * @param strAddressRepresentationCode Specifies representations of the same name/address Suggested values are I,A,P [Refer table 0465]
	 * @param objEffectiveDate It is The first date, if known, on which the address is valid and active.
	 * @param objExpirationDate It is The last date, if known, on which the address is valid and active.
	 * @param objExpirationReason indicates why this address was marked as ended.
	 * @param strTemporaryIndicator indicates whether address is considered temporary .
	 * @param strBadAddressIndicator indicates whether it is possible to contact the owning entity.
	 * @param strAddressUsage indicates how the address is intended to be used.
	 * @param strAddressee indicates the name of the person whose address is intended to be used.
	 * @param strComment indicated descriptive information
	 * @param strPreferenceOrder preference order
	 * @param objProtectionCode indicates that an address need to be protected
	 * @param objAdressIdentifier indicates a unique identifier for address
	 */ 
	public void setAssertorAddress (SAD objStreetAddress,String strOtherDesignation,String strCity,
			String strStateOrProvince,String strZipOrPostalCode,String strCountry,String strAddressType,
			String strOtherGeographicDesignation,CWE objCountyParishCode,CWE objCensusTract,
			String strAddressRepresentationCode,DTM objEffectiveDate,
			DTM objExpirationDate, CWE objEXpirationReason, String strTemporaryIndicator,
			String strBadAddressIndicator, String strAddressUsage, String strAddressee, String strComment,
			String strPreferenceOrder, CWE objProtectionCode, EI objAddressIdentifier)
	{
		XAD xad = (XAD)getDataElement(2248);
		xad.setStreetAddress(objStreetAddress);
		xad.setOtherDesignation(strOtherDesignation);
		xad.setCity(strCity);
		xad.setStateOrProvince(strStateOrProvince);
		xad.setZipOrPostalCode(strZipOrPostalCode);
		xad.setCountry(strCountry);
		xad.setAddressType(strAddressType);
		xad.setOtherGeographicDesignation(strOtherGeographicDesignation);
		xad.setCountyParishCode(objCountyParishCode);
		xad.setCensusTract(objCensusTract);
		xad.setAddressRepresentationCode(strAddressRepresentationCode);
 
		xad.setEffectiveDate(objEffectiveDate);
		xad.setExpirationDate(objExpirationDate); 
		xad.setExpirationReason(objEXpirationReason);
		xad.setTemporaryIndicator(strTemporaryIndicator);
		xad.setBadAddressIndicator(strBadAddressIndicator);
		xad.setAddressUsage(strAddressUsage);
		xad.setAddressee(strAddressee);
		xad.setComment(strComment);
		xad.setPreferenceOrder(strPreferenceOrder);
		xad.setProtectionCode(objProtectionCode);
		xad.setAddressIdentifier(objAddressIdentifier);
		setAssertorAddress(xad);

	} 
	/** Set the Assertor Address.
	 * This field contains the address of the Person or Organization that asserted the relationship.
	 * @param objAssertorAddress Used as Performing Organization Name.
	 */ 
	public void setAssertorAddress(XAD objAssertorAddress)
	{
		setDataType(2248,objAssertorAddress);
	}
	
	/**
	 * Set the Assertor Contact.
	 * This field contains the address of the Person or Organization that asserted the relationship.
	 * @param strTeleCommunicationUseCode Specifies a code that represents a specific use of a telecommunication number.
	 										Suggested values are PRN,ORN,WPN,VHN,ASN,EMR,NET,BPN  [Refer table 0201.]
	 * @param strTeleCommunicationEquipmentType Specifies a code that represents the type of telecommunication equipment.
	 * 											  Suggested values are PH,FX,MD,CP,BP,Internet,X.400,TDD,TTY  [Refer table 0202.]
	 * @param strCommuinicationAddress Specifies Email address.
	 * @param strCountryCode Specifies the Country code.
	 * @param strAreaCityCode Specifies the area /City Code.
	 * @param strLocalNumber Specifies an Local Number.
	 * @param strExtension Specifies an Extension.
	 * @param strAnyText Contains comments with respect to the telephone number.
	 * @param strExtensionPrefix Specifies the characters established within a company-s 
	 * 							   internal telephone system network used as a prefix to the Extension component for internal dialing. 
	 * @param strSpeedDialCode Specifies The characters established within a 
	 * 							 company's internal telephone system used in place of the (external) telephone number.
	 * @param strUnformattedTelephoneNumber Specifies an expression of the telephone number as an unparsible string.
	 * @param strEffectiveStartDate Specifies start date.
	 * @param strExpirationDate Specifies expiration date.
	 * @param objExpirationReason Specifies reason why this contact is marked as ended.
	 * @param objProtectionCode Specifies reason why this information is sensitive or protected.
	 * @param objSharedTelecommunicationIdentifier Specifies a unique phone number phone telephone number or email-id.
	 * @param strPreferenceOrder Specifies the preference order for an entity..
	 */  
	public void setAssertorContact (String strTeleCommunicationUseCode,String strTeleCommunicationEquipmentType
			,String strCommuinicationAddress,String strCountryCode,String strAreaCityCode,String strLocalNumber,String strExtension,String strAnyText,
			String strExtensionPrefix,String strSpeedDialCode,String strUnformattedTelephoneNumber, String strEffectiveStartDate, String strExpirationDate,
			CWE objExpirationReason, CWE objProtectionCode, EI objSharedTelecommunicationIdentifier, String strPreferenceOrder)
	{
		XTN xtn  = (XTN)getDataElement(2249);
//		xtn.setTelephoneNumber(strTelephoneNumber);
		xtn.setTelecommunicationUseCode(strTeleCommunicationUseCode);
		xtn.setTelecommunicationEquipmentType(strTeleCommunicationEquipmentType);
		xtn.setCommuinicationAddress(strCommuinicationAddress);
		xtn.setCountryCode(strCountryCode);
		xtn.setAreaCityCode(strAreaCityCode);
		xtn.setLocalNumber(strLocalNumber);
		xtn.setExtension(strExtension);
		xtn.setAnyText(strAnyText);
		xtn.setExtensionPrefix(strExtensionPrefix);
		xtn.setSpeedDialCode(strSpeedDialCode);
		xtn.setUnformattedTelephonenumber(strUnformattedTelephoneNumber); 
		xtn.setEffectiveStartDate(strEffectiveStartDate);
		xtn.setExpirationDate(strExpirationDate);
		xtn.setExpirationReason(objExpirationReason);
		xtn.setProtectionCode(objProtectionCode);
		xtn.setSharedTelecommunicationIdentifier(objSharedTelecommunicationIdentifier);
		xtn.setPreferenceOrder(strPreferenceOrder); 
		setAssertorContact(xtn);

	} 

	/** 
	 * Set the Assertor Contact.
	 * This field contains the address of the Person or Organization that asserted the relationship.
	 * @param objAssertorContact Object of Assertor Contact.
	 */ 
	public void setAssertorContact(XTN objAssertorContact)
	{
		setDataType(2249,objAssertorContact);

	}
	
	/**
	 * Set the Assertion Date Range.
	 * This field contains the date range during which assertion of the relationship took place.
	 * @param objRangeStartDateTime Specifies the earliest date/time (time stamp) in the specified range.
	 * @param objRangeEndDateTime Specifies the latest date/time in the specified range.
	 */ 
	public void setAssertionDateRange (DTM objRangeStartDateTime,DTM objRangeEndDateTime)
	{
		DR dr = (DR)getDataElement(2250);
		dr.setRangeStartDateTime(objRangeStartDateTime);
		dr.setRangeEndDateTime(objRangeEndDateTime); 
		setAssertionDateRange(dr);
	} 

	/**
	 * Set the Assertion Date Range.
	 * This field contains the date range during which assertion of the relationship took place.
	 * @param objRangeStartDateTime Specifies the earliest date/time (time stamp) in the specified range.
	 * @param objRangeEndDateTime Specifies the latest date/time in the specified range.
	 */ 
	public void setAssertionDateRange (DR objAssertionDateRange)
	{
		setDataType(2250,objAssertionDateRange);
	} 
	
//	/** 
//	 * Set the Assertion Date Range.
//	 * This field contains the date range during which assertion of the relationship took place.
//	 * @param objAssertionDateRange Object of Specimen Collection Date Time.
//	 */ 
//	public void setSpecimenCollectionDateTime(DR objAssertionDateRange)
//	{
//		setDataType(2250,objAssertionDateRange);
//	}
//	.............
	/**
	 * Set the Negation Indicator.
	 * This field contains the date range relevant to the assertion of the relationship. 
	 * @param strNegationIndicator Specifies the the intent of the message    
	 */ 
	public void setNegationIndicator (String strNegationIndicator)
	{
		ID id  = (ID)getDataElement(2251);
		id.setValue(strNegationIndicator); 
		setNegationIndicator(id);


	} 

	/** Set the Negation Indicator.
	 * This field contains the date range relevant to the assertion of the relationship. 
	 * @param objNegationIndicator Specifies the the intent of the message    
	 */ 
	public void setNegationIndicator(ID objNegationIndicator)
	{
		setDataType(2251,objNegationIndicator);
	}
	
	/**
	 * Set the Certainty of Relationship.
	 * This field contains the certainty of existence of the relationship.
	 * @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 setCertaintyofRelationship (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(2252);
		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);
		setCertaintyofRelationship(cwe);

	} 

	/**
	 * Set the Certainty of Relationship.
	 * This field contains the certainty of existence of the relationship.
	 * @param objCertaintyofRelationship.
	 */ 
	public void setCertaintyofRelationship(CWE objCertaintyofRelationship)
	{
		setDataType(2252,objCertaintyofRelationship);
	}
	
	/**
	 * Set the Priority No.
	 * This field contains the priority number as used, for example, in relative ordering, plans, and workflows.
	 * @param strPriorityNo A quantitative or numeric representation of the certainty that the problem exists for this patient
	 */ 
	public void setPriorityNo (String strPriorityNo)  
	{
		NM nm  = (NM)getDataElement(2253);
		nm.setValue(strPriorityNo); 
		setPriorityNo(nm);
	} 

	/** 
	 * Set the Priority No.
	 * This field contains the priority number as used, for example, in relative ordering, plans, and workflows.
	 * @param objPriorityNo A quantitative or numeric representation of the certainty that the problem exists for this patient
	 */ 
	public void setPriorityNo (NM objPriorityNo)
	{
		setDataType(2253,objPriorityNo);

	}
	
	/**
	 * Set the Priority Sequence No.
	 * This field indicates whether source and target can be interpreted independently.
	 * @param strPrioritySequenceNo A quantitative or numeric representation of the certainty that the problem exists for this patient
	 */ 
	public void setPrioritySequenceNo (String strPrioritySequenceNo)  
	{
		NM nm  = (NM)getDataElement(2254);
		nm.setValue(strPrioritySequenceNo); 
		setPriorityNo(nm);
	} 

	/** 
	 * Set the Priority Sequence No.
	 * This field indicates whether source and target can be interpreted independently.
	 * @param objPrioritySequenceNo A quantitative or numeric representation of the certainty that the problem exists for this patient
	 */ 
	public void setPrioritySequenceNo (NM objPrioritySequenceNo)
	{
		setDataType(2254,objPrioritySequenceNo);

	}
	
	/**
	 * Set the Separability Indicator.
	 * This field indicates whether source and target can be interpreted independently.  
	 * @param setSeparabilityIndicator Specifies the the intent of the message.    
	 */ 
	public void setSeparabilityIndicator (String strSeparabilityIndicator)
	{
		ID id  = (ID)getDataElement(2255);
		id.setValue(strSeparabilityIndicator); 
		setSeparabilityIndicator(id);

	} 

	/** Set the Separability Indicator.
	 * This field reveals the intent of the message.
	 * This field indicates whether source and target can be interpreted independently.      
	 */ 
	public void setSeparabilityIndicator(ID objSeparabilityIndicator)
	{
		setDataType(2255, objSeparabilityIndicator);
	}
	
	/**
	 * 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 Throws when Segment Validation fails.
	 */
	@Override
	public boolean validate() throws InvalidSegmentException 
	{
		try
		{
			/*
			 * Variance Instance ID, Documented Date Time  are required fields.
			 */
			super.validate();
			return true;
		}
		catch(FieldMissingException ex)
		{
			throw new InvalidSegmentException(enumSegments.getValue(),ex);
		}
	}
}