Fix NodeDAO.getStore to do what the JavaDoc says it does

- Fixed AbstractAuthorityBridgeDAO to detect potential null


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@48650 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2013-03-27 16:40:21 +00:00
parent 64ddd278cd
commit d0858c3170
2 changed files with 13 additions and 5 deletions

View File

@@ -697,7 +697,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
Pair<StoreRef, Node> rootNodePair = rootNodesCache.getByKey(storeRef); Pair<StoreRef, Node> rootNodePair = rootNodesCache.getByKey(storeRef);
if (rootNodePair == null) if (rootNodePair == null)
{ {
throw new InvalidStoreRefException(storeRef); return null;
} }
else else
{ {

View File

@@ -97,11 +97,15 @@ public abstract class AbstractAuthorityBridgeDAO implements AuthorityBridgeDAO
} }
// Get tenenat specifc store id // Get tenenat specifc store id
Long storeId = Long.MIN_VALUE;
StoreRef tenantSpecificStoreRef = tenantService.getName(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); StoreRef tenantSpecificStoreRef = tenantService.getName(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
Long storeId = Long.MIN_VALUE;
if (tenantSpecificStoreRef != null) if (tenantSpecificStoreRef != null)
{ {
storeId = nodeDAO.getStore(tenantSpecificStoreRef).getFirst(); Pair<Long, StoreRef> storePair = nodeDAO.getStore(tenantSpecificStoreRef);
if (storePair != null)
{
storeId = storePair.getFirst();
}
} }
return selectAuthorityBridgeLinks(authorityContainerTypeQNameId, memberAssocQNameId, authorityNameQNameId, storeId); return selectAuthorityBridgeLinks(authorityContainerTypeQNameId, memberAssocQNameId, authorityNameQNameId, storeId);
@@ -137,11 +141,15 @@ public abstract class AbstractAuthorityBridgeDAO implements AuthorityBridgeDAO
} }
// Get tenenat specifc store id // Get tenenat specifc store id
Long storeId = Long.MIN_VALUE;
StoreRef tenantSpecificStoreRef = tenantService.getName(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); StoreRef tenantSpecificStoreRef = tenantService.getName(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
Long storeId = Long.MIN_VALUE;
if (tenantSpecificStoreRef != null) if (tenantSpecificStoreRef != null)
{ {
storeId = nodeDAO.getStore(tenantSpecificStoreRef).getFirst(); Pair<Long, StoreRef> storePair = nodeDAO.getStore(tenantSpecificStoreRef);
if (storePair != null)
{
storeId = storePair.getFirst();
}
} }
Pair<Long, NodeRef> pair = (authRef == null) ? null : nodeDAO.getNodePair(tenantService.getName(authRef)); Pair<Long, NodeRef> pair = (authRef == null) ? null : nodeDAO.getNodePair(tenantService.getName(authRef));