<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-7-25 下午04:59:01  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="CON_CLAUSE_TEMPLET_LINE">
    <bm:fields>
        <bm:field name="templet_line_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TEMPLET_LINE_ID" prompt="CON_CLAUSE_TEMPLET_LINE.TEMPLET_LINE_ID"/>
        <bm:field name="templet_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TEMPLET_ID" prompt="CON_CLAUSE_TEMPLET_LINE.TEMPLET_ID"/>
        <bm:field name="clause_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CLAUSE_ID" prompt="CON_CLAUSE_TEMPLET_LINE.CLAUSE_ID"/>
        <bm:field name="parent_line_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PARENT_LINE_ID" prompt="CON_CLAUSE_TEMPLET_LINE.PARENT_LINE_ID"/>
        <bm:field name="order_seq" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ORDER_SEQ" prompt="CON_CLAUSE_TEMPLET_LINE.ORDER_SEQ"/>
        <bm:field name="display_seq" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DISPLAY_SEQ" prompt="CON_CLAUSE_TEMPLET_LINE.DISPLAY_SEQ"/>
        <bm:field name="revisable_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REVISABLE_FLAG" prompt="CON_CLAUSE_TEMPLET_LINE.REVISABLE_FLAG"/>
        <bm:field name="nullable_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NULLABLE_FLAG" prompt="CON_CLAUSE_TEMPLET_LINE.NULLABLE_FLAG"/>
        <bm:field name="expand_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXPAND_FLAG" prompt="CON_CLAUSE_TEMPLET_LINE.EXPAND_FLAG"/>
        <bm:field name="deletable_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DELETABLE_FLAG" prompt="CON_CLAUSE_TEMPLET_LINE.DELETABLE_FLAG"/>
        <bm:field name="parent_clause_code" expression="(select cbc.clause_code from con_basic_clause cbc,con_clause_templet_line ctl where cbc.CLAUSE_ID=ctl.clause_id and ctl.templet_line_id=t1.parent_line_id)" forInsert="false" forUpdate="false" prompt="CON_BASIC_CLAUSE.PARENT_CLAUSE_ID"/>
        <bm:field name="clause_code" displayWidth="150" expression="cbc1.clause_code" forDisplay="true" forQuery="true" physicalName="CLAUSE_CODE" prompt="CON_BASIC_CLAUSE.CLAUSE_CODE"/>
        <bm:field name="clause_desc" displayWidth="150" expression="cbc1.description" forDisplay="true" forQuery="true" physicalName="DESCRIPTION" prompt="CON_BASIC_CLAUSE.DESCRIPTION"/>
    </bm:fields>
    <bm:relations>
        <bm:relation name="ref1" joinType="LEFT OUTER" refAlias="cbc1" refModel="cont.CON201.con_basic_clause">
            <bm:reference foreignField="clause_id" localField="clause_id"/>
        </bm:relation>
    </bm:relations>
    <bm:ref-fields>
        <bm:ref-field name="clause_text_cn" relationName="ref1" sourceField="clause_text_cn"/>
        <bm:ref-field name="clause_text_en" relationName="ref1" sourceField="clause_text_en"/>
        <bm:ref-field name="clause_text_jp" relationName="ref1" sourceField="clause_text_jp"/>
    </bm:ref-fields>
    <bm:query-fields>
        <bm:query-field name="clause_code" queryExpression="cbc1.clause_code like ${@clause_code}"/>
        <bm:query-field name="clause_name" queryExpression="cbc1.description like ${@clause_name}"/>
        <bm:query-field name="enabled_flag" queryExpression="(t1.enabled_flag=${@enabled_flag} or ${@enabled_flag}=&apos;ALL&apos;)"/>
        <bm:query-field name="not_templet_line_id" queryExpression="(not exists(select 1 from con_clause_templet_line ctl where ctl.parent_line_id=${@not_templet_line_id} and t1.templet_line_id =ctl.templet_line_id) and t1.templet_line_id !=${@not_templet_line_id})"/>
    </bm:query-fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="templet_line_id"/>
    </bm:primary-key>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.templet_id=${@templet_id}"/>
    </bm:data-filters>
</bm:model>
