<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-7-16 下午02:01:10  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    (
                        CASE
                            WHEN ${@function_usage}='CREATE'
                            THEN aut_document_authority_pkg.aut_object_authority(p_company_id=>${/session/@top_biz_company_id}, p_role_id =>${/session/@role_id}, p_user_id =>${/session/@user_id}, p_lease_org =>${@lease_organization}, p_lease_channel =>${@lease_channel}, p_division =>${@division}, p_document_category =>${@document_category}, p_document_type =>${@document_type})
                            WHEN ${@function_usage} IN ('MODIFY','QUERY')
                            THEN aut_document_authority_pkg.aut_document_authority(p_company_id =>${/session/@top_biz_company_id}, p_role_id =>${/session/@role_id}, p_user_id =>${/session/@user_id}, p_document_category =>${@document_category}, p_document_id =>${@document_id})
                            ELSE NULL
                        END) check_message,
                    fnd_common_pkg.is_business_company(p_screen_company_id=>${@company_id},p_session_company_id=>${/session/@company_id}) company_check_message
                FROM
                    dual
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
