<#--
     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/>
 *  BID Name: ${object.name?cap_first}<#if object.versionID?has_content>${'\n'} *  BID Version: ${object.versionID}</#if><#if object.description?has_content>${'\n'} *  BID Description: ${object.description}</#if><#if object.status?has_content>${'\n'} *  BID status: ${object.status}</#if><#if object.schemaVersion?has_content>${'\n'} *  Schema Version: ${object.schemaVersion}</#if>
 ****************************************************/

<#assign bdeName>
	<@common.toName name="${object.name?cap_first}"/>
</#assign>

using System;
using OpenWorld.Adapter.BdeImpl;
using OpenWorld.Adapter.Bde;

<#if properties.namespace?has_content>namespace ${properties.namespace}
{
</#if>
	/// <summary>
 	/// Generated typesafe BDE Proxy Manager for the BDE ${object.name?cap_first}.<br>
 	/// This ${object.name?cap_first}Manager extends com.ssaglobal.bdeimpl.java.BdeManager.<br>
 	/// BID Name: ${object.name?cap_first}<br>
	/// <#if object.versionID?has_content>${'\n\t'}/// BID Version: ${object.versionID}<br></#if><#if object.schemaVersion?has_content>${'\n\t'}/// Schema Version: ${object.schemaVersion}<br></#if><#if object.description?has_content>${'\n\t'}/// BID Description: ${object.description}<br></#if>
	/// </summary>
	public class ${bdeName?cap_first}Manager : BdeManager
	{
		/// <summary>
	 	/// Create a new ${bdeName}Manager for accessing ${bdeName} BDE components on the backend.
		/// </summary>
		public ${bdeName}Manager() : base()
		{
		}

<#list object.method as method>
	<#switch method.name>
  	<#case "Show">
		/// <summary>
	 	/// Try to retreive a ${bdeName} from the backend based in passed Identifying attributes, and Selection set in this ${bdeName}Manager.<br>
	 	/// <br>A ${bdeName} proxy is returned.<br>
	 	/// The parameters are identifying information which is used as input for the Show method.	<br>
<@GenerateControlAttributesJavadoc oMethod=method />	 
	 	/// @throws BdeException If anything goes wrong, superclass of BdeResultException and BdeCommunicationException.<br>
	 	/// @throws BdeCommunicationException If anything goes wrong on the transport level.	 <br>
	 	/// @throws BdeResultException If an error occurs on the backend during this List. This exception contains detailed information about the error on the server. <br>
	 	/// </summary>
		public ${bdeName} Show(${common.primkeys_types_and_names(object)}) 
		{
			return (${bdeName}) show(new ${bdeName}(${common.primkeys_names(object)}));
		}

	<#break>
	<#case "List">
		/// <summary>
		/// Try to retreive a number of ${bdeName} from the backend using Selection and Filter set in this ${bdeName}Manager.<br>
		/// <br>A ${bdeName}Iterator is returned, which can be used to iterate trough the retreived components.
<@GenerateControlAttributesJavadoc oMethod=method />			
		/// @throws BdeException If anything goes wrong, superclass of BdeResultException and BdeCommunicationException.<br>
		/// @throws BdeCommunicationException If anything goes wrong on the transport level.	 <br>
		/// @throws BdeResultException If an error occurs on the backend during this List. This exception contains detailed information about the error on the server. <br>
		/// </summary>
		public ${bdeName}Iterator List()  	
		{
			return (${bdeName}Iterator) list(-1);	
		}
		
		/// <summary>
		/// Try to retreive a number of ${bdeName} from the backend using Selection and Filter set in this ${bdeName}Manager.<br>
		/// A ${bdeName}Iterator is returned, which can be used to iterate trough the retreived components.<br>
<@GenerateControlAttributesJavadoc oMethod=method />			
		/// @param maxNrOfObjects Limits the number of returned components.
		/// @throws BdeException If anything goes wrong, superclass of BdeResultException and BdeCommunicationException.<br>
		/// @throws BdeCommunicationException If anything goes wrong on the transport level.<br>
		/// @throws BdeResultException If an error occurs on the backend during this List. This exception contains detailed information about the error on the server. <br>
		/// </summary>
		public ${bdeName}Iterator List(int maxNrOfObjects)  	
		{
			return (${bdeName}Iterator) list(maxNrOfObjects);
		}
	
	<#break>
	<#case "Create">
		/// <summary>
		/// Try to Create a new ${bdeName} in the backend with all data currently present in the ${bdeName} proxy.<br>
		/// <br>If the Create succeeds then the ${bdeName} proxy is filled with new data from the backend.<br>
<@GenerateControlAttributesJavadoc oMethod=method />			
		/// @param p_bde the ${bdeName} component which is used as input and output for the Create method.<br>
		/// @throws BdeException If anything goes wrong, superclass of BdeResultException and BdeCommunicationException.<br>
		/// @throws BdeCommunicationException If anything goes wrong on the transport level. <br>
		/// @throws BdeResultException If an error occurs on the backend during this Create. This exception contains detailed information about the error on the server. <br>
		/// </summary>
		public void Create(${bdeName} p_bde) 
		{
			create(p_bde);
		}

	<#break>
	<#case "Change">
		/// <summary>
		/// Try to Change a ${bdeName} in the backend with data currently present in the passed ${bdeName} proxy.<br>
		/// <br>If the Change succeeds then the ${bdeName} proxy is filled with new data from the backend.<br>
<@GenerateControlAttributesJavadoc oMethod=method />			
		/// @param p_bde the ${bdeName} component which is used as input and output for the Change method.	 
		///	@throws BdeException If anything goes wrong, superclass of BdeResultException and BdeCommunicationException.<br>
		/// @throws BdeCommunicationException If anything goes wrong on the transport level.<br>
		/// @throws BdeResultException If an error occurs on the backend during this Create. This exception contains detailed information about the error on the server. <br>
		/// </summary>	
		public void Change(${bdeName} p_bde) 
		{
			change(p_bde);
		}
	
	<#break>
	<#case "Delete">
		/// <summary>
		/// Try to Delete a ${bdeName} in the backend with identifying information present in the passed ${bdeName} proxy.<br>
<@GenerateControlAttributesJavadoc oMethod=method />			
		/// @param p_bde the ${bdeName} component which is used as input for the Delete method.<br> 
		/// @throws BdeException If anything goes wrong, superclass of BdeResultException and BdeCommunicationException.<br>
		/// @throws BdeCommunicationException If anything goes wrong on the transport level.<br>
		/// @throws BdeResultException If an error occurs on the backend during this Create. This exception contains detailed information about the error on the server. <br>
		/// </summary>	
		public void Delete(${bdeName} p_bde) 
		{
			_delete(p_bde);
		}

		/// <summary>
		/// Try to Delete a ${bdeName} in the backend with identifying information passed.<br>
		/// The parameters are identifying information which is used as input for the Delete method.<br>
<@GenerateControlAttributesJavadoc oMethod=method />			
		/// @throws BdeException If anything goes wrong, superclass of BdeResultException and BdeCommunicationException.<br>
		/// @throws BdeCommunicationException If anything goes wrong on the transport level. <br>
		/// @throws BdeResultException If an error occurs on the backend during this Create. This exception contains detailed information about the error on the server. <br>
		/// </summary>	
		public void Delete(${common.primkeys_types_and_names(object)}) 
		{
			_delete(new ${bdeName}(${common.primkeys_names(object)}));
		}

	<#break>
	<#case "SubscribeEvent">	
		/// <summary>	
		/// With the SubscribeEvent method a request can be issued for publishing all changes of a BDE each time a change occurs. 
		/// As Argument this method has a IPublishControl object which holds all publishing controlling data.<br>
		/// The IPublishControl object can be created using the BdeToolkit with an 'eventConsumer' argument.<br>
		/// Other optional 'SubscribeEvent' IPublishControl attributes are 'destination'.<br>
		/// The SubscribeEvent uses the Selection and Filter currently set in this Manager.
<@GenerateControlAttributesJavadoc oMethod=method />			
		/// </summary>		
		public void ${method.name}(IPublishControl publishControl) 
		{
			_specific((BusinessDataEntity) publishControl, "${method.name}");
		}
	
	<#break>
	<#case "UnSubscribeEvent">	
		/// <summary>		
		/// With the UnSubscribeEvent an application server can be notified that publishing of the changes in the instances of a specific BDE is not required anymore and should be stopped. 
		/// As Argument this method has a IPublishControl object which holds all publishing controlling data.<br>
		/// The IPublishControl object can be created using the BdeToolkit with an 'eventConsumer' argument.<br>
		/// There are no other optional IPublishControl attributes necceserry for UnSubscribeEvent.
<@GenerateControlAttributesJavadoc oMethod=method />			
		/// </summary>		
		public void ${method.name}(IPublishControl publishControl)
		{
			_specific((BusinessDataEntity) publishControl, "${method.name}");
		}

	<#break>
	<#case "SubscribeList">	
		/// <summary>		
	 	/// With the SubscribeList method a request can be issued for a full list of a BDE being published only once, to a specific consumer.
		/// The PublishList returns the same data as an asynchronous ListRequest, with the exception that the data is send using events.
		/// As Argument this method has a IPublishControl object which holds all publishing controlling data.<br>
		/// The IPublishControl object can be created using the BdeToolkit with an 'eventConsumer' argument.<br>
		/// Other optional 'SubscribeList' IPublishControl attributes are 'destination', 'maxNumberOfObjects' and 'eventBatchSize'.<br>
		/// The PublishList uses the Selection and Filter currently set in this Manager.
<@GenerateControlAttributesJavadoc oMethod=method />			
		/// </summary>		
		public void ${method.name}(IPublishControl publishControl) 
		{
			_specific((BusinessDataEntity) publishControl, "${method.name}");
		}
	
	<#break> <#-- "UnpublishChanges" "PublishList" "PublishChanges" are nog generated, can be used as user methods -->
	<#case "OnEvent"> <#-- Ignore in proxy code -->
	<#break> 
	<#case "PublishEvent">	<#-- Ignore in proxy code -->
	<#break>
	<#default>
		/// <summary>			
		/// Specific method ${method.name} for BDE ${bdeName}
<@GenerateControlAttributesJavadoc oMethod=method />			
		/// @throws BdeException If anything goes wrong, superclass of BdeResultException and BdeCommunicationException.<br>
		/// @throws BdeCommunicationException If anything goes wrong on the transport level.	 <br>
		/// @throws BdeResultException If an error occurs on the backend during this method call. This exception contains detailed information about the error on the server. <br>
		/// </summary>				
		public void ${method.name}(${bdeName} p_bde)
		{
			_specific(p_bde, "${method.name}");
		}
	
	</#switch>  
</#list>
<#assign cAttributeIndex=0>
<#list object.method as method>
	<#list method.methodArgument as methodArgument>
		<#if methodArgument.type == "controllingAttribute">
			<#assign dataType = common.getdotnetdt(methodArgument.datatype.idref.primitiveDatatype)>		  	
			<#assign functionType = common.getFunctiondt(methodArgument.datatype.idref.primitiveDatatype)>		  	
		/// <summary>					
		/// Has method for Specific Controlling Attribute '${methodArgument.name}' of method ${method.name}.
		/// <#if methodArgument.isMandatory>This Controlling attribute is mandatory !<br><#else>This Controlling attribute is optional.<br></#if>	 
		/// </summary>				
		public bool Has${method.name}${methodArgument.name?cap_first}()
		{
			return HasSpecificControlAttribute(${cAttributeIndex});
		}
		
		/// <summary>					
		/// Unset method for Specific Controlling Attribute '${methodArgument.name}' of method ${method.name}.
	 	/// <#if methodArgument.isMandatory>This Controlling attribute is mandatory !<br><#else>This Controlling attribute is optional.<br></#if>	 
		/// </summary>			 	
		public void Unset${method.name}${methodArgument.name?cap_first}()
		{
			UnsetSpecificControlAttribute(${cAttributeIndex});
		}
	
		<#if methodArgument.scope=="in" || methodArgument.scope=="inout">
		/// <summary>				
		/// Set method for Specific Controlling Attribute '${methodArgument.name}' of method ${method.name}.
	 	/// <#if methodArgument.isMandatory>This Controlling attribute is mandatory !<br><#else>This Controlling attribute is optional.<br></#if>
	 	/// @param ${methodArgument.name}Value the ${dataType} to set.
	 	/// @throws BdeException If anything goes wrong setting the attribute<br>
		/// </summary>			 	
		public void Set${method.name}${methodArgument.name?cap_first}(${dataType} ${methodArgument.name}Value)
		{
			Set${functionType?cap_first}SpecificControlAttribute(${cAttributeIndex}, ${methodArgument.name}Value);
		}

	</#if>
	<#if methodArgument.scope=="out" || methodArgument.scope=="inout">
		/// <summary>			
		/// Get method for Specific Controlling Attribute '${methodArgument.name}' of method ${method.name}.<br>
	 	/// <#if methodArgument.isMandatory>This Controlling attribute is mandatory !<br><#else>This Controlling attribute is optional.<br></#if>
	 	/// @return ${dataType} value.
	 	/// @throws BdeException If anything goes wrong getting the attribute, f.e value is not set<br>
		/// </summary>			 	
		public ${dataType} Get${method.name}${methodArgument.name?cap_first}() 
		{
			return Get${functionType?cap_first}SpecificControlAttribute(${cAttributeIndex});
		}
	
	</#if><#assign cAttributeIndex=cAttributeIndex+1>
		</#if>
	</#list>
</#list>
		protected override BusinessDataEntity _createBde()
		{
			return new ${bdeName}();
		}

		protected override BdeIterator _createIterator()
		{
			return new ${bdeName}Iterator();
		}
		
		protected override String _getBdeName()
		{
			return "${bdeName}<#list object.method as method><#list method.methodArgument as methodArgument><#if methodArgument.type == "controllingAttribute">:;:${method.name};${methodArgument.name};${methodArgument.scope};<#if methodArgument.isMandatory>true<#else>false</#if></#if></#list></#list>";
		}	
	
		private static String _primaryKeys = null;
	
		protected override String _getPrimaryKeys()
		{
			if (_primaryKeys == null)
				_primaryKeys = ${bdeName}._getPrimaryKeys("");
			return _primaryKeys;
		}
	}
<#if properties.namespace?has_content>}</#if>
<#macro GenerateControlAttributesJavadoc oMethod>
	<#list oMethod.methodArgument as methodArgument>
		<#if methodArgument.type == "controllingAttribute">
	 	/// Has <#if methodArgument.isMandatory>mandatory<#else>optional</#if> controlling attribute ${methodArgument.name} which has scope ${methodArgument.scope}.<br>
	 	</#if>
	 </#list>
</#macro>