Merged 5.0.N (5.0.4) to 5.1.N (5.1.2)

124888 jvonka: Merged 50N-NDB (5.0.4) to 5.0.N (5.0.4)
      124735: MNT-15211: Follow-on (note: only affects NDB) - tweaks for further repo tests, including:
      - FileFolderServiceImplTest.testMoveCopyLotsOfFiles
      - DbNodeServiceImplTest.testDuplicateCatch


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@124938 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrei Rebegea
2016-04-06 14:50:52 +00:00
parent 5dbcd554d2
commit e303d5348c
3 changed files with 86 additions and 21 deletions

View File

@@ -3143,6 +3143,28 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
// Index
assoc.setAssocIndex(-1);
Long assocId = newChildAssocImplInsert(assoc, assocTypeQName, childNodeName);
// Persist it
assoc.setId(assocId);
// Primary associations accompany new nodes, so we only have to bring the
// node into the current transaction for secondary associations
if (!isPrimary)
{
updateNode(childNodeId, null, null);
}
// Done
if (isDebugEnabled)
{
logger.debug("Created child association: " + assoc);
}
return assoc;
}
protected Long newChildAssocImplInsert(final ChildAssocEntity assoc, final QName assocTypeQName, final String childNodeName)
{
RetryingCallback<Long> callback = new RetryingCallback<Long>()
{
public Long execute() throws Throwable
@@ -3175,7 +3197,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
// We assume that this is from the child cm:name constraint violation
throw new DuplicateChildNodeNameException(
parentNode.getNodeRef(),
assoc.getParentNode().getNodeRef(),
assocTypeQName,
childNodeName,
e);
@@ -3183,22 +3205,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
}
};
Long assocId = childAssocRetryingHelper.doWithRetry(callback);
// Persist it
assoc.setId(assocId);
// Primary associations accompany new nodes, so we only have to bring the
// node into the current transaction for secondary associations
if (!isPrimary)
{
updateNode(childNodeId, null, null);
}
// Done
if (isDebugEnabled)
{
logger.debug("Created child association: " + assoc);
}
return assoc;
return assocId;
}
@Override