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

import java.io.IOException;
import java.util.Locale;

import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataSet;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDicomStream;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDictionaryReader;
import cdac.medinfo.sdk.dcm30_04.commoninterface.ITransferSyntax;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.ClinicalTrialSeriesModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.ClinicalTrialStudyModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.ClinicalTrialSubjectModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.CommonInstanceReferenceModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.EnhancedGeneralEquipmentModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.GeneralEquipmentModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.GeneralSeriesModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.GeneralStudyModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.NonImageIOD;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.PatientModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.PatientStudyModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.PresentationSeriesModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.SOPCommonModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.StructuredDisplayAnnotationModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.StructuredDisplayImageBoxModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.StructuredDisplayModule;
import cdac.medinfo.sdk.dcm30_04.enums.EnumModuleNames;
import cdac.medinfo.sdk.dcm30_04.enums.EnumSOPClassUIDs;

import cdac.medinfo.sdk.dcm30_04.exceptions.InvalidIODException;
import cdac.medinfo.sdk.dcm30_04.exceptions.InvalidModuleException;
import cdac.medinfo.sdk.dcm30_04.exceptions.ParseException;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConfig;
import cdac.medinfo.sdk.dcm30_04.utils.DicomLogger;
import cdac.medinfo.sdk.dcm30_04.utils.ResourceBundleWrapper;
/**
 * The Basic Structured Display Information Object Definition (IOD) specifies an instance of a single screen structured display that hasbeen created for a patient.
 * @author saloni
 *
 */
public class BasicStructuredDisplayIOD extends NonImageIOD
{

	

	/**
	 * The Constant BASIC_STRUCTURED_DISPLAY_IOD.
	 */
	public static final String BASIC_STRUCTURED_DISPLAY_IOD = "Basic Structured Display IOD";
	
	/**
	 * The obj patient module.
	 */
	PatientModule objPatientModule = null;

	/**
	 * The obj general study module.
	 */
	GeneralStudyModule objGeneralStudyModule = null;

	/**
	 * The obj patient study module.
	 */
	PatientStudyModule objPatientStudyModule = null;

	/**
	 * The obj general series module.
	 */
	GeneralSeriesModule objGeneralSeriesModule = null;

	/**
	 * The obj clinical trial series module.
	 */
	ClinicalTrialSeriesModule objClinicalTrialSeriesModule = null;

	/**
	 * The obj general equipment module.
	 */
	GeneralEquipmentModule objGeneralEquipmentModule = null;

	/**
	 * The obj clinical trial subject module.
	 */
	ClinicalTrialSubjectModule objClinicalTrialSubjectModule = null;

	/**
	 * The obj clinical trial study module.
	 */
	ClinicalTrialStudyModule objClinicalTrialStudyModule = null;

	/**
	 * The obj Common Instance Reference Module.
	 */
	CommonInstanceReferenceModule objCommonInstanceReferenceModule = null;
	
	/**
	 * The obj sop common module.
	 */
	SOPCommonModule objSOPCommonModule = null;

	/**
	 * The obj Enhanced General Equipment module.
	 */
	EnhancedGeneralEquipmentModule objEnhancedGeneralEquipmentModule = null;
	
	/**
	 * The obj presentation series module.
	 */
	PresentationSeriesModule objPresentationSeriesModule = null;
	
	/**
	 * The obj Structured Display module.
	 */
	StructuredDisplayModule objStructuredDisplayModule = null;
	
	/**
	 * The obj Structured Display Image Box module.
	 */
	StructuredDisplayImageBoxModule objStructuredDisplayImageBoxModule = null;
	
	/**
	 * The obj Structured Display Annotation module.
	 */
	StructuredDisplayAnnotationModule objStructuredDisplayAnnotationModule = null;
	
	/**
	 * Creates Composite IOD with default initialization.
	 */
	
	/**
	 * Instantiates a new image iod.
	 */
	public BasicStructuredDisplayIOD()
	{
		super();
	}

	/**
	 * This constructor initializes the TransferSyntax in its superclass IOD.
	 * 
	 * @param objITransferSyntax_ Transfer Syntax of IOD.
	 */
	public BasicStructuredDisplayIOD(ITransferSyntax objITransferSyntax_)
	{
		super(objITransferSyntax_);
	}

	/**
	 * This constructor initializes DictionaryReader in its superclass IOD.
	 * 
	 * @param objIDictionaryReader_ Dictionary Reader used by the IOD.
	 */
	public BasicStructuredDisplayIOD(IDictionaryReader objIDictionaryReader_)
	{
		super(objIDictionaryReader_);
	}

	/**
	 * This constructor accepts the DictionaryReader and TransferSyntax from the user  in its superclass IOD.
	 * 
	 * @param objITransferSyntax_ Transfer Syntax of IOD.
	 * @param objIDictionaryReader_ Dictionary Reader used by the IOD.
	 */
	public BasicStructuredDisplayIOD(ITransferSyntax objITransferSyntax_,IDictionaryReader objIDictionaryReader_)
	{
		super(objITransferSyntax_,objIDictionaryReader_);
	}

	/**
	 * This constructor accepts the Data set from the user  in its superclass IOD.
	 * 
	 * @param objIDataSet_ the obj i data set_
	 */
	public BasicStructuredDisplayIOD(IDataSet objIDataSet_)
	{
		super(objIDataSet_);
	}

	/**
	 * Creates IOD from a DICOM file containing corresponding DICOM data.
	 * @param strFileName DICOM File with absolute path.
	 * @throws IOException signals Exception caused due to wrong I/O operations. 
	 * @throws ParseException signals if some parse exceptions occurred.
	 */
	public BasicStructuredDisplayIOD(String strFileName)throws IOException, InvalidIODException
	{
		super(strFileName);
		try
		{
			if(objIDataSet != null)
			{
				String strSOPClassUID = objIDataSet.getSOPClassUID();
				if(strSOPClassUID != null)
				{
					if(!strSOPClassUID.equals(EnumSOPClassUIDs.BASICSTRUCTUREDDISPLAYIOD.getValue()))
					{
						throw new InvalidIODException(ResourceBundleWrapper.getValue("exceptions", "InvalidIOD.FileNotMatched", new Locale(DicomConfig.createInstance().getLocale())) + BASIC_STRUCTURED_DISPLAY_IOD);
					}
				}
				strSOPClassUID = null;
			}
		}
		catch(InvalidIODException iie)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(iie.getMessage());
			}
			throw iie;
		}
	}

	/**
	 * This method returns the PatientModule with preinitializing it.
	 * 
	 * @return the patient module
	 */
	public PatientModule getPatientModule()
	{
		if(objPatientModule == null)
		{
			objPatientModule = new PatientModule(objIDataSet);
			return objPatientModule;
		}
		return objPatientModule;
	}

	/**
	 * This method returns the GeneralStudyModule with preinitializing it.
	 * 
	 * @return the general study module
	 */
	public GeneralStudyModule getGeneralStudyModule()
	{
		if(objGeneralStudyModule == null)
		{
			objGeneralStudyModule = new GeneralStudyModule(objIDataSet);
			return objGeneralStudyModule;
		}
		return objGeneralStudyModule;
	}

	/**
	 * This method returns the PatientStudyModule with preinitializing it.
	 * 
	 * @return the patient study module
	 */
	public PatientStudyModule getPatientStudyModule()
	{
		if(objPatientStudyModule == null)
		{
			objPatientStudyModule = new PatientStudyModule(objIDataSet);
			return objPatientStudyModule;
		}
		return objPatientStudyModule;
	}

	/**
	 * Gets the clinical trial series module.
	 * 
	 * @return the clinical trial series module
	 */
	public ClinicalTrialSeriesModule getClinicalTrialSeriesModule()
	{
		if(objClinicalTrialSeriesModule == null)
		{
			objClinicalTrialSeriesModule = new ClinicalTrialSeriesModule(objIDataSet);
			return objClinicalTrialSeriesModule;
		}
		return objClinicalTrialSeriesModule;
	}

	/**
	 * This method returns the GeneralSeriesModule with preinitializing it.
	 * 
	 * @return the general series module
	 */
	public GeneralSeriesModule getGeneralSeriesModule()
	{
		if(objGeneralSeriesModule == null)
		{
			objGeneralSeriesModule = new GeneralSeriesModule(objIDataSet);
			return objGeneralSeriesModule;
		}
		return objGeneralSeriesModule;
	}

	/**
	 * This method returns the GeneralEquipmentModule with preinitializing it.
	 * 
	 * @return the general equipment module
	 */
	public GeneralEquipmentModule getGeneralEquipmentModule()
	{
		if(objGeneralEquipmentModule == null)
		{
			objGeneralEquipmentModule = new GeneralEquipmentModule(objIDataSet);
			return objGeneralEquipmentModule;
		}
		return objGeneralEquipmentModule;
	}

	/**
	 * This method returns the ClinicalTrialSubjectModule with preinitializing it.
	 * 
	 * @return the clinical trial subject module
	 */
	public ClinicalTrialSubjectModule getClinicalTrialSubjectModule()
	{
		if(objClinicalTrialSubjectModule == null)
		{
			objClinicalTrialSubjectModule = new ClinicalTrialSubjectModule(objIDataSet);
			return objClinicalTrialSubjectModule;
		}
		return objClinicalTrialSubjectModule;
	}

	/**
	 * This method returns the ClinicalTrialStudyModule with preinitializing it.
	 * 
	 * @return the clinical trial study module
	 */
	public ClinicalTrialStudyModule getClinicalTrialStudyModule()
	{
		if(objClinicalTrialStudyModule == null)
		{
			objClinicalTrialStudyModule = new ClinicalTrialStudyModule(objIDataSet);
			return objClinicalTrialStudyModule;
		}
		return objClinicalTrialStudyModule;
	}
	/**
	 * Retrieves pre-initialized instance of SOP Common Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return SOPCommonModule - instance of {@link SOPCommonModule}.
	 */
	public SOPCommonModule getSOPCommonModule()
	{
		if(objSOPCommonModule == null)
		{
			objSOPCommonModule = new SOPCommonModule(objIDataSet);
			return objSOPCommonModule;
		}
		return objSOPCommonModule;
	}

	/**
	 * Retrieves pre-initialized instance of Common Instance Reference Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return - instance of {@link CommonInstanceReferenceModule}.
	 */
	public CommonInstanceReferenceModule getCommonInstanceReferenceModule() 
	{
		if(objCommonInstanceReferenceModule == null)
		{
			objCommonInstanceReferenceModule = new CommonInstanceReferenceModule(objIDataSet);
			return objCommonInstanceReferenceModule;
		}
		return objCommonInstanceReferenceModule;
	}
	/**
	 * Retrieves pre-initialized instance of Enhanced General Equipment Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return EnhancedGeneralEquipmentModule - instance of {@link EnhancedGeneralEquipmentModule}.
	 */
	public EnhancedGeneralEquipmentModule getEnhancedGeneralEquipmentModule() 
	{
		if(objEnhancedGeneralEquipmentModule == null)
		{
			objEnhancedGeneralEquipmentModule = new EnhancedGeneralEquipmentModule(objIDataSet);
			return objEnhancedGeneralEquipmentModule;
		}
		return objEnhancedGeneralEquipmentModule;
	}
	/**
	 * Retrieves pre-initialized instance of PresentationSeriesModule. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return PresentationSeriesModule - instance of {@link PresentationSeriesModule}.
	 */
	public PresentationSeriesModule getPresentationSeriesModule() 
	{
		if(objPresentationSeriesModule == null)
		{
			objPresentationSeriesModule = new PresentationSeriesModule(objIDataSet);
			return objPresentationSeriesModule;
		}
		return objPresentationSeriesModule;
	}
	/**
	 * Retrieves pre-initialized instance of Structured Display Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return StructuredDisplayModule - instance of {@link StructuredDisplayModule}.
	 */
	public StructuredDisplayModule getStructuredDisplayModule()
	{
		if(objStructuredDisplayModule == null)
		{
			objStructuredDisplayModule = new StructuredDisplayModule(objIDataSet);
			return objStructuredDisplayModule;
		}
		return objStructuredDisplayModule;
	}
	
	/**
	 * Retrieves pre-initialized instance of StructuredDisplayImageBoxModule. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return StructuredDisplayImageBoxModule - instance of {@link StructuredDisplayImageBoxModule}.
	 */
	public StructuredDisplayImageBoxModule getStructuredDisplayImageBoxModule()
	{
		if(objStructuredDisplayImageBoxModule == null)
		{
			objStructuredDisplayImageBoxModule = new StructuredDisplayImageBoxModule(objIDataSet);
			return objStructuredDisplayImageBoxModule;
		}
		return objStructuredDisplayImageBoxModule;
	}
	/**
	 * Retrieves pre-initialized instance of StructuredDisplayAnnotationModule . Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return StructuredDisplayAnnotationModule - instance of {@link StructuredDisplayAnnotationModule}.
	 */
	public StructuredDisplayAnnotationModule getStructuredDisplayAnnotationModule()
	{
		if(objStructuredDisplayAnnotationModule == null)
		{
			objStructuredDisplayAnnotationModule = new StructuredDisplayAnnotationModule(objIDataSet);
			return objStructuredDisplayAnnotationModule;
		}
		return objStructuredDisplayAnnotationModule;
	}
	/**
	 * This method validates Image IOD according to the Module Table given in The DICOM Standard.
	 * The validate method fails if one of the mandatory modules are absent or any of the
	 * modules are invalid. The validate method also checks for conditional modules.
	 * 
	 * @return - status of validation as success or failure
	 * 
	 * @throws InvalidIODException the invalid iod exception
	 */
	public boolean validate() throws InvalidIODException
	{
		try
		{
			super.validate();

						
			/*
			 * The implementation is given in the following way because it may be needed this way 
			 * during exception handling when exact source of failure is to be decided.
			 * This condition checks for ImageIOD's common mandatory modules validation
			 */
			getPatientModule().validateModule();
			getGeneralStudyModule().validateModule();
			getGeneralSeriesModule().validateModule();
			getGeneralEquipmentModule().validateModule();
			getSOPCommonModule().validateModule();
			getCommonInstanceReferenceModule().validateModule();
			getStructuredDisplayModule().validateModule();
			getStructuredDisplayImageBoxModule().validateModule();
			getPresentationSeriesModule().validateModule();
			/*
			 * This condition checks for Image IOD's user optional modules validation
			 */
			if(isModulePresent(PatientStudyModule.objSingleCollection, objIDataSet))
			{
				getPatientStudyModule().validateModule();
			}
			if(isModulePresent(ClinicalTrialSeriesModule.objSingleCollection, objIDataSet))
			{
				getClinicalTrialSeriesModule().validateModule();
			}
			if(isModulePresent(ClinicalTrialSubjectModule.objSingleCollection, objIDataSet))
			{
				getClinicalTrialSubjectModule().validateModule();
			}
			if(isModulePresent(ClinicalTrialStudyModule.objSingleCollection, objIDataSet))
			{
				getClinicalTrialStudyModule().validateModule();
			}
			if(isModulePresent(StructuredDisplayAnnotationModule.objSingleCollection, objIDataSet))
			{
				getStructuredDisplayAnnotationModule().validateModule();
			}
			if(isModulePresent(EnhancedGeneralEquipmentModule.objSingleCollection, objIDataSet))
			{
				getEnhancedGeneralEquipmentModule().validateModule();
			}
			
		}
		catch(InvalidModuleException ime)
		{
			if(DicomConfig.createInstance().isLoggingOn())
				DicomLogger.getLogger().log(ime.getMessage());
			
				throw new InvalidIODException(ime.getMessage(),ime);
		}
		return true;
	}

	/**
	 *  Dumps the Name of Module and corresponding Attributs of IOD.
	 *  @param objIDicomStream - the Stream on which the Data is to be written.
	 *  @throws IOException - Exception is thrown indicating runtime failure of writing operation.
	 */
	public void dumpDICOMInfo(IDicomStream objIDicomStream) throws IOException
	{
		super.dumpDICOMInfo(objIDicomStream);
		objIDicomStream.writeString(BASIC_STRUCTURED_DISPLAY_IOD+ "\n");
		
		objIDicomStream.writeString("\t" + getPatientModule().getClass().getSimpleName() + "\n");
		getPatientModule().dumpDICOMInfo(objIDicomStream);

		objIDicomStream.writeString("\t" + getGeneralStudyModule().getClass().getSimpleName() + "\n");
		getGeneralStudyModule().dumpDICOMInfo(objIDicomStream);

		objIDicomStream.writeString("\t" + getPatientStudyModule().getClass().getSimpleName() + "\n");
		getPatientStudyModule().dumpDICOMInfo(objIDicomStream);

		objIDicomStream.writeString("\t" + getGeneralSeriesModule().getClass().getSimpleName() + "\n");
		getGeneralSeriesModule().dumpDICOMInfo(objIDicomStream);

		objIDicomStream.writeString("\t" + getClinicalTrialSeriesModule().getClass().getSimpleName() + "\n");
		getClinicalTrialSeriesModule().dumpDICOMInfo(objIDicomStream);

		objIDicomStream.writeString("\t" + getGeneralEquipmentModule().getClass().getSimpleName() + "\n");
		getGeneralEquipmentModule().dumpDICOMInfo(objIDicomStream);

		objIDicomStream.writeString("\t" + getClinicalTrialSubjectModule().getClass().getSimpleName() + "\n");
		getClinicalTrialSubjectModule().dumpDICOMInfo(objIDicomStream);

		objIDicomStream.writeString("\t" + getClinicalTrialStudyModule().getClass().getSimpleName() + "\n");
		getClinicalTrialStudyModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getEnhancedGeneralEquipmentModule().getClass().getSimpleName() + "\n");
		getEnhancedGeneralEquipmentModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getSOPCommonModule().getClass().getSimpleName() + "\n");
		getSOPCommonModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getCommonInstanceReferenceModule().getClass().getSimpleName() + "\n");
		getCommonInstanceReferenceModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getStructuredDisplayModule().getClass().getSimpleName() + "\n");
		getStructuredDisplayModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getStructuredDisplayImageBoxModule().getClass().getSimpleName() + "\n");
		getStructuredDisplayImageBoxModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getStructuredDisplayAnnotationModule().getClass().getSimpleName() + "\n");
		getStructuredDisplayAnnotationModule().dumpDICOMInfo(objIDicomStream);
	}

	/**
	 * Checks whether the Module is present in the IOD or not.
	 * @param strModuleName String value of module name 
	 * @return boolean - true if the module is present in the IOD, else false is returned.
	 */
	public boolean isModulePresent(String strModuleName)
	{
		if(!super.isModulePresent(strModuleName))
		{
			if(strModuleName == null || strModuleName.equals(""))
				return false;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.PATIENT_MODULE.getValue()) && isModulePresent(PatientModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.GENERAL_STUDY_MODULE.getValue()) && isModulePresent(GeneralStudyModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.PATIENT_STUDY_MODULE.getValue()) && isModulePresent(PatientStudyModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.GENERAL_SERIES_MODULE.getValue()) && isModulePresent(GeneralSeriesModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.CLINICAL_TRIAL_SUBJECT_MODULE.getValue()) && isModulePresent(ClinicalTrialSubjectModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.CLINICAL_TRIAL_SERIES_MODULE.getValue()) && isModulePresent(ClinicalTrialSeriesModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.GENERAL_EQUIPMENT_MODULE.getValue()) && isModulePresent(GeneralEquipmentModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.CLINICAL_TRIAL_SUBJECT_MODULE.getValue()) && isModulePresent(ClinicalTrialSubjectModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.CLINICAL_TRIAL_STUDY_MODULE.getValue()) && isModulePresent(ClinicalTrialStudyModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.SOP_COMMON_MODULE.getValue()) && isModulePresent(SOPCommonModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.COMMON_INSTANCE_REFERENCE_MODULE.getValue()) && isModulePresent(CommonInstanceReferenceModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.ENHANCED_GENERAL_EQUIPMENT_MODULE.getValue()) && isModulePresent(EnhancedGeneralEquipmentModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.STRUCTURED_DISPLAY_MODULE.getValue()) && isModulePresent(StructuredDisplayModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.STRUCTURED_DISPLAY_IMAGE_BOX_MODULE.getValue()) && isModulePresent(StructuredDisplayImageBoxModule.objSingleCollection))
				return true;
			else if(strModuleName.equalsIgnoreCase(EnumModuleNames.STRUCTURED_DISPLAY_ANNOTATION_MODULE.getValue()) && isModulePresent(StructuredDisplayAnnotationModule.objSingleCollection))
				return true;
			else
				return false;
		}
		return true;
	}
}
