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

import java.io.File;
import java.util.UUID;

import cdac.medinfo.sdk.hl7282.commoninterface.ISegmentKey;



/**
 * Contains some general purpose methods used in the project.
 */
public class StandardMethods 
{

	//	static String strOS;
	static String strTempDirPath;
	static 
	{
		//strOS = System.getProperty("os.name");
		strTempDirPath = System.getProperty("java.io.tmpdir");
		if(strTempDirPath.endsWith(File.separator) == false)
			strTempDirPath = strTempDirPath + File.separator;
	}

	public static String getTempDirectoryStorage() 
	{
		return strTempDirPath;
	}

	/**
	 * Clears StringBuffer contents.
	 * @param strBuffervalue value to be clear.
	 */
	public static void clearStringBuffer(StringBuffer strBuffervalue)
	{
		int isizeofBuffer = strBuffervalue.length();
		strBuffervalue.delete(0,isizeofBuffer);
	}

	/**
	 * Retrieves Enumeration for Message Structure specified in String format.
	 * @param strMessageStructure string containing Message Structure.
	 * @return EnumMessageStructure - enum contains all Message Structure of HL7.
	 */
	public static EnumMessageStructure getEnumMessageStructure(String strMessageStructure)
	{
		try
		{
			return EnumMessageStructure.valueOf(strMessageStructure);
		}
		catch(IllegalArgumentException ie)
		{
			return null; 
		}
	}

	/**
	 * Retrieves Enumeration for MessageCode specified in String format.
	 * @param strMessageCode
	 * @return EnumMessageCode
	 */
	public static EnumMessageCode getEnumMessageCode(String strMessageCode)
	{
		try
		{
			return EnumMessageCode.valueOf(strMessageCode);
		}
		catch(IllegalArgumentException ie)
		{
			return null; 
		}
	}

	/**
	 * Retrieves Enumeration for Trigger Event specified in String format.
	 * @param strTriggerEvent string containing Trigger Event.
	 * @return EnumTriggerEvent - enum contains all Trigger Event of HL7.
	 */
	public static EnumTriggerEvent getEnumTriggerEvent(String strTriggerEvent)
	{
		try
		{
			return EnumTriggerEvent.valueOf(strTriggerEvent);
		}
		catch(IllegalArgumentException ie)
		{
			return null; 
		}
	}

	/**
	 * Retrieves Enumeration for Trigger Event specified in String format.
	 * @param strMessageCode string containing Message Code.
	 * @param strTriggerEvent string containing Trigger Event.
	 * @return EnumMessageStructure - enum contains all Message Structure of HL7.
	 */
	public static EnumMessageStructure getExpectedMessageStructure(String strMessageCode,String strTriggerEvent)
	{
		try
		{
			EnumMessageCode enumMessageCode = getEnumMessageCode(strMessageCode);
			EnumTriggerEvent enumTriggerEvent = getEnumTriggerEvent(strTriggerEvent);	
			switch(enumMessageCode)
			{
			case OSQ:
			{
				return EnumMessageStructure.OSR_Q06;
			}
			case QRY:
			{
				switch(enumTriggerEvent)
				{
				case Q01:
					return EnumMessageStructure.DSR_Q01;
					
				case P04: 
					return EnumMessageStructure.DSR_P04;
				
				}
			}
			case QBP:
			{
				switch(enumTriggerEvent)
				{
				case Q11:
					return EnumMessageStructure.RSP_K11;
				case Q13:
					return EnumMessageStructure.RTB_K13;
				case Q15:
					return EnumMessageStructure.RDY_K15;
				case Q21:
					return EnumMessageStructure.RSP_K21;
				case Q22:
					return EnumMessageStructure.RSP_K22;
				case Q23:
				case Q24:
					return EnumMessageStructure.RSP_K23;
				case Q25:
					return EnumMessageStructure.RSP_K25;
				case Q31:
					return EnumMessageStructure.RSP_K31;
				case Q32:
					return EnumMessageStructure.RSP_K32;
				case Q33:
					return EnumMessageStructure.RSP_K33;
				case Q34: 
					return EnumMessageStructure.RSP_K34;
				case Z73:
					return EnumMessageStructure.RTB_Z74;
				case Z81:
					return EnumMessageStructure.RSP_Z82;
				case Z85:
					return EnumMessageStructure.RSP_Z86;
				case Z87:
					return EnumMessageStructure.RSP_Z88;
				case Z89:
					return EnumMessageStructure.RSP_Z90;
				case Z75:
				case Z77:
				case Z91:
				case Z93:
				case Z95:
					return EnumMessageStructure.RTB_K13;
				case Z97:
					return EnumMessageStructure.RDY_K15;
				case Z79:
				case Z99:
					return EnumMessageStructure.RSP_K11;
				case E03:
					return EnumMessageStructure.RSP_E03;
				case E22: 
					return EnumMessageStructure.RSP_E22;
				}
			}
			case CCQ:
				return EnumMessageStructure.CQU_I19;
			case CCF:
				return EnumMessageStructure.CCI_I22;
			case EHC:
			{
				switch(enumTriggerEvent)
				{
				case E12:
					return EnumMessageStructure.EHC_E13;
				case E20:
					return EnumMessageStructure.EHC_E24;
				}
			}
			case OMG:
			{
				return EnumMessageStructure.ORG_O20;
			}
			case OML:
			{
				switch(enumTriggerEvent)
				{
				case O21:
					return EnumMessageStructure.ORL_O22;
				case O33:
					return EnumMessageStructure.ORL_O34;
				case O35:
					return EnumMessageStructure.ORL_O36;
				}
			}
			case OMI:
			{
				return EnumMessageStructure.ORI_O24;
			}
			case OMD:
			{
				return EnumMessageStructure.ORD_O04;
			}
			
			case OMN:
			{
				return EnumMessageStructure.ORN_O08;
			}
			case OMP:
			{
				return EnumMessageStructure.ORP_O10;
			}
			case RDE:
			{
				switch(enumTriggerEvent)
				{
				case O11:
					return EnumMessageStructure.RRE_O12;
				case O25:
					return EnumMessageStructure.RRE_O12;
				}
			}
			case RDS:
			{
				return EnumMessageStructure.RRD_O14;
			}
			case RGV:
			{
				return EnumMessageStructure.RRG_O16;
			}
			case RAS:
			{
				return EnumMessageStructure.RRA_O18;
			}
			
			case OMB:
			{
				return EnumMessageStructure.ORB_O28;
			}
			case BPS:
			{
				return EnumMessageStructure.BRP_O30;
			}
			
			case BTS:
			{
				return EnumMessageStructure.BRT_O32;
			}
			case MFN:
			{
				return EnumMessageStructure.MFK_M01;
			}
			case MFQ:
			{
				return EnumMessageStructure.MFR_M01;
			}
			case SRM:
			{
				return EnumMessageStructure.SRR_S01;
			}
			
			case RQI:
			{
				switch(enumTriggerEvent)
				{
				case I01:
					return EnumMessageStructure.RPI_I01;
				case I02:
					return EnumMessageStructure.RPL_I02;
				case I03:
					return EnumMessageStructure.RPR_I03;
				}
			}
			case RQP:
			{
				return EnumMessageStructure.RPI_I04;
			}
			
			case RQA:
			{
				return EnumMessageStructure.RPA_I08;
			}
			case REF:
			{
				return EnumMessageStructure.RRI_I12;
			}
			case NMQ:
			{
				return EnumMessageStructure.NMR_N01;
			}
			case QSB:
			{
				return EnumMessageStructure.ORU_R01;
			}
			case EQQ:
			{
				return EnumMessageStructure.TBR_R08;
			}
			case SPQ:
			{
				return EnumMessageStructure.EDR_R07;
			}
			case VQQ:
			{
				return EnumMessageStructure.EDR_R07;
			}
			default:
				return EnumMessageStructure.ACK;
			}
		}
		catch(IllegalArgumentException ie)
		{
			return null; 
		}
	}

	/**
	 * Generates the unique identifier.
	 * @return String - unique identifier.
	 */
	public static String generateUUID()
	{
		String strUUID = null;
		strUUID = UUID.randomUUID().toString();
		return strUUID;
	}
	/**
	 * Gives the EnumSegment Name.
	 * @param strSegmentName String containing Segment name.
	 * @return ISegmentKey - enum contain Segment name.
	 */
	public static ISegmentKey getSegmentEnum(String strSegmentName)
	{
		if (strSegmentName.equalsIgnoreCase("ABS"))
			return EnumSegments.HL7_SEG_ABS;
		else if(strSegmentName.equalsIgnoreCase("ACC"))
			return EnumSegments.HL7_SEG_ACC;
		else if(strSegmentName.equalsIgnoreCase("ADD"))
			return EnumSegments.HL7_SEG_ADD;
		else if(strSegmentName.equalsIgnoreCase("AFF"))
			return EnumSegments.HL7_SEG_AFF;
		else if(strSegmentName.equalsIgnoreCase("AIG"))
			return EnumSegments.HL7_SEG_AIG;
		else if(strSegmentName.equalsIgnoreCase("AIL"))
			return EnumSegments.HL7_SEG_AIL;
		else if(strSegmentName.equalsIgnoreCase("AIP"))
			return EnumSegments.HL7_SEG_AIP;
		else if(strSegmentName.equalsIgnoreCase("AIS"))
			return EnumSegments.HL7_SEG_AIS;
		else if(strSegmentName.equalsIgnoreCase("AL1"))
			return EnumSegments.HL7_SEG_AL1;
		else if(strSegmentName.equalsIgnoreCase("APR"))
			return EnumSegments.HL7_SEG_APR;
		else if(strSegmentName.equalsIgnoreCase("ARQ"))
			return EnumSegments.HL7_SEG_ARQ;
		else if(strSegmentName.equalsIgnoreCase("AUT"))
			return EnumSegments.HL7_SEG_AUT;
		else if(strSegmentName.equalsIgnoreCase("BHS"))
			return EnumSegments.HL7_SEG_BHS;
		else if(strSegmentName.equalsIgnoreCase("BLC"))
			return EnumSegments.HL7_SEG_BLC;
		else if(strSegmentName.equalsIgnoreCase("BLG"))
			return EnumSegments.HL7_SEG_BLG;
		else if(strSegmentName.equalsIgnoreCase("BPO"))
			return EnumSegments.HL7_SEG_BPX;
		else if(strSegmentName.equalsIgnoreCase("BTS"))
			return EnumSegments.HL7_SEG_BTS;
		else if(strSegmentName.equalsIgnoreCase("BTX"))
			return EnumSegments.HL7_SEG_BTX;
		else if(strSegmentName.equalsIgnoreCase("CDM"))
			return EnumSegments.HL7_SEG_CDM;
		else if(strSegmentName.equalsIgnoreCase("CER"))
			return EnumSegments.HL7_SEG_CER;
		else if(strSegmentName.equalsIgnoreCase("CM0"))
			return EnumSegments.HL7_SEG_CM0;
		else if(strSegmentName.equalsIgnoreCase("CM1"))
			return EnumSegments.HL7_SEG_CM1;
		else if(strSegmentName.equalsIgnoreCase("CM2"))
			return EnumSegments.HL7_SEG_CM2;
		else if(strSegmentName.equalsIgnoreCase("CNS"))
			return EnumSegments.HL7_SEG_CNS;
		else if(strSegmentName.equalsIgnoreCase("CON"))
			return EnumSegments.HL7_SEG_CON;
		else if(strSegmentName.equalsIgnoreCase("CSP"))
			return EnumSegments.HL7_SEG_CSP;
		else if(strSegmentName.equalsIgnoreCase("CSR"))
			return EnumSegments.HL7_SEG_CSR;
		else if(strSegmentName.equalsIgnoreCase("CSS"))
			return EnumSegments.HL7_SEG_CSS;
		else if(strSegmentName.equalsIgnoreCase("CTD"))
			return EnumSegments.HL7_SEG_CTD;
		else if(strSegmentName.equalsIgnoreCase("CTI"))
			return EnumSegments.HL7_SEG_CTI;
		else if(strSegmentName.equalsIgnoreCase("DB1"))
			return EnumSegments.HL7_SEG_DB1;
		else if(strSegmentName.equalsIgnoreCase("DG1"))
			return EnumSegments.HL7_SEG_DG1;
		else if(strSegmentName.equalsIgnoreCase("DRG"))
			return EnumSegments.HL7_SEG_DRG;
		else if(strSegmentName.equalsIgnoreCase("DSC"))
			return EnumSegments.HL7_SEG_DSC;
		else if(strSegmentName.equalsIgnoreCase("DSP"))
			return EnumSegments.HL7_SEG_DSP;
		else if(strSegmentName.equalsIgnoreCase("ECD"))
			return EnumSegments.HL7_SEG_ECD;
		else if(strSegmentName.equalsIgnoreCase("ECR"))
			return EnumSegments.HL7_SEG_ECR;
		else if(strSegmentName.equalsIgnoreCase("EDU"))
			return EnumSegments.HL7_SEG_EDU;
		else if(strSegmentName.equalsIgnoreCase("EQL"))
			return EnumSegments.HL7_SEG_EQL;
		else if(strSegmentName.equalsIgnoreCase("EQP"))
			return EnumSegments.HL7_SEG_EQP;
		else if(strSegmentName.equalsIgnoreCase("EQU"))
			return EnumSegments.HL7_SEG_EQU;
		else if(strSegmentName.equalsIgnoreCase("ERQ"))
			return EnumSegments.HL7_SEG_ERQ;
		else if(strSegmentName.equalsIgnoreCase("ERR"))
			return EnumSegments.HL7_SEG_ERR;
		else if(strSegmentName.equalsIgnoreCase("EVN"))
			return EnumSegments.HL7_SEG_EVN;
		else if(strSegmentName.equalsIgnoreCase("FAC"))
			return EnumSegments.HL7_SEG_FAC;
		else if(strSegmentName.equalsIgnoreCase("FHS"))
			return EnumSegments.HL7_SEG_FHS;
		else if(strSegmentName.equalsIgnoreCase("FT1"))
			return EnumSegments.HL7_SEG_FT1;
		else if(strSegmentName.equalsIgnoreCase("FTS"))
			return EnumSegments.HL7_SEG_FTS;
		else if(strSegmentName.equalsIgnoreCase("GOL"))
			return EnumSegments.HL7_SEG_GOL;
		else if(strSegmentName.equalsIgnoreCase("GP1"))
			return EnumSegments.HL7_SEG_GP1;
		else if(strSegmentName.equalsIgnoreCase("GP2"))
			return EnumSegments.HL7_SEG_GP2;
		else if(strSegmentName.equalsIgnoreCase("GT1"))
			return EnumSegments.HL7_SEG_GT1;
		else if(strSegmentName.equalsIgnoreCase("IAM"))
			return EnumSegments.HL7_SEG_IAM;
		else if(strSegmentName.equalsIgnoreCase("IIM"))
			return EnumSegments.HL7_SEG_IIM;
		else if(strSegmentName.equalsIgnoreCase("IN1"))
			return EnumSegments.HL7_SEG_IN1;
		else if(strSegmentName.equalsIgnoreCase("IN2"))
			return EnumSegments.HL7_SEG_IN2;
		else if(strSegmentName.equalsIgnoreCase("IN3"))
			return EnumSegments.HL7_SEG_IN3;
		else if(strSegmentName.equalsIgnoreCase("INV"))
			return EnumSegments.HL7_SEG_INV;
		else if(strSegmentName.equalsIgnoreCase("IPC"))
			return EnumSegments.HL7_SEG_IPC;
		else if(strSegmentName.equalsIgnoreCase("ISD"))
			return EnumSegments.HL7_SEG_ISD;
		else if(strSegmentName.equalsIgnoreCase("LAN"))
			return EnumSegments.HL7_SEG_LAN;
		else if(strSegmentName.equalsIgnoreCase("LCC"))
			return EnumSegments.HL7_SEG_LCC;
		else if(strSegmentName.equalsIgnoreCase("LCH"))
			return EnumSegments.HL7_SEG_LCH;
		else if(strSegmentName.equalsIgnoreCase("LDP"))
			return EnumSegments.HL7_SEG_LDP;
		else if(strSegmentName.equalsIgnoreCase("LOC"))
			return EnumSegments.HL7_SEG_LOC;
		else if(strSegmentName.equalsIgnoreCase("LRL"))
			return EnumSegments.HL7_SEG_LRL;
		else if(strSegmentName.equalsIgnoreCase("MFA"))
			return EnumSegments.HL7_SEG_MFA;
		else if(strSegmentName.equalsIgnoreCase("MFE"))
			return EnumSegments.HL7_SEG_MFE;
		else if(strSegmentName.equalsIgnoreCase("MFI"))
			return EnumSegments.HL7_SEG_MFI;
		else if(strSegmentName.equalsIgnoreCase("MRG"))
			return EnumSegments.HL7_SEG_MRG;
		else if(strSegmentName.equalsIgnoreCase("MSA"))
			return EnumSegments.HL7_SEG_MSA;
		else if(strSegmentName.equalsIgnoreCase("MSH"))
			return EnumSegments.HL7_SEG_MSH;
		else if(strSegmentName.equalsIgnoreCase("NCK"))
			return EnumSegments.HL7_SEG_NCK;
		else if(strSegmentName.equalsIgnoreCase("NDS"))
			return EnumSegments.HL7_SEG_NDS;
		else if(strSegmentName.equalsIgnoreCase("NK1"))
			return EnumSegments.HL7_SEG_NK1;
		else if(strSegmentName.equalsIgnoreCase("NPU"))
			return EnumSegments.HL7_SEG_NPU;
		else if(strSegmentName.equalsIgnoreCase("NSC"))
			return EnumSegments.HL7_SEG_NSC;
		else if(strSegmentName.equalsIgnoreCase("NST"))
			return EnumSegments.HL7_SEG_NST;
		else if(strSegmentName.equalsIgnoreCase("NTE"))
			return EnumSegments.HL7_SEG_NTE;
		else if(strSegmentName.equalsIgnoreCase("OBR"))
			return EnumSegments.HL7_SEG_OBR;
		else if(strSegmentName.equalsIgnoreCase("OBX"))
			return EnumSegments.HL7_SEG_OBX;
		else if(strSegmentName.equalsIgnoreCase("ODS"))
			return EnumSegments.HL7_SEG_ODS;
		else if(strSegmentName.equalsIgnoreCase("ODT"))
			return EnumSegments.HL7_SEG_ODT;
		else if(strSegmentName.equalsIgnoreCase("OM1"))
			return EnumSegments.HL7_SEG_OM1;
		else if(strSegmentName.equalsIgnoreCase("OM2"))
			return EnumSegments.HL7_SEG_OM2;
		else if(strSegmentName.equalsIgnoreCase("OM3"))
			return EnumSegments.HL7_SEG_OM3;
		else if(strSegmentName.equalsIgnoreCase("OM4"))
			return EnumSegments.HL7_SEG_OM4;
		else if(strSegmentName.equalsIgnoreCase("OM5"))
			return EnumSegments.HL7_SEG_OM5;
		else if(strSegmentName.equalsIgnoreCase("OM6"))
			return EnumSegments.HL7_SEG_OM6;
		else if(strSegmentName.equalsIgnoreCase("OM7"))
			return EnumSegments.HL7_SEG_OM7;
		else if(strSegmentName.equalsIgnoreCase("ORC"))
			return EnumSegments.HL7_SEG_ORC;
		else if(strSegmentName.equalsIgnoreCase("ORG"))
			return EnumSegments.HL7_SEG_ORG;
		else if(strSegmentName.equalsIgnoreCase("OVR"))
			return EnumSegments.HL7_SEG_OVR;
		else if(strSegmentName.equalsIgnoreCase("PCR"))
			return EnumSegments.HL7_SEG_PCR;
		else if(strSegmentName.equalsIgnoreCase("PD1"))
			return EnumSegments.HL7_SEG_PD1;
		else if(strSegmentName.equalsIgnoreCase("PDA"))
			return EnumSegments.HL7_SEG_PDA;
		else if(strSegmentName.equalsIgnoreCase("PDC"))
			return EnumSegments.HL7_SEG_PDC;
		else if(strSegmentName.equalsIgnoreCase("PEO"))
			return EnumSegments.HL7_SEG_PEO;
		else if(strSegmentName.equalsIgnoreCase("PES"))
			return EnumSegments.HL7_SEG_PES;
		else if(strSegmentName.equalsIgnoreCase("PID"))
			return EnumSegments.HL7_SEG_PID;
		else if(strSegmentName.equalsIgnoreCase("PR1"))
			return EnumSegments.HL7_SEG_PR1;
		else if(strSegmentName.equalsIgnoreCase("PRA"))
			return EnumSegments.HL7_SEG_PRA;
		else if(strSegmentName.equalsIgnoreCase("PRB"))
			return EnumSegments.HL7_SEG_PRB;
		else if(strSegmentName.equalsIgnoreCase("PRC"))
			return EnumSegments.HL7_SEG_PRC;
		else if(strSegmentName.equalsIgnoreCase("PRD"))
			return EnumSegments.HL7_SEG_PRD;
		else if(strSegmentName.equalsIgnoreCase("PSH"))
			return EnumSegments.HL7_SEG_PSH;
		else if(strSegmentName.equalsIgnoreCase("PTH"))
			return EnumSegments.HL7_SEG_PTH;
		else if(strSegmentName.equalsIgnoreCase("PV1"))
			return EnumSegments.HL7_SEG_PV1;
		else if(strSegmentName.equalsIgnoreCase("PV2"))
			return EnumSegments.HL7_SEG_PV2;
		else if(strSegmentName.equalsIgnoreCase("QAK"))
			return EnumSegments.HL7_SEG_QAK;
		else if(strSegmentName.equalsIgnoreCase("QID"))
			return EnumSegments.HL7_SEG_QID;
		else if(strSegmentName.equalsIgnoreCase("QPD"))
			return EnumSegments.HL7_SEG_QPD;
		else if(strSegmentName.equalsIgnoreCase("QRI"))
			return EnumSegments.HL7_SEG_QRI;
		else if(strSegmentName.equalsIgnoreCase("RCP"))
			return EnumSegments.HL7_SEG_RCP;
		else if(strSegmentName.equalsIgnoreCase("RDF"))
			return EnumSegments.HL7_SEG_RDF;
		else if(strSegmentName.equalsIgnoreCase("RDT"))
			return EnumSegments.HL7_SEG_RDT;
		else if(strSegmentName.equalsIgnoreCase("RF1"))
			return EnumSegments.HL7_SEG_RF1;
		else if(strSegmentName.equalsIgnoreCase("RGS"))
			return EnumSegments.HL7_SEG_RGS;
		else if(strSegmentName.equalsIgnoreCase("RMI"))
			return EnumSegments.HL7_SEG_RMI;
		else if(strSegmentName.equalsIgnoreCase("ROL"))
			return EnumSegments.HL7_SEG_ROL;
		else if(strSegmentName.equalsIgnoreCase("RQ1"))
			return EnumSegments.HL7_SEG_RQ1;
		else if(strSegmentName.equalsIgnoreCase("RQD"))
			return EnumSegments.HL7_SEG_RQD;
		else if(strSegmentName.equalsIgnoreCase("RXA"))
			return EnumSegments.HL7_SEG_RXA;
		else if(strSegmentName.equalsIgnoreCase("RXC"))
			return EnumSegments.HL7_SEG_RXC;
		else if(strSegmentName.equalsIgnoreCase("RXD"))
			return EnumSegments.HL7_SEG_RXD;
		else if(strSegmentName.equalsIgnoreCase("RXE"))
			return EnumSegments.HL7_SEG_RXE;
		else if(strSegmentName.equalsIgnoreCase("RXG"))
			return EnumSegments.HL7_SEG_RXG;
		else if(strSegmentName.equalsIgnoreCase("RXO"))
			return EnumSegments.HL7_SEG_RXO;
		else if(strSegmentName.equalsIgnoreCase("RXR"))
			return EnumSegments.HL7_SEG_RXR;
		else if(strSegmentName.equalsIgnoreCase("SAC"))
			return EnumSegments.HL7_SEG_SAC;
		else if(strSegmentName.equalsIgnoreCase("SCH"))
			return EnumSegments.HL7_SEG_SCH;
		else if(strSegmentName.equalsIgnoreCase("SFT"))
			return EnumSegments.HL7_SEG_SFT;
		else if(strSegmentName.equalsIgnoreCase("SID"))
			return EnumSegments.HL7_SEG_SID;
		else if(strSegmentName.equalsIgnoreCase("SPM"))
			return EnumSegments.HL7_SEG_SPM;
		else if(strSegmentName.equalsIgnoreCase("SPR"))
			return EnumSegments.HL7_SEG_SPR;
		else if(strSegmentName.equalsIgnoreCase("STF"))
			return EnumSegments.HL7_SEG_STF;
		else if(strSegmentName.equalsIgnoreCase("TCC"))
			return EnumSegments.HL7_SEG_TCC;
		else if(strSegmentName.equalsIgnoreCase("TCD"))
			return EnumSegments.HL7_SEG_TCD;
		else if(strSegmentName.equalsIgnoreCase("TQ1"))
			return EnumSegments.HL7_SEG_TQ1;
		else if(strSegmentName.equalsIgnoreCase("TQ2"))
			return EnumSegments.HL7_SEG_TQ2;
		else if(strSegmentName.equalsIgnoreCase("TXA"))
			return EnumSegments.HL7_SEG_TXA;
		else if(strSegmentName.equalsIgnoreCase("UB2"))
			return EnumSegments.HL7_SEG_UB2;
		else if(strSegmentName.equalsIgnoreCase("VAR"))
			return EnumSegments.HL7_SEG_VAR;
		else if(strSegmentName.equalsIgnoreCase("VTQ"))
			return EnumSegments.HL7_SEG_VTQ;
		else if(strSegmentName.equalsIgnoreCase("ITM"))
			return EnumSegments.HL7_SEG_ITM;
		else if(strSegmentName.equalsIgnoreCase("STZ"))
			return EnumSegments.HL7_SEG_STZ;
		else if(strSegmentName.equalsIgnoreCase("VND"))
			return EnumSegments.HL7_SEG_VND;
		else if(strSegmentName.equalsIgnoreCase("PKG"))
			return EnumSegments.HL7_SEG_PKG;
		else if(strSegmentName.equalsIgnoreCase("PCE"))
			return EnumSegments.HL7_SEG_PCE;
		else if(strSegmentName.equalsIgnoreCase("IVT"))
			return EnumSegments.HL7_SEG_IVT;
		else if(strSegmentName.equalsIgnoreCase("ILT"))
			return EnumSegments.HL7_SEG_ILT;
		else if(strSegmentName.equalsIgnoreCase("SCP"))
			return EnumSegments.HL7_SEG_SCP;
		else if(strSegmentName.equalsIgnoreCase("SLT"))
			return EnumSegments.HL7_SEG_SLT;
		else if(strSegmentName.equalsIgnoreCase("SDD"))
			return EnumSegments.HL7_SEG_SDD;
		else if(strSegmentName.equalsIgnoreCase("SCD"))
			return EnumSegments.HL7_SEG_SCD;
		else if(strSegmentName.equalsIgnoreCase("RFI"))
			return EnumSegments.HL7_SEG_RFI;
		else if(strSegmentName.equalsIgnoreCase("IVC"))
			return EnumSegments.HL7_SEG_IVC;
		else if(strSegmentName.equalsIgnoreCase("PYE"))
			return EnumSegments.HL7_SEG_PYE;
		else if(strSegmentName.equalsIgnoreCase("PSS"))
			return EnumSegments.HL7_SEG_PSS;
		else if(strSegmentName.equalsIgnoreCase("PSG"))
			return EnumSegments.HL7_SEG_PSG;
		else if(strSegmentName.equalsIgnoreCase("PLS"))
			return EnumSegments.HL7_SEG_PSL;
		else if(strSegmentName.equalsIgnoreCase("ADJ"))
			return EnumSegments.HL7_SEG_ADJ;
		else if(strSegmentName.equalsIgnoreCase("PMT"))
			return EnumSegments.HL7_SEG_PMT;
		else if(strSegmentName.equalsIgnoreCase("IPR"))
			return EnumSegments.HL7_SEG_IPR;

		return null;
	}
}
