<?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
                    fam.table_name,
                    fam.table_pk_value,
                    fam.record_id,
                    faa.attachment_id,
                    faa.file_name,
                    faa.file_path
                FROM
                    prj_cdd_item_doc_ref doc,
                    fnd_atm_attachment_multi fam,
                    fnd_atm_attachment faa
                WHERE
                    doc.document_id    = ${@table_pk_value} AND
                    doc.document_table = ${@table_name} AND
                    fam.table_name     = 'PRJ_CDD_ITEM_CHECK' AND
                    fam.table_pk_value = TO_CHAR(doc.check_id) AND
                    fam.attachment_id  = faa.attachment_id
            ]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter name="table_pk_value"/>
                <bm:parameter name="table_name"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="table_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_NAME" required="true"/>
        <bm:field name="table_pk_value" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_PK_VALUE" required="true"/>
        <bm:field name="record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RECORD_ID" required="true"/>
        <bm:field name="attachment_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ATTACHMENT_ID" required="true"/>
        <bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_NAME"/>
        <bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_PATH"/>
    </bm:fields>
</bm:model>
