Files
alfresco-community-repo/config/alfresco/ibatis/org.hibernate.dialect.Dialect/audit-common-SqlMap.xml
Derek Hulley add74c1a59 Merged V3.2 to HEAD
17332: ETHREEOH-2020: Original tag disappears after a new one has been added to a wiki page
   17711: Fix ETHREEOH-3720 - blocker (upgrade from 2.x)
   17712: Build/test fix (FeedCleanerTest.testConcurrentAccessAndRemoval)
   17726: DownloadContentServlet wraps call in read-only RetryingTransactionHelper
   17736: Fix ETHREEOH-2821 - deployment of layered file (fix for 3.2 deployment)
   17745: Fixed broken PostgreSQL (AVM, audit, etc) and Oracle (audit)
   17746: Merged V3.1 to V3.2
      17290: Merged V2.2 to V3.1
         17282: (record-only) Fix for ETWOTWO-1387: Node deletions transactions not properly detected ...
      17381: (record-only) Putting explicit version name on PDFRenderer.jar
      17413: (record-only) Removed dev from label
   17749: Type handler fixes for PostgreSQL: Use LONGVARBINARY
   17750: Fixed propval mappings for DB2
   17754: Fixed "invalid character" in Oracle port of propval
   17757: Re-added fix for ETHREEOH-2789 that got lost in a merge.
   17762: Fix FeedCleanerTest (for Oracle 10g) + exposed feed cleaner issue (maxSize)
   17765: Assorted minor build fixes for Oracle
   17767: Empty String property values are persisted as '.empty'
   17768: Merged DEV/BELARUS/V3.2-2009_11_24 to V3.2
      17758: ETHREEOH-3757: Oracle upgrade issue: failed "inviteEmailTemplate" patch
   17772: Fix build (JBPMEngineUnitTest) - fallout from r17765
   17774: Fix JSONtoFmModelTest
   17781: Build/test fix (AVMCrawlTestP)
   17791: Fix for ETHREEOH-3793: Oracle unit test failure for JobLockServiceTest - Missing unique indexes for all DB ports
   17795: ETHREEOH-3696: Attempt to navigate into any existent web-project or create new one after upgrade from Enterprise 2.1.7 ...
   17799: ETHREEOH-3796: org.alfresco.repo.importer.ImporterComponentTest fails
   17807: Fix ETHREEOH-3723 - MT blocker (can't restart)
   17816: Merged DEV/BELARUS/V3.2-2009_12_15 to V3.2
      17814: ETHREEOH-3808: Upgrade fails if content cm:name contains curly brackets ('{}')
   17822: Fix for ETHREEOH-3828: Mistake porting AlfrescoPostCreate-3.2-PropertyValueTables.sql script to mssql dialect
   17823: Fix for ETHREEOH-3829: SQLServer index limit reached for 'idx_alf_props_str'
   17831: Fix ETHREEOH-3818 - upgrade from Community 3.2r2 to Enterprise 3.2
   17862: Merged V3.1 to V3.2
      17722: Fix ETHREEOH-3643 - WCM layered folders (flatten) - also add unit test
      17835: ETHREEOH-3763 - fix for WCM layered folders - also add unit test
   17871: Merged V3.1 to V3.2
      17855: ACT 12915 - create web project performance (-> setPermission -> buildIndirections)
      17863: ETHREEOH-3852 - perf tweak (WCM layered files)
-------------------------------------
Modified: svn:mergeinfo
   Merged /alfresco/BRANCHES/DEV/BELARUS/V3.2-2009_11_24:r17758
   Merged /alfresco/BRANCHES/DEV/BELARUS/V3.2-2009_12_15:r17814
   Merged /alfresco/BRANCHES/V2.2:r17282
   Merged /alfresco/BRANCHES/V3.1:r17290,17381,17413,17722,17835,17855,17863
   Merged /alfresco/BRANCHES/V3.2:r17332,17711-17712,17726,17736,17745-17746,17749-17750,17754,17757,17762,17765,17767-17768,17772,17774,17781,17791,17795,17799,17807,17816,17822-17823,17831,17862,17871


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18169 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2010-01-20 12:30:14 +00:00

275 lines
12 KiB
XML

<?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">
<!-- -->
<!-- Type Defs -->
<!-- -->
<typeAlias alias="AuditModel" type="org.alfresco.repo.domain.audit.AuditModelEntity"/>
<typeAlias alias="AuditApplication" type="org.alfresco.repo.domain.audit.AuditApplicationEntity"/>
<typeAlias alias="AuditEntry" type="org.alfresco.repo.domain.audit.AuditEntryEntity"/>
<typeAlias alias="AuditDeleteParameters" type="org.alfresco.repo.domain.audit.AuditDeleteParameters"/>
<typeAlias alias="AuditQueryParameters" type="org.alfresco.repo.domain.audit.AuditQueryParameters"/>
<typeAlias alias="AuditQueryResult" type="org.alfresco.repo.domain.audit.AuditQueryResult"/>
<!-- -->
<!-- Result Maps -->
<!-- -->
<resultMap id="result_AuditModel" class="AuditModel">
<result property="id" column="id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="contentDataId" column="content_data_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="contentCrc" column="content_crc" jdbcType="BIGINT" javaType="long"/>
</resultMap>
<resultMap id="result_AuditApplication" class="AuditApplication">
<result property="id" column="id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="version" column="version" jdbcType="TINYINT" javaType="java.lang.Short"/>
<result property="applicationNameId" column="app_name_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="auditModelId" column="audit_model_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="disabledPathsId" column="disabled_paths_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
</resultMap>
<resultMap id="result_AuditEntry" class="AuditEntry">
<result property="id" column="id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="auditApplicationId" column="audit_app_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="auditUserId" column="audit_user_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="auditTime" column="audit_time" jdbcType="BIGINT" javaType="long"/>
<result property="auditValuesId" column="audit_values_id" jdbcType="BIGINT" javaType="long"/>
</resultMap>
<resultMap id="result_AuditQueryNoValues" class="AuditQueryResult">
<result property="auditAppNameId" column="audit_app_name_id" jdbcType="BIGINT" javaType="long"/>
<result property="auditEntryId" column="audit_entry_id" jdbcType="BIGINT" javaType="long"/>
<result property="auditUserId" column="audit_user_id" jdbcType="BIGINT" javaType="long"/>
<result property="auditTime" column="audit_time" jdbcType="BIGINT" javaType="long"/>
<result property="auditValuesId" column="audit_values_id" jdbcType="BIGINT" javaType="long"/>
</resultMap>
<resultMap id="result_AuditQueryAllValues"
extends="alfresco.audit.result_AuditQueryNoValues"
class="AuditQueryResult">
<result property="auditValueRows" resultMap="alfresco.propval.result_PropertyIdSearchRow"/>
</resultMap>
<!-- -->
<!-- Parameter Maps -->
<!-- -->
<parameterMap id="parameter_IdMap" class="map">
<parameter property="id" jdbcType="BIGINT" javaType="java.lang.Long"/>
</parameterMap>
<!-- -->
<!-- SQL Snippets -->
<!-- -->
<sql id="insert_AuditModel_AutoIncrement">
insert into alf_audit_model (content_data_id, content_crc)
values (#contentDataId#, #contentCrc#)
</sql>
<sql id="insert_AuditApplication_AutoIncrement">
insert into alf_audit_app (version, app_name_id, audit_model_id, disabled_paths_id)
values (#version#, #applicationNameId#, #auditModelId#, #disabledPathsId#)
</sql>
<sql id="insert_AuditEntry_AutoIncrement">
insert into alf_audit_entry (audit_app_id, audit_user_id, audit_time, audit_values_id)
values (#auditApplicationId#, #auditUserId#, #auditTime#, #auditValuesId#)
</sql>
<!-- -->
<!-- Statements -->
<!-- -->
<!-- Get the audit model by the CRC value -->
<select id="select_AuditModelByCrc" parameterClass="AuditModel" resultMap="result_AuditModel">
select
*
from
alf_audit_model
where
content_crc = #contentCrc#
</select>
<!-- Get the audit application by ID -->
<select id="select_AuditApplicationById" parameterMap="parameter_IdMap" resultMap="result_AuditApplication">
select
*
from
alf_audit_app
where
id = ?
</select>
<!-- Get the audit application by name ID -->
<select id="select_AuditApplicationByNameId" parameterMap="parameter_IdMap" resultMap="result_AuditApplication">
select
*
from
alf_audit_app
where
app_name_id = ?
</select>
<!-- Optimistic update of the audit application -->
<update id="update_AuditApplication" parameterClass="AuditApplication">
update
alf_audit_app
set
version = #version#,
app_name_id = #applicationNameId#,
audit_model_id = #auditModelId#,
disabled_paths_id = #disabledPathsId#
where
id = #id#
<isGreaterThan property="version" compareValue="1">
and version = ((#version#-1))
</isGreaterThan>
</update>
<!-- TODO: This has to be replaced with two deletes; one for the property links and another for the entries -->
<delete id="delete_AuditEntries" parameterClass="AuditDeleteParameters">
delete
from
alf_audit_entry
where
audit_app_id = #auditApplicationId#
<isNotNull property="auditFromTime">
<![CDATA[and audit_time >= #auditFromTime#]]>
</isNotNull>
<isNotNull property="auditFromTime">
<![CDATA[and audit_time < #auditToTime#]]>
</isNotNull>
</delete>
<!-- Get audit entries -->
<select id="select_AuditEntriesWithValues" parameterClass="AuditQueryParameters" resultMap="result_AuditQueryAllValues">
select
app.app_name_id as audit_app_name_id,
entry.id as audit_entry_id,
entry.audit_user_id as audit_user_id,
entry.audit_time as audit_time,
entry.audit_values_id as audit_values_id,
pl.root_prop_id as link_root_prop_id,
pl.prop_index as link_prop_index,
pl.contained_in as link_contained_in,
pl.key_prop_id as link_key_prop_id,
pl.value_prop_id as link_value_prop_id,
pv.actual_type_id as prop_actual_type_id,
pv.persisted_type as prop_persisted_type,
pv.long_value as prop_long_value,
dv.double_value as prop_double_value,
sv.string_value as prop_string_value,
serv.serializable_value as prop_serializable_value
from
alf_audit_app app
join alf_audit_entry entry on (entry.audit_app_id = app.id)
<isNotNull property="searchKeyId">
join alf_prop_link sp_kpl on (sp_kpl.root_prop_id = entry.audit_values_id)
</isNotNull>
<isNotNull property="searchValueId">
join alf_prop_link sp_mpl on (sp_mpl.root_prop_id = entry.audit_values_id)
</isNotNull>
join alf_prop_link pl on (pl.root_prop_id = entry.audit_values_id)
join alf_prop_value pv on (pl.value_prop_id = pv.id)
left join alf_prop_double_value dv on (dv.id = pv.long_value and pv.persisted_type = 2)
left join alf_prop_string_value sv on (sv.id = pv.long_value and (pv.persisted_type = 3 OR pv.persisted_type = 5))
left join alf_prop_serializable_value serv on (serv.id = pv.long_value and pv.persisted_type = 4)
<dynamic prepend="where">
<isNotNull prepend="and" property="auditAppNameId">
app.app_name_id = #auditAppNameId#
</isNotNull>
<isNotNull prepend="and" property="auditUserId">
entry.audit_user_id = #auditUserId#
</isNotNull>
<isNotNull prepend="and" property="auditFromId">
<![CDATA[entry.id >= #auditFromId#]]>
</isNotNull>
<isNotNull prepend="and" property="auditToId">
<![CDATA[entry.id < #auditToId#]]>
</isNotNull>
<isNotNull prepend="and" property="auditFromTime">
<![CDATA[entry.audit_time >= #auditFromTime#]]>
</isNotNull>
<isNotNull prepend="and" property="auditToTime">
<![CDATA[entry.audit_time < #auditToTime#]]>
</isNotNull>
<isNotNull prepend="and" property="searchKeyId">
sp_kpl.key_prop_id = #searchKeyId#
</isNotNull>
<isNotNull prepend="and" property="searchValueId">
sp_mpl.value_prop_id = #searchValueId#
</isNotNull>
</dynamic>
<isEqual property="forward" compareProperty="forwardTrue">
order by
entry.id asc
</isEqual>
<isNotEqual property="forward" compareProperty="forwardTrue">
order by
entry.id desc
</isNotEqual>
</select>
<!-- Get audit entries -->
<select id="select_AuditEntriesWithoutValues" parameterClass="AuditQueryParameters" resultMap="result_AuditQueryNoValues">
select
app.app_name_id as audit_app_name_id,
entry.id as audit_entry_id,
entry.audit_user_id as audit_user_id,
entry.audit_time as audit_time,
entry.audit_values_id as audit_values_id
from
alf_audit_app app
join alf_audit_entry entry on (entry.audit_app_id = app.id)
<isNotNull property="searchKeyId">
join alf_prop_link sp_kpl on (sp_kpl.root_prop_id = entry.audit_values_id)
</isNotNull>
<isNotNull property="searchValueId">
join alf_prop_link sp_mpl on (sp_mpl.root_prop_id = entry.audit_values_id)
</isNotNull>
<dynamic prepend="where">
<isNotNull prepend="and" property="auditAppNameId">
app.app_name_id = #auditAppNameId#
</isNotNull>
<isNotNull prepend="and" property="auditUserId">
entry.audit_user_id = #auditUserId#
</isNotNull>
<isNotNull prepend="and" property="auditFromId">
<![CDATA[entry.id >= #auditFromId#]]>
</isNotNull>
<isNotNull prepend="and" property="auditToId">
<![CDATA[entry.id < #auditToId#]]>
</isNotNull>
<isNotNull prepend="and" property="auditFromTime">
<![CDATA[entry.audit_time >= #auditFromTime#]]>
</isNotNull>
<isNotNull prepend="and" property="auditToTime">
<![CDATA[entry.audit_time < #auditToTime#]]>
</isNotNull>
<isNotNull prepend="and" property="searchKeyId">
sp_kpl.key_prop_id = #searchKeyId#
</isNotNull>
<isNotNull prepend="and" property="searchValueId">
sp_mpl.value_prop_id = #searchValueId#
</isNotNull>
</dynamic>
<isEqual property="forward" compareProperty="forwardTrue">
order by
entry.id asc
</isEqual>
<isNotEqual property="forward" compareProperty="forwardTrue">
order by
entry.id desc
</isNotEqual>
</select>
</sqlMap>