ACE-1640: Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

70000: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud)
      69998: Merged V4.1-BUG-FIX (4.1.9) to V4.2-BUG-FIX (4.2.3)
         69997: MNT-11437: Merged V4.1.5 (4.1.5.14) to V4.1-BUG-FIX (4.1.9)
            69995: Revised fix for     MNT-11107  Documents uploaded by another user are not filtered via tags in My Files
            Fix for     MNT-11427  Impossible to start reindex process for bm-0010 and bm-0013 tests: api/solr/aclchangesets return status:502
            - fixed as described - no complex join - pull back and check inherited shared are indexed when the defining acls is indexed if it exists
            - will also be indexed if created lazily


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@70001 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-05-11 11:39:28 +00:00
parent 1d796567dc
commit 873db6ba7c
4 changed files with 56 additions and 15 deletions

View File

@@ -12,7 +12,8 @@
<result property="aclCount" column="acl_count" jdbcType="INTEGER" javaType="java.lang.Integer"/> <result property="aclCount" column="acl_count" jdbcType="INTEGER" javaType="java.lang.Integer"/>
</resultMap> </resultMap>
<resultMap id="result_Acl" type="SOLRAcl"> <resultMap id="result_Acl" type="SOLRAcl">
<id property="id" column="acl_id" jdbcType="BIGINT" javaType="java.lang.Long"/> <result property="id" column="acl_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="inheritedId" column="inherited_acl_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="aclChangeSetId" column="acl_changeset_id" jdbcType="BIGINT" javaType="java.lang.Long"/> <result property="aclChangeSetId" column="acl_changeset_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
</resultMap> </resultMap>
<resultMap id="result_Transaction" type="SOLRTransaction"> <resultMap id="result_Transaction" type="SOLRTransaction">
@@ -41,7 +42,7 @@
alf_acl_change_set acs alf_acl_change_set acs
join alf_access_control_list acl on (acl.acl_change_set = acs.id) join alf_access_control_list acl on (acl.acl_change_set = acs.id)
<where> <where>
exists (select 1 from alf_node admnode where admnode.acl_id = acl.id OR admnode.acl_id = acl.inherits_from) exists (select 1 from alf_node admnode where admnode.acl_id = acl.id)
<if test="fromCommitTimeInclusive != null"> <if test="fromCommitTimeInclusive != null">
and <![CDATA[acs.commit_time_ms >= #{fromCommitTimeInclusive}]]> and <![CDATA[acs.commit_time_ms >= #{fromCommitTimeInclusive}]]>
</if> </if>
@@ -62,11 +63,12 @@
<select id="select_AclsByChangeSetIds" parameterType="SOLRTrackingParameters" resultMap="result_Acl"> <select id="select_AclsByChangeSetIds" parameterType="SOLRTrackingParameters" resultMap="result_Acl">
select select
acl.acl_change_set as acl_changeset_id, acl.acl_change_set as acl_changeset_id,
acl.id as acl_id acl.id as acl_id,
acl.inherited_acl as inherited_acl_id
from from
alf_access_control_list acl alf_access_control_list acl
<where> <where>
exists (select 1 from alf_node admnode where admnode.acl_id = acl.id OR admnode.acl_id = acl.inherits_from) exists (select 1 from alf_node admnode where admnode.acl_id = acl.id)
<if test="fromIdInclusive != null"> <if test="fromIdInclusive != null">
and <![CDATA[acl.id >= #{fromIdInclusive}]]> and <![CDATA[acl.id >= #{fromIdInclusive}]]>
</if> </if>

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2011 Alfresco Software Limited. * Copyright (C) 2005-2014 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
@@ -29,22 +29,21 @@ import org.alfresco.repo.solr.Acl;
public class AclEntity implements Acl public class AclEntity implements Acl
{ {
private Long id; private Long id;
private Long inheritedId;
private Long aclChangeSetId; private Long aclChangeSetId;
@Override @Override
public String toString() public String toString()
{ {
return "AclEntity " + return "AclEntity [id=" + id + ", inheritedId=" + inheritedId + ", aclChangeSetId=" + aclChangeSetId + "]";
"[id=" + id +
", aclChangeSetId=" + aclChangeSetId +
"]";
} }
@Override @Override
public Long getId() public Long getId()
{ {
return id; return id;
} }
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
@@ -59,4 +58,15 @@ public class AclEntity implements Acl
{ {
this.aclChangeSetId = aclChangeSetId; this.aclChangeSetId = aclChangeSetId;
} }
@Override
public Long getInheritedId()
{
return inheritedId;
}
public void setInheritedId(Long inheritedId)
{
this.inheritedId = inheritedId;
}
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2011 Alfresco Software Limited. * Copyright (C) 2005-2014 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
@@ -18,11 +18,14 @@
*/ */
package org.alfresco.repo.domain.solr.ibatis; package org.alfresco.repo.domain.solr.ibatis;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.domain.node.Node; import org.alfresco.repo.domain.node.Node;
import org.alfresco.repo.domain.qname.QNameDAO; import org.alfresco.repo.domain.qname.QNameDAO;
import org.alfresco.repo.domain.solr.AclEntity;
import org.alfresco.repo.domain.solr.NodeParametersEntity; import org.alfresco.repo.domain.solr.NodeParametersEntity;
import org.alfresco.repo.domain.solr.SOLRDAO; import org.alfresco.repo.domain.solr.SOLRDAO;
import org.alfresco.repo.domain.solr.SOLRTrackingParameters; import org.alfresco.repo.domain.solr.SOLRTrackingParameters;
@@ -120,15 +123,40 @@ public class SOLRDAOImpl implements SOLRDAO
params.setIds(aclChangeSetIds); params.setIds(aclChangeSetIds);
params.setFromIdInclusive(minAclId); params.setFromIdInclusive(minAclId);
List<Acl> source;
if (maxResults <= 0 || maxResults == Integer.MAX_VALUE) if (maxResults <= 0 || maxResults == Integer.MAX_VALUE)
{ {
return (List<Acl>) template.selectList(SELECT_ACLS_BY_CHANGESET_IDS, params); source = (List<Acl>) template.selectList(SELECT_ACLS_BY_CHANGESET_IDS, params);
} }
else else
{ {
return (List<Acl>) template.selectList(SELECT_ACLS_BY_CHANGESET_IDS, params, new RowBounds(0, maxResults)); source = (List<Acl>) template.selectList(SELECT_ACLS_BY_CHANGESET_IDS, params, new RowBounds(0, maxResults));
} }
// Add any unlinked shared ACLs from defining nodes to index them now
ArrayList<Acl> answer = new ArrayList<Acl>(source);
HashSet<Long> acls = new HashSet<Long>();
for(Acl acl : answer)
{
acls.add(acl.getId());
}
ArrayList<Acl> sharedAndUnlinked = new ArrayList<Acl>();
for(Acl acl : answer)
{
if(acl.getInheritedId() != null)
{
if(!acls.contains(acl.getInheritedId()))
{
AclEntity shared = new AclEntity();
shared.setId(acl.getInheritedId());
shared.setAclChangeSetId(acl.getAclChangeSetId());
shared.setInheritedId(acl.getInheritedId());
sharedAndUnlinked.add(shared);
acls.add(shared.getId());
}
}
}
answer.addAll(sharedAndUnlinked);
return answer;
} }
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2011 Alfresco Software Limited. * Copyright (C) 2005-2014 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
@@ -27,5 +27,6 @@ package org.alfresco.repo.solr;
public interface Acl public interface Acl
{ {
Long getId(); Long getId();
Long getInheritedId();
Long getAclChangeSetId(); Long getAclChangeSetId();
} }