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

import cdac.medinfo.sdk.hl7282.baselibs.CQ;
import cdac.medinfo.sdk.hl7282.baselibs.CWE;
import cdac.medinfo.sdk.hl7282.baselibs.DTM;
import cdac.medinfo.sdk.hl7282.baselibs.HD;
import cdac.medinfo.sdk.hl7282.baselibs.ID;
import cdac.medinfo.sdk.hl7282.baselibs.ST;
import cdac.medinfo.sdk.hl7282.baselibs.XON;
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;
import cdac.medinfo.sdk.hl7282.utils.SingleCollection;

/**
 * PDC - Product Detail Country Segment<p>
 * <p>Represents an HL7 PDC message segment. 
 * This segment has the following fields:</p><p>
 * PDC-1: Manufacturer/Distributor (XON)<b>Required</b><br> 
 * PDC-2: Country (CWE)<b>Required</b><br> 
 * PDC-3: Brand Name (ST)<b>Required</b><br> 
 * PDC-4: Device Family Name (ST)<b>Optional</b><br> 
 * PDC-5: Generic Name (CWE)<b>Optional</b><br> 
 * PDC-6: Model Identifier (ST)<b>Optional</b><br> 
 * PDC-7: Catalogue Identifier (ST)<b>Optional</b><br> 
 * PDC-8: Other Identifier (ST)<b>Optional</b><br> 
 * PDC-9: Product Code (CWE)<b>Optional</b><br> 
 * PDC-10: Marketing Basis (ID)<b>Optional</b><br> 
 * PDC-11: Marketing Approval ID (ST)<b>Optional</b><br> 
 * PDC-12: Labeled Shelf Life (CQ)<b>Optional</b><br> 
 * PDC-13: Expected Shelf Life (CQ)<b>Optional</b><br> 
 * PDC-14: Date First Marketed (DTM)<b>Optional</b><br> 
 * PDC-15: Date Last Marketed (DTM)<b>Optional</b><br><p>  
 * 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 PDC extends Segment    
{
	

	//Integer values used in getter/setter is unique item id defined 
	//for each attribute.

	/**
	 * Constructs the PDC segment.
	 */
	public PDC()
	{super(EnumSegments.HL7_SEG_PDC);
	}

	/**
	 * Retrieves the Brand Name.
	 * This field contains the name under which the product is marketed by this manufacturer.
	 * @return ST - brandName
	 */
	public ST getBrandName() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1249);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Catalogue Identifier.
	 * This field contains the manufacturer's catalogue identifier for the product.
	 * @return ST - catalogueIdentifier
	 */
	public ST getCatalogueIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1253);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Country.
	 * This field contains the country to which this product detail is relevant.
	 * @return CWE - country
	 */
	public CWE getCountry() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1248);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Date First Marketed.
	 * This field contains the date of the product is first marketed in the country.
	 * @return DTM - dateFirstMarketed
	 */
	public DTM getDateFirstMarketed() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1260);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Date Last Marketed.
	 * This field contains the date of the product is last marketed in the country.  
	 * @return DTM - dateLastMarketed
	 */
	public DTM getDateLastMarketed() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1261);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Device Family Name.
	 * This field contains the name used by the manufacturer to describe the family of the products to which this product belongs.
	 * @return ST - deviceFamilyName
	 */
	public ST getDeviceFamilyName() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1250);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Expected Shelf Life.
	 * This field contains the shelf life of the product expected by the manufacturer.
	 * @return CQ - expectedShelfLife
	 */
	public CQ getExpectedShelfLife() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1259);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CQ)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Generic Name.
	 * This field contains the name generically used to identify the product.
	 * @return CWE - genericName
	 */
	public CWE getGenericName() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1251);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Labeled Shelf Life.
	 * This field contains the shelf life of the product as labeled.  
	 * @return CQ - labeledShelfLife
	 */
	public CQ getLabeledShelfLife() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1258);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CQ)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Manufacturer Distributor.
	 * This field contains the identity of the manufacturer/distributor.
	 * @return ISingleCollection<XON> - manufacturerDistributor
	 */
	public ISingleCollection<XON> getManufacturerDistributor() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1247);
		ISingleCollection<XON> objDataList = new SingleCollection<XON>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				XON objXON = (XON)objDataType;
				objDataList.add(objXON);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Marketing Approval ID.
	 * This field contains the designation or description of the marketing basis.
	 * @return ST - marketingApprovalID
	 */
	public ST getMarketingApprovalID() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1257);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Marketing Basis.
	 * This field contains the basis for marketing approval.  
	 * @return ID - marketingBasis
	 */
	public ID getMarketingBasis() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1256);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Model Identifier.
	 * This field contains the manufacturer's model identifier for the product.
	 * @return ISingleCollection<ST> - modelIdentifier
	 */
	public ISingleCollection<ST> getModelIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1252);
		ISingleCollection<ST> objDataList = new SingleCollection<ST>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				ST objST = (ST)objDataType;
				objDataList.add(objST);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Other Identifier.
	 * This field contains any other identifier used to for the product.
	 * @return ISingleCollection<ST> - otherIdentifier
	 */
	public ISingleCollection<ST> getOtherIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1254);
		ISingleCollection<ST> objDataList = new SingleCollection<ST>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				ST objST = (ST)objDataType;
				objDataList.add(objST);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Product Code.
	 * This field contains the product code from an external coding system such as that used by the CDRH at the FDA.
	 * @return CWE - productCode
	 */
	public CWE getProductCode() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1255);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Set the Brand Name.
	 * This field contains the name under which the product is marketed by this manufacturer.
	 * @param strBrandName This field contains the String Value of Brand Name 
	 */ 
	public void setBrandName (String strBrandName) 
	{
		ST brandName  = (ST)getDataElement(1249);
		brandName.setValue(strBrandName); 
		setBrandName(brandName);

	} 

	/** 
	 * Set the Brand Name.
	 * This field contains the name under which the product is marketed by this manufacturer.
	 * @param objbrandName Object of Brand Name.
	 */ 
	public void setBrandName(ST objbrandName)
	{
		setDataType(1249,objbrandName);

	}

	/**
	 * Set the Catalogue Identifier.
	 * This field contains the manufacturer's catalogue identifier for the product.
	 * @param strCatalogueIdentifier This field contains the String Value of Catalogue Identifier 
	 */ 
	public void setCatalogueIdentifier (String strCatalogueIdentifier) 
	{
		ST catalogueIdentifier  = (ST)getDataElement(1253);
		catalogueIdentifier.setValue(strCatalogueIdentifier); 
		setCatalogueIdentifier(catalogueIdentifier);

	} 

	/** 
	 * Set the Catalogue Identifier.
	 * This field contains the manufacturer's catalogue identifier for the product.
	 * @param objcatalogueIdentifier Object of Catalogue Identifier.
	 */ 
	public void setCatalogueIdentifier(ST objcatalogueIdentifier)
	{
		setDataType(1253,objcatalogueIdentifier);

	}

	/**
	 * Set the Country.
	 * This field contains the country to which this product detail is relevant.
	 * @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 setCountry (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(1248);
		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);
		setCountry(cwe);

	} 

	/** 
	 * Set the Country.
	 * This field contains the country to which this product detail is relevant.
	 * @param objcountry Object of Country.
	 */ 
	public void setCountry(CWE objcountry)
	{
		setDataType(1248,objcountry);

	}

	/**
	 * Set the Date First Marketed.
	 * This field contains the date of the product is first marketed in the country.
	 * @param strTime Specifies a point in time using a 24-hour clock notation. 
	 */ 
	public void setDateFirstMarketed (String strTime) 
	{
		DTM dateFirstMarketed  = (DTM)getDataElement(1260);
		dateFirstMarketed.setValue(strTime);		
		setDateFirstMarketed(dateFirstMarketed);

	} 

	/** 
	 * Set the Date First Marketed.
	 * This field contains the date of the product is first marketed in the country.
	 * @param objdateFirstMarketed OBject of Date First Marketed.
	 */ 
	public void setDateFirstMarketed(DTM objdateFirstMarketed)
	{
		setDataType(1260,objdateFirstMarketed);

	}

	/**
	 * Set the Date Last Marketed.
	 * This field contains the date of the product is last marketed in the country.  
	 * @param strTime Specifies a point in time using a 24-hour clock notation. 
	 */ 
	public void setDateLastMarketed (String strTime) 
	{
		DTM dateLastMarketed  = (DTM)getDataElement(1261);
		dateLastMarketed.setValue(strTime);		 
		setDateLastMarketed(dateLastMarketed);

	} 

	/** 
	 * Set the Date Last Marketed.
	 * This field contains the date of the product is last marketed in the country.  
	 * @param objdateLastMarketed Object of Date Last Marketed.
	 */ 
	public void setDateLastMarketed(DTM objdateLastMarketed)
	{
		setDataType(1261,objdateLastMarketed);

	}

	/**
	 * Set the Device Family Name.
	 * This field contains the name used by the manufacturer to describe the family of the products to which this product belongs.
	 * @param strDeviceFamilyName This field contains the String Value of Device Family Name 
	 */ 
	public void setDeviceFamilyName (String strDeviceFamilyName) 
	{
		ST deviceFamilyName  = (ST)getDataElement(1250);
		deviceFamilyName.setValue(strDeviceFamilyName); 
		setDeviceFamilyName(deviceFamilyName);

	} 

	/** 
	 * Set the Device Family Name.
	 * This field contains the name used by the manufacturer to describe the family of the products to which this product belongs.
	 * @param objdeviceFamilyName object of Device Family Name. 
	 */ 
	public void setDeviceFamilyName(ST objdeviceFamilyName)
	{
		setDataType(1250,objdeviceFamilyName);

	}

	/**
	 * Set the Expected Shelf Life.
	 * This field contains the shelf life of the product expected by the manufacturer.
	 * @param strQuantity Specifies the numeric quantity or amount of an entity.
	 * @param objUnits Specifies the units in which the quantity is expressed. 
	 */ 
	public void setExpectedShelfLife (String strQuantity,CWE objUnits) 
	{
		CQ expectedShelfLife  = (CQ)getDataElement(1259);
		expectedShelfLife.setQuantity(strQuantity);
		expectedShelfLife.setUnits(objUnits); 
		setExpectedShelfLife(expectedShelfLife);

	} 

	/** 
	 * Set the Expected Shelf Life.
	 * This field contains the shelf life of the product expected by the manufacturer.
	 * @param objexpectedShelfLife Object of Expected Shelf Life. 
	 */ 
	public void setExpectedShelfLife(CQ objexpectedShelfLife)
	{
		setDataType(1259,objexpectedShelfLife);

	}

	/**
	 * Set the Generic Name.
	 * This field contains the name generically used to identify the product.
	 * @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 setGenericName (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(1251);
		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);
		setGenericName(cwe);

	} 

	/** 
	 * Set the Generic Name.
	 * This field contains the name generically used to identify the product.
	 * @param objgenericName Object of Generic Name.
	 */ 
	public void setGenericName(CWE objgenericName)
	{
		setDataType(1251,objgenericName);

	}

	/**
	 * Set the Labeled Shelf Life.
	 * This field contains the shelf life of the product as labeled.
	 * @param strQuantity Specifies the numeric quantity or amount of an entity.
	 * @param objUnits Specifies the units in which the quantity is expressed. 
	 */ 
	public void setLabeledShelfLife (String strQuantity,CWE objUnits) 
	{
		CQ labeledShelfLife  = (CQ)getDataElement(1258);
		labeledShelfLife.setQuantity(strQuantity);
		labeledShelfLife.setUnits(objUnits); 
		setLabeledShelfLife(labeledShelfLife);

	} 

	/** 
	 * Set the Labeled Shelf Life.
	 * This field contains the shelf life of the product as labeled.
	 * @param objlabeledShelfLife Object of Labeled Shelf Life. 
	 */ 
	public void setLabeledShelfLife(CQ objlabeledShelfLife)
	{
		setDataType(1258,objlabeledShelfLife);

	}

	/**
	 * Add the Manufacturer Distributor.
	 * This field contains the identity of the manufacturer/distributor.
	 * @param strOrganizationName Specifies name of the specified organization.
	 * @param strOrganizationNameTypeCode Specifies a code that represents the type of name i.e., legal name, display name.
	 * 										Suggested Values A,L,D,SL.[Refer to table No.0204]  
	 * @param objAssigningAuthority Specifies The assigning authority is a unique identifier of the system 
	 * 									(or organization or agency or department) that creates the data. 
	 * @param strIdentifierTypeCode Specifies a code corresponding to the type of identifier. 
	 * @param objAssigningFacility Specifies The place or location identifier where the identifier was first assigned to the person. 
	 * @param strNameRepresentationCode Specifies representations of the same name/address Suggested values are I,A,P [Refer table 0465] 
	 * @param strOrganizationIdentifier This component contains the sequence of characters (the code) that uniquely 
	 * 									  identifies the item being referenced by XON.1 Organization Name. 
	 * 									  This component replaces XON.3 ID Number as of v 2.5.
	 */  
	public void addManufacturerDistributor (String strOrganizationName, CWE objOrganizationNameTypeCode,
			 HD objAssigningAuthority,
			String strIdentifierTypeCode, HD objAssigningFacility, String strNameRepresentationCode,
			String strOrganizationIdentifier)
	{
		XON xon  = (XON)getDataElement(1247);
		xon.setOrganizationName(strOrganizationName);
		xon.setOrganizationNameTypeCode(objOrganizationNameTypeCode);
		xon.setAssigningAuthority(objAssigningAuthority);
		xon.setIdentifierTypeCode(strIdentifierTypeCode);
		xon.setAssigningFacility(objAssigningFacility);
		xon.setNameRepresentationCode(strNameRepresentationCode);
		xon.setOrganizationIdentifier(strOrganizationIdentifier); 
		addManufacturerDistributor(xon);

	} 

	/** 
	 * Add the Manufacturer Distributor.
	 * This field contains the identity of the manufacturer/distributor.
	 * @param objmanufacturerDistributor Object of Manufacturer Distributor.
	 */ 
	public void addManufacturerDistributor(XON objmanufacturerDistributor)
	{
		addDataType(1247,objmanufacturerDistributor);

	} 

	/** 
	 * Set the Manufacturer Distributor.
	 * This field contains the identity of the manufacturer/distributor.
	 * @param objmanufacturerDistributorList List of Manufacturer Distributor.
	 */ 
	@SuppressWarnings("unchecked")
	public void setManufacturerDistributor(ISingleCollection<XON> objmanufacturerDistributorList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objmanufacturerDistributorList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1247,objCollection);
	}

	/**
	 * Set the Marketing Approval ID.
	 * This field contains the designation or description of the marketing basis.
	 * @param strMarketingApprovalID This field contains the String Value of Marketing Approval ID 
	 */ 
	public void setMarketingApprovalID (String strMarketingApprovalID) 
	{
		ST marketingApprovalID  = (ST)getDataElement(1257);
		marketingApprovalID.setValue(strMarketingApprovalID); 
		setMarketingApprovalID(marketingApprovalID);

	} 

	/** 
	 * Set the Marketing Approval ID.
	 * This field contains the designation or description of the marketing basis.
	 * @param objmarketingApprovalID Object of Marketing Approval ID. 
	 */ 
	public void setMarketingApprovalID(ST objmarketingApprovalID)
	{
		setDataType(1257,objmarketingApprovalID);

	}

	/**
	 * Set the Marketing Basis.
	 * This field contains the basis for marketing approval.
	 * @param strMarketingBasis This field contains the String Value of Marketing Basis 
	 */ 
	public void setMarketingBasis (String strMarketingBasis) 
	{
		ID marketingBasis  = (ID)getDataElement(1256);
		marketingBasis.setValue(strMarketingBasis); 
		setMarketingBasis(marketingBasis);

	} 

	/** 
	 * Set the Marketing Basis.
	 * This field contains the basis for marketing approval.
	 * @param objmarketingBasis Object of Marketing Basis.
	 */ 
	public void setMarketingBasis(ID objmarketingBasis)
	{
		setDataType(1256,objmarketingBasis);

	}

	/**
	 * Add the Model Identifier.
	 * This field contains the manufacturer's model identifier for the product.
	 * @param strModelIdentifier This field contains the String Value of Model Identifier 
	 */ 
	public void addModelIdentifier (String strModelIdentifier) 
	{
		ST modelIdentifier  = (ST)getDataElement(1252);
		modelIdentifier.setValue(strModelIdentifier); 
		addModelIdentifier(modelIdentifier);

	} 

	/** 
	 * Add the Model Identifier.
	 * This field contains the manufacturer's model identifier for the product.
	 * @param objmodelIdentifier Object of Model Identifier.
	 */ 
	public void addModelIdentifier(ST objmodelIdentifier)
	{
		addDataType(1252,objmodelIdentifier);

	} 

	/** 
	 * Set the Model Identifier.
	 * This field contains the manufacturer's model identifier for the product.
	 * @param objmodelIdentifierList List of Model Identifier.
	 */ 
	@SuppressWarnings("unchecked")
	public void setModelIdentifier(ISingleCollection<ST> objmodelIdentifierList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objmodelIdentifierList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1252,objCollection);
	}

	/**
	 * Add the Other Identifier.
	 * This field contains any other identifier used to for the product.
	 * @param strOtherIdentifier This field contains the String Value of Other Identifier 
	 */ 
	public void addOtherIdentifier (String strOtherIdentifier) 
	{
		ST otherIdentifier  = (ST)getDataElement(1254);
		otherIdentifier.setValue(strOtherIdentifier); 
		addOtherIdentifier(otherIdentifier);

	} 

	/** 
	 * Add the Other Identifier.
	 * This field contains any other identifier used to for the product.
	 * @param objotherIdentifier Object of Other Identifier.
	 */ 
	public void addOtherIdentifier(ST objotherIdentifier)
	{
		addDataType(1254,objotherIdentifier);

	} 

	/** 
	 * Set the Other Identifier.
	 * This field contains any other identifier used to for the product.
	 * @param objotherIdentifierList List of Other Identifier.
	 */ 
	@SuppressWarnings("unchecked")
	public void setOtherIdentifier(ISingleCollection<ST> objotherIdentifierList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objotherIdentifierList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1254,objCollection);
	}

	/**
	 * Set the Product Code.
	 * This field contains the product code from an external coding system such as that used by the CDRH at the FDA.
	 * @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 setProductCode (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(1255);
		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);
		setProductCode(cwe);

	} 

	/** 
	 * Set the Product Code.
	 * This field contains the product code from an external coding system such as that used by the CDRH at the FDA.
	 * @param objproductCode Object of Product Code.
	 */ 
	public void setProductCode(CWE objproductCode)
	{
		setDataType(1255,objproductCode);

	}

	/**
	 * 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 Throws when Segment Validation fails.
	 */
	public boolean validate()throws InvalidSegmentException 
	{
		/*
		 * Manufacturer/Distributor,Country,Brand Name are required fields.
		 */
		try
		{
			super.validate();

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