/*******************************************************************************
 *  Copyright 2017-2018 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.dcm30_04.baselibs;

import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataElement;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDicomValue;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDictionaryReader;
import cdac.medinfo.sdk.dcm30_04.commoninterface.ITransferSyntax;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConstants;
/**
* This item class contains methods to validate, set and get the attributes of Unified Procedure Step Performed Procedure Sequence .
 */

public class UnifiedProcedureStepPerformedProcedureSequenceItem extends Item  
{
	

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * This constructor creates the item and internal code sequence macro with default TransferSyntax 
	 */
	UnifiedProcedureStepPerformedProcedureSequenceItem()
	{
		super();
	}

	/*
	 * This constructor calls the respective superclass constructor
	 * This constructor should throw exception if null TS is tried to be set
	 */
	/**
	 * This constructor creates the item and internal code sequence macro with default TransferSyntax 
	 * @param objITransferSyntax specifies the DICOM Standard defined TransfeSyntax
	 */
	UnifiedProcedureStepPerformedProcedureSequenceItem(ITransferSyntax objITransferSyntax)
	{
		super(objITransferSyntax);
	}

	/**
	 * This constructor creates ComponentTypesSequenceItem with specified TransferSyntax and
	 * specified DictionaryReader
	 * @param objTransferSyntax specifies the DICOM Standard defined TransfeSyntax
	 * @param objDictionaryReader specifies the DICOM Dictionary reader to be used 
	 */
	UnifiedProcedureStepPerformedProcedureSequenceItem(ITransferSyntax objTransferSyntax, IDictionaryReader objDictionaryReader)
	{
		super(objTransferSyntax,objDictionaryReader);
	}
	/**
	 * Retrieves pre-initialized object of Actual Human Performers Sequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence.
	 * @return ActualHumanPerformersSequence - instance of ActualHumanPerformersSequence. 
	 */
	public ActualHumanPerformersSequence getActualHumanPerformersSequence()
	{
		ActualHumanPerformersSequence objActualHumanPerformersSequence = null;
		IDataElement objIDataElement =  getDataForTag(0x0040, 0x4035);
		if(objIDataElement != null)
		{
			IDicomValue objIDicomValue = objIDataElement.getDicomValue();
			if(objIDicomValue != null)
				objActualHumanPerformersSequence = (ActualHumanPerformersSequence)objIDicomValue;
		}
		else
		{
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			int iVRTransferSyntax = objITransferSyntax.getVRTransferSyntax();
			objIDataElement = null;
			objActualHumanPerformersSequence = (ActualHumanPerformersSequence)objDicomV3Factory.createSequence(0x0040, 0x4009, objITransferSyntax, objIDictionaryReader);

			if(iVRTransferSyntax == DicomConstants.DCM_VR_IMPLICIT)
				objIDataElement = new ImplicitDE(0x0040, 0x4035, objActualHumanPerformersSequence.getValue(),objIDictionaryReader);
			else
				objIDataElement = new ExplicitDE(0x0040, 0x4035, DicomConstants.DCM_DT_SQ, objActualHumanPerformersSequence.getValue());
			objIDataElement.setTransferSyntax(objITransferSyntax);
			if(objIDataElement != null)
				addDataElement(objIDataElement);
		}
		return objActualHumanPerformersSequence;
	}

	
	/**
	 * Retrieves pre-initialized object of Human Performer Code Sequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence.
	 * @return HumanPerformerCodeSequence - instance of HumanPerformerCodeSequence. 
	 */
	public HumanPerformerCodeSequence getHumanPerformerCodeSequence()
	{
		HumanPerformerCodeSequence objHumanPerformerCodeSequence = null;
		IDataElement objIDataElement =  getDataForTag(0x0040, 0x4009);
		if(objIDataElement != null)
		{
			IDicomValue objIDicomValue = objIDataElement.getDicomValue();
			if(objIDicomValue != null)
				objHumanPerformerCodeSequence = (HumanPerformerCodeSequence)objIDicomValue;
		}
		else
		{
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			int iVRTransferSyntax = objITransferSyntax.getVRTransferSyntax();
			objIDataElement = null;
			objHumanPerformerCodeSequence = (HumanPerformerCodeSequence)objDicomV3Factory.createSequence(0x0040, 0x4009, objITransferSyntax, objIDictionaryReader);

			if(iVRTransferSyntax == DicomConstants.DCM_VR_IMPLICIT)
				objIDataElement = new ImplicitDE(0x0040, 0x4009, objHumanPerformerCodeSequence.getValue(),objIDictionaryReader);
			else
				objIDataElement = new ExplicitDE(0x0040, 0x4009, DicomConstants.DCM_DT_SQ, objHumanPerformerCodeSequence.getValue());
			objIDataElement.setTransferSyntax(objITransferSyntax);
			if(objIDataElement != null)
				addDataElement(objIDataElement);
		}
		return objHumanPerformerCodeSequence;
	}
	/**
	 * Sets Human Performers Organization.
	 * @param strHumanPerformersOrganization String value of Human Performers Organization.
	 */
	public void setHumanPerformersOrganization(String strHumanPerformersOrganization)
	{
		/* Accept the HumanPerformersOrganization in String format of type LO.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 	
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0040,0x4036, strHumanPerformersOrganization,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0040,0x4036,DicomConstants.DCM_DT_LO, strHumanPerformersOrganization);

		addDataElement(objIDataElement);
	}

	/**
	 * Return user-defined label identifier for Human Performers Organization.
	 * @return String - value of HumanPerformersOrganization.
	 */
	public String getHumanPerformersOrganization()
	{
		Object objValue = getValue(0x0040,0x4036);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	/**
	 * Sets the Human Performers Name.
	 * @param strHumanPerformersName user-defined comments
	 */
	public void setHumanPerformersName(String strHumanPerformersName)
	{
		/*Accept the HumanPerformersName in String format of type PN.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * 
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0040, 0x4037, strHumanPerformersName,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0040, 0x4037,DicomConstants.DCM_DT_ST, strHumanPerformersName);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves HumanPerformersName.
	 * @return String value of Human Performer's Name.
	 */
	public String getHumanPerformersName()
	{
		Object objValue = getValue(0x0040, 0x4037);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	/**
	 * Retrieves pre-initialized object of Performed Station Name Code Sequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence.
	 * @return PerformedStationNameCodeSequence - instance of Performed Station Name Code Sequence. 
	 */
	public PerformedStationNameCodeSequence getPerformedStationNameCodeSequence()
	{
		PerformedStationNameCodeSequence objPerformedStationNameCodeSequence = null;
		IDataElement objIDataElement =  getDataForTag(0x0040, 0x4028);
		if(objIDataElement != null)
		{
			IDicomValue objIDicomValue = objIDataElement.getDicomValue();
			if(objIDicomValue != null)
				objPerformedStationNameCodeSequence = (PerformedStationNameCodeSequence)objIDicomValue;
		}
		else
		{
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			int iVRTransferSyntax = objITransferSyntax.getVRTransferSyntax();
			objIDataElement = null;
			objPerformedStationNameCodeSequence = (PerformedStationNameCodeSequence)objDicomV3Factory.createSequence(0x0040, 0x4028, objITransferSyntax, objIDictionaryReader);

			if(iVRTransferSyntax == DicomConstants.DCM_VR_IMPLICIT)
				objIDataElement = new ImplicitDE(0x0040, 0x4028, objPerformedStationNameCodeSequence.getValue(),objIDictionaryReader);
			else
				objIDataElement = new ExplicitDE(0x0040, 0x4028, DicomConstants.DCM_DT_SQ, objPerformedStationNameCodeSequence.getValue());
			objIDataElement.setTransferSyntax(objITransferSyntax);
			if(objIDataElement != null)
				addDataElement(objIDataElement);
		}
		return objPerformedStationNameCodeSequence;
	}
	/**
	 * Retrieves pre-initialized object of Performed Station Class Code Sequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence.
	 * @return PerformedStationClassCodeSequence - instance of Performed Station Class Code Sequence. 
	 */
	public PerformedStationClassCodeSequence getPerformedStationClassCodeSequence()
	{
		PerformedStationClassCodeSequence objPerformedStationClassCodeSequence = null;
		IDataElement objIDataElement =  getDataForTag(0x0040, 0x4029);
		if(objIDataElement != null)
		{
			IDicomValue objIDicomValue = objIDataElement.getDicomValue();
			if(objIDicomValue != null)
				objPerformedStationClassCodeSequence = (PerformedStationClassCodeSequence)objIDicomValue;
		}
		else
		{
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			int iVRTransferSyntax = objITransferSyntax.getVRTransferSyntax();
			objIDataElement = null;
			objPerformedStationClassCodeSequence = (PerformedStationClassCodeSequence)objDicomV3Factory.createSequence(0x0040, 0x4029, objITransferSyntax, objIDictionaryReader);

			if(iVRTransferSyntax == DicomConstants.DCM_VR_IMPLICIT)
				objIDataElement = new ImplicitDE(0x0040, 0x4029, objPerformedStationClassCodeSequence.getValue(),objIDictionaryReader);
			else
				objIDataElement = new ExplicitDE(0x0040, 0x4029, DicomConstants.DCM_DT_SQ, objPerformedStationClassCodeSequence.getValue());
			objIDataElement.setTransferSyntax(objITransferSyntax);
			if(objIDataElement != null)
				addDataElement(objIDataElement);
		}
		return objPerformedStationClassCodeSequence;
	}
	/**
	 * Retrieves pre-initialized object of Performed Station Geographic Location Code Sequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence.
	 * @return PerformedStationGeographicLocationCodeSequence - instance of PerformedStationGeographicLocationCodeSequence. 
	 */
	public PerformedStationGeographicLocationCodeSequence getPerformedStationGeographicLocationCodeSequence()
	{
		PerformedStationGeographicLocationCodeSequence objPerformedStationGeographicLocationCodeSequence = null;
		IDataElement objIDataElement =  getDataForTag(0x0040, 0x4030);
		if(objIDataElement != null)
		{
			IDicomValue objIDicomValue = objIDataElement.getDicomValue();
			if(objIDicomValue != null)
				objPerformedStationGeographicLocationCodeSequence = (PerformedStationGeographicLocationCodeSequence)objIDicomValue;
		}
		else
		{
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			int iVRTransferSyntax = objITransferSyntax.getVRTransferSyntax();
			objIDataElement = null;
			objPerformedStationGeographicLocationCodeSequence = (PerformedStationGeographicLocationCodeSequence)objDicomV3Factory.createSequence(0x0040, 0x4030, objITransferSyntax, objIDictionaryReader);

			if(iVRTransferSyntax == DicomConstants.DCM_VR_IMPLICIT)
				objIDataElement = new ImplicitDE(0x0040, 0x4030, objPerformedStationGeographicLocationCodeSequence.getValue(),objIDictionaryReader);
			else
				objIDataElement = new ExplicitDE(0x0040, 0x4030, DicomConstants.DCM_DT_SQ, objPerformedStationGeographicLocationCodeSequence.getValue());
			objIDataElement.setTransferSyntax(objITransferSyntax);
			if(objIDataElement != null)
				addDataElement(objIDataElement);
		}
		return objPerformedStationGeographicLocationCodeSequence;
	}
	/**
	 * Sets Date and Time of Performed Procedure Step Start Date Time.
	 * @param strPerformedProcedureStepStartDateTime String value of PerformedProcedureStepStartDateTime
	 */
	public void setPerformedProcedureStepStartDateTime(String strPerformedProcedureStepStartDateTime)
	{
		/* Accept the PerformedProcedureStepStartDateTime of type DT.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0040,0x4050,strPerformedProcedureStepStartDateTime,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0040,0x4050,DicomConstants.DCM_DT_DT, strPerformedProcedureStepStartDateTime);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves PerformedProcedureStepStartDateTime
	 * @return String - value of PerformedProcedureStepStartDateTime
	 */
	public String getPerformedProcedureStepStartDateTime()
	{
		Object objValue = getValue(0x0040,0x4050);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets PerformedProcedureStepDescription.
	 * @param strPerformedProcedureStepDescription String value of PerformedProcedureStepDescription.
	 */
	public void setPerformedProcedureStepDescription(String strPerformedProcedureStepDescription)
	{
		/* Accept the PerformedProcedureStepDescription in String format of type LO.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0040,0x0254, strPerformedProcedureStepDescription,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0040,0x0254,DicomConstants.DCM_DT_LO, strPerformedProcedureStepDescription);

		addDataElement(objIDataElement);
	}

	/**
	 * Return PerformedProcedureStepDescription.
	 * @return String - value of PerformedProcedureStepDescription.
	 */
	public String getPerformedProcedureStepDescription()
	{
		Object objValue = getValue(0x0040,0x0254);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets the CommentsonthePerformedProcedureStep.
	 * @param strCommentsonthePerformedProcedureStep user-defined comments
	 */
	public void setCommentsonthePerformedProcedureStep(String strCommentsonthePerformedProcedureStep)
	{
		/*Accept the CommentsonthePerformedProcedureStep in String format of type ST.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0040, 0x0310, strCommentsonthePerformedProcedureStep,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0040, 0x0310,DicomConstants.DCM_DT_ST, strCommentsonthePerformedProcedureStep);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Comments on the Performed Procedure Step
	 * @return String value of CommentsonthePerformedProcedureStep.
	 */
	public String getCommentsonthePerformedProcedureStep()
	{
		Object objValue = getValue(0x0040, 0x0310);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	/**
	 * Retrieves pre-initialized object of Performed Workitem Code Sequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence.
	 * @return PerformedWorkitemCodeSequence - instance of PerformedWorkitemCodeSequence. 
	 */
	public PerformedWorkitemCodeSequence getPerformedWorkitemCodeSequencee()
	{
		PerformedWorkitemCodeSequence objPerformedWorkitemCodeSequence = null;
		IDataElement objIDataElement =  getDataForTag(0x0040, 0x4019);	
		if(objIDataElement != null)
		{
			IDicomValue objIDicomValue = objIDataElement.getDicomValue();
			if(objIDicomValue != null)
				objPerformedWorkitemCodeSequence = (PerformedWorkitemCodeSequence)objIDicomValue;
		}
		else
		{
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			int iVRTransferSyntax = objITransferSyntax.getVRTransferSyntax();
			objIDataElement = null;
			objPerformedWorkitemCodeSequence = (PerformedWorkitemCodeSequence)objDicomV3Factory.createSequence(0x0040, 0x4019, objITransferSyntax, objIDictionaryReader);

			if(iVRTransferSyntax == DicomConstants.DCM_VR_IMPLICIT)
				objIDataElement = new ImplicitDE(0x0040, 0x4019, objPerformedWorkitemCodeSequence.getValue(),objIDictionaryReader);
			else
				objIDataElement = new ExplicitDE(0x0040, 0x4019, DicomConstants.DCM_DT_SQ, objPerformedWorkitemCodeSequence.getValue());
			objIDataElement.setTransferSyntax(objITransferSyntax);
			if(objIDataElement != null)
				addDataElement(objIDataElement);
		}
		return objPerformedWorkitemCodeSequence;
	}
	/**
	 * Retrieves pre-initialized object of Performed Processing Parameters Sequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence.
	 * @return PerformedProcessingParametersSequence - instance of Performed Processing Parameters Sequence. 
	 */
	public PerformedProcessingParametersSequence getPerformedProcessingParametersSequence()
	{
		PerformedProcessingParametersSequence objPerformedProcessingParametersSequence = null;
		IDataElement objIDataElement =  getDataForTag(0x0074, 0x1212);
		if(objIDataElement != null)
		{
			IDicomValue objIDicomValue = objIDataElement.getDicomValue();
			if(objIDicomValue != null)
				objPerformedProcessingParametersSequence = (PerformedProcessingParametersSequence)objIDicomValue;
		}
		else
		{
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			int iVRTransferSyntax = objITransferSyntax.getVRTransferSyntax();
			objIDataElement = null;
			objPerformedProcessingParametersSequence = (PerformedProcessingParametersSequence)objDicomV3Factory.createSequence(0x0074, 0x1212, objITransferSyntax, objIDictionaryReader);

			if(iVRTransferSyntax == DicomConstants.DCM_VR_IMPLICIT)
				objIDataElement = new ImplicitDE(0x0074, 0x1212, objPerformedProcessingParametersSequence.getValue(),objIDictionaryReader);
			else
				objIDataElement = new ExplicitDE(0x0074, 0x1212, DicomConstants.DCM_DT_SQ, objPerformedProcessingParametersSequence.getValue());
			objIDataElement.setTransferSyntax(objITransferSyntax);
			if(objIDataElement != null)
				addDataElement(objIDataElement);
		}
		return objPerformedProcessingParametersSequence;
	}
	/**
	 * Retrieves pre-initialized object of Content Item Modifier Sequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence.
	 * @return ContentItemModifierSequence - instance of ContentItemModifierSequence. 
	 */
	public ContentItemModifierSequence getContentItemModifierSequence()
	{
		ContentItemModifierSequence objContentItemModifierSequence = null;
		IDataElement objIDataElement =  getDataForTag(0x0040, 0x0441);	
		if(objIDataElement != null)
		{
			IDicomValue objIDicomValue = objIDataElement.getDicomValue();
			if(objIDicomValue != null)
				objContentItemModifierSequence = (ContentItemModifierSequence)objIDicomValue;
		}
		else
		{
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			int iVRTransferSyntax = objITransferSyntax.getVRTransferSyntax();
			objIDataElement = null;
			objContentItemModifierSequence = (ContentItemModifierSequence)objDicomV3Factory.createSequence(0x0040, 0x0441, objITransferSyntax, objIDictionaryReader);

			if(iVRTransferSyntax == DicomConstants.DCM_VR_IMPLICIT)
				objIDataElement = new ImplicitDE(0x0040, 0x0441, objContentItemModifierSequence.getValue(),objIDictionaryReader);
			else
				objIDataElement = new ExplicitDE(0x0040, 0x0441, DicomConstants.DCM_DT_SQ, objContentItemModifierSequence.getValue());
			objIDataElement.setTransferSyntax(objITransferSyntax);
			if(objIDataElement != null)
				addDataElement(objIDataElement);
		}
		return objContentItemModifierSequence;
	}
	/**
	 * Sets PerformedProcedureStepEndDateTime.
	 * @param strPerformedProcedureStepEndDateTime String value of PerformedProcedureStepEndDateTime
	 */
	public void setPerformedProcedureStepEndDateTime(String strPerformedProcedureStepEndDateTime)
	{
		/* Accept the PerformedProcedureStepEndDateTime of type DT.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0040,0x4051,strPerformedProcedureStepEndDateTime,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0040,0x4051,DicomConstants.DCM_DT_DT, strPerformedProcedureStepEndDateTime);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves PerformedProcedureStepEndDateTimee
	 * @return String - value of PerformedProcedureStepEndDateTime
	 */
	public String getPerformedProcedureStepEndDateTime()
	{
		Object objValue = getValue(0x0040,0x4051);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Retrieves pre-initialized object of ScheduledHumanPerformersSequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence.
	 * @return ScheduledHumanPerformersSequence - instance of ScheduledHumanPerformersSequence. 
	 */
	public ScheduledHumanPerformersSequence getScheduledHumanPerformersSequence()
	{
		ScheduledHumanPerformersSequence objScheduledHumanPerformersSequence = null;
		IDataElement objIDataElement =  getDataForTag(0x0040,0x4033);
		if(objIDataElement != null)
		{
			IDicomValue objIDicomValue = objIDataElement.getDicomValue();
			if(objIDicomValue != null)
				objScheduledHumanPerformersSequence = (ScheduledHumanPerformersSequence)objIDicomValue;
		}
		else
		{
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			int iVRTransferSyntax = objITransferSyntax.getVRTransferSyntax();
			objIDataElement = null;
			objScheduledHumanPerformersSequence = (ScheduledHumanPerformersSequence)objDicomV3Factory.createSequence(0x0040,0x4033, objITransferSyntax, objIDictionaryReader);

			if(iVRTransferSyntax == DicomConstants.DCM_VR_IMPLICIT)
				objIDataElement = new ImplicitDE(0x0040,0x4033, objScheduledHumanPerformersSequence.getValue(),objIDictionaryReader);
			else
				objIDataElement = new ExplicitDE(0x0040,0x4033, DicomConstants.DCM_DT_SQ, objScheduledHumanPerformersSequence.getValue());
			objIDataElement.setTransferSyntax(objITransferSyntax);
			if(objIDataElement != null)
				addDataElement(objIDataElement);
		}
		return objScheduledHumanPerformersSequence;
	}



}
