package cdac.medinfo.sdk.hl7282.baselibs.segments;

import cdac.medinfo.sdk.hl7282.baselibs.CNE;
import cdac.medinfo.sdk.hl7282.baselibs.CP;
import cdac.medinfo.sdk.hl7282.baselibs.CWE;
import cdac.medinfo.sdk.hl7282.baselibs.DTM;
import cdac.medinfo.sdk.hl7282.baselibs.MO;
import cdac.medinfo.sdk.hl7282.baselibs.NM;
import cdac.medinfo.sdk.hl7282.baselibs.SI;
import cdac.medinfo.sdk.hl7282.commoninterface.IDataType;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.exceptions.FieldMissingException;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidSegmentException;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;

/**
 * PKG - Packaging Segment <p>
 * This segment contains the type of packaging available for the inventory supply 
 * item to be ordered and/or issued to a department or other supply location for a specified Purchasing Vendor.   
 * <p>Represents an HL7 PKG message segment. 
 * This segment has the following fields:</p><p>
 * PKG-1 : Set Id - PKG (SI) <b>Required</b><br>
 * PKG-2 : Packaging Units(CWE) <b>Optional</b><br>
 * PKG-3 : Default Order Unit Of Measure Indicator(CNE) <b>Optional</b><br>
 * PKG-4 : Package Quantity(NM) <b><Optional</b><br>
 * PKG-5 : Price(CP) <b>Optional</b><br>
 * PKG-6 : Future Item Price(CP) <b>Optional</b><br>
 * PKG-7 : Future Item Price Effective Date(DTM) <b>Optional</b><br>
 * PKG-8 : Global Trade Item Number(CWE) <b>Optional</b><br>
 * 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 PKG extends Segment
{
	/**
	 *  Constructs the PKG segment. 
	 */
	public PKG()
	{super(EnumSegments.HL7_SEG_PKG);
	}
	
	//Integer values used in getter/setter is unique item id defined 
	//for each attribute.
	
	/**
	 * Retrieves the Set Id - PKG.
	 * This field contains a sequential number that identifies this segment within a given Purchasing Vendor segment group. 
	 * @return SI - setId_PKG
	 */
	public SI getSetId_PKG() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2221);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SI)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Packaging Units.
	 * This field contains the packaging unit that this inventory supply 
	 * item can be ordered or issued in when purchased from the vendor in the related vendor segment.   
	 * @return CWE - packagingUnits
	 */
	public CWE getPackagingUnits() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2222);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Default Order Unit Of Measure Indicator.
	 * This field contains an indicator that determines whether or not the unit of measure 
	 * present in the PKG-2 is considered the default Order unit of measure.    
	 * @return CNE - defaultOrderUnitOfMeasureIndicator
	 */
	public CNE getDefaultOrderUnitOfMeasureIndicator() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2223);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CNE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Package Quantity.
	 * This field contains the number of units present within a unit of measure.
	 * @return NM - packageQuantity
	 */
	public NM getPackageQuantity() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2224);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (NM)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Price.
	 * This field contains the price of the item when purchased from 
	 * the vendor in the associated VND segment, for the unit of measure present in this PKG segment.
	 * @return CP - price
	 */
	public CP getPrice() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2225);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CP)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Future Item Price.
	 * This field contains a future price for the item based on the packaging unit in PKG-2.
	 * @return CP - futureItemPrice
	 */
	public CP getFutureItemPrice() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2226);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CP)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Future Item Price Effective Date.
	 * This field contains the date and time that a price change for the item becomes effective.
	 * @return DTM - itemPriceEffectiveDate
	 */
	public DTM getItemPriceEffectiveDate() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2227);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Global Trade Item Number.
	 * This field contains the GTIN assigned to an item by the item manufacturer used for 
	 * unique supply item identification by unit of measure within the GS1 standard.
	 * @return CWE - globalTradeItemNumber
	 */
	public CWE getGlobalTradeItemNumber() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3307);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Set Id - PKG.
	 * This field contains a sequential number that identifies this segment within a given Purchasing Vendor segment group. 
	 * @param strSetId_PKG Specifies Set Id - PKG
	 */ 
	public void setSetId_PKG (String strSetId_PKG) 
	{
		SI objSI  = (SI)getDataElement(2221);
		objSI.setValue(strSetId_PKG); 
		setSetId_PKG(objSI);

	} 

	/** 
	 * Set the Set Id - PKG.
	 * This field contains a sequential number that identifies this segment within a given Purchasing Vendor segment group.  
	 * @param objSetId_PKG Specifies Set Id - PKG
	 */ 
	public void setSetId_PKG(SI objSetId_PKG)
	{
		setDataType(2221,objSetId_PKG);

	}
	
	/**
	 * Set the Packaging Units.
	 * This field contains the packaging unit that this inventory supply 
	 * item can be ordered or issued in when purchased from the vendor in the related vendor segment.  
	 * @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. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */ 
	public void setPackagingUnits(String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(2222);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setPackagingUnits(cwe);

	} 
	
	/** 
	 * Set the Packaging Units.
	 * This field contains the packaging unit that this inventory supply 
	 * item can be ordered or issued in when purchased from the vendor in the related vendor segment.  
	 * @param objPackagingUnits Object of Packaging Units.
	 */ 
	public void setPackagingUnits(CWE objPackagingUnits)
	{
		setDataType(2222,objPackagingUnits);

	}
	
	/**
	 * Set the Default Order Unit Of Measure Indicator.
	 * This field contains an indicator that determines whether or not the unit of measure 
	 * present in the PKG-2 is considered the default Order unit of measure.  
	 * @param strIdentifier Specifies sequence of characters (the code) that uniquely identifies
	 * 						 the item being referenced by the CNE.
	 * @param strText Specifies descriptive or textual name of the identifier, e.g., myocardial infarction 
	 * @param strNameOfCodingSystem Specifies the coding scheme being used in the identifier component. 
	 * @param strAlternateIdentifier Specifies the local or user seen code as described. 
	 * @param strAlternateText Specifies descriptive or textual name of the alternate identifier.  
	 * @param strNameOfAlternateCodingSystem Specifies the coding scheme being used in the alternate identifier 
	 * 											component.  
	 * @param strCodingSystemVersionID Specifies the version ID for the coding system. 
	 * @param strAlternateCodingSystemVersionID Specifies the version ID for the coding system .
	 * @param strOriginalText Specifies the original text that was available to an automated process or a human 
	 * 							before a specific code was assigned.
	 * @param strSecondAlternateIdentifier Specifies a sequence of characters that uniquely identifies the second alternate code
	 * @param strSecondAlternateText Specifies a the textual information of the second alternate code
	 * @param strNameOfSecondAltenateCodingSystem Specifies the second coding scheme being used in the identifier component.
	 * @param strSecondAlternateCodingSystemVersionID Specifies version ID of Second alternative coding system.
	 * @param strCodingSystemOID contains the ISO Object identifier for the coding system.
	 * @param strValueSetOID contains the value set from which CNE-1 is obtained 
	 * @param strValueSetVersionID contains the version of the value set identified by CNE-15. 
	 * @param strAlternateCodingSystemOID contains the ISO Object identifier for the alternate coding system
	 * @param strAlternateValueSetOID contains the value set from which CNE-4 is obtained
	 * @param strAlternateValueSetVersionID contains the version of the value set identified by CNE-18. 
	 * @param strSecondAlternateCodingSystemOID contains the value set from which CNE-12 is obtained
	 * @param strSecondAlternateValueSetOID contains the value set from which CNE-10 is obtained
	 * @param strSecondAlternateValueSetVersionID contains the version of the value set identified by CNE-21. 
	 */ 
	public void setDefaultOrderUnitOfMeasureIndicator(String strIdentifier,String strText,String strNameOfCodingSystem,String strAlternateIdentifier,
			String strAlternateText,String strNameOfAlternateCodingSystem,String strCodingSystemVersionID,
			String strAlternateCodingSystemVersionID,String strOriginalText, String strSecondAlternateIdentifier, String strSecondAlternateText,
			String strNameOfSecondAltenateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, 
			String strValueSetOID, String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID,
			String strAlternateValueSetVersionID, String strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID,
			String strSecondAlternateValueSetVersionID)
	{
		CNE cne  = (CNE)getDataElement(2223);
		cne.setIdentifier(strIdentifier);
		cne.setText(strText);
		cne.setNameOfCodingSystem(strNameOfCodingSystem);
		cne.setAlternateIdentifier(strAlternateIdentifier);
		cne.setAlternateText(strAlternateText);
		cne.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem);
		cne.setCodingSystemVersionID(strCodingSystemVersionID);
		cne.setAlternateCodingSystemVersionID(strAlternateCodingSystemVersionID);
		cne.setOriginalText(strOriginalText); 
		cne.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cne.setSecondAlternateText(strSecondAlternateText);
		cne.setNameofSecondAlternateCodingSystem(strNameOfSecondAltenateCodingSystem);
		cne.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cne.setCodingSystemOID(strCodingSystemOID);
		cne.setValueSetOID(strValueSetOID);
		cne.setValueSetVersionID(strValueSetVersionID);
		cne.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cne.setAlternateValueSetOID(strAlternateValueSetOID);
		cne.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cne.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cne.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cne.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setDefaultOrderUnitOfMeasureIndicator(cne);

	} 

	/** 
	 * Set the Default Order Unit Of Measure Indicator.
	 * This field contains an indicator that determines whether or not the unit of measure 
	 * present in the PKG-2 is considered the default Order unit of measure.       
	 * @param objDefaultOrderUnitOfMeasureIndicator Object of Default Order Unit Of Measure Indicator. 
	 */ 
	public void setDefaultOrderUnitOfMeasureIndicator(CNE objDefaultOrderUnitOfMeasureIndicator)
	{
		setDataType(2223,objDefaultOrderUnitOfMeasureIndicator);

	}
	
	/**
	 * Set the Package Quantity.
	 * This field contains the number of units present within a unit of measure.
	 * @param strPackageQuantity Use as Package Quantity.
	 */ 
	public void setPackageQuantity(String strPackageQuantity) 
	{
		NM objNM  = (NM)getDataElement(2224);
		objNM.setValue(strPackageQuantity); 
		setPackageQuantity(objNM);

	} 

	/** 
	 * Set the Package Quantity.
	 * This field contains the number of units present within a unit of measure.
	 * @param objPackageQuantity Use as Package Quantity.
	 */ 
	public void setPackageQuantity(NM objPackageQuantity)
	{
		setDataType(2224,objPackageQuantity);

	}
	
	/**
	 * Set the Price.
	 * This field contains the price of the item when purchased from 
	 * the vendor in the associated VND segment, for the unit of measure present in this PKG segment.
	 * @param objPrice Specifies an amount of money and the denomination in which it is expressed.
	 * @param strPriceType Specifies a coded value, data type ID.[Refer to HL7 Table 0205]
	 * 						  Suggested Values AP,DC,IC,PF,TF,TP,UP. 
	 * @param strFromValue Specifies the "range" along with strToValue.  
	 * @param strToValue Specifies the "range" along with strFromValue.
	 * @param objRangeUnits Specifies This describes the units associated with the range, e.g., seconds, minutes
	 * @param strRangeType Refer to HL7 Table 0298 - CP range type for valid values.(P,F)
	 */ 
	public void setPrice(MO objPrice,String strPriceType,
			String strFromValue,String strToValue,CWE objRangeUnits,String strRangeType)
	{
		CP objCP = (CP)getDataElement(2225);
		objCP.setPrice(objPrice);
		objCP.setPriceType(strPriceType);
		objCP.setFromValue(strFromValue);
		objCP.setToValue(strToValue);
		objCP.setRangeUnits(objRangeUnits);
		objCP.setRangeType(strRangeType); 
		setPrice(objCP);

	} 

	/** 
	 * Set the Price.
	 * This field contains the price of the item when purchased from 
	 * the vendor in the associated VND segment, for the unit of measure present in this PKG segment.
	 * @param objPrice
	 */ 
	public void setPrice(CP objPrice)
	{
		setDataType(2225,objPrice);

	}
	
	/**
	 * Set the Future Item Price.
	 * This field contains a future price for the item based on the packaging unit in PKG-2.
	 * @param objPrice Specifies an amount of money and the denomination in which it is expressed.
	 * @param strPriceType Specifies a coded value, data type ID.[Refer to HL7 Table 0205]
	 * 						  Suggested Values AP,DC,IC,PF,TF,TP,UP. 
	 * @param strFromValue Specifies the "range" along with strToValue.  
	 * @param strToValue Specifies the "range" along with strFromValue.
	 * @param objRangeUnits Specifies This describes the units associated with the range, e.g., seconds, minutes
	 * @param strRangeType Refer to HL7 Table 0298 - CP range type for valid values.(P,F)
	 */ 
	public void setFutureItemPrice(MO objPrice,String strPriceType,
			String strFromValue,String strToValue,CWE objRangeUnits,String strRangeType)
	{
		CP objCP = (CP)getDataElement(2226);
		objCP.setPrice(objPrice);
		objCP.setPriceType(strPriceType);
		objCP.setFromValue(strFromValue);
		objCP.setToValue(strToValue);
		objCP.setRangeUnits(objRangeUnits);
		objCP.setRangeType(strRangeType); 
		setFutureItemPrice(objCP);

	} 

	/** 
	 * Set the Future Item Price.
	 * This field contains a future price for the item based on the packaging unit in PKG-2.
	 * @param objFutureItemPrice
	 */ 
	public void setFutureItemPrice(CP objFutureItemPrice)
	{
		setDataType(2226,objFutureItemPrice);

	}
	
	/**
	 * Set the Future Item Price Effective Date.
	 * This field contains the date and time that a price change for the item becomes effective.
	 * @param strFutureItemPriceEffectiveDate Use as Future Item Price Effective Date.
	 */
	public void setFutureItemPriceEffectiveDate(String strFutureItemPriceEffectiveDate) 
	{
		DTM objDTM  = (DTM)getDataElement(2227);
		objDTM.setValue(strFutureItemPriceEffectiveDate);
		setFutureItemPriceEffectiveDate(objDTM);
	}

	/**
	 * Set the Future Item Price Effective Date.
	 * This field contains the date and time that a price change for the item becomes effective.
	 * @param objFutureItemPriceEffectiveDate Object of Future Item Price Effective Date.
	 */
	public void setFutureItemPriceEffectiveDate(DTM objFutureItemPriceEffectiveDate)
	{
		setDataType(2227,objFutureItemPriceEffectiveDate);
	}
	
	/**
	 * Set the Global Trade Item Number.
	 * This field contains the GTIN assigned to an item by the item manufacturer used for 
	 * unique supply item identification by unit of measure within the GS1 standard.
	 * @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. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */ 
	public void setGlobalTradeItemNumber(String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(3307);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setGlobalTradeItemNumber(cwe);

	} 
	
	/** 
	 * Set the Global Trade Item Number.
	 * This field contains the GTIN assigned to an item by the item manufacturer used for 
	 * unique supply item identification by unit of measure within the GS1 standard.
	 * @param objGlobalTradeItemNumber Object of Global Trade Item Number.
	 */ 
	public void setGlobalTradeItemNumber(CWE objGlobalTradeItemNumber)
	{
		setDataType(3307,objGlobalTradeItemNumber);

	}
	
	/**
	 * Validates HL7 Message objects .
	 * Validate method checks for validation each and every segments in side the Message object against specified message Structure. 
	 * Validation checks include optionality of segment or group.
	 * It also verifies the number of times segment or group is repeated in message.
	 * e.g 
	 * {PSH} while parsing PSH segment validate method will check for its mandatory presence.
	 * [PSH] in this case validate will throw exception if one tries to enter more than one PSH segment.
	 * @return boolean - true or false.
	 * @throws InvalidSegmentException If Segment Validation fails 
	 */
	@Override
	public boolean validate() throws InvalidSegmentException 
	{
		try
		{
			/*
			 * Item Identifier is required fields of this segment.
			 */
			super.validate();

			return true;
		}
		catch(FieldMissingException ex)
		{
			throw new InvalidSegmentException(enumSegments.getValue(),ex);
		}
	}
	
}
