Merged V3.2 to HEAD

16780: Fix failing unit test
      - HeartBeat now needs to be constructed inside a transaction.
   16765: Merged DEV/BELARUS/V3.2-2009_10_05 to V3.2
      16754: ETHREEOH-2534: SPP does not authenticate when authentication chain contains both alfrescoNtlm and passthru types.
         - NTLM Authentication handler for Sharepoint module was implemented as singleton. But after it was integrated into Alfresco Authentication Subsystem, instance of this object is created for each type of NTLM authentication. As result static field with NTLM flags was rewrited for each instance. Bug was resolved by removing static indicator.
   16751: LDAP sync improvements
      - Correction to the way retried transactional errors are reported
      - Addition of unit test for synchronization with a mock user registry generating a large volume of users, groups and associations
   16749: Removed UserUsageBootstrapJob from scheduled jobs and moved UserUsageTrackingComponent to bootstrap
      - files missed from CHK-9619
   16748: User Usage Tracking Component bootstrapped synchronously to avoid its expensive queries across all users 'stepping on top of' other bootstrap activity such as LDAP synchronization
      - Its startup messages are no longer masked out by log4j.properties
      - Logged ETHREEOH-3009 regarding upgrade impact of new faster queries
   16747: Lower impact of HeartBeat service on server performance
      - More efficient AuthorityService APIs used to determine the total number of groups and users more efficiently
      - Queries of all users and groups done synchronously at startup only
   16746: Improvements for faster user and group lookup and association on a large repository (unfortunately intertwined)
      - NodeService getChildAssocRefsByTypeQNames query rewritten to use a subquery to force a more logical evaluation order on MySQL
      - NodeService getChildAssocs method made to use more efficient getChildAssocRefsByTypeQNames DAO call when a type qname but no assoc qname is specified
      - NodeService getUsersWithoutUsage / getUsersWithUsage queries rewritten to avoid an expensive outer join on all users
      - PersonService getPersonIgnoreCase query corrected to include the type QName ID of the child associations it is querying (thus avoiding unnecessarily triggering duplicate person removal)
      - PersonService now supports an optional boolean argument to getPerson that indicates whether the auto-create + home folder creation behaviour should be triggered.
      - AuthorityDAOImpl now uses false argument to getPerson call to avoid lazy home folder creation during creation of group associations
      - AuthorityDAOImpl now specifies assoc type to getChildAssocs in getAllAuthoritiesInZone and findAuthorities calls so that the more efficient query variant is used
      - Redundant personExists() call removed from authorityServiceImpl


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16914 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2009-10-14 11:48:02 +00:00
parent 3d3554a628
commit b1433afacf
15 changed files with 345 additions and 267 deletions

View File

