<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hp  
    $Date: 2014-7-16 下午2:55:07  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                 select t.interface_log_id,t.interface_header_id,t.line_number,t.message from fnd_interface_log t
                 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
        
                 begin
				  ins_policy_import_pkg.delete_interface(p_batch_id => ${@batch_id});
				end; 
               ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:parameters>
                <bm:parameter name="err_count" output="true" outputPath="/parameter/@err_count"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[ 
                begin
                ins_policy_import_pkg.import_interface(p_header_id  => ${@header_id},
        											   p_type   =>${@type},
									                   p_user_id => ${/session/@user_id},
									                   p_err_count => ${@err_count});
			end;  
               ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:parameters>
                <bm:parameter name="valid_to" output="true" outputPath="/parameter/@valid_to"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[ 
                begin
                 ins_insurance_policy_pkg.get_insurance_valid_to(p_contract_id =>${@contract_id},
                                   p_project_id =>${@project_id},
                                   p_quotation_id =>${@quotation_id},
                                   p_valid_from   =>to_date(${@valid_from},'yyyy-mm-dd'),
                                   p_valid_to     =>${@valid_to},
                                   p_user_id      =>${/session/@user_id});
			end;  
               ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="interface_header_id"/>
        <bm:field name="line_number"/>
        <bm:field name="message"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="interface_header_id" queryOperator="="/>
    </bm:query-fields>
</bm:model>
