<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-4-1 上午9:37:46  
    $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_SCORE_TARGET_VALUES">
    <bm:fields>
        <bm:field name="score_target_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SCORE_TARGET_ID" prompt="FND712.FND_SCORE_TARGET_VALUES.SCORE_TARGET_ID"/>
        <bm:field name="score_target_value_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SCORE_TARGET_VALUE_ID" prompt="FND712.FND_SCORE_TARGET_VALUES.SCORE_TARGET_VALUE_ID"/>
        <bm:field name="line_number" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LINE_NUMBER" prompt="FND712.FND_SCORE_TARGET_VALUES.LINE_NUMBER"/>
        <bm:field name="left_bracket" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEFT_BRACKET" prompt="FND712.FND_SCORE_TARGET_VALUES.LEFT_BRACKET"/>
        <bm:field name="from_value" databaseType="NUMBER" datatype="java.lang.Double" physicalName="FROM_VALUE" prompt="FND712.FND_SCORE_TARGET_VALUES.FROM_VALUE"/>
        <bm:field name="quotation_mark" forInsert="false" forUpdate="false"/>
        <bm:field name="to_value" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TO_VALUE" prompt="FND712.FND_SCORE_TARGET_VALUES.TO_VALUE"/>
        <bm:field name="right_bracket" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RIGHT_BRACKET" prompt="FND712.FND_SCORE_TARGET_VALUES.RIGHT_BRACKET"/>
        <bm:field name="scoring_value_per" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SCORING_VALUE_PER" prompt="FND712.FND_SCORE_TARGET_VALUES.SCORING_VALUE_PER"/>
        <bm:field name="fixed_target_value" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIXED_TARGET_VALUE" prompt="FND712.FND_SCORE_TARGET_VALUES.FIXED_TARGET_VALUE"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="FND712.FND_SCORE_TARGET_VALUES.DESCRIPTION"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
			select t1.score_target_id,
			       t1.score_target_value_id,
			       t1.line_number,
			       t1.left_bracket,
			       t1.from_value,
			       ',' as quotation_mark,
			       t1.to_value,
			       t1.right_bracket,
			       t1.scoring_value_per,
			       t1.fixed_target_value,
			       t1.description,
			       t1.creation_date,
			       t1.created_by,
			       t1.last_update_date,
			       t1.last_updated_by
			  from fnd_score_target_values t1
			  #WHERE_CLAUSE#
			  order by t1.line_number
    		]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
    			begin
    			   fnd_score_define_pkg.target_value_delete(p_score_target_value_id => ${@score_target_value_id},
						                              		p_user_id         		=> ${/session/@user_id});
    			end;
    		]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="score_target_value_id"/>
    </bm:primary-key>
    <bm:data-filters>
        <bm:data-filter name="score_target_id" enforceOperations="query" expression="score_target_id=${@score_target_id}"/>
    </bm:data-filters>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="FND712.ERROR_MESSAGE.LINE_NUMBER_REPEATED"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
