private void addLinkedNotebookResult(LinkedNotebook linkedNotebook, List<NotesMetadataList> linkedNotebookResult) { Pair<String, LinkedNotebook> key = new Pair<>(linkedNotebook.getGuid(), linkedNotebook); mLinkedNotebookResults.put(key, linkedNotebookResult); }
private void addBusinessResult(LinkedNotebook linkedNotebook, List<NotesMetadataList> linkedNotebookResult) { Pair<String, LinkedNotebook> key = new Pair<>(linkedNotebook.getGuid(), linkedNotebook); mBusinessResults.put(key, linkedNotebookResult); }
/** * Returns an async wrapper providing several helper methods for this {@link LinkedNotebook}. With * {@link EvernoteLinkedNotebookHelper#getClient()} you can get access to the underlying {@link EvernoteNoteStoreClient}, * which references the {@link LinkedNotebook}'s note store URL. * * @param linkedNotebook The referenced {@link LinkedNotebook}. Its GUID and share key must not be * {@code null}. * @return An async wrapper providing several helper methods. */ public synchronized EvernoteLinkedNotebookHelper getLinkedNotebookHelper(@NonNull LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException { String key = linkedNotebook.getGuid(); EvernoteLinkedNotebookHelper notebookHelper = mLinkedNotebookHelpers.get(key); if (notebookHelper == null) { notebookHelper = createLinkedNotebookHelper(linkedNotebook); mLinkedNotebookHelpers.put(key, notebookHelper); } return notebookHelper; }
public static LinkedNotebook getLinkedNotebook(String notebookGuid) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException { if (LINKED_NOTEBOOK_CACHE.containsKey(notebookGuid)) { return LINKED_NOTEBOOK_CACHE.get(notebookGuid); } List<LinkedNotebook> linkedNotebooks = getSession().getEvernoteClientFactory().getNoteStoreClient().listLinkedNotebooks(); for (LinkedNotebook linkedNotebook : linkedNotebooks) { LINKED_NOTEBOOK_CACHE.put(linkedNotebook.getGuid(), linkedNotebook); } return LINKED_NOTEBOOK_CACHE.get(notebookGuid); }
/** * @param defaultClient The note store client, which references the user's note store. * @return A flag indicating if the action was successful. * @see EvernoteNoteStoreClient#expungeLinkedNotebook(String) */ public int deleteLinkedNotebook(@NonNull EvernoteNoteStoreClient defaultClient) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException { SharedNotebook sharedNotebook = mClient.getSharedNotebookByAuth(); List<Long> sharedNotebookIds = new ArrayList<>(); sharedNotebookIds.add(sharedNotebook.getId()); mClient.expungeSharedNotebooks(sharedNotebookIds); return defaultClient.expungeLinkedNotebook(mLinkedNotebook.getGuid()); }
@Override public NoteRef fromLinked(NoteMetadata linkedNoteMetadata, LinkedNotebook linkedNotebook) { return new NoteRef(linkedNoteMetadata.getGuid(), linkedNotebook.getGuid(), linkedNoteMetadata.getTitle(), true); } }
/** * @return The linked notebook if this is a linked note. * @see #isLinked() */ public LinkedNotebook loadLinkedNotebook() throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException { if (!mLinked) { return null; } EvernoteNoteStoreClient noteStore = NoteRefHelper.getSession().getEvernoteClientFactory().getNoteStoreClient(); if (noteStore == null) { return null; } List<LinkedNotebook> linkedNotebooks = noteStore.listLinkedNotebooks(); for (LinkedNotebook linkedNotebook : linkedNotebooks) { if (linkedNotebook.getGuid().equals(mNotebookGuid)) { return linkedNotebook; } } return null; }
/** * Use this method, if you want to download a linked note as HTML. * * @param linkedNotebook The referenced {@link LinkedNotebook}. Its GUID and share key must not be * {@code null}. * @return An async wrapper to load a note as HTML from the Evernote service. */ public EvernoteHtmlHelper getLinkedHtmlHelper(@NonNull LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException { String key = linkedNotebook.getGuid(); EvernoteHtmlHelper htmlHelper = mLinkedHtmlHelper.get(key); if (htmlHelper == null) { String url = linkedNotebook.getNoteStoreUrl(); EvernoteNoteStoreClient client = getNoteStoreClient(url, EvernotePreconditions.checkNotEmpty(mEvernoteSession.getAuthToken())); AuthenticationResult authenticationResult = client.authenticateToSharedNotebook(linkedNotebook.getShareKey()); htmlHelper = createHtmlHelper(authenticationResult.getAuthenticationToken()); mLinkedHtmlHelper.put(key, htmlHelper); } return htmlHelper; }