<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select * from (select cpy.company_code,
			       cpy.company_short_name company_name,
			       pos.position_code,
			       pos.description position_name,
			       job.employee_job_code job_code,
			       job.description job_name,
			       lev.employee_levels_code levels_code,
			       lev.description levels_name,
			       t.primary_position_flag,
			       t.enabled_flag,
			       t.employees_assign_id,
			       t.company_id,
			       t.employee_id,
			       t.position_id,
			       pos.employee_job_id,
			       t.employee_levels_id,
				   job.level_series_id,
				   unit.unit_id,
				   unit.unit_code,
				   unit.description unit_name
			  from exp_employee_assigns   t,
			       fnd_companies_vl       cpy,
			       exp_org_position_vl    pos,
			       exp_org_unit_vl        unit,
			       exp_employee_jobs_vl job,
			       exp_employee_levels_vl lev
			   where cpy.company_id = t.company_id
			   and pos.position_id = t.position_id
			   and job.employee_job_id(+) = pos.employee_job_id
			   and lev.employee_levels_id(+) = t.employee_levels_id
			   and unit.unit_id = pos.unit_id)v
			   #WHERE_CLAUSE#
       ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="company_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COMPANY_CODE"/>
        <bm:field name="company_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COMPANY_NAME"/>
        <bm:field name="position_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="POSITION_CODE"/>
        <bm:field name="position_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="POSITION_NAME"/>
        <bm:field name="job_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="JOB_CODE"/>
        <bm:field name="job_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="JOB_NAME"/>
        <bm:field name="levels_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEVELS_CODE"/>
        <bm:field name="levels_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEVELS_NAME"/>
        <bm:field name="primary_position_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRIMARY_POSITION_FLAG"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG"/>
        <bm:field name="employees_assign_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EMPLOYEES_ASSIGN_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"/>
        <bm:field name="employee_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EMPLOYEE_ID"/>
        <bm:field name="position_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="POSITION_ID"/>
        <bm:field name="employee_job_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EMPLOYEE_JOB_ID"/>
        <bm:field name="employee_levels_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EMPLOYEE_LEVELS_ID"/>
        <bm:field name="level_series_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEVEL_SERIES_ID"/>
        <bm:field name="unit_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="UNIT_ID"/>
        <bm:field name="unit_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="UNIT_CODE"/>
        <bm:field name="unit_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="UNIT_NAME"/>
    </bm:fields>
    <bm:data-filters>
        <bm:data-filter name="filter" enforceOperations="query" expression="v.employee_id=${@employee_id}"/>
    </bm:data-filters>
    <bm:query-fields>
        <!-- <bm:query-field field="employee_id" queryExpression="employee_id=${@employee_id}"/> --><![CDATA[
        
    ]]></bm:query-fields>
</bm:model>
