<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-6-18 下午3:47:27  
    $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_TAB" defaultOrderBy="tab_seq">
    <bm:fields>
        <bm:field name="layout_code" databaseType="VARCHAR2" datatype="java.lang.String" forUpdate="false" physicalName="LAYOUT_CODE" prompt="HLS030.HLS_DOC_LAYOUT.LAYOUT_CODE"/>
        <bm:field name="tab_code" databaseType="VARCHAR2" datatype="java.lang.String" forUpdate="false" physicalName="TAB_CODE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.TAB_CODE"/>
        <bm:field name="tab_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TAB_DESC" prompt="HLS030.HLS_DOC_LAYOUT_TAB.TAB_DESC"/>
        <bm:field name="tab_seq" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TAB_SEQ" prompt="HLS030.HLS_DOC_LAYOUT_TAB.TAB_SEQ"/>
        <bm:field name="tab_group" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TAB_GROUP" prompt="HLS030.HLS_DOC_LAYOUT_TAB.TAB_GROUP"/>
        <bm:field name="base_table" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BASE_TABLE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.BASE_TABLE"/>
        <bm:field name="query_source" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="QUERY_SOURCE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.QUERY_SOURCE"/>
        <bm:field name="row_count" databaseType="NUMBER" datatype="java.lang.Long" insertExpression="" physicalName="ROW_COUNT" prompt="HLS030.HLS_DOC_LAYOUT_TAB.ROW_COUNT"/>
        <bm:field name="column_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COLUMN_COUNT" prompt="HLS030.HLS_DOC_LAYOUT_TAB.COLUMN_COUNT"/>
        <bm:field name="field_width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FIELD_WIDTH" prompt="HLS030.HLS_DOC_LAYOUT_TAB.FIELD_WIDTH"/>
        <bm:field name="label_width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LABEL_WIDTH" prompt="HLS030.HLS_DOC_LAYOUT_TAB.LABEL_WIDTH"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="HLS.ENABLED_FLAG"/>
        <bm:field name="configurable" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONFIGURABLE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.CONFIGURABLE"/>
        <bm:field name="margin_top" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="MARGIN_TOP" prompt="HLS030.HLS_DOC_LAYOUT_TAB.MARGIN_TOP"/>
        <bm:field name="margin_height" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MARGIN_HEIGHT" prompt="HLS030.HLS_DOC_LAYOUT_TAB.MARGIN_HEIGHT"/>
        <bm:field name="margin_width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MARGIN_WIDTH" prompt="HLS030.HLS_DOC_LAYOUT_TAB.MARGIN_WIDTH"/>
        <bm:field name="width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WIDTH"/>
        <bm:field name="height" databaseType="NUMBER" datatype="java.lang.Long" physicalName="HEIGHT"/>
        <bm:field name="box_width" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BOX_WIDTH" prompt="HLS030.HLS_DOC_LAYOUT_TAB.BOX_WIDTH"/>
        <bm:field name="show_box" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SHOW_BOX" prompt="HLS030.HLS_DOC_LAYOUT_TAB.SHOW_BOX"/>
        <bm:field name="parent_tab_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PARENT_TAB_CODE"/>
        <bm:field name="tab_type" databasetype="VARCHAR2" datatype="java.lang.String" physicalname="TAB_TYPE"/>
        <bm:field name="repeat_object" databasetype="VARCHAR2" datatype="java.lang.String" physicalname="REPEAT_OBJECT" prompt="HLS030.HLS_DOC_LAYOUT_TAB.REPEAT_OBJECT"/>
        <bm:field name="base_table_pk" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="BASE_TABLE_PK"/>
        <bm:field name="parent_table" databasetype="VARCHAR2" datatype="java.lang.String" physicalName="PARENT_TABLE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.PARENT_TABLE"/>
        <bm:field name="parent_tab_code_flag" forInsert="false" forUpdate="false"/>
        <bm:field name="parent_table_flag" forInsert="false" forUpdate="false"/>
        <bm:field name="ref_tab_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_TAB_CODE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.REF_TAB_CODE"/>
        <bm:field name="tab_ref_screen" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TAB_REF_SCREEN" prompt="HLS030.HLS_DOC_LAYOUT_TAB.TAB_REF_SCREEN"/>
        <bm:field name="tree_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TREE_CODE" prompt="HLS030.HLS_DOC_LAYOUT_TAB.TREE_CODE"/>
        <bm:field name="parent_loaded_object" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PARENT_LOADED_OBJECT"/>
        <bm:field name="attachment_tab_group" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ATTACHMENT_TAB_GROUP"/>
        <bm:field name="root_tree_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ROOT_TREE_CODE"/>
        <bm:field name="repeat_bindname_object" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REPEAT_BINDNAME_OBJECT"/>
        <bm:field name="query_bp_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="QUERY_BP_CATEGORY"/>
        <bm:field name="query_bp_category_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="QUERY_BP_CATEGORY_NAME"/>
        <bm:field name="parent_base_table_pk" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PARENT_BASE_TABLE_PK"/>
        <bm:field name="parent_table_tab_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PARENT_TABLE_TAB_CODE"/>
        <bm:field name="repeat_bp_seq" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REPEAT_BP_SEQ"/>
        <bm:field name="project_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NAME"/>
        <bm:field name="form_binder_tab_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FORM_BINDER_TAB_CODE"/>
        <bm:field name="query_only" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="QUERY_ONLY"/>
        <bm:field name="navbar" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NAVBAR"/>
        <bm:field name="fetchall" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FETCHALL"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    t1.layout_code,
                    t1.tab_code,
                    DECODE(t1.parent_tab_code_flag,'Y',t1.tab_code,t1.parent_table_tab_code) form_binder_tab_code,
                    t1.tab_desc,
                    t1.tab_seq,
                    t1.tab_group,
                    lower(t1.base_table) base_table,
                    t1.query_source,
                    t1.row_count,
                    t1.column_count,
                    t1.enabled_flag,
                    t1.created_by,
                    t1.creation_date,
                    t1.last_updated_by,
                    t1.last_update_date,
                    t1.configurable,
                    t1.field_width,
                    t1.label_width,
                    t1.margin_top,
                    t1.box_width,
                    t1.show_box,
                    t1.parent_tab_code,
                    lower(t1.parent_table) parent_table,
                    t1.base_table_pk,
                    t1.parent_table_tab_code,
                    t1.parent_base_table_pk,
                    t1.tab_type,
                    t1.parent_tab_code_flag,
                    t1.parent_table_flag,
                    t1.tree_code,
                    t1.ref_tab_code,
                    t1.tab_ref_screen,
                    t1.margin_width,
                    t1.width,
                    t1.margin_height,
                    t1.height,
                    t1.repeat_object,
                    DECODE(t1.repeat_bindertarget_flag,'Y',${/parameter/@bp_seq},'') repeat_bp_seq,
                    t1.parent_loaded_object,
                    t1.attachment_tab_group,
                    t1.root_tree_code,
                    t1.repeat_bindname_object,
                    (SELECT p.project_name FROM prj_project p WHERE p.project_id=${@document_id}
                    ) project_name,
                    t1.query_bp_category,
                    (SELECT
                        bc.description
                    FROM
                        hls_bp_category bc
                    WHERE
                        bc.bp_category=t1.query_bp_category
                    ) query_bp_category_name,
                    t1.query_only,
                    t1.navbar,
                    t1.fetchall
                FROM
                    hls_prj_layout_tab_v t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field field="tab_code" queryOperator="="/>
        <bm:query-field field="parent_table" queryOperator="="/>
        <bm:query-field field="enabled_flag" queryOperator="="/>
        <bm:query-field field="tree_code" queryExpression="(t1.tree_code=${@tree_code} or ${@all_data_flag}=&apos;Y&apos;)"/>
        <bm:query-field field="root_tree_code" queryExpression="(t1.root_tree_code=${@root_tree_code} or t1.parent_table=&apos;PRJ_PROJECT&apos;)"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.layout_code=${@layout_code}"/>
    </bm:data-filters>
</bm:model>
