<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="fdv" baseTable="FND_DIMENSION_VALUES" defaultorderby="dimension_value_code">
    <bm:fields>
        <bm:field name="dimension_id" physicalName="DIMENSION_ID"/>
        <bm:field name="dimension_value_id" physicalName="DIMENSION_VALUE_ID"/>
        <bm:field name="dimension_value_code" displayWidth="210" forDisplay="true" forQuery="true" physicalName="DIMENSION_VALUE_CODE" prompt="FND_DIMENSION_VALUES.DIMENSION_VALUE_CODE"/>
        <bm:field name="description_id" forUpdate="true" multiLanguage="true" multiLanguageDescField="description" physicalName="DESCRIPTION_ID"/>
        <bm:field name="description" displayWidth="210" forDisplay="true" forInsert="false" forQuery="true" forUpdate="false" prompt="FND_DIMENSION_VALUES.DESCRIPTION"/>
        <bm:field name="summary_flag" physicalName="SUMMARY_FLAG" prompt="FND_DIMENSION_VALUES.SUMMARY_FLAG"/>
        <bm:field name="enabled_flag" physicalName="ENABLED_FLAG" prompt="FND_DIMENSION_VALUES.ENABLED_FLAG"/>
    </bm:fields>
    <bm:primary-key>
        <bm:pk-field name="dimension_value_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="dimension_value_id" queryOperator="="/>
        <bm:query-field field="dimension_id" queryOperator="="/>
        <bm:query-field field="dimension_value_code" queryOperator="like"/>
        <bm:query-field name="description" queryExpression="(select description_text from fnd_descriptions fd where fd.description_id=fdv.description_id and fd.language=${/session/@lang}) like ${@description}"/>
        <bm:query-field field="summary_flag" queryOperator="="/>
        <bm:query-field field="enabled_flag" queryOperator="="/>
    </bm:query-fields>
    <bm:features>
        <o:sequence-pk/>
        <f:standard-who/>
        <f:multi-language-storage/>
    </bm:features>
    <bm:operations>
        <bm:operation name="insert">
            <bm:parameters>
                <bm:parameter name="dimension_value_id" input="false" output="true" outputPath="@dimension_value_id"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
    			begin
    				fnd_dimension_values_pkg.insert_fnd_dimension_values(p_dimension_code       =>${@dimension_code},
									                                     p_dimension_value_code =>${@dimension_value_code},
									                                     p_description          =>${@description},
									                                     p_summary_flag         =>${@summary_flag},
									                                     p_enabled_flag         =>${@enabled_flag},
									                                     p_created_by           =>${/session/@user_id},
									                                     p_dimension_value_id   =>${@dimension_value_id});
    			end;
    		]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
    			begin
    				fnd_dimension_values_pkg.update_fnd_dimension_values(p_dimension_value_code =>${@dimension_value_code},
								                                         p_description          =>${@description},
								                                         p_summary_flag         =>${@summary_flag},
								                                         p_enabled_flag         =>${@enabled_flag},
								                                         p_last_updated_by      =>${/session/@user_id},
								                                         p_dimension_id         =>${@dimension_id});
    			end;
    		]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
