mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Fix/mnt 23290 slow group membership (#1637)
* MNT-23290 - Change query to get the root groups
This commit is contained in:
@@ -47,6 +47,7 @@ rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getPaths=RM.Re
|
||||
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getStoreArchiveNode=RM_ABSTAIN
|
||||
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.restoreNode=RM_ABSTAIN
|
||||
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocsWithoutParentAssocsOfType=RM_ABSTAIN
|
||||
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.findAssocsNotLinkedByTwoOtherAssocs=RM_ABSTAIN
|
||||
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getNodeRef=RM.Read.0
|
||||
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocsByPropertyValue=RM.Read.0,AFTER_RM.FilterNode
|
||||
rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.countChildAssocs=RM.Read.0
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Data model classes
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -714,6 +714,18 @@ public interface NodeService
|
||||
final NodeRef parent,
|
||||
final QName assocTypeQName);
|
||||
|
||||
/**
|
||||
* Gets the list of the localnames of the child associations without parent node
|
||||
*
|
||||
* @param parent
|
||||
* the parent node reference
|
||||
* @return a list of the local names of the child associations
|
||||
*/
|
||||
@Auditable(parameters = {"parent"})
|
||||
public List<String> findAssocsNotLinkedByTwoOtherAssocs(
|
||||
final NodeRef parent);
|
||||
|
||||
|
||||
/**
|
||||
* Create a peer association between two nodes.
|
||||
* <p/>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -894,6 +894,8 @@ public interface NodeDAO extends NodeBulkLoader
|
||||
Serializable nodeValue,
|
||||
ChildAssocRefQueryCallback resultsCallback);
|
||||
|
||||
public abstract List<String> selectAssocsNotLinkedByTwoOtherAssocs(
|
||||
Long parentNodeId);
|
||||
/**
|
||||
* Used by the re-encryptor to re-encrypt encryptable properties with a new encryption key.
|
||||
*/
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -139,6 +139,8 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
|
||||
private static final String SELECT_CHILD_ASSOC_OF_PARENT_BY_NAME = "alfresco.node.select_ChildAssocOfParentByName";
|
||||
private static final String SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_PARENT_ASSOCS_OF_TYPE =
|
||||
"alfresco.node.select_ChildAssocsOfParentWithoutParentAssocsOfType";
|
||||
|
||||
private static final String SELECT_ASSOCS_NOT_LINKED_BY_TWO_OTHER_ASSOCS = "alfresco.node.select_AssocsNotLinkedByTwoOtherAssocs";
|
||||
private static final String SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_NODE_ASSOCS_OF_TYPE =
|
||||
"alfresco.node.select_ChildAssocsOfParentWithoutNodeAssocsOfType";
|
||||
private static final String SELECT_PARENT_ASSOCS_OF_CHILD = "alfresco.node.select_ParentAssocsOfChild";
|
||||
@@ -1420,6 +1422,18 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
|
||||
resultsCallback.done();
|
||||
}
|
||||
|
||||
public List<String> selectAssocsNotLinkedByTwoOtherAssocs(
|
||||
Long parentNodeId)
|
||||
{
|
||||
ChildAssocEntity assoc = new ChildAssocEntity();
|
||||
// Parent
|
||||
NodeEntity parentNode = new NodeEntity();
|
||||
parentNode.setId(parentNodeId);
|
||||
assoc.setParentNode(parentNode);
|
||||
// Type QName
|
||||
return template.selectList(SELECT_ASSOCS_NOT_LINKED_BY_TWO_OTHER_ASSOCS, assoc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Node> selectChildAssocsWithoutNodeAssocsOfTypes(Long parentNodeId, Long minNodeId, Long maxNodeId, Set<QName> assocTypeQNames)
|
||||
{
|
||||
|
@@ -2134,6 +2134,15 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extens
|
||||
return results;
|
||||
}
|
||||
|
||||
@Extend(traitAPI=NodeServiceTrait.class,extensionAPI=NodeServiceExtension.class)
|
||||
public List<String> findAssocsNotLinkedByTwoOtherAssocs(NodeRef parent)
|
||||
{
|
||||
// Get the parent node
|
||||
Pair<Long, NodeRef> nodePair = getNodePairNotNull(parent);
|
||||
Long parentNodeId = nodePair.getFirst();
|
||||
|
||||
return nodeDAO.selectAssocsNotLinkedByTwoOtherAssocs(parentNodeId);
|
||||
}
|
||||
/**
|
||||
* Specific properties <b>not</b> supported by {@link #getChildAssocsByPropertyValue(NodeRef, QName, Serializable)}
|
||||
*/
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -48,7 +48,6 @@ import org.alfresco.query.CannedQueryFactory;
|
||||
import org.alfresco.query.CannedQueryResults;
|
||||
import org.alfresco.query.PagingRequest;
|
||||
import org.alfresco.query.PagingResults;
|
||||
import org.alfresco.repo.cache.AsynchronouslyRefreshedCache;
|
||||
import org.alfresco.util.cache.RefreshableCacheEvent;
|
||||
import org.alfresco.util.cache.RefreshableCacheListener;
|
||||
import org.alfresco.repo.cache.SimpleCache;
|
||||
@@ -1566,11 +1565,11 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
|
||||
{
|
||||
return Collections.<String> emptySet();
|
||||
}
|
||||
Collection<ChildAssociationRef> childRefs = nodeService.getChildAssocsWithoutParentAssocsOfType(container, ContentModel.ASSOC_MEMBER);
|
||||
List<String> rootGroupsNames = nodeService.findAssocsNotLinkedByTwoOtherAssocs(container);
|
||||
Set<String> authorities = new TreeSet<String>();
|
||||
for (ChildAssociationRef childRef : childRefs)
|
||||
for (String rootGroupName : rootGroupsNames)
|
||||
{
|
||||
addAuthorityNameIfMatches(authorities, childRef.getQName().getLocalName(), type);
|
||||
addAuthorityNameIfMatches(authorities, rootGroupName, type);
|
||||
}
|
||||
return authorities;
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -764,6 +764,14 @@ public class NodeServiceImpl implements NodeService, VersionModel
|
||||
throw new UnsupportedOperationException(MSG_UNSUPPORTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws UnsupportedOperationException always
|
||||
*/
|
||||
public List<String> findAssocsNotLinkedByTwoOtherAssocs(NodeRef parent)
|
||||
{
|
||||
throw new UnsupportedOperationException(MSG_UNSUPPORTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets, converts and adds the intrinsic properties to the current node's properties
|
||||
*/
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -1467,6 +1467,11 @@ public class VirtualNodeServiceExtension extends VirtualSpringBeanExtension<Node
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> findAssocsNotLinkedByTwoOtherAssocs(NodeRef nodeRef){
|
||||
return getTrait().findAssocsNotLinkedByTwoOtherAssocs(nodeRef);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
|
||||
throws InvalidNodeRefException
|
||||
|
@@ -1148,6 +1148,20 @@
|
||||
a.child_node_id IS NULL
|
||||
</select>
|
||||
|
||||
<select id="select_AssocsNotLinkedByTwoOtherAssocs" parameterType="ChildAssoc" resultType="java.lang.String">
|
||||
select distinct c.qname_localname
|
||||
from alf_child_assoc c
|
||||
where c.parent_node_id = #{parentNode.id}
|
||||
and not exists (
|
||||
select 1
|
||||
from alf_child_assoc a
|
||||
join alf_child_assoc z
|
||||
on z.parent_node_id = #{parentNode.id}
|
||||
and z.child_node_id = a.parent_node_id
|
||||
where c.child_node_id = a.child_node_id
|
||||
);
|
||||
</select>
|
||||
|
||||
<select id="select_ChildAssocsByPropertyValue" parameterType="ChildProperty" resultMap="result_ChildAssoc">
|
||||
<include refid="alfresco.node.select_ChildAssoc_Results"/>
|
||||
<include refid="alfresco.node.select_ChildAssoc_FromSimple"/>
|
||||
|
@@ -425,6 +425,7 @@
|
||||
org.alfresco.service.cmr.repository.NodeService.getStoreArchiveNode=ACL_NODE.0.sys:base.Read
|
||||
org.alfresco.service.cmr.repository.NodeService.restoreNode=ACL_NODE.0.sys:base.DeleteNode,ACL_NODE.1.sys:base.CreateChildren
|
||||
org.alfresco.service.cmr.repository.NodeService.getChildAssocsWithoutParentAssocsOfType=ACL_NODE.0.sys:base.ReadProperties,AFTER_ACL_NODE.sys:base.ReadProperties
|
||||
org.alfresco.service.cmr.repository.NodeService.findAssocsNotLinkedByTwoOtherAssocs=ACL_NODE.0.sys:base.ReadProperties,AFTER_ACL_NODE.sys:base.ReadProperties
|
||||
org.alfresco.service.cmr.repository.NodeService.countChildAssocs=ACL_NODE.0.sys:base.ReadChildren
|
||||
org.alfresco.service.cmr.repository.NodeService.*=ACL_DENY
|
||||
</value>
|
||||
|
Reference in New Issue
Block a user