Files
alfresco-community-repo/config/alfresco/ibatis/org.hibernate.dialect.Dialect/patch-common-SqlMap.xml
Derek Hulley 33da30e3b8 Merged DEV to HEAD (5.0)
87810: ACE-2030: Moved retired patches into retired-patches-context.xml
  87811: ACE-2030: Clean up unused PatchDAO methods and SQL mappings


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@87814 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2014-10-11 21:00:25 +00:00

470 lines
22 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="alfresco.patch">
<!-- -->
<!-- Result Maps -->
<!-- -->
<resultMap id="result_admOldContentProp" type="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" type="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" type="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" type="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 type="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 type="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 type="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>
<resultMap id="result_aclIneritanceIssue" type="java.util.HashMap">
<result property="childAclId" column="child_acl_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="childAclType" column="child_acl_type" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="primaryParentAclId" column="primary_parent_acl_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="primaryParentAclType" column="primary_parent_acl_type" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="childNodeId" column="child_node_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
</resultMap>
<resultMap id="result_sharedAclsThatDoNotInheritCorrectlyFromTheirDefiningAcl" type="java.util.HashMap">
<result property="inheritedAclId" column="inherited_acl_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="inheritedAclType" column="inherited_acl_type" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="aclId" column="acl_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="aclType" column="acl_type" jdbcType="BIGINT" javaType="java.lang.Long"/>
</resultMap>
<resultMap id="result_nodeNameUuidMap" type="java.util.HashMap">
<result property="uuid" column="uuid" jdbcType="VARCHAR" javaType="java.lang.String"/>
<result property="protocol" column="protocol" jdbcType="VARCHAR" javaType="java.lang.String"/>
<result property="identifier" column="identifier" jdbcType="VARCHAR" javaType="java.lang.String"/>
</resultMap>
<!-- -->
<!-- Parameter Maps -->
<!-- -->
<parameterMap id="parameter_IdMap" type="map">
<parameter property="id" jdbcType="BIGINT" javaType="long"/>
</parameterMap>
<parameterMap id="parameter_admNewContentProp" type="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" type="map">
<parameter property="newMimetypeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="oldMimetypeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
</parameterMap>
<parameterMap id="parameter_childAssocCrcs" type="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" type="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>
<parameterMap id="parameter_qnameIdAndMinMaxNodeId" type="map">
<parameter property="qnameId" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="minNodeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="maxNodeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
</parameterMap>
<parameterMap id="parameter_nsIdAndMinMaxNodeId" type="map">
<parameter property="nsId" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="minNodeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="maxNodeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
</parameterMap>
<parameterMap id="parameter_mimetypeIdAndMinMaxNodeId" type="map">
<parameter property="mimetypeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="minNodeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="maxNodeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
</parameterMap>
<parameterMap id="parameter_qnameCrcAndMinMaxNodeId" type="map">
<parameter property="qnameCrcSites" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="qnameCrcSurfConfig" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="qnameCrcPages" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="qnameCrcUser" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="qnameTypeIdContains" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="minNodeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="maxNodeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
</parameterMap>
<!-- -->
<!-- Selects -->
<!-- -->
<select id="select_admMaxNodeId" resultType="java.lang.Long">
select max(id) from alf_node
</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} <include refid="alfresco.util.escape"/>
</select>
<select id="select_sharedAclsThatDoNotInheritCorrectlyFromThePrimaryParent" parameterType="boolean" resultMap="result_aclIneritanceIssue">
<![CDATA[
select distinct
childAcl.id as child_acl_id,
childAcl.type as child_acl_type,
acl.id as primary_parent_acl_id,
acl.type as primary_parent_acl_type,
child.id as child_node_id
from
alf_access_control_list acl
join alf_acl_member mem on mem.acl_id = acl.id
join alf_node node on node.acl_id = acl.id
join alf_child_assoc priChild on priChild.parent_node_id = node.id and is_primary = #{trueOrFalse}
join alf_node child on priChild.child_node_id = child.id
join alf_access_control_list childAcl on childAcl.id = child.acl_id AND childAcl.inherits = #{trueOrFalse} AND childAcl.type = 2
where
(
acl.id = childAcl.inherits_from
AND NOT EXISTS (
select 1
from alf_acl_member childMem
where
childMem.acl_id = childAcl.id
and childMem.ace_id = mem.ace_id
and childMem.pos = mem.pos +1
)
)
]]>
</select>
<select id="select_definingAclsThatDoNotInheritCorrectlyFromThePrimaryParent" parameterType="boolean" resultMap="result_aclIneritanceIssue">
<![CDATA[
select distinct
childAcl.id as child_acl_id,
childAcl.type as child_acl_type,
acl.id as primary_parent_acl_id,
acl.type as primary_parent_acl_type,
child.id as child_node_id
from
alf_access_control_list acl
join alf_acl_member mem on mem.acl_id = acl.id
join alf_node node on node.acl_id = acl.id
join alf_child_assoc priChild on priChild.parent_node_id = node.id and is_primary = #{trueOrFalse}
join alf_node child on priChild.child_node_id = child.id
join alf_access_control_list childAcl on childAcl.id = child.acl_id AND childAcl.inherits = #{trueOrFalse} AND childAcl.type = 1
where
(
acl.inherited_acl = childAcl.inherits_from
AND acl.id <> childAcl.inherits_from
AND NOT EXISTS (
select 1 from alf_acl_member childMem
where
childMem.acl_id = childAcl.id
and childMem.ace_id = mem.ace_id
and childMem.pos = mem.pos + 2
)
)
]]>
</select>
<select id="select_aclsThatInheritFromNonPrimaryParent" parameterType="boolean" resultMap="result_aclIneritanceIssue">
<![CDATA[
select distinct
childAcl.id as child_acl_id,
childAcl.type as child_acl_type,
acl.id as primary_parent_acl_id,
acl.type as primary_parent_acl_type,
child.id as child_node_id
from
alf_access_control_list acl
join alf_acl_member mem on mem.acl_id = acl.id
join alf_node node on node.acl_id = acl.id
join alf_child_assoc priChild on priChild.parent_node_id = node.id and is_primary = #{trueOrFalse}
join alf_node child on priChild.child_node_id = child.id
join alf_access_control_list childAcl on childAcl.id = child.acl_id AND childAcl.inherits = #{trueOrFalse}
where
(
childAcl.id is not null
AND acl.id <> childAcl.id
AND acl.id <> childAcl.inherits_from
AND acl.inherited_acl <> childAcl.inherits_from
)
]]>
</select>
<select id="select_aclsThatInheritWithInheritanceUnset" parameterType="boolean" resultMap="result_aclIneritanceIssue">
<![CDATA[
select distinct
childAcl.id as child_acl_id,
childAcl.type as child_acl_type,
acl.id as primary_parent_acl_id,
acl.type as primary_parent_acl_type,
child.id as child_node_id
from
alf_access_control_list acl
join alf_acl_member mem on mem.acl_id = acl.id
join alf_node node on node.acl_id = acl.id
join alf_child_assoc priChild on priChild.parent_node_id = node.id and is_primary = #{trueOrFalse}
join alf_node child on priChild.child_node_id = child.id
join alf_access_control_list childAcl on childAcl.id = child.acl_id AND childAcl.inherits = #{trueOrFalse}
where
(
childAcl.id is not null
AND childAcl.inherits_from is null
AND childAcl.id <> acl.id
)
]]>
</select>
<select id="select_sharedAclsThatDoNotInheritCorrectlyFromTheirDefiningAcl" parameterType="boolean" resultMap="result_sharedAclsThatDoNotInheritCorrectlyFromTheirDefiningAcl">
<![CDATA[
select distinct
inheritedAcl.id as inherited_acl_id,
inheritedAcl.type as inherited_acl_type,
acl.id as acl_id,
acl.type as acl_type
from
alf_access_control_list acl
join alf_acl_member mem on mem.acl_id = acl.id
join alf_access_control_list inheritedAcl on inheritedAcl.inherits_from = acl.id AND inheritedAcl.inherits = #{trueOrFalse} AND inheritedAcl.type = 1
where acl.id = inheritedAcl.inherits_from
AND NOT EXISTS (
select 1
from alf_acl_member childMem
where
childMem.acl_id = inheritedAcl.id
and childMem.ace_id = mem.ace_id
and childMem.pos = mem.pos +1
)
]]>
</select>
<select id="select_CountNodesWithAspectIds" parameterType="Ids" resultType="long" >
select
count(*)
from
alf_node_aspects na
where
na.qname_id in
<foreach item="item" index="i" collection="ids" open="(" separator="," close=")">#{item}</foreach>
</select>
<!-- Find nodes by type qname -->
<select id="select_NodesByTypeQName" parameterMap="parameter_qnameIdAndMinMaxNodeId" resultType="java.lang.Long" >
select
n.id
from
alf_node n
where
n.type_qname_id = #{qnameId}
and n.id &gt;= #{minNodeId}
and n.id &lt; #{maxNodeId}
</select>
<select id="select_NodesByTypeUriId" parameterMap="parameter_nsIdAndMinMaxNodeId" resultType="java.lang.Long" >
select
n.id
from
alf_node n
join alf_qname q on q.id = n.type_qname_id
where
q.ns_id = #{nsId}
and n.id &gt;= #{minNodeId}
and n.id &lt; #{maxNodeId}
</select>
<!-- Find nodes by aspect qname -->
<select id="select_NodesByAspectQName" parameterMap="parameter_qnameIdAndMinMaxNodeId" resultType="java.lang.Long" >
select
n.id
from
alf_node n
join alf_node_aspects a on n.id = a.node_id
where
a.qname_id = #{qnameId}
and n.id &gt;= #{minNodeId}
and n.id &lt; #{maxNodeId}
</select>
<!-- Find nodes by content mimetype -->
<select id="select_NodesByContentMimetype" parameterMap="parameter_mimetypeIdAndMinMaxNodeId" resultType="long">
select
np.node_id
from
alf_node_properties np
join alf_content_data cd on np.long_value = cd.id
where
cd.content_mimetype_id = #{mimetypeId}
and (np.actual_type_n = 3 or np.actual_type_n = 21)
and np.node_id &gt;= #{minNodeId}
and np.node_id &lt; #{maxNodeId}
</select>
<select id="select_CountNodesWithTypeId" parameterType="Ids" resultType="java.lang.Long" >
select
count(*)
from
alf_node n
where
n.type_qname_id = #{idOne}
</select>
<!-- Select children of surf-config folder. Mainly, we are interested in:
company_home/sites/surf-config/components
company_home/sites/surf-config/pages
company_home/sites/surf-config/pages/user
company_home/sites/surf-config/pages/user{userId}
-->
<select id="select_ChildrenOfTheSharedSurfConfigFolder" parameterMap="parameter_qnameCrcAndMinMaxNodeId" resultMap="result_nodeNameUuidMap" >
<![CDATA[
select lev3.child_node_name as name, lev3.child_node_id as node_id, targetn.uuid, targets.protocol, targets.identifier
from
alf_child_assoc lev1
join alf_child_assoc lev2 on (lev2.parent_node_id = lev1.child_node_id)
join alf_child_assoc lev3 on (lev3.parent_node_id = lev2.child_node_id)
join alf_node targetn on (targetn.id = lev3.child_node_id)
join alf_store targets on (targets.id = targetn.store_id)
where
lev1.qname_crc = #{qnameCrcSites}
and lev1.type_qname_id = #{qnameTypeIdContains}
and lev2.qname_crc = #{qnameCrcSurfConfig}
and lev2.type_qname_id = #{qnameTypeIdContains}
and lev3.child_node_id >= #{minNodeId}
and lev3.child_node_id < #{maxNodeId}
UNION
select lev4.child_node_name as name, lev4.child_node_id as node_id, targetn.uuid, targets.protocol, targets.identifier
from
alf_child_assoc lev1
join alf_child_assoc lev2 on (lev2.parent_node_id = lev1.child_node_id)
join alf_child_assoc lev3 on (lev3.parent_node_id = lev2.child_node_id)
join alf_child_assoc lev4 on (lev4.parent_node_id = lev3.child_node_id)
join alf_node targetn on (targetn.id = lev4.child_node_id)
join alf_store targets on (targets.id = targetn.store_id)
where
lev1.qname_crc = #{qnameCrcSites}
and lev1.type_qname_id = #{qnameTypeIdContains}
and lev2.qname_crc = #{qnameCrcSurfConfig}
and lev2.type_qname_id = #{qnameTypeIdContains}
and lev3.qname_crc = #{qnameCrcPages}
and lev3.type_qname_id = #{qnameTypeIdContains}
and lev4.child_node_id >= #{minNodeId}
and lev4.child_node_id < #{maxNodeId}
UNION
select lev5.child_node_name as name, lev5.child_node_id as node_id, targetn.uuid, targets.protocol, targets.identifier
from
alf_child_assoc lev1
join alf_child_assoc lev2 on (lev2.parent_node_id = lev1.child_node_id)
join alf_child_assoc lev3 on (lev3.parent_node_id = lev2.child_node_id)
join alf_child_assoc lev4 on (lev4.parent_node_id = lev3.child_node_id)
join alf_child_assoc lev5 on (lev5.parent_node_id = lev4.child_node_id)
join alf_node targetn on (targetn.id = lev5.child_node_id)
join alf_store targets on (targets.id = targetn.store_id)
where
lev1.qname_crc = #{qnameCrcSites}
and lev1.type_qname_id = #{qnameTypeIdContains}
and lev2.qname_crc = #{qnameCrcSurfConfig}
and lev2.type_qname_id = #{qnameTypeIdContains}
and lev3.qname_crc = #{qnameCrcPages}
and lev3.type_qname_id = #{qnameTypeIdContains}
and lev4.qname_crc = #{qnameCrcUser}
and lev4.type_qname_id = #{qnameTypeIdContains}
and lev5.child_node_id >= #{minNodeId}
and lev5.child_node_id < #{maxNodeId}
]]>
</select>
<!-- -->
<!-- Updates -->
<!-- -->
<update id="update_contentMimetypeId" parameterMap="parameter_contentMimetype">
update
alf_content_data
set
content_mimetype_id = ?
where
content_mimetype_id = ?
</update>
<update id="drop_oldAttrAlfListAttributeEntries">
drop table alf_list_attribute_entries
</update>
<update id="drop_oldAttrAlfMapAttributeEntries">
drop table alf_map_attribute_entries
</update>
<update id="drop_oldAttrAlfGlobalAttributes">
drop table alf_global_attributes
</update>
<update id="drop_oldAttrAlfAttributes">
drop table alf_attributes
</update>
<update id="drop_oldAttrAlfAttributes_seq">
drop sequence alf_attributes_seq
</update>
<!-- -->
<!-- Deletes -->
<!-- -->
</mapper>