protected function checkForExistingNode($srcWorkspace, $srcAbsPath, $destAbsPath)
{
try {
$existingNode = $this->getNode($destAbsPath);
} catch (ItemNotFoundException $exception) {
return;
}
if (empty($existingNode->{'jcr:uuid'})) {
throw new ItemExistsException('A node already exists at the destination path');
} else {
$existingNodeUuid = $existingNode->{'jcr:uuid'};
try {
$correspondingPath = $this->getNodePathForIdentifier($existingNodeUuid, $srcWorkspace);
} catch (ItemNotFoundException $exception) {
$correspondingPath = null;
}
if ($correspondingPath != $srcAbsPath) {
throw new ItemExistsException('A node already exists at the destination path that does not correspond to the source node');
}
}
}