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

/**
 * SPR - Stored Procedure Request.<p>
 * The SPR segment is used to issue queries using stored procedure calls.
 * <p>Represents an HL7 SPR message segment. 
 * This segment has the following fields:</p><p>
 * SPR-1: Query Tag (ST)<b>Optional</b><br> 
 * SPR-2: Query/Response Format Code (ID)<b>Required</b><br> 
 * SPR-3: Stored Procedure Name (CE)<b>Required</b><br> 
 * SPR-4: Input Parameter List (QIP)<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 SPR extends Segment    
{
	





	/**
	 *  Constructs the SPR Segment
	 */
	public SPR()
	{super(EnumSegments.HL7_SEG_SPR);
	}

//	/**
//	 * Retrieves the Query tag.
//	 * @return ST - queryTag
//	 */
//	public ST getQueryTag() 
//	{
//		ISingleCollection<IDataType> objDataCollection =getDataType(696);
//		if(objDataCollection != null && objDataCollection.size() != 0) 
//			return (ST)objDataCollection.elementAt(0);
//		else
//			return null;
//	}
//
//	/**
//	 * Set the query tag.
//	 * This field may be valued by the initiating system to identify the query, and may be used to match response messages to the originating query. 
//	 * @param strQueryTag Specifies string value of QueryTag.
//	 */ 
//	public void setQueryTag (String strQueryTag) 
//	{
//		ST queryTag  = (ST)getDataElement(696);
//		queryTag.setValue(strQueryTag); 
//		setQueryTag(queryTag);
//	} 
//
//	/** Set the query tag.
//	 * This field may be valued by the initiating system to identify the query, and may be used to match response messages to the originating query. 
//	 * @param strQueryTag Specifies string value of QueryTag.
//	 */ 
//	public void setQueryTag(ST objqueryTag)
//	{
//		setDataType(696,objqueryTag);
//	}	
//	/**
//	 * Retrieves the Query Response Format Code.
//	 * This field refers to HL7 Table 0106 - Query/response format code for valid values.
//	 * @return string- queryResponseFormatCode
//	 */
//	public ID getQueryResponseFormatCode() 
//	{
//		ISingleCollection<IDataType> objDataCollection =getDataType(697);
//		if(objDataCollection != null && objDataCollection.size() != 0) 
//			return (ID)objDataCollection.elementAt(0);
//		else
//			return null;
//	}
//
//	/**
//	 * Set the Query Response Format Code.
//	 * This field refers to HL7 Table 0106 - Query/response format code for valid values D,R,T.
//	 * @param strQueryResponseFormatCode Specifies string value of QueryResponseFormatCode.
//	 */ 
//	public void setQueryResponseFormatCode (String strQueryResponseFormatCode) 
//	{
//		ID queryResponseFormatCode  = (ID)getDataElement(697);
//		queryResponseFormatCode.setValue(strQueryResponseFormatCode); 
//		setQueryResponseFormatCode(queryResponseFormatCode);
//	} 
//
//	/** @param strQueryResponseFormatCode Specifies string value of QueryResponseFormatCode.
//	 */ 
//	public void setQueryResponseFormatCode(ID objqueryResponseFormatCode)
//	{
//		setDataType(697,objqueryResponseFormatCode);
//	}	
//	/**
//	 * Retrieves the Input Parameter List.
//	 * @return ISingleCollection<QIP> - inputParameterList
//	 */
//	public ISingleCollection<QIP> getInputParameterList() 
//	{
//		ISingleCollection<IDataType> objDataCollection =getDataType(705);
//		ISingleCollection<QIP> objDataList = new SingleCollection<QIP>(); 
//		if(objDataCollection != null && objDataCollection.size() != 0)
//		{
//			for(IDataType objDataType : objDataCollection)
//			{
//				QIP objQIP = (QIP)objDataType;
//				objDataList.add(objQIP);
//			}
//		}
//		return objDataList;
//	}
//
//	/**
//	 * Set the Input Parameter List.
//	 * @param strSegmentFieldName This component contains the segment field name
//	 * @param strValues This component contains the field value or values in the form "value1& value2 & value3...".
//	 */ 
//	public void addInputParameterList (String strSegmentFieldName, String strValues) 
//	{
//		QIP tempInputParameter  = (QIP)getDataElement(705);
//		tempInputParameter.setSegmentFieldName(strSegmentFieldName);
//		tempInputParameter.setValues(strValues); 
//		addInputParameterList(tempInputParameter);
//	} 
//
//	/** Set the Input Parameter List.
//	 * @param strSegmentFieldName This component contains the segment field name
//	 * @param strValues This component contains the field value or values in the form "value1& value2 & value3...".
//	 */ 
//	public void addInputParameterList(QIP objtempInputParameter)
//	{
//		addDataType(705,objtempInputParameter);
//	}	
//	/**
//	 * Set the Input Parameter List.
//	 * @param objDiagnosingClinicianList List of Input Parameter List.
//	 */	
//	@SuppressWarnings("unchecked")
//	public void setInputParameterList(ISingleCollection<QIP> objDiagnosingClinicianList)
//	{
//		ISingleCollection<IDataType> objCollection = null;
//		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objDiagnosingClinicianList;
//		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
//		setDataType(705,objCollection);
//	}
//
//	/**
//	 * Retrieves the Stored Procedure Name.
//	 * @return CE - storedProcedureName
//	 */
//	public CE getStoredProcedureName() 
//	{
//		ISingleCollection<IDataType> objDataCollection =getDataType(704);
//		if(objDataCollection != null && objDataCollection.size() != 0) 
//			return (CE)objDataCollection.elementAt(0);
//		else
//			return null;
//	}
//
//	/**
//	 * Set the field Stored Procedure Name.
//	 * @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.
//	 */ 
//	public void setStoredProcedureName (String strIdentifier,String strText,String strNameOfCodingSystem,String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem)
//	{
//		CE storedProcedureName  = (CE)getDataElement(704);
//		storedProcedureName.setIdentifier(strIdentifier);
//		storedProcedureName.setText(strText);
//		storedProcedureName.setNameOfCodingSystem(strNameOfCodingSystem);
//		storedProcedureName.setAlternateIdentifier(strAlternateIdentifier);
//		storedProcedureName.setAlternateText(strAlternateText);
//		storedProcedureName.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
//		setStoredProcedureName(storedProcedureName);
//	} 
//
//	/** Set the field Stored Procedure Name.
//	 * @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.
//	 */ 
//	public void setStoredProcedureName(CE objstoredProcedureName)
//	{
//		setDataType(704,objstoredProcedureName);
//	}	
//	/**
//	 * Validates the Segment object.
//	 * This method checks for validation of each and every field as per HL7 attribute table of segment.
//	 * Validation chcecks include confirmation of presence of required field denoted by 'R' in OPT column of table.
//	 * It also verifies conditional fields(denoted by 'C').If condition is not fullfilled Exception is thrown.
//	 * Backward fields (denoted by 'B')are not checked for validation,as they are introduced for compatibility with previous versions. 
//	 * @return boolean - true or false.
//	 * @throws InvalidSegmentException Thrown when Any of required filed is missing.
//	 */
//	@Override
//	public boolean validate() throws InvalidSegmentException 
//	{
//		try
//		{
//			super.validate();
//			return true;
//		}
//		catch(FieldMissingException ex)
//		{
//			throw new InvalidSegmentException(enumSegments.getValue(),ex);
//		}
//	}
}