<#--
     Generate the type-safe Java proxy for a BusinessInterfaceDefinition
     - object is an instance of BusinessInterfaceDefinition
     - properties is a HashMap generated by PropertiesHelper.getInstance() - it provides access to the
       named GeneratorProperty elements in ApplicationControlData.
  -->
<#import "common.ftl" as common/>  
<@common.copyright/>
 *  Name: ${object.name?cap_first}
 * <#if object.versionID?has_content> Version: ${object.versionID}</#if>
 * <#if object.description?has_content> Description: ${object.description}</#if>
 *****************************************************/
<#if object.type == "group">
<#assign TypeName><@common.toName name="${object.name?cap_first}"/></#assign>
<#else>
<#assign TypeName><@common.toName name="${object.datatype.idref.name?cap_first}"/></#assign>
</#if>
<#if properties.javaPackage?has_content>package ${properties.javaPackage};</#if>

import com.ssaglobal.bdeimpl.java.BusinessDataEntity;
import com.ssaglobal.bdeimpl.java.BdeIterator;
import com.ssaglobal.bde.BdeException;
import com.ssaglobal.bde.Date;
import com.ssaglobal.bde.DateTime;
import com.ssaglobal.bde.Time;
import java.math.BigDecimal;
import java.math.BigInteger;

/**
 * Generated typesafe BDE '${object.type}' Type ${TypeName}.
 * <#if object.versionID?has_content>Component Version: ${object.versionID}<br></#if>
 * <#if object.description?has_content>Component Description: ${object.description}</#if>
 */
public class ${TypeName}  extends BusinessDataEntity
{
	/**
	 * Constructor for creating an 'empty' type ${TypeName}.
	 * <br>Depending on the action you want to perform identifying or mandatory attributes may be required.
	 */
	public ${TypeName}()
	{
		super(s_metaData[0][ITEM_NAME]);
	}


<#assign attributeIndex=0>
<#list object.attributeRelationship as attr>
	<#assign subAttribute=attr.attribute.idref>
	<#if !subAttribute.isHidden>  
	<#assign attributeIndex=attributeIndex+1>
	<#switch subAttribute.type>
	  	<#case "simple">
		<#assign dataType = common.getjavadt(subAttribute.datatype.idref.primitiveDatatype)>
		<#assign subAttributeName=attr.name>		
		<#break>
		<#case "group">
		<#assign dataType = subAttribute.name?cap_first>
		<#assign subAttributeName=subAttribute.name>		
		<#break>
		<#case "complex">		
		<#assign dataType = subAttribute.datatype.idref.name?cap_first>
		<#assign subAttributeName=attr.name>		
		<#break>
	</#switch>
	/** 
	 * Get <@common.printAttributeInfo _attr=subAttribute/>
	 * <@common.printAttributeDescription _attr=subAttribute/>
	 */	   	
	public ${dataType} get${subAttributeName?cap_first}() throws BdeException	
   	{
		<#if subAttribute.type = "simple">
		return super.get${dataType?cap_first}Value(${attributeIndex});
		<#else>
		${dataType} new${dataType} = new ${dataType}();
		super.getComplexValue(${attributeIndex}, new${dataType});
		return new${dataType};
		</#if>
   	}
    
	/** 
	 * Set <@common.printAttributeInfo _attr=subAttribute/>
	 * <@common.printAttributeDescription _attr=subAttribute/>
	 */	   	
   	public void set${subAttributeName?cap_first}(${dataType} value) throws BdeException		
   	{
		<#if subAttribute.type = "simple">
		super.set${dataType?cap_first}Value(${attributeIndex}, value);
		<#else>
		super.setComplexValue(${attributeIndex}, value);
		</#if>
   	}
   		
	/** 
	 * Has <@common.printAttributeInfo _attr=subAttribute/>
	 * <@common.printAttributeDescription _attr=subAttribute/>
	 */	   	
   	public boolean has${subAttributeName?cap_first}()
   	{
       	return super.hasValue(${attributeIndex});
   	}	
   	
	/** 
	 * Unset <@common.printAttributeInfo _attr=subAttribute/>
	 * <@common.printAttributeDescription _attr=subAttribute/>
	 */	   	
   	public void unset${subAttributeName?cap_first}()
   	{
       	super.unsetValue(${attributeIndex});
   	}	  

	</#if>	
</#list>
	private static final String [][] s_metaData = 
	{
		{"${TypeName}"}
<#list object.attributeRelationship as attr>
	<#assign subAttribute=attr.attribute.idref>
	<#if !subAttribute.isHidden>
	<#switch subAttribute.type>
	  	<#case "simple">
		,{"${attr.name}", TYPE_${subAttribute.datatype.idref.primitiveDatatype?upper_case}<#list subAttribute.datatype.idref.facet as facet><#if facet_index = 0>,</#if><#break></#list><#list subAttribute.datatype.idref.facet as facet>"${facet.type?j_string}:${facet.value?j_string}"<#if facet_has_next>,</#if></#list>}  	
		<#break>
		<#case "group">
		,{"${attr.name}", TYPE_GROUP}
		<#break>
		<#case "complex">
		,{"${attr.name}", TYPE_COMPLEX}
		<#break>	
	</#switch>
	</#if>
</#list>
	};
	
	protected String getMetaData(int ItemIndex, int ProperyIndex)
	{
		try
        {
            return s_metaData[ItemIndex][ProperyIndex];
        }
        catch (Exception e) 
        {
            return null;
       	}
	}


	protected BdeIterator _createComponentIterator(int index)
	{
		return null;
	}
	
	/*package private */ static String _getPrimaryKeys(String sParentName)
	{
		return null;
	}
}
