/*******************************************************************************
 *  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.CNE;
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.SI;
import cdac.medinfo.sdk.hl7282.baselibs.ST;
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;

/**
 * ARV - Access Restrictions segment. <p>
 * The ARV segment is used to communicate the requested/required type of access restrictions from system to system, at both the person/patient and the encounter/visit level 
 * <p>Represents an HL7 ARV message segment. 
 * This segment has the following fields:</p><p>
 * ARV-1: Set ID (SI)<b>Required</b><br> 
 * ARV-2: Access Restriction Action Code (CNE)<b>Required</b><br> 
 * ARV-3: Access Restriction Value (CWE)<b>Required</b><br> 
 * ARV-4: Access Restriction Reason (CWE)<b>Optional</b><br>
 * ARV-5: Special Access Restriction Instructions (ST)<b>Optional</b><br> 
 * ARV-6: Access Restriction Date Range (DR)<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 ARV extends Segment  
{
	

	/**
	 * Constructs the ARV segment.
	 */
	public ARV()
	{super(EnumSegments.HL7_SEG_ARV);
	}

	/**
	 * Retrieves the Set ID.
	 * This field contains the number that identifies this transaction. 
	 * @return String - setID
	 */
	public SI getSetID() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2143);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SI)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Access Restriction Action Code.
	 * This field contains a code defining the action to be taken for this segment.    
	 * @return CNE - Access Restriction Action Code
	 */
	public CNE getAccessRestrictionActionCode() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2144);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CNE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Access Restriction Value.  
	 * This field specifies the information to which access is restricted.  
	 * @return CWE - Access Restriction Value
	 */
	public CWE getAccessRestrictionValue() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2145);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Access Restriction Reason.
	 * This field is used to convey the reason for the restricted access.    
	 * @return ISingleCollection<CWE> - bPIndicationforUse
	 */
	public ISingleCollection<CWE> getAccessRestrictionReason() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2146);
		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 Special Access Restriction Instructions.
	 * Used to convey specific instructions about the protection of the patient's data (e.g., "Always refer to the patient as Mr. Everyman").  
	 * This field may also be used to specify instructions about the release of information to family and friends (e.g., "Do not release information to patient's brother, Adam Everyman"). 
	 * These instructions may be in conjunction with other fields (as elected by the system).
	 * @return ISingleCollection<ST> - Special Access Restriction Instructions
	 */
	public ISingleCollection<ST> getSpecialAccessRestrictionInstructions() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2147);
		ISingleCollection<ST> objDataList = new SingleCollection<ST>();
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				ST objST = (ST)objDataType;
				objDataList.add(objST);
			}
		}

		return objDataList;
	}
	
	/**
	 * Retrieves the Access Restriction Date Range .
	 * This element defines the date from which an access restriction commences until the date it is specifically rescinded.
	 * @return DR - Access Restriction Date Range 
	 */
	public DR getAccessRestrictionDateRange () 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2148);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DR)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Set ID.
	 * This field contains the number that identifies this transaction.
	 * @param strSetID Use as SetID.
	 */ 
	public void setSetID(String strSetID)
	{
		SI setID = (SI)getDataElement(2143);
		setID.setValue(strSetID); 
		setSetID(setID);

	} 

	/** Set the Set ID.
	 * This field contains the number that identifies this transaction.
	 * @param objsetID object of SetID.
	 */ 
	public void setSetID(SI objsetID)
	{
		setDataType(2143,objsetID);
	}
	
	/** 
	 * Set the Bc Component.
	 * This field contains a code defining the action to be taken for this segment.  
	 * @param strIdentifier Specifies sequence of characters (the code) that uniquely identifies
	 * 						 the item being referenced by the CNE.
	 * @param strText Specifies descriptive or textual name of the identifier, e.g., myocardial infarction 
	 * @param strNameOfCodingSystem Specifies the coding scheme being used in the identifier component. 
	 * @param strAlternateIdentifier Specifies the local or user seen code as described. 
	 * @param strAlternateText Specifies descriptive or textual name of the alternate identifier.  
	 * @param strNameOfAlternateCodingSystem Specifies the coding scheme being used in the alternate identifier 
	 * 											component.  
	 * @param strCodingSystemVersionID Specifies the version ID for the coding system. 
	 * @param strAlternateCodingSystemVersionID Specifies the version ID for the coding system .
	 * @param strOriginalText Specifies the original text that was available to an automated process or a human 
	 * 							before a specific code was assigned.
	 * @param strSecondAlternateIdentifier Specifies a sequence of characters that uniquely identifies the second alternate code
	 * @param strSecondAlternateText Specifies a the textual information of the second alternate code
	 * @param strNameOfSecondAltenateCodingSystem Specifies the second coding scheme being used in the identifier component.
	 * @param strSecondAlternateCodingSystemVersionID Specifies version ID of Second alternative coding system.
	 * @param strCodingSystemOID contains the ISO Object identifier for the coding system.
	 * @param strValueSetOID contains the value set from which CNE-1 is obtained 
	 * @param strValueSetVersionID contains the version of the value set identified by CNE-15. 
	 * @param strAlternateCodingSystemOID contains the ISO Object identifier for the alternate coding system
	 * @param strAlternateValueSetOID contains the value set from which CNE-4 is obtained
	 * @param strAlternateValueSetVersionID contains the version of the value set identified by CNE-18. 
	 * @param strSecondAlternateCodingSystemOID contains the value set from which CNE-12 is obtained
	 * @param strSecondAlternateValueSetOID contains the value set from which CNE-10 is obtained
	 * @param strSecondAlternateValueSetVersionID contains the version of the value set identified by CNE-21. 
	 */
	public void setAccessRestrictionActionCode (String strIdentifier,String strText,String strNameOfCodingSystem,String strAlternateIdentifier,
			String strAlternateText,String strNameOfAlternateCodingSystem,String strCodingSystemVersionID,
			String strAlternateCodingSystemVersionID,String strOriginalText, String strSecondAlternateIdentifier, String strSecondAlternateText,
			String strNameOfSecondAltenateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, 
			String strValueSetOID, String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID,
			String strAlternateValueSetVersionID, String strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID,
			String strSecondAlternateValueSetVersionID)
	{
		CNE cne  = (CNE)getDataElement(2144);
		cne.setIdentifier(strIdentifier);
		cne.setText(strText);
		cne.setNameOfCodingSystem(strNameOfCodingSystem);
		cne.setAlternateIdentifier(strAlternateIdentifier);
		cne.setAlternateText(strAlternateText);
		cne.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem);
		cne.setCodingSystemVersionID(strCodingSystemVersionID);
		cne.setAlternateCodingSystemVersionID(strAlternateCodingSystemVersionID);
		cne.setOriginalText(strOriginalText); 
		cne.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cne.setSecondAlternateText(strSecondAlternateText);
		cne.setNameofSecondAlternateCodingSystem(strNameOfSecondAltenateCodingSystem);
		cne.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cne.setCodingSystemOID(strCodingSystemOID);
		cne.setValueSetOID(strValueSetOID);
		cne.setValueSetVersionID(strValueSetVersionID);
		cne.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cne.setAlternateValueSetOID(strAlternateValueSetOID);
		cne.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cne.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cne.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cne.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setAccessRestrictionActionCode(cne);

	} 

	/** 
	 * Set the Access Restriction Action Code.
	 * This field includes an identifier and description of the specific blood component.
	 * @param objAccessRestrictionActionCode object of Bc Component.
	 */ 
	public void setAccessRestrictionActionCode(CNE objAccessRestrictionActionCode)
	{
		setDataType(2144,objAccessRestrictionActionCode);

	}
	
	/**
	 * Set the Access Restriction Value.
	 * This field specifies the information to which access is restricted.
	 * @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 setAccessRestrictionValue(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(2145);
		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);
		setAccessRestrictionValue(cwe);
	} 

	/** Set the  Access Restriction Value.
	 * This field specifies the information to which access is restricted.  
	 * @param objAccessRestrictionValue object of AccessRestrictionValue.
	 */ 
	public void setAccessRestrictionValue(CWE objAccessRestrictionValue)
	{
		addDataType(2145,objAccessRestrictionValue);
	}
	
	
	/**
	 * Set the Access Restriction Reason.
	 * @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 addAccessRestrictionReason(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(2146);
		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);
		addAccessRestrictionReason(cwe);
	} 

	/** Set the Access Restriction Reason.
	 * This field indicates any permanent or transient handicapped conditions.
	 * @param objtempAccessRestrictionReason object of AccessRestrictionReason.
	 */ 
	public void addAccessRestrictionReason(CWE objtempAccessRestrictionReason)
	{
		addDataType(2146,objtempAccessRestrictionReason);
	}

	/**
	 * Set the Access Restriction Reason list.
	 * @param objAccessRestrictionReasonList List of Access Restriction Reason
	 */	
	@SuppressWarnings("unchecked")
	public void setAccessRestrictionReason(ISingleCollection<CWE> objAccessRestrictionReasonList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objAccessRestrictionReasonList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(2146,objCollection);
	}

	/**
	 * Set the Special Access Restriction Instructions.
	 * Used to convey specific instructions about the protection of the patient's data (e.g., "Always refer to the patient as Mr. Everyman").  
	 * This field may also be used to specify instructions about the release of information to family and friends (e.g., "Do not release information to patient's brother, Adam Everyman"). 
	 * These instructions may be in conjunction with other fields (as elected by the system).
	 * @param strSpecialAccessRestrictionInstructions   
	 */ 
	public void addSpecialAccessRestrictionInstructions (String strSpecialAccessRestrictionInstructions) 
	{
		ST tempSpecialAccessRestrictionInstructions  = (ST)getDataElement(2147);
		tempSpecialAccessRestrictionInstructions.setValue(strSpecialAccessRestrictionInstructions); 
		addSpecialAccessRestrictionInstructions(tempSpecialAccessRestrictionInstructions);
	} 

	/** Set the Special Access Restriction Instructions.
	 * Used to convey specific instructions about the protection of the patient's data (e.g., "Always refer to the patient as Mr. Everyman").  
	 * This field may also be used to specify instructions about the release of information to family and friends (e.g., "Do not release information to patient's brother, Adam Everyman"). 
	 * These instructions may be in conjunction with other fields (as elected by the system).
	 * @param objtempSpecialAccessRestrictionInstructions object indicates Special Access Restriction Instructions.  
	 */ 
	public void addSpecialAccessRestrictionInstructions(ST objtempSpecialAccessRestrictionInstructions)
	{
		addDataType(2147,objtempSpecialAccessRestrictionInstructions);
	}

	/**
	 * Set the Special Access Restriction Instructions.
	 * Used to convey specific instructions about the protection of the patient's data (e.g., "Always refer to the patient as Mr. Everyman").  
	 * This field may also be used to specify instructions about the release of information to family and friends (e.g., "Do not release information to patient's brother, Adam Everyman"). 
	 * These instructions may be in conjunction with other fields (as elected by the system).
	 * @param objSpecialAccessRestrictionInstructions List of Special Access Restriction Instructions.
	 */
	@SuppressWarnings("unchecked")
	public void setSpecialAccessRestrictionInstructions(ISingleCollection<ST> objSpecialAccessRestrictionInstructions)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objSpecialAccessRestrictionInstructions;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(2147,objCollection);
	}
	
	/**
	 * Set the Access Restriction Date Range .
	 * This element defines the date from which an access restriction commences until the date it is specifically rescinded. 
	 * @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 setAccessRestrictionDateRange (DTM objRangeStartDateTime, DTM objRangeEndDateTime) 
	{
		DR accessRestrictionDateRange  = (DR)getDataElement(2148);
		accessRestrictionDateRange .setRangeStartDateTime(objRangeStartDateTime);
		accessRestrictionDateRange .setRangeEndDateTime(objRangeEndDateTime);
		setAccessRestrictionDateRange (accessRestrictionDateRange);
	}

	/**
	 * Set the Access Restriction Date Range .
	 * This element defines the date from which an access restriction commences until the date it is specifically rescinded.
	 * @param objAccess RestrictionDateRange  Object of Access Restriction Date Range .
	 */
	public void setAccessRestrictionDateRange (DR objAccessRestrictionDateRange )
	{
		setDataType(2148,objAccessRestrictionDateRange );

	}

	/**
	 * Validates HL7 Message objects .
	 * Validate method checks for validation each and every segments in side the Message object against specified message Structure. 
	 * Validation chcecks 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 
	{
		/*
		 * Data Line is required field.
		 */
		try 
		{
			super.validate();
			return true;		
		}
		catch(FieldMissingException ex)
		{
			throw new InvalidSegmentException(enumSegments.getValue(),ex);
		}
	}
}
