<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ericyin  
    $Date: 2013-3-28 下午1:55:28  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:e="leaf.service.exception" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="HLS_DEFAULT_PARAMETER">
    <bm:fields>
        <bm:field name="role_id" databaseType="NUMBER" datatype="java.lang.Long" forQuery="true" physicalName="ROLE_ID" prompt="HLS_DEFAULT_PARAMETER.ROLE_ID"/>
        <bm:field name="role_desc" expression="(select a.description from sys_role_vl a where a.role_id = t1.role_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="role_code" expression="(select a.role_code from sys_role_vl a where a.role_id = t1.role_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" forQuery="true" physicalName="COMPANY_ID" prompt="HLS_DEFAULT_PARAMETER.COMPANY_ID"/>
        <bm:field name="lease_organization" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_ORGANIZATION" prompt="HLS_DEFAULT_PARAMETER.LEASE_ORGANIZATION"/>
        <bm:field name="unit_id" expression="(select oa.unit_id from hls_lease_org_assign oa where oa.lease_organization = t1.lease_organization and oa.company_id=t1.company_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="unit_name" expression="(select eou.unit_name from hls_lease_org_assign oa,exp_org_unit_v eou where oa.lease_organization = t1.lease_organization and oa.company_id=t1.company_id and oa.unit_id=eou.unit_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="lease_organization_name" expression="(select a.description from hls_lease_organization a where a.lease_organization = t1.lease_organization)" forInsert="false" forUpdate="false"/>
        <bm:field name="lease_channel" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHANNEL" prompt="HLS_DEFAULT_PARAMETER.LEASE_CHANNEL"/>
        <bm:field name="lease_channel_desc" expression="(select a.description from hls_lease_channel a where a.lease_channel = t1.lease_channel)" forInsert="false" forUpdate="false"/>
        <bm:field name="division" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DIVISION" prompt="HLS_DEFAULT_PARAMETER.DIVISION"/>
        <bm:field name="division_desc" expression="(select a.description from hls_division a where a.division = t1.division)" forInsert="false" forUpdate="false"/>
        <bm:field name="lease_chance_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHANCE_TYPE" prompt="HLS_DEFAULT_PARAMETER.LEASE_CHANCE_TYPE"/>
        <bm:field name="project_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_TYPE" prompt="HLS_DEFAULT_PARAMETER.PROJECT_TYPE"/>
        <bm:field name="contract_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_TYPE" prompt="HLS_DEFAULT_PARAMETER.CONTRACT_TYPE"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01" prompt="HLS_DEFAULT_PARAMETER.REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02" prompt="HLS_DEFAULT_PARAMETER.REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03" prompt="HLS_DEFAULT_PARAMETER.REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="HLS_DEFAULT_PARAMETER.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="HLS_DEFAULT_PARAMETER.REF_V05"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N01" prompt="HLS_DEFAULT_PARAMETER.REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N02" prompt="HLS_DEFAULT_PARAMETER.REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N03" prompt="HLS_DEFAULT_PARAMETER.REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N04" prompt="HLS_DEFAULT_PARAMETER.REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N05" prompt="HLS_DEFAULT_PARAMETER.REF_N05"/>
        <bm:field name="ref_d01" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D01" prompt="HLS_DEFAULT_PARAMETER.REF_D01"/>
        <bm:field name="ref_d02" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D02" prompt="HLS_DEFAULT_PARAMETER.REF_D02"/>
        <bm:field name="ref_d03" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D03" prompt="HLS_DEFAULT_PARAMETER.REF_D03"/>
        <bm:field name="ref_d04" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D04" prompt="HLS_DEFAULT_PARAMETER.REF_D04"/>
        <bm:field name="ref_d05" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D05" prompt="HLS_DEFAULT_PARAMETER.REF_D05"/>
        <bm:field name="company_short_name" expression="(select fc.company_short_name from fnd_companies_vl fc where fc.company_id=t1.company_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="company_code" expression="(select fc.company_code from fnd_companies_vl fc where fc.company_id=t1.company_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="employee_id" expression="(select su.employee_id from sys_user su where su.user_id=${/session/@user_id} and exists(select 1 from hls_salesman_v d where d.employee_id=su.employee_id))" forInsert="false" forUpdate="false"/>
        <bm:field name="employee_name" expression="(select su.description from sys_user su where su.user_id=${/session/@user_id} and exists(select 1 from hls_salesman_v d where d.employee_id=su.employee_id))" forInsert="false" forUpdate="false"/>
        <bm:field name="lov_search_rule" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOV_SEARCH_RULE"/>
        <bm:field name="price_list" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRICE_LIST"/>
        <bm:field name="price_list_name" expression="(select p.description from hls_price_list p where p.price_list=t1.price_list)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:query-fields>
        <bm:query-field name="role_id" queryExpression="t1.role_id=${@role_id}"/>
        <bm:query-field name="company_id" queryExpression="t1.company_id=${@company_id}"/>
    </bm:query-fields>
    <bm:primary-key>
        <bm:pk-field name="company_id"/>
        <bm:pk-field name="role_id"/>
    </bm:primary-key>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="HLS.HLS109_UNIQUE_ERROR"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