@@ -1456,65 +1456,136 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
Long nodeId = nodePair.getFirst();
final List<ChildAssociationRef> results = new ArrayList<ChildAssociationRef>(100);
// if the type is the wildcard type, and the qname is not a search, then use a shortcut query
if (typeQNamePattern.equals(RegexQNamePattern.MATCH_ALL) && qnamePattern instanceof QName)
if (qnamePattern instanceof QName)
{
NodeDaoService.ChildAssocRefQueryCallback callback = new NodeDaoService.ChildAssocRefQueryCallback()
// Both explicit QNames
if (typeQNamePattern instanceof QName)
{
public boolean handle(
Pair<Long, ChildAssociationRef> childAssocPair,
Pair<Long, NodeRef> parentNodePair,
Pair<Long, NodeRef> childNodePair)
NodeDaoService.ChildAssocRefQueryCallback callback = new NodeDaoService.ChildAssocRefQueryCallback()
{
results.add(childAssocPair.getSecond());
return false;
}
};
// Get all child associations with the specific qualified name
nodeDaoService.getChildAssocs(nodeId, (QName)qnamePattern, callback);
}
else if (typeQNamePattern instanceof QName && qnamePattern instanceof QName)
{
NodeDaoService.ChildAssocRefQueryCallback callback = new NodeDaoService.ChildAssocRefQueryCallback()
public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair,
Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair)
{
results.add(childAssocPair.getSecond());
return false;
}
};
// Get all child associations with the specific qualified name
nodeDaoService.getChildAssocsByTypeQNameAndQName(nodeId, (QName) typeQNamePattern,
(QName) qnamePattern, callback);
}
// Type is explicit, local qname is pattern
else
{
public boolean handle(
Pair<Long, ChildAssociationRef> childAssocPair,
Pair<Long, NodeRef> parentNodePair,
Pair<Long, NodeRef> childNodePair)
NodeDaoService.ChildAssocRefQueryCallback callback;
if (typeQNamePattern.equals(RegexQNamePattern.MATCH_ALL))
{
results.add(childAssocPair.getSecond());
return false;
callback = new NodeDaoService.ChildAssocRefQueryCallback()
{
public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair,
Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair)
{
results.add(childAssocPair.getSecond());
return false;
}
};
}
};
// Get all child associations with the specific qualified name
nodeDaoService.getChildAssocsByTypeQNameAndQName(
nodeId,
(QName)typeQNamePattern,
(QName)qnamePattern,
callback);
else
{
callback = new NodeDaoService.ChildAssocRefQueryCallback()
{
public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair,
Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair)
{
ChildAssociationRef assocRef = childAssocPair.getSecond();
QName assocTypeQName = assocRef.getTypeQName();
if (!typeQNamePattern.isMatch(assocTypeQName))
{
// No match
return false;
}
results.add(assocRef);
return false;
}
};
}
// Get all child associations with the specific qualified name
nodeDaoService.getChildAssocs(nodeId, (QName) qnamePattern, callback);
}
}
else
{
NodeDaoService.ChildAssocRefQueryCallback callback = new NodeDaoService.ChildAssocRefQueryCallback()
// Local qname is pattern, type name is explicit
if (typeQNamePattern instanceof QName)
{
public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair, Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair)
NodeDaoService.ChildAssocRefQueryCallback callback;
// if the type is the wildcard type, and the qname is not a search, then use a shortcut query
if (qnamePattern.equals(RegexQNamePattern.MATCH_ALL))
{
ChildAssociationRef assocRef = childAssocPair.getSecond();
QName assocTypeQName = assocRef.getTypeQName();
QName assocQName = assocRef.getQName();
if (!qnamePattern.isMatch(assocQName) || !typeQNamePattern.isMatch(assocTypeQName))
callback = new NodeDaoService.ChildAssocRefQueryCallback()
{
// No match
public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair,
Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair)
{
results.add(childAssocPair.getSecond());
return false;
}
};
}
else
{
callback = new NodeDaoService.ChildAssocRefQueryCallback()
{
public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair,
Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair)
{
ChildAssociationRef assocRef = childAssocPair.getSecond();
QName assocQName = assocRef.getQName();
if (!qnamePattern.isMatch(assocQName))
{
// No match
return false;
}
results.add(assocRef);
return false;
}
};
}
// Get all child associations with the specific type qualified name
nodeDaoService.getChildAssocsByTypeQNames(nodeId, Collections.singletonList((QName) typeQNamePattern),
callback);
}
// Local qname is pattern, type name is pattern
else
{
NodeDaoService.ChildAssocRefQueryCallback callback = new NodeDaoService.ChildAssocRefQueryCallback()
{
public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair,
Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair)
{
ChildAssociationRef assocRef = childAssocPair.getSecond();
QName assocTypeQName = assocRef.getTypeQName();
QName assocQName = assocRef.getQName();
if (!qnamePattern.isMatch(assocQName) || !typeQNamePattern.isMatch(assocTypeQName))
{
// No match
return false;
}
results.add(assocRef);
return false;
}
results.add(assocRef);
return false;
}
};
// Get all child associations
nodeDaoService.getChildAssocs(nodeId, callback, false);
};
// Get all child associations
nodeDaoService.getChildAssocs(nodeId, callback, false);
}
}
// sort the results
List<ChildAssociationRef> orderedList = reorderChildAssocs(results);
// done