<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hp  
    $Date: 2013-9-18 上午10:24:55  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:e="leaf.service.exception" xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="FND_SC_SCORE_RESULT">
    <bm:fields>
        <bm:field name="result_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESULT_ID" prompt="FND_SC_SCORE_RESULT.RESULT_ID"/>
        <bm:field name="sc_score_id" databaseType="NUMBER" datatype="java.lang.Long" insertExpression="${@sc_score_id}" physicalName="SC_SCORE_ID" prompt="FND_SC_SCORE_RESULT.SC_SCORE_ID"/>
        <bm:field name="template_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TEMPLATE_TYPE" prompt="FND_SC_SCORE_RESULT.TEMPLATE_TYPE"/>
        <bm:field name="object_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OBJECT_ID" prompt="FND_SC_SCORE_RESULT.OBJECT_ID"/>
        <bm:field name="score_template_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SCORE_TEMPLATE_ID" prompt="FND_SC_SCORE_RESULT.SCORE_TEMPLATE_ID"/>
        <bm:field name="internal_period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INTERNAL_PERIOD_NUM" prompt="FND_SC_SCORE_RESULT.INTERNAL_PERIOD_NUM"/>
        <bm:field name="score_result" databaseType="NUMBER" datatype="java.lang.Double" physicalName="SCORE_RESULT" prompt="FND_SC_SCORE_RESULT.SCORE_RESULT"/>
        <bm:field name="score_date" databaseType="DATE" datatype="java.util.Date" expression="to_char(t1.score_date,&apos;yyyy-mm-dd&apos;)" insertExpression="sysdate" physicalName="SCORE_DATE" prompt="FND_SC_SCORE_RESULT.SCORE_DATE"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="FND_SC_SCORE_RESULT.DESCRIPTION"/>
        <bm:field name="status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS" prompt="FND_SC_SCORE_RESULT.STATUS"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01" prompt="FND_SC_SCORE_RESULT.REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02" prompt="FND_SC_SCORE_RESULT.REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03" prompt="FND_SC_SCORE_RESULT.REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="FND_SC_SCORE_RESULT.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="FND_SC_SCORE_RESULT.REF_V05"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N01" prompt="FND_SC_SCORE_RESULT.REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N02" prompt="FND_SC_SCORE_RESULT.REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N03" prompt="FND_SC_SCORE_RESULT.REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N04" prompt="FND_SC_SCORE_RESULT.REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N05" prompt="FND_SC_SCORE_RESULT.REF_N05"/>
        <bm:field name="ref_d01" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D01" prompt="FND_SC_SCORE_RESULT.REF_D01"/>
        <bm:field name="ref_d02" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D02" prompt="FND_SC_SCORE_RESULT.REF_D02"/>
        <bm:field name="ref_d03" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D03" prompt="FND_SC_SCORE_RESULT.REF_D03"/>
        <bm:field name="ref_d04" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D04" prompt="FND_SC_SCORE_RESULT.REF_D04"/>
        <bm:field name="ref_d05" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D05" prompt="FND_SC_SCORE_RESULT.REF_D05"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="result_id"/>
    </bm:primary-key>
    <bm:operations>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
    			begin
    				fnd_sc_score_pkg.fnd_sc_score_bp(p_bp_id             =>${@object_id},
					                            p_score_template_id =>${@score_template_id},
					                            p_result_id         =>${@result_id},
					                            p_user_id           =>${/session/@user_id});
				select t1.score_result 
				  into ${@score_result}	
				  FROM FND_SC_SCORE_RESULT t1
				 where t1.result_id=${@result_id};
    			end;
    		]]></bm:update-sql>
            <bm:parameters>
                <bm:parameter name="score_result" output="true" outputPath="@score_result"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="FND714.SCORE_RESULT_UNIQ_ERROR"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
