<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE sqlMap      
    PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"      
    "http://ibatis.apache.org/dtd/sql-map-2.dtd">

<sqlMap namespace="alfresco.audit">

    <insert id="insert_AuditModel" parameterClass="AuditModel" >
        
        <selectKey resultClass="long" keyProperty="id">
            select nextVal('alf_audit_model_seq')
        </selectKey>
        
        insert into alf_audit_model (id, content_data_id, content_crc) 
        values (#id#, #contentDataId#, #contentCrc#)
        
    </insert>

    <insert id="insert_AuditApplication" parameterClass="AuditApplication" >
        
        <selectKey resultClass="long" keyProperty="id">
            select nextVal('alf_audit_app_seq')
        </selectKey>
        
        insert into alf_audit_app (id, version, app_name_id, audit_model_id, disabled_paths_id) 
        values (#id#, #version#, #applicationNameId#, #auditModelId#, #disabledPathsId#)
        
    </insert>

    <insert id="insert_AuditEntry" parameterClass="AuditEntry" >
        
        <selectKey resultClass="long" keyProperty="id">
            select nextVal('alf_audit_entry_seq')
        </selectKey>
        
        insert into alf_audit_entry (id, audit_app_id, audit_user_id, audit_time, audit_values_id) 
        values (#id#, #auditApplicationId#, #auditUserId#, #auditTime#, #auditValuesId#)
        
    </insert>

</sqlMap>