<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qianming  
    $Date: 2015-7-27 下午4:38:18  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
        <bm:field name="tmp_id"/>
        <bm:field name="file_path"/>
        <bm:field name="file_name"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            	select * from bgfl_generate_word_tmp t1 
            	where t1.tmp_id = ${@tmp_id}
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
            	declare
            		v_tmp_id number;
            	begin
            		v_tmp_id:= bgfl_generate_word_tmp_s.nextval;
            		insert into bgfl_generate_word_tmp(tmp_id,file_path,file_name,description) 
            		values(v_tmp_id,${/parameter/@file_path},${/parameter/@file_name},${/parameter/@description});
            		${@tmp_id} :=  v_tmp_id;
            	end;
            ]]></bm:update-sql>
            <bm:parameters>
                <bm:parameter name="tmp_id" output="true" outputPath="@tmp_id"/>
            </bm:parameters>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
                begin
                  update bgfl_generate_word_tmp t
                  	set t.file_size = ${@file_size}
                  where t.tmp_id = ${@tmp_id};
                end;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
                begin
                	bgfl_upload_atm_pkg.upload_atm(
                	   p_document_category=>${@document_category},
                	   p_document_table =>${@document_table},
                       p_document_id    =>${@document_id},
                       p_tmp_id         =>${@tmp_id},
                       p_tab_group	    =>${@tab_group},
                       p_user_id        =>${/session/@user_id}
                	);
                end;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
