/*******************************************************************************
 *  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.EI;
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;

/**
 * IPC - Imaging Procedure Control Segment.<p>
 * The IPC segment contains information about tasks that need to be performed in order 
 * to fulfill the request for imaging service. The information includes location, 
 * type and instance identification of equipment (acquisition modality) and stages (procedure steps).  
 * <p>Represents an HL7 IPC message segment. 
 * This segment has the following fields:</p><p>
 * IPC-1: Accession Identifier (EI)<b>Required</b><br> 
 * IPC-2: Requested Procedure ID (EI)<b>Required</b><br> 
 * IPC-3: Study Instance UID (EI)<b>Required</b><br> 
 * IPC-4: Scheduled Procedure Step ID (EI)<b>Required</b><br> 
 * IPC-5: Modality (CWE)<b>Optional</b><br> 
 * IPC-6: Protocol Code (CWE)<b>Optional</b><br> 
 * IPC-7: Scheduled Station Name (EI)<b>Optional</b><br> 
 * IPC-8: Scheduled Procedure Step Location (CWE)<b>Optional</b><br> 
 * IPC-9: Scheduled AE Title (ST)<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 IPC extends Segment    
{
	

	/**
	 * Constructs the IPC segment.
	 */
	public IPC()
	{super(EnumSegments.HL7_SEG_IPC);
	}

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

	/**
	 * Retrieves the Accession Identifier.
	 * This field identify the Filler Order for an Imaging Service (Imaging Service Request). 
	 * @return EI - accessionIdentifier
	 */
	public EI getAccessionIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1330);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Modality.
	 * This type of equipment requested to acquire data during performance of a Procedure Step. 
	 * @return CWE - modality
	 */
	public CWE getModality() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1661);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Protocol Code.
	 * This field specify the One or more coded entries identifying the protocol according to which the Scheduled Procedure Step shall be performed.
	 * @return ISingleCollection<CWE> - protocolCode
	 */
	public ISingleCollection<CWE> getProtocolCode() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1662);
		ISingleCollection<CWE> objDataList = new SingleCollection<CWE>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				CWE objCE = (CWE)objDataType;
				objDataList.add(objCE);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Requested Procedure ID.
	 * This field identify the Requested Procedure that the workflow management IDIS 
	 * selected to perform as a part of the order for the imaging service.  
	 * @return EI - requestedProcedureID
	 */
	public EI getRequestedProcedureID() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1658);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Scheduled Station AE Title.
	 * This field contains the Application Entity Title of the modality
	 *  resource being requested for performance of a particular Scheduled Procedure Step. 
	 * @return ST - scheduledAETitle
	 */
	public ST getScheduledStationAETitle() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1665);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Scheduled Procedure Step ID.
	 * This field identifies particular Procedure 
	 * Step (sub-procedure) of the Requested Procedure that the workflow 
	 * management IDIS selected to perform as a part of the order for imaging service. 
	 * @return EI - scheduledProcedureStepID
	 */
	public EI getScheduledProcedureStepID() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1660);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Scheduled Procedure Step Location.
	 * This field specify a locally defined physical location of the modality
	 *  resource being requested for performance of particular Scheduled Procedure Step. 
	 * @return ISingleCollection<CWE> - scheduledProcedureStepLocation
	 */
	public ISingleCollection<CWE> getScheduledProcedureStepLocation() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1664);
		ISingleCollection<CWE> objDataList = new SingleCollection<CWE>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				CWE objCE = (CWE)objDataType;
				objDataList.add(objCE);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Scheduled Station Name.
	 * This field identify the instance of the modality resource being 
	 * requested for the performance of a particular Scheduled Procedure Step. 
	 * @return EI - scheduledStationName
	 */
	public EI getScheduledStationName() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1663);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Study Instance UID.
	 * This field specify Globally unique identifier assigned by the workflow management 
	 * IDIS to the Imaging Study under which all images and other DICOM objects 
	 * produced in the course of the Requested Procedure shall be collected. 
	 * @return EI - studyInstanceUID
	 */
	public EI getStudyInstanceUID() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1659);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Set the Accession Identifier.
	 * This field identify the Filler Order for an Imaging Service (Imaging Service Request). 
	 * @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 setAccessionIdentifier (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI accessionIdentifier  = (EI)getDataElement(1330);
		accessionIdentifier.setEntityIdentifier(strEntityIdentifier);
		accessionIdentifier.setNamespaceId(strNamespaceId);
		accessionIdentifier.setUniversalId(strUniversalId);
		accessionIdentifier.setUniversalIdType(strUniversalIdType); 
		setAccessionIdentifier(accessionIdentifier);

	} 

	/** 
	 * Set the Accession Identifier.
	 * This field identify the Filler Order for an Imaging Service (Imaging Service Request). 
	 * @param objaccessionIdentifier Object of Accession Identifier. 
	 */ 
	public void setAccessionIdentifier(EI objaccessionIdentifier)
	{
		setDataType(1330,objaccessionIdentifier);

	}

	/**
	 * Set the Modality.
	 * This type of equipment requested to acquire data during performance of a Procedure Step. 
	 * @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 setModality (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(1661);
		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);
		setModality(cwe);

	} 

	/** 
	 * Set the Modality.
	 * This type of equipment requested to acquire data during performance of a Procedure Step. 
	 * @param objmodality Object of Modality.
	 */ 
	public void setModality(CWE objmodality)
	{
		setDataType(1661,objmodality);

	}

	/**
	 * Add the Protocol Code.
	 * This field specify the One or more coded entries identifying the protocol according to which the Scheduled Procedure Step shall be performed.
	 * @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 addProtocolCode (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(1662);
		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); 
		addProtocolCode(cwe);

	} 

	/** 
	 * Add the Protocol Code.
	 * This field specify the One or more coded entries identifying the protocol according to which the Scheduled Procedure Step shall be performed.
	 * @param objprotocolCode Object of Protocol Code.
	 */ 
	public void addProtocolCode(CWE objprotocolCode)
	{
		addDataType(1662,objprotocolCode);

	} 

	/** 
	 * Set the Protocol Code.
	 * This field specify the One or more coded entries identifying the protocol according to which the Scheduled Procedure Step shall be performed.
	 * @param objprotocolCodeList List of Protocol Code.
	 */ 
	@SuppressWarnings("unchecked")
	public void setProtocolCode(ISingleCollection<CWE> objprotocolCodeList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objprotocolCodeList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1662,objCollection);
	}

	/**
	 * Set the Requested Procedure ID.
	 * This field identify the Requested Procedure that the workflow management IDIS 
	 * selected to perform as a part of the order for the imaging service.  
	 * @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 setRequestedProcedureID (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI requestedProcedureID  = (EI)getDataElement(1658);
		requestedProcedureID.setEntityIdentifier(strEntityIdentifier);
		requestedProcedureID.setNamespaceId(strNamespaceId);
		requestedProcedureID.setUniversalId(strUniversalId);
		requestedProcedureID.setUniversalIdType(strUniversalIdType); 
		setRequestedProcedureID(requestedProcedureID);

	} 

	/** 
	 * Set the Requested Procedure ID.
	 * This field identify the Requested Procedure that the workflow management IDIS 
	 * selected to perform as a part of the order for the imaging service.  
	 * @param objrequestedProcedureID Object of Requested Procedure ID. 
	 */ 
	public void setRequestedProcedureID(EI objrequestedProcedureID)
	{
		setDataType(1658,objrequestedProcedureID);

	}

	/**
	 * Set the Scheduled Station AE Title.
	 * This field contains the Application Entity Title of the modality
	 *  resource being requested for performance of a particular Scheduled Procedure Step.
	 * @param strScheduledStationAETitle .Contains value to be passed as Scheduled AE Title  
	 */ 
	public void setScheduledStationAETitle (String strScheduledStationAETitle)  
	{
		ST scheduledAETitle  = (ST)getDataElement(1665); 
		scheduledAETitle.setValue(strScheduledStationAETitle); 
		setScheduledStationAETitle(scheduledAETitle);

	} 

	/** 
	 * Set the Scheduled Station AE Title.
	 * This field contains the Application Entity Title of the modality
	 *  resource being requested for performance of a particular Scheduled Procedure Step.
	 * @param objscheduledAETitle Object of Scheduled Station AE Title.  
	 */ 
	public void setScheduledStationAETitle(ST objscheduledAETitle)
	{
		setDataType(1665,objscheduledAETitle);

	}

	/**
	 * Set the Scheduled Procedure Step ID.
	 * This field identifies particular Procedure 
	 * Step (sub-procedure) of the Requested Procedure that the workflow 
	 * management IDIS selected to perform as a part of the order for imaging service. 
	 * @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 setScheduledProcedureStepID (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI scheduledProcedureStepID  = (EI)getDataElement(1660);
		scheduledProcedureStepID.setEntityIdentifier(strEntityIdentifier);
		scheduledProcedureStepID.setNamespaceId(strNamespaceId);
		scheduledProcedureStepID.setUniversalId(strUniversalId);
		scheduledProcedureStepID.setUniversalIdType(strUniversalIdType); 
		setScheduledProcedureStepID(scheduledProcedureStepID);

	} 

	/** 
	 * Set the Scheduled Procedure Step ID.
	 * This field identifies particular Procedure 
	 * Step (sub-procedure) of the Requested Procedure that the workflow 
	 * management IDIS selected to perform as a part of the order for imaging service. 
	 * @param objscheduledProcedureStepID Object of Scheduled Procedure Step ID. 
	 */ 
	public void setScheduledProcedureStepID(EI objscheduledProcedureStepID)
	{
		setDataType(1660,objscheduledProcedureStepID);

	}

	/**
	 * Add the Scheduled Procedure Step Location.
	 * This field specify a locally defined physical location of the modality
	 *  resource being requested for performance of particular Scheduled Procedure Step. 
	 * @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 addScheduledProcedureStepLocation (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(1664);
		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);
		addScheduledProcedureStepLocation(cwe);

	} 

	/** 
	 * Add the Scheduled Procedure Step Location.
	 * This field specify a locally defined physical location of the modality
	 *  resource being requested for performance of particular Scheduled Procedure Step. 
	 * @param objscheduledProcedureStepLocation Object of Scheduled Procedure Step Location.
	 */ 
	public void addScheduledProcedureStepLocation(CWE objscheduledProcedureStepLocation)
	{
		addDataType(1664,objscheduledProcedureStepLocation);

	} 

	/** 
	 * Set the Scheduled Procedure Step Location.
	 * This field specify a locally defined physical location of the modality
	 *  resource being requested for performance of particular Scheduled Procedure Step. 
	 * @param objscheduledProcedureStepLocationList List of Scheduled Procedure Step Location.
	 */ 
	@SuppressWarnings("unchecked")
	public void setScheduledProcedureStepLocation(ISingleCollection<CWE> objscheduledProcedureStepLocationList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objscheduledProcedureStepLocationList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1664,objCollection);
	}

	/**
	 * Set the Scheduled Station Name.
	 * This field identify the instance of the modality resource being 
	 * requested for the performance of a particular Scheduled Procedure Step.
	 * @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 setScheduledStationName (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI scheduledStationName  = (EI)getDataElement(1663);
		scheduledStationName.setEntityIdentifier(strEntityIdentifier);
		scheduledStationName.setNamespaceId(strNamespaceId);
		scheduledStationName.setUniversalId(strUniversalId);
		scheduledStationName.setUniversalIdType(strUniversalIdType); 
		setScheduledStationName(scheduledStationName);

	} 

	/** 
	 * Set the Scheduled Station Name.
	 * This field identify the instance of the modality resource being 
	 * requested for the performance of a particular Scheduled Procedure Step.
	 * @param objscheduledStationName Object of Scheduled Station Name. 
	 */ 
	public void setScheduledStationName(EI objscheduledStationName)
	{
		setDataType(1663,objscheduledStationName);

	}

	/**
	 * Set the Study Instance UID.
	 * This field specify Globally unique identifier assigned by the workflow management 
	 * IDIS to the Imaging Study under which all images and other DICOM objects 
	 * produced in the course of the Requested Procedure shall be collected.
	 * @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 setStudyInstanceUID (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI studyInstanceUID  = (EI)getDataElement(1659);
		studyInstanceUID.setEntityIdentifier(strEntityIdentifier);
		studyInstanceUID.setNamespaceId(strNamespaceId);
		studyInstanceUID.setUniversalId(strUniversalId);
		studyInstanceUID.setUniversalIdType(strUniversalIdType); 
		setStudyInstanceUID(studyInstanceUID);

	} 

	/** 
	 * Set the Study Instance UID.
	 * This field specify Globally unique identifier assigned by the workflow management 
	 * IDIS to the Imaging Study under which all images and other DICOM objects 
	 * produced in the course of the Requested Procedure shall be collected.
	 * @param objstudyInstanceUID Object of Study Instance UID. 
	 */ 
	public void setStudyInstanceUID(EI objstudyInstanceUID)
	{
		setDataType(1659,objstudyInstanceUID);

	}

	/**
	 * 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
	 */
	public boolean validate() throws InvalidSegmentException 
	{
		try
		{
			/*
			 * Accession Identifier,Requested Procedure ID,Study Instance UID,Scheduled Procedure Step ID
			 * are required fields.
			 */
			super.validate();

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