<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: xiaobo  
    $Date: 2012-11-26 上午9:11:52  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" allowFetchAll="false" baseTable="PSR_REPORT_HEADERS" defaultOrderBy="report_creation_date desc">
    <bm:fields>
        <bm:field name="report_header_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REPORT_HEADER_ID" prompt="PSR_REPORT_HEADERS.REPORT_HEADER_ID"/>
        <bm:field name="report_header_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REPORT_HEADER_NAME" prompt="PSR_REPORT_HEADERS.REPORT_HEADER_NAME"/>
        <bm:field name="report_header_description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REPORT_HEADER_DESCRIPTION" prompt="PSR_REPORT_HEADERS.REPORT_HEADER_DESCRIPTION"/>
        <bm:field name="report_owner" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REPORT_OWNER" prompt="PSR_REPORT_HEADERS.REPORT_OWNER"/>
        <bm:field name="view_range" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VIEW_RANGE" prompt="PSR_REPORT_HEADERS.VIEW_RANGE"/>
        <bm:field name="report_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REPORT_TYPE" prompt="PSR_REPORT_HEADERS.REPORT_TYPE"/>
        <bm:field name="sql_statement" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SQL_STATEMENT" prompt="PSR_REPORT_HEADERS.SQL_STATEMENT"/>
        <bm:field name="report_creation_date" databaseType="DATE" datatype="java.util.Date" physicalName="report_creation_date" prompt="PSR_REPORT_HEADERS.report_creation_date"/>
        <bm:field name="fixed_time_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIXED_TIME_FLAG" prompt="PSR_REPORT_HEADERS.FIXED_TIME_FLAG"/>
        <bm:field name="start_date" databaseType="DATE" datatype="java.util.Date" physicalName="start_date" prompt="PSR_REPORT_HEADERS.start_date"/>
        <bm:field name="push_cycle" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PUSH_CYCLE" prompt="PSR_REPORT_HEADERS.PUSH_CYCLE"/>
        <bm:field name="other_report_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="OTHER_REPORT_FLAG" prompt="PSR_REPORT_HEADERS.OTHER_REPORT_FLAG"/>
        <bm:field name="other_report_header_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OTHER_REPORT_HEADER_ID" prompt="PSR_REPORT_HEADERS.OTHER_REPORT_HEADER_ID"/>
        <bm:field name="synchronization_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SYNCHRONIZATION_FLAG" prompt="PSR_REPORT_HEADERS.SYNCHRONIZATION_FLAG"/>
        <bm:field name="layout_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LAYOUT_CODE" prompt="PSR_REPORT_HEADERS.LAYOUT_CODE"/>
        <bm:field name="layout_code_desc" expression="(select d.description from hls_doc_layout d where d.layout_code=t1.layout_code)" forInsert="false" forUpdate="false"/>
        <bm:field name="width" expression="(select d.width from hls_doc_layout d where d.layout_code=t1.layout_code)" forInsert="false" forUpdate="false"/>
        <bm:field name="height" expression="(select d.height from hls_doc_layout d where d.layout_code=t1.layout_code)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <s:bm-script><![CDATA[
            var cx = Packages.leaf.javascript.Context.getCurrentContext();
            Packages.leaf.plugin.script.engine.ScriptImportor.defineExternScript(cx, this, $ctx.getData(), "aut_authority_bm_validate.js");
        ]]></s:bm-script>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="report_header_id"/>
    </bm:primary-key>
    <bm:data-filters>
        <!-- <bm:data-filter name="report_owner" enforceOperations="query" expression="(t1.report_owner = ${/session/@user_id} or t1.view_range = &apos;PUBLIC&apos;)"/> -->
        <bm:data-filter enforceOperations="query" expression="(t1.report_header_id = ${/parameter/@report_header_id} or nvl(${@all_query_flag},&apos;N&apos;)=&apos;Y&apos;)"/>
    </bm:data-filters>
    <bm:query-fields>
        <bm:query-field name="report_header_name" queryExpression="t1.report_header_name like &apos;%&apos;||${/parameter/@report_header_name}||&apos;%&apos;"/>
        <bm:query-field name="report_type" queryExpression="t1.report_type = ${/parameter/@report_type}"/>
    </bm:query-fields>
</bm:model>
