<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-7-24 上午11:05:54  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="HLS_DOC_LAYOUT_BUTTON" defaultOrderBy="display_order">
    <bm:fields>
        <bm:field name="function_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FUNCTION_CODE" prompt="HLS031.HLS_DOC_LAYOUT_BUTTON.FUNCTION_CODE"/>
        <bm:field name="button_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUTTON_CODE" prompt="HLS031.HLS_DOC_LAYOUT_BUTTON.BUTTON_CODE"/>
        <bm:field name="prompt" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROMPT" prompt="HLS031.HLS_DOC_LAYOUT_BUTTON.PROMPT"/>
        <bm:field name="save_data_first" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SAVE_DATA_FIRST" prompt="HLS031.HLS_DOC_LAYOUT_BUTTON.SAVE_DATA_FIRST"/>
        <bm:field name="system_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SYSTEM_FLAG" prompt="HLS031.HLS_DOC_LAYOUT_BUTTON.SYSTEM_FLAG"/>
        <bm:field name="display_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DISPLAY_FLAG" prompt="HLS031.HLS_DOC_LAYOUT_BUTTON.DISPLAY_FLAG"/>
        <bm:field name="display_order" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DISPLAY_ORDER" prompt="HLS031.HLS_DOC_LAYOUT_BUTTON.DISPLAY_ORDER"/>
        <bm:field name="javascript" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="JAVASCRIPT" prompt="HLS031.HLS_DOC_LAYOUT_BUTTON.JAVASCRIPT"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="HLS031.HLS_DOC_LAYOUT_BUTTON.ENABLED_FLAG"/>
        <bm:field name="action_after_button" databaseType="VARCHAR2" datatype="java.lang.String" lookupCode="HLS_ACTION_AFTER_BUTTON" lookupField="action_after_button_display" physicalName="ACTION_AFTER_BUTTON" prompt="HLS.ACTION_AFTER_BUTTON"/>
        <bm:field name="action_after_button_display" forInsert="false" forUpdate="false" prompt="HLS.ACTION_AFTER_BUTTON"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:operations>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
                begin
        		    hls_doc_layout_button_pkg.add_layout_user_button(p_function_code      => ${@function_code},
									                                   p_button_code      => ${@button_code},
									                                   p_prompt           => ${@prompt},
									                                   p_save_data_first  => ${@save_data_first},
									                                   p_action_after_button => ${@action_after_button},
									                                   p_system_flag         => ${@system_flag},
									                                   p_display_flag        => ${@display_flag},
									                                   p_display_order       => ${@display_order},
									                                   p_javascript          => ${@javascript},
									                                   p_enabled_flag        => ${@enabled_flag},
									                                   p_user_id             => ${/session/@user_id});
        		end;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
            BEGIN
                hls_doc_layout_button_pkg.button_config_load(p_function_code => ${@function_code},p_user_id => ${/session/@user_id});
            END;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field field="button_code" queryOperator="like"/>
        <bm:query-field field="prompt" queryOperator="like"/>
        <bm:query-field name="enabled_flag" queryExpression="(t1.enabled_flag=${@enabled_flag} or ${@enabled_flag}=&apos;ALL&apos;)"/>
    </bm:query-fields>
    <bm:primary-key>
        <bm:pk-field name="button_code"/>
        <bm:pk-field name="function_code"/>
    </bm:primary-key>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.function_code=${@function_code}"/>
    </bm:data-filters>
</bm:model>
