public function getNote($guid, $scope = null)
{
if (null === $scope || self::PERSONAL_SCOPE === $scope) {
try {
$edam_note = $this->getUserNotestore()->getNote($this->token, $guid, true, true, false, false);
return $this->getNoteInstance($edam_note, $this->getUserNotestore(), $this->token);
} catch (EDAMNotFoundException $e) {
// The note does not exist. No need to go further.
if (self::PERSONAL_SCOPE === $scope) {
return null;
}
} catch (EDAMUserException $e) {
// The note is in a linked notebook
if (self::PERSONAL_SCOPE === $scope) {
// we only want the personal notes
return null;
}
}
}
if (null === $scope || self::LINKED_SCOPE === $scope) {
$linkedNotebooks = $this->listLinkedNotebooks();
foreach ($linkedNotebooks as $linkedNotebook) {
try {
$sharedNoteStore = $this->getNotestore($linkedNotebook->noteStoreUrl);
$authToken = $this->getSharedNotebookAuthResult($linkedNotebook)->authenticationToken;
$edam_note = $sharedNoteStore->getNote($authToken, $guid, true, true, false, false);
return $this->getNoteInstance($edam_note, $sharedNoteStore, $authToken);
} catch (EDAMUserException $e) {
// No right on this notebook.
continue;
} catch (EDAMNotFoundException $e) {
// Note not found
continue;
}
}
return null;
}
}