<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-9-11 上午10:12:15  
    $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="SCH_TASK_AUTHORIZE">
    <bm:fields>
        <bm:field name="task_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TASK_CODE"/>
        <bm:field name="role_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ROLE_ID"/>
        <bm:field name="role_code" forInsert="false" forUpdate="false" prompt="HLS.ROLE_CODE"/>
        <bm:field name="role_name" forInsert="false" forUpdate="false" prompt="HLS.ROLE_NAME"/>
        <bm:field name="start_date" databaseType="DATE" datatype="java.util.Date" physicalName="START_DATE" prompt="HLS.START_DATE"/>
        <bm:field name="end_date" databaseType="DATE" datatype="java.util.Date" physicalName="END_DATE" prompt="HLS.END_DATE"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.task_code,
			       t1.role_id,
			       r.role_code,
			       r.role_name,
			       t1.start_date,
			       t1.end_date
			  from sch_task_authorize t1, sch_sys_role_v r
			 where t1.task_code = ${@task_code}
			   and t1.role_id = r.role_id
    		]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="role_id"/>
        <bm:pk-field name="task_code"/>
    </bm:primary-key>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="SCH102.ERROR_MESSAGE.ROLE_REPEATED"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
