Fixed ALF-10061: NodeService.getAssoc() throws an exception if the requested association does not exist

- CMIS expects to get null (as per NodeService javadoc) but it was generating a concurrency exception
 - Added a specific call to getNodeAssocOrNull to the DAO


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30162 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-09-02 03:23:06 +00:00
parent a33fa7be9f
commit 9e84d86ec5
4 changed files with 40 additions and 7 deletions

View File

@@ -1569,7 +1569,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
{
// Disable all behaviour.
// This only affects cm:auditable and is discarded at the end of this txn
policyBehaviourFilter.disableAllBehaviours();
policyBehaviourFilter.disableBehaviour();
// Tag the transaction to prevent further propagation
AlfrescoTransactionSupport.bindResource(KEY_AUDITABLE_PROPAGATION_DISABLE, Boolean.TRUE);
@@ -2506,16 +2506,33 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
}
return results;
}
public Pair<Long, AssociationRef> getNodeAssoc(Long assocId)
@Override
public Pair<Long, AssociationRef> getNodeAssocOrNull(Long assocId)
{
NodeAssocEntity nodeAssocEntity = selectNodeAssocById(assocId);
if (nodeAssocEntity == null)
{
return null;
}
else
{
AssociationRef assocRef = nodeAssocEntity.getAssociationRef(qnameDAO);
return new Pair<Long, AssociationRef>(assocId, assocRef);
}
}
public Pair<Long, AssociationRef> getNodeAssoc(Long assocId)
{
Pair<Long, AssociationRef> ret = getNodeAssocOrNull(assocId);
if (ret == null)
{
throw new ConcurrencyFailureException("Assoc ID does not point to a valid association: " + assocId);
}
AssociationRef assocRef = nodeAssocEntity.getAssociationRef(qnameDAO);
return new Pair<Long, AssociationRef>(assocId, assocRef);
else
{
return ret;
}
}
/*