/*******************************************************************************
 *  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.services.implanttemplate.sourceimpl;

import cdac.medinfo.sdk.dcm30_04.baselibs.CoatingMaterialsCodeSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.DerivationImplantTemplateSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.DicomV3Factory;
import cdac.medinfo.sdk.dcm30_04.baselibs.ImplantRegulatoryDisapprovalCodeSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.ImplantTargetAnatomySequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.MaterialsCodeSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.OriginalImplantTemplateSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.ReplacedImplantTemplateSequence;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataSet;
import cdac.medinfo.sdk.dcm30_04.enums.EnumImplantType;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConstants;

/**
 *  This class contains the Attributes required for Query Model. Also contains methods to populate and fill data set of Query Model.
 */
public class ImplantTemplateAttributes extends Attributes
{
	/**
	 * Sets Manufacturer
	 * @param strManufacturer String value of Manufacturer
	 */
	public void setManufacturer(String strManufacturer)
	{
		/* Accept the Manufacturer 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
		 */
		addDataElement(0x0008, 0x0070,DicomConstants.DCM_DT_LO,strManufacturer);
	}

	/**
	 * Return Manufacturer
	 * @return String - value of Manufacturer
	 */
	public String getManufacturer()
	{
		Object objValue = getValue(0x0008, 0x0070);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	/**
	 * Sets Implant Name
	 * @param strImplantName String value of Implant Name
	 */
	public void setImplantName(String strImplantName)
	{
		/* Accept the Implant Name 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
		 */
		addDataElement(0x0022, 0x1095,DicomConstants.DCM_DT_LO,strImplantName);
	}

	/**
	 * Return Implant Name
	 * @return String - value of Implant Name
	 */
	public String getImplantName()
	{
		Object objValue = getValue(0x0022, 0x1095);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	/**
	 * Sets Implant Size
	 * @param strImplantSize String value of Implant Size
	 */
	public void setImplantSize(String strImplantSize)
	{
		/* Accept the Implant Size 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
		 */
		addDataElement(0x0068, 0x6210,DicomConstants.DCM_DT_LO,strImplantSize);
	}

	/**
	 * Return Implant Size
	 * @return String - value of Implant Size
	 */
	public String getImplantSize()
	{
		Object objValue = getValue(0x0068, 0x6210);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	/**
	 * Sets Implant Part Number
	 * @param strImplantPartNumber String value of ImplantPartNumber
	 */
	public void setImplantPartNumber(String strImplantSize)
	{
		/* Accept the ImplantPartNumber 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
		 */
		addDataElement(0x0022, 0x1097,DicomConstants.DCM_DT_LO,strImplantSize);
	}

	/**
	 * Return Implant Part Number
	 * @return String - value of ImplantPartNumber
	 */
	public String getImplantPartNumber()
	{
		Object objValue = getValue(0x0022, 0x1097);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	/**
	 * Sets Implant Template Version
	 * @param strImplantTemplateVersion String value of ImplantTemplateVersion
	 */
	public void setImplantTemplateVersion(String strImplantTemplateVersion)
	{
		/* Accept the ImplantPartNumber 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
		 */
		addDataElement(0x0068, 0x6221,DicomConstants.DCM_DT_LO,strImplantTemplateVersion);
	}

	/**
	 * Return Implant Template Version
	 * @return String - value of ImplantTemplateVersion
	 */
	public String getImplantTemplateVersion()
	{
		Object objValue = getValue(0x0068, 0x6221);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	/**
	 * Sets Effective DateTime
	 * @param strEffectiveDateTime String value of Effective DateTime
	 */
	public void setEffectiveDateTime(String strEffectiveDateTime)
	{
		/* Accept the Effective DateTime 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
		 */
		addDataElement(0x0068, 0x6226,DicomConstants.DCM_DT_DT,strEffectiveDateTime);
	}

	/**
	 * Retrieves Effective DateTime
	 * @return String - value of Effective DateTime
	 */
	public String getEffectiveDateTime()
	{
		Object objValue = getValue(0x0068, 0x6226);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	/**
	 * Sets whether the Implant Template is derived from another Implant Template.
	 *Enumerated Values:
	 *ORIGINAL
	 *DERIVED
	 * @param enumImplantType enum value of Setup Device Type.
	 */
	public void setImplantType(EnumImplantType enumImplantType)
	{
		/* Accept the Setup Device Type in String format of type CS.
		 * 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
		 * */
		addDataElement(0x0068, 0x6223,DicomConstants.DCM_DT_CS,enumImplantType);
	}
	/**
	 * Return Implant Type
	 * @return String - value of ImplantType
	 */ 
	public String getImplantType()
	{
		Object objValue = getValue(0x0068,0x6223);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Retrieves pre-initialized object of Replaced Implant Template 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 ReplacedImplantTemplateSequence - Replaced Implant Template Sequence.
	 */
	public ReplacedImplantTemplateSequence getReplacedImplantTemplateSequence()
	{
		ReplacedImplantTemplateSequence objReplacedImplantTemplateSequence = (ReplacedImplantTemplateSequence)getDicomValue(0x0068, 0x6222);
		if(objReplacedImplantTemplateSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objReplacedImplantTemplateSequence = (ReplacedImplantTemplateSequence)objDicomV3Factory.createSequence(0x0068, 0x6222, getDataSet().getTransferSyntax(), getDataSet().getDictionaryReader());
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0068, 0x6222, DicomConstants.DCM_DT_SQ, objReplacedImplantTemplateSequence.getValue());
		}
		return objReplacedImplantTemplateSequence;
	}
	/**
	 * Retrieves pre-initialized object of Original Implant Template 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 OriginalImplantTemplateSequence - Original Implant Template Sequence.
	 */
	public OriginalImplantTemplateSequence getOriginalImplantTemplateSequence()
	{
		OriginalImplantTemplateSequence objOriginalImplantTemplateSequence= (OriginalImplantTemplateSequence)getDicomValue(0x0068,0x6225);
		if(objOriginalImplantTemplateSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objOriginalImplantTemplateSequence = (OriginalImplantTemplateSequence)objDicomV3Factory.createSequence(0x0068,0x6225,getDataSet().getTransferSyntax(), getDataSet().getDictionaryReader());
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0068,0x6225, DicomConstants.DCM_DT_SQ, objOriginalImplantTemplateSequence.getValue());
		}
		return objOriginalImplantTemplateSequence;
	}
	
	/**
	 * Retrieves pre-initialized object of Derivation Implant Template 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 DerivationImplantTemplateSequence - Derivation Implant Template Sequence.
	 */
	public DerivationImplantTemplateSequence getDerivationImplantTemplateSequence()
	{
		DerivationImplantTemplateSequence objDerivationImplantTemplateSequence = (DerivationImplantTemplateSequence)getDicomValue(0x0068, 0x6224);
		if(objDerivationImplantTemplateSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objDerivationImplantTemplateSequence = (DerivationImplantTemplateSequence)objDicomV3Factory.createSequence(0x0068, 0x6224, getDataSet().getTransferSyntax(), getDataSet().getDictionaryReader());
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0068, 0x6224, DicomConstants.DCM_DT_SQ, objDerivationImplantTemplateSequence.getValue());
		}
		return objDerivationImplantTemplateSequence;
	}	
	/**
	 * Retrieves pre-initialized object of Implant TargetAnatomy 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 ImplantTargetAnatomySequence - Implant TargetAnatomy Sequence
	 */
	public ImplantTargetAnatomySequence getImplantTargetAnatomySequence()
	{
		ImplantTargetAnatomySequence objImplantTargetAnatomySequence= (ImplantTargetAnatomySequence)getDicomValue(0x0068, 0x6230);
		if(objImplantTargetAnatomySequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objImplantTargetAnatomySequence = (ImplantTargetAnatomySequence)objDicomV3Factory.createSequence(0x0068, 0x6230,getDataSet().getTransferSyntax(), getDataSet().getDictionaryReader());
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0068, 0x6230, DicomConstants.DCM_DT_SQ, objImplantTargetAnatomySequence.getValue());
		}
		return objImplantTargetAnatomySequence;
	}	
	


	/**
	 * Retrieves pre-initialized object of ImplantRegulatoryDisapprovalCodeSequence. 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 ImplantRegulatoryDisapprovalCodeSequence 
	 */
	public ImplantRegulatoryDisapprovalCodeSequence getImplantRegulatoryDisapprovalCodeSequence()
	{
		ImplantRegulatoryDisapprovalCodeSequence objImplantRegulatoryDisapprovalCodeSequence= (ImplantRegulatoryDisapprovalCodeSequence)getDicomValue(0x0068, 0x62A0);
		if(objImplantRegulatoryDisapprovalCodeSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objImplantRegulatoryDisapprovalCodeSequence = (ImplantRegulatoryDisapprovalCodeSequence)objDicomV3Factory.createSequence(0x0068, 0x62A0, getDataSet().getTransferSyntax(), getDataSet().getDictionaryReader());
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0068, 0x62A0, DicomConstants.DCM_DT_SQ, objImplantRegulatoryDisapprovalCodeSequence.getValue());
		}
		return objImplantRegulatoryDisapprovalCodeSequence;
	}
	/**
	 * Retrieves pre-initialized object of MaterialsCodeSequence. 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 MaterialsCodeSequence 
	 */
	public MaterialsCodeSequence getMaterialsCodeSequence()
	{
		MaterialsCodeSequence objMaterialsCodeSequence= (MaterialsCodeSequence)getDicomValue(0x0068, 0x63A0);
		if(objMaterialsCodeSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objMaterialsCodeSequence = (MaterialsCodeSequence)objDicomV3Factory.createSequence(0x0068, 0x63A0, getDataSet().getTransferSyntax(), getDataSet().getDictionaryReader());
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0068, 0x63A0, DicomConstants.DCM_DT_SQ, objMaterialsCodeSequence.getValue());
		}
		return objMaterialsCodeSequence;
	}
	/**
	 * Retrieves pre-initialized object of CoatingMaterialsCodeSequence. 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 CoatingMaterialsCodeSequence 
	 */
	public CoatingMaterialsCodeSequence getCoatingMaterialsCodeSequence()
	{
		CoatingMaterialsCodeSequence objCoatingMaterialsCodeSequence= (CoatingMaterialsCodeSequence)getDicomValue(0x0068, 0x63A4);
		if(objCoatingMaterialsCodeSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objCoatingMaterialsCodeSequence = (CoatingMaterialsCodeSequence)objDicomV3Factory.createSequence(0x0068, 0x63A4, getDataSet().getTransferSyntax(), getDataSet().getDictionaryReader());
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0068, 0x63A4, DicomConstants.DCM_DT_SQ, objCoatingMaterialsCodeSequence.getValue());
		}
		return objCoatingMaterialsCodeSequence;
	}
	/**
	 * Populates the query Model using filled data set.
	 */
	public void populate(IDataSet objIDataSet)
	{
		super.populate(objIDataSet);
	}	
	
	/**
	 * Fills the data set using already populated Query Model.
	 */
	public void fill(IDataSet objIDataSet)
	{
		super.fill(objIDataSet);
	}

}
