<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhenwei.yin  
    $Date: 2013-4-16 下午3:49:53  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t" baseTable="HLS_DOCUMENT_TYPE" defaultOrderBy="t.document_category,t.document_type" needAccessControl="false">
    <bm:fields>
        <bm:field name="document_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_TYPE" prompt="HLS.DOCUMENT_TYPE"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="HLS.DESCRIPTION"/>
        <bm:field name="document_category_desc" forInsert="false" forUpdate="false" prompt="HLS.DOCUMENT_CATEGORY_DESC"/>
        <bm:field name="document_category" databaseType="VARCHAR" datatype="java.lang.String" lookupCode="CODING_RULE_DOC_CATEGORY" lookupField="document_category_desc" prompt="HLS.DOCUMENT_CATEGORY"/>
        <bm:field name="business_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE" prompt="HLS.BUSINESS_TYPE"/>
        <bm:field name="business_type_desc" forInsert="false" forUpdate="false" prompt="HLS.BUSINESS_TYPE_DESC"/>
        <bm:field name="status_profile" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS_PROFILE" prompt="HLS.STATUS_PROFILE"/>
        <bm:field name="coding_rule" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CODING_RULE"/>
        <bm:field name="coding_rule_desc" forInsert="false" forUpdate="false" prompt="HLS.CODING_RULE_DESC"/>
        <bm:field name="ref_document_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_DOCUMENT_TYPE"/>
        <bm:field name="ref_document_type_desc" forInsert="false" forUpdate="false" prompt="HLS.REF_DOCUMENT_TYPE"/>
        <bm:field name="printing_format" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRINTING_FORMAT" prompt="HLS.PRINTING_FORMAT"/>
        <bm:field name="printing_format_desc" forInsert="false" forUpdate="false" prompt="HLS.PRINTING_FORMAT"/>
        <bm:field name="approval_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="APPROVAL_METHOD"/>
        <bm:field name="approval_method_desc" forInsert="false" forUpdate="false" prompt="HLS.APPROVAL_METHOD"/>
        <bm:field name="ln_starting" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LN_STARTING" prompt="HLS.LN_STARTING"/>
        <bm:field name="ln_step_length" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LN_STEP_LENGTH" prompt="HLS.LN_STEP_LENGTH"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="HLS.ENABLED_FLAG"/>
        <bm:field name="workflow_id" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WORKFLOW_ID"/>
        <bm:field name="workflow_desc" forInsert="false" forUpdate="false" prompt="HLS.WORKFLOW_DESC"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01" prompt="HLS_DOCUMENT_TYPE.REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02" prompt="HLS_DOCUMENT_TYPE.REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03" prompt="HLS_DOCUMENT_TYPE.REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="HLS_DOCUMENT_TYPE.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="HLS_DOCUMENT_TYPE.REF_V05"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N01" prompt="HLS_DOCUMENT_TYPE.REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N02" prompt="HLS_DOCUMENT_TYPE.REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N03" prompt="HLS_DOCUMENT_TYPE.REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N04" prompt="HLS_DOCUMENT_TYPE.REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N05" prompt="HLS_DOCUMENT_TYPE.REF_N05"/>
        <bm:field name="ref_d01" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D01" prompt="HLS_DOCUMENT_TYPE.REF_D01"/>
        <bm:field name="ref_d02" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D02" prompt="HLS_DOCUMENT_TYPE.REF_D02"/>
        <bm:field name="ref_d03" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D03" prompt="HLS_DOCUMENT_TYPE.REF_D03"/>
        <bm:field name="ref_d04" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D04" prompt="HLS_DOCUMENT_TYPE.REF_D04"/>
        <bm:field name="ref_d05" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D05" prompt="HLS_DOCUMENT_TYPE.REF_D05"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    *
                FROM
                    (SELECT
                        t.document_type,
                        t.document_type_desc AS description,
                        t.document_category,
                        t.document_category_desc,
                        t.business_type,
                        t.business_type_desc,
                        t.status_profile,
                        t.coding_rule,
                        t.coding_rule_desc,
                        t.printing_format,
                        t.printing_format_desc,
                        t.approval_method,
                        t.approval_method_desc,
                        t.ln_starting,
                        t.ln_step_length,
                        t.ref_document_type,
                        t.ref_document_type_desc,
                        t.enabled_flag,
                        t.workflow_id,
                        t.workflow_desc,
                        t.ref_v01,
                        t.ref_v02,
                        t.ref_v03,
                        t.ref_v04,
                        t.ref_v05,
                        t.ref_n01,
                        t.ref_n02,
                        t.ref_n03,
                        t.ref_n04,
                        t.ref_n05,
                        t.ref_d01,
                        t.ref_d02,
                        t.ref_d03,
                        t.ref_d04,
                        t.ref_d05,
                        (SELECT u.admin_flag FROM sys_user u WHERE u.user_id = ${/session/@user_id}
                        ) admin_flag
                    FROM
                        hls_document_type_v t
                    )t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:query-fields>
        <bm:query-field field="document_type" queryOperator="like"/>
        <bm:query-field field="document_category" queryOperator="="/>
    </bm:query-fields>
    <bm:primary-key>
        <bm:pk-field name="document_type"/>
    </bm:primary-key>
</bm:model>
