<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:ns2="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="ea" extend="exp.EXP1050.exp_employee_assigns" extendMode="refence">
    <bm:fields>
        <bm:field name="employees_assign_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="employee_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="position_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="employee_job_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="employee_levels_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="primary_position_flag" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="employee_job_code" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select job.employee_job_code  from exp_employee_jobs job where pos.position_id = ea.position_id and job.employee_job_id(+) = pos.employee_job_id)"/>
        <bm:field name="employee_job_name" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select description_text from fnd_descriptions des, exp_employee_jobs job where des.description_id=job.description_id and Language=${/session/@lang} and                    pos.position_id = ea.position_id and job.employee_job_id(+) = pos.employee_job_id)"/>
        <bm:field name="level_series_id" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select job.level_series_id from exp_employee_jobs job where pos.position_id = ea.position_id and job.employee_job_id(+) = pos.employee_job_id)"/>
        <!--<bm:field name="employee_levels_description" expression="(select fd.description_text from fnd_descriptions fd where fd.description_id = (select description_id from exp_employee_levels eel where eel.employee_levels_id = ea.employee_levels_id ) and fd.language = ${/session/@lang})"/>-->
    </bm:fields>
    <bm:primary-key>
        <bm:pk-field name="employees_assign_id"/>
    </bm:primary-key>
    <bm:relations>
        <bm:relation name="cpy" joinType="INNER" refModel="fnd.fnd_companies">
            <bm:reference foreignField="company_id" localField="company_id"/>
        </bm:relation>
        <bm:relation name="pos" joinType="INNER" refModel="exp.exp_org_position">
            <bm:reference foreignField="position_id" localField="position_id"/>
        </bm:relation>
        <bm:relation name="lev" joinType="LEFT OUTER" refModel="exp.EXP1030.exp_employee_levels">
            <bm:reference foreignField="employee_levels_id" localField="employee_levels_id"/>
        </bm:relation>
    </bm:relations>
    <bm:query-fields>
        <bm:query-field name="employee_id" dataType="java.lang.String" queryExpression="ea.employee_id = ${/parameter/@employee_id}"/>
    </bm:query-fields>
    <bm:features>
        <ns2:sequence-pk/>
        <f:standard-who/>
        <f:multi-language-display/>
    </bm:features>
    <bm:ref-fields>
        <bm:ref-field name="company_code" relationName="cpy" sourceField="company_code"/>
        <bm:ref-field name="company_short_name" relationName="cpy" sourceField="company_short_name"/>
        <bm:ref-field name="position_code" relationName="pos" sourceField="position_code"/>
        <bm:ref-field name="position_description_id" relationName="pos" sourceField="description_id"/>
        <bm:ref-field name="employee_levels_code" relationName="lev" sourceField="employee_levels_code"/>
        <bm:ref-field name="levels_description_id" relationName="lev" sourceField="description_id"/>
    </bm:ref-fields>
</bm:model>
