<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:e="leaf.service.exception" xmlns:ns2="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="ut" baseTable="exp_org_unit_assign_types" defaultOrderBy="unit_type_id">
    <bm:fields>
        <bm:field name="assign_types_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="unit_type_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="unit_type_code" databaseType="VARCHAR2" datatype="java.lang.String" prompt="EXP_ORG_UNIT_TYPES.UNIT_TYPE_CODE"/>
        <bm:field name="description_id" databaseType="BIGINT" datatype="java.lang.Long" multiLanguage="true" multiLanguageDescField="description"/>
        <bm:field name="description" databaseType="VARCHAR" datatype="java.lang.String" prompt="EXP_ORG_UNIT_TYPES.DESCRIPTION"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" prompt="EXP_ORG_UNIT_TYPES.ENABLED_FLAG"/>
    </bm:fields>
    <bm:primary-key>
        <bm:pk-field name="assign_types_id"/>
    </bm:primary-key>
    <bm:data-filters>
        <!-- <bm:data-filter enforceOperations="query" expression="ut.enabled_flag=&apos;Y&apos; and ut.company_id=${/session/@company_id}"/> -->
        <bm:data-filter enforceOperations="query" expression="ut.company_id=${/session/@company_id}"/>
    </bm:data-filters>
    <bm:query-fields>
        <bm:query-field field="unit_type_id" queryOperator="="/>
        <bm:query-field field="unit_type_code" queryOperator="like"/>
        <bm:query-field field="description" queryExpression="exists (select 1 from fnd_descriptions fd where ut.description_id=fd.description_id and fd.description_text like ${@description} and fd.language = ${/session/@lang})"/>
    </bm:query-fields>
    <bm:features>
        <ns2:sequence-pk/>
        <f:standard-who/>
        <f:multi-language-storage/>
    </bm:features>
    <bm:ref-fields/>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="EXP_ORG_UNIT_TYPES.DISTINCT"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
    <bm:operations>
        <bm:operation name="insert">
            <bm:parameters>
                <bm:parameter name="unit_type_code" dataType="java.lang.String" input="true" output="false"/>
                <bm:parameter name="company_id" dataType="java.lang.Long" input="true" output="false"/>
                <bm:parameter name="description" dataType="java.lang.String" input="true" output="false"/>
                <bm:parameter name="enabled_flag" dataType="java.lang.String" input="true" output="false"/>
                <bm:parameter name="user_id" dataType="java.lang.Long" input="true" output="false"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
                begin
                   EXP_ORG_UNIT_TYPES_ASSIGN_PKG.INSERT_ORG_UNIT_ASSIGN_TYPES
                    (
                        p_unit_type_code=>${@unit_type_code},
                        p_company_id=>${/session/@company_id},
                        p_enabled_flag=>${@enabled_flag},
                        p_description=>${@description},
                        p_user_id=>${/session/@user_id}
                    );
                end;]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
