mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
- Finished implementation: Missing bean injection, update parameters wrong way around, etc - Improved performance (negative name crc values can be left as is) - Tested git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21814 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
331 lines
14 KiB
XML
331 lines
14 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.patch">
|
|
|
|
<!-- -->
|
|
<!-- Type Defs -->
|
|
<!-- -->
|
|
|
|
<typeAlias alias="Ids" type="org.alfresco.ibatis.IdsEntity"/>
|
|
|
|
<!-- -->
|
|
<!-- Result Maps -->
|
|
<!-- -->
|
|
|
|
<resultMap id="result_admOldContentProp" class="java.util.HashMap">
|
|
<result property="nodeId" column="node_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<result property="qnameId" column="qname_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<result property="listIndex" column="list_index" jdbcType="INTEGER" javaType="java.lang.Integer"/>
|
|
<result property="localeId" column="locale_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<result property="stringValue" column="string_value" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="result_authoritiesAndCrc" class="java.util.HashMap">
|
|
<result property="authority" column="authority" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
<result property="crc" column="crc" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="result_childAssocsForCrc" class="java.util.HashMap">
|
|
<result property="id" column="id" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<result property="typeQNameId" column="type_qname_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<result property="qnameNamespaceId" column="qname_ns_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<result property="qnameLocalName" column="qname_localname" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
<result property="childNodeNameCrc" column="child_node_name_crc" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<result property="qnameCrc" column="qname_crc" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<result property="childNodeUuid" column="child_node_uuid" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
<result property="childNodeName" column="child_node_name" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="result_nodeIdAndName" class="java.util.HashMap">
|
|
<result property="id" column="id" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<result property="name" column="name" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
</resultMap>
|
|
|
|
<resultMap class="java.util.HashMap" id="result_admTenant">
|
|
<result property="tenantDomain" column="tenantDomain" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
<result property="isEnabled" column="isEnabled" jdbcType="BIT" javaType="java.lang.Boolean"/>
|
|
<result property="rootDir" column="rootDir" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
</resultMap>
|
|
|
|
<resultMap class="java.util.HashMap" id="result_avmLock">
|
|
<result property="wpStoreId" column="wpStoreId" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
<result property="relPath" column="relPath" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
<result property="avmStore" column="avmStore" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
<result property="owner1" column="owner1" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
</resultMap>
|
|
|
|
<resultMap class="java.util.HashMap" id="result_PBB">
|
|
<result property="componentName" column="componentName" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
<result property="propName" column="propName" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
<result property="propValue" column="propValue" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
</resultMap>
|
|
|
|
<resultMap class="java.util.HashMap" id="result_ChainingURS">
|
|
<result property="label" column="label" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
<result property="zoneId" column="zoneId" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
<result property="lastModified" column="lastModified" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
</resultMap>
|
|
|
|
<!-- -->
|
|
<!-- Parameter Maps -->
|
|
<!-- -->
|
|
|
|
<parameterMap id="parameter_admNewContentProp" class="map">
|
|
<parameter property="longValue" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<parameter property="nodeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<parameter property="qnameId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<parameter property="listIndex" jdbcType="INTEGER" javaType="java.lang.Integer"/>
|
|
<parameter property="localeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
</parameterMap>
|
|
|
|
<parameterMap id="parameter_contentMimetype" class="map">
|
|
<parameter property="newMimetypeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<parameter property="oldMimetypeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
</parameterMap>
|
|
|
|
<parameterMap id="parameter_childAssocCrcs" class="map">
|
|
<parameter property="childNodeNameCrc" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<parameter property="qnameCrc" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<parameter property="id" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
</parameterMap>
|
|
|
|
<parameterMap id="parameter_nodeTypeAndNamePattern" class="map">
|
|
<parameter property="typeQNameId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<parameter property="propQNameId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
|
<parameter property="namePattern" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
|
</parameterMap>
|
|
|
|
<!-- -->
|
|
<!-- Selects -->
|
|
<!-- -->
|
|
|
|
<select id="select_avmMaxNodeId" resultClass="java.lang.Long">
|
|
select max(id) from avm_nodes
|
|
</select>
|
|
|
|
<select id="select_admMaxNodeId" resultClass="java.lang.Long">
|
|
select max(id) from alf_node
|
|
</select>
|
|
|
|
<select id="select_avmNodesWithOldContentProperties" parameterClass="Ids" resultClass="java.lang.Long">
|
|
<![CDATA[
|
|
select
|
|
id
|
|
from
|
|
avm_nodes
|
|
where
|
|
id >= #idOne#
|
|
and id < #idTwo#
|
|
and class_type = 'plainfile'
|
|
and content_url is not null
|
|
and content_url not like 'id:%'
|
|
order by
|
|
id ASC
|
|
]]>
|
|
</select>
|
|
|
|
<select id="select_admOldContentProperties" parameterClass="Ids" resultMap="result_admOldContentProp">
|
|
<![CDATA[
|
|
select
|
|
node_id,
|
|
qname_id,
|
|
list_index,
|
|
locale_id,
|
|
string_value
|
|
from
|
|
alf_node_properties
|
|
where
|
|
node_id >= #idOne#
|
|
and node_id < #idTwo#
|
|
and actual_type_n = 11
|
|
order by
|
|
node_id ASC
|
|
]]>
|
|
</select>
|
|
|
|
<select id="select_authoritiesAndCrc" resultMap="result_authoritiesAndCrc">
|
|
select
|
|
authority,
|
|
crc
|
|
from
|
|
alf_authority
|
|
</select>
|
|
|
|
<select id="select_allChildAssocsCount" resultClass="java.lang.Integer">
|
|
select count(*) from alf_child_assoc
|
|
</select>
|
|
|
|
<select id="select_allChildAssocsForCrcs" parameterClass="Ids" resultMap="result_childAssocsForCrc">
|
|
<![CDATA[
|
|
select
|
|
ca.id,
|
|
ca.type_qname_id,
|
|
ca.qname_ns_id,
|
|
ca.qname_localname,
|
|
ca.child_node_name_crc,
|
|
ca.qname_crc,
|
|
cn.uuid as child_node_uuid,
|
|
cnp.string_value as child_node_name
|
|
from
|
|
alf_child_assoc ca
|
|
join alf_node cn on (cn.id = ca.child_node_id)
|
|
left join alf_node_properties cnp on (cnp.node_id = cn.id and cnp.qname_id = #idOne#)
|
|
where
|
|
ca.id > #idTwo#
|
|
]]>
|
|
</select>
|
|
|
|
<select id="select_nodesByTypeAndNamePattern" parameterMap="parameter_nodeTypeAndNamePattern" resultMap="result_nodeIdAndName">
|
|
select
|
|
s.protocol,
|
|
s.identifier,
|
|
n.uuid,
|
|
np.string_value as name
|
|
from
|
|
alf_node n
|
|
join alf_store s on (s.id = n.store_id)
|
|
join alf_node_properties np on (np.node_id = n.id)
|
|
where
|
|
n.type_qname_id = #typeQNameId# and
|
|
np.qname_id = #propQNameId# and
|
|
np.string_value like #namePattern#
|
|
</select>
|
|
|
|
<select id="select_oldAttrTenants" resultMap="result_admTenant">
|
|
select
|
|
ma.mkey tenantDomain,
|
|
a2.bool_value isEnabled,
|
|
a3.string_value rootDir
|
|
from
|
|
alf_global_attributes ga
|
|
join alf_map_attribute_entries ma on (ma.map_id = ga.attribute)
|
|
join alf_map_attribute_entries ma2 on (ma2.map_id = ma.attribute_id and ma2.mkey = 'enabled')
|
|
join alf_attributes a2 on (a2.id = ma2.attribute_id)
|
|
join alf_map_attribute_entries ma3 on (ma3.map_id = ma.attribute_id and ma3.mkey = 'rootContentStoreDir')
|
|
join alf_attributes a3 on (a3.id = ma3.attribute_id)
|
|
where
|
|
ga.name = 'alfresco-tenants'
|
|
</select>
|
|
|
|
<select id="select_oldAttrAVMLocks" resultMap="result_avmLock">
|
|
select
|
|
ma2.mkey wpStoreId,
|
|
a4.string_value relPath,
|
|
a5.string_value avmStore,
|
|
a6.string_value owner1
|
|
from
|
|
alf_global_attributes ga
|
|
join alf_map_attribute_entries ma on (ma.map_id = ga.attribute)
|
|
join alf_map_attribute_entries ma2 on (ma2.map_id = ma.attribute_id)
|
|
join alf_map_attribute_entries ma3 on (ma3.map_id = ma2.attribute_id)
|
|
join alf_map_attribute_entries ma4 on (ma4.map_id = ma3.attribute_id and ma4.mkey = 'path')
|
|
join alf_attributes a4 on (a4.id = ma4.attribute_id)
|
|
join alf_map_attribute_entries ma5 on (ma5.map_id = ma3.attribute_id and ma5.mkey = 'store')
|
|
join alf_attributes a5 on (a5.id = ma5.attribute_id)
|
|
join alf_map_attribute_entries ma6 on (ma6.map_id = ma3.attribute_id and ma6.mkey = 'owners')
|
|
join alf_list_attribute_entries la6 on (la6.list_id = ma6.attribute_id and la6.mindex = 0)
|
|
join alf_attributes a6 on (a6.id = la6.attribute_id)
|
|
where
|
|
ga.name = '.avm_lock_table'
|
|
</select>
|
|
|
|
<select id="select_oldAttrPropertyBackedBeans" resultMap="result_PBB">
|
|
select
|
|
ma.mkey componentName,
|
|
ma2.mkey propName,
|
|
a2.string_value propValue
|
|
from
|
|
alf_global_attributes ga
|
|
join alf_map_attribute_entries ma on (ma.map_id = ga.attribute)
|
|
join alf_map_attribute_entries ma2 on (ma2.map_id = ma.attribute_id)
|
|
join alf_attributes a2 on (a2.id = ma2.attribute_id)
|
|
where
|
|
ga.name = '.PropertyBackedBeans'
|
|
</select>
|
|
|
|
<select id="select_oldAttrChainingURS" resultMap="result_ChainingURS">
|
|
select
|
|
ma.mkey label,
|
|
ma2.mkey zoneId,
|
|
a2.long_value lastModified
|
|
from
|
|
alf_global_attributes ga
|
|
join alf_map_attribute_entries ma on (ma.map_id = ga.attribute)
|
|
join alf_map_attribute_entries ma2 on (ma2.map_id = ma.attribute_id)
|
|
join alf_attributes a2 on (a2.id = ma2.attribute_id)
|
|
where
|
|
ga.name = '.ChainingUserRegistrySynchronizer'
|
|
</select>
|
|
|
|
<select id="select_oldAttrCustomNames" resultClass="string">
|
|
select
|
|
ga.name as name
|
|
from
|
|
alf_global_attributes ga
|
|
where
|
|
name not in ('alfresco-tenants', '.avm_lock_table', '.PropertyBackedBeans', '.ChainingUserRegistrySynchronizer')
|
|
</select>
|
|
|
|
<!-- -->
|
|
<!-- Updates -->
|
|
<!-- -->
|
|
|
|
<update id="update_admOldContentProperty" parameterMap="parameter_admNewContentProp">
|
|
update
|
|
alf_node_properties
|
|
set
|
|
actual_type_n = 21,
|
|
persisted_type_n = 3,
|
|
long_value = ?,
|
|
string_value = null
|
|
where
|
|
node_id = ?
|
|
and qname_id = ?
|
|
and list_index = ?
|
|
and locale_id = ?
|
|
</update>
|
|
|
|
<update id="update_contentMimetypeId" parameterMap="parameter_contentMimetype">
|
|
update
|
|
alf_content_data
|
|
set
|
|
content_mimetype_id = ?
|
|
where
|
|
content_mimetype_id = ?
|
|
</update>
|
|
|
|
<update id="update_childAssocCrc" parameterMap="parameter_childAssocCrcs">
|
|
update
|
|
alf_child_assoc
|
|
set
|
|
child_node_name_crc = ?,
|
|
qname_crc = ?
|
|
where
|
|
id = ?
|
|
</update>
|
|
|
|
<!-- -->
|
|
<!-- Deletes -->
|
|
<!-- -->
|
|
|
|
<delete id="delete_oldAttrAlfListAttributeEntries">
|
|
delete from alf_list_attribute_entries
|
|
</delete>
|
|
|
|
<delete id="delete_oldAttrAlfMapAttributeEntries">
|
|
delete from alf_map_attribute_entries
|
|
</delete>
|
|
|
|
<delete id="delete_oldAttrAlfGlobalAttributes">
|
|
delete from alf_global_attributes
|
|
</delete>
|
|
|
|
<delete id="delete_oldAttrAlfAttributes">
|
|
delete from alf_attributes
|
|
</delete>
|
|
|
|
</sqlMap> |