Search in sources :

Example 1 with LinkedNotebook

use of com.evernote.edam.type.LinkedNotebook in project Notes by lguipeng.

the class EvernoteSearchHelper method findNotesInBusinessNotebook.

protected List<NotesMetadataList> findNotesInBusinessNotebook(Search search, LinkedNotebook linkedNotebook) throws Exception {
    EvernoteBusinessNotebookHelper businessNotebookHelper = mClientFactory.getBusinessNotebookHelper();
    EvernoteLinkedNotebookHelper linkedNotebookHelper = mClientFactory.getLinkedNotebookHelper(linkedNotebook);
    Notebook correspondingNotebook = linkedNotebookHelper.getCorrespondingNotebook();
    // create a deep copy so that we don't touch the initial search request values
    NoteFilter noteFilter = new NoteFilter(search.getNoteFilter());
    noteFilter.setNotebookGuid(correspondingNotebook.getGuid());
    return findAllNotes(search, businessNotebookHelper.getClient(), noteFilter);
}
Also used : NoteFilter(com.evernote.edam.notestore.NoteFilter) Notebook(com.evernote.edam.type.Notebook) LinkedNotebook(com.evernote.edam.type.LinkedNotebook)

Example 2 with LinkedNotebook

use of com.evernote.edam.type.LinkedNotebook in project Notes by lguipeng.

the class NoteRefHelper method getNoteStore.

public static EvernoteNoteStoreClient getNoteStore(NoteRef noteRef) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException {
    EvernoteSession session = getSession();
    if (!noteRef.isLinked()) {
        return getSession().getEvernoteClientFactory().getNoteStoreClient();
    }
    LinkedNotebook linkedNotebook = getLinkedNotebook(noteRef.getNotebookGuid());
    if (linkedNotebook == null) {
        return null;
    }
    return session.getEvernoteClientFactory().getLinkedNotebookHelper(linkedNotebook).getClient();
}
Also used : LinkedNotebook(com.evernote.edam.type.LinkedNotebook) EvernoteSession(com.evernote.client.android.EvernoteSession)

Example 3 with LinkedNotebook

use of com.evernote.edam.type.LinkedNotebook in project Notes by lguipeng.

the class AsyncLinkedNoteStoreClient method createNotebook.

/**
 * Create Linked Notebook from a Notebook.
 *
 * Synchronous call
 *
 * @return {@link LinkedNotebook} with guid from server
 */
@Deprecated
public LinkedNotebook createNotebook(Notebook notebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {
    Notebook originalNotebook = getAsyncClient().getClient().createNotebook(getAuthenticationToken(), notebook);
    SharedNotebook sharedNotebook = originalNotebook.getSharedNotebooks().get(0);
    LinkedNotebook linkedNotebook = new LinkedNotebook();
    linkedNotebook.setShareKey(sharedNotebook.getShareKey());
    linkedNotebook.setShareName(originalNotebook.getName());
    linkedNotebook.setUsername(mClientFactory.getBusinessAuthResult().getUser().getUsername());
    linkedNotebook.setShardId(mClientFactory.getBusinessAuthResult().getUser().getShardId());
    return getAsyncPersonalClient().getClient().createLinkedNotebook(getAsyncPersonalClient().getAuthenticationToken(), linkedNotebook);
}
Also used : LinkedNotebook(com.evernote.edam.type.LinkedNotebook) Notebook(com.evernote.edam.type.Notebook) SharedNotebook(com.evernote.edam.type.SharedNotebook) LinkedNotebook(com.evernote.edam.type.LinkedNotebook) SharedNotebook(com.evernote.edam.type.SharedNotebook)

Example 4 with LinkedNotebook

use of com.evernote.edam.type.LinkedNotebook in project Notes by lguipeng.

the class EvernoteBusinessNotebookHelper method createBusinessNotebook.

/**
 * @param notebook The new business notebook.
 * @param defaultClient The note store client, which references the user's note store.
 * @return The new created {@link LinkedNotebook}, which has an business ID.
 */
public LinkedNotebook createBusinessNotebook(@NonNull Notebook notebook, @NonNull EvernoteNoteStoreClient defaultClient) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {
    Notebook originalNotebook = mClient.createNotebook(notebook);
    List<SharedNotebook> sharedNotebooks = originalNotebook.getSharedNotebooks();
    SharedNotebook sharedNotebook = sharedNotebooks.get(0);
    LinkedNotebook linkedNotebook = new LinkedNotebook();
    linkedNotebook.setShareKey(sharedNotebook.getShareKey());
    linkedNotebook.setShareName(originalNotebook.getName());
    linkedNotebook.setUsername(mBusinessUserName);
    linkedNotebook.setShardId(mBusinessUserShardId);
    return defaultClient.createLinkedNotebook(linkedNotebook);
}
Also used : LinkedNotebook(com.evernote.edam.type.LinkedNotebook) Notebook(com.evernote.edam.type.Notebook) SharedNotebook(com.evernote.edam.type.SharedNotebook) LinkedNotebook(com.evernote.edam.type.LinkedNotebook) SharedNotebook(com.evernote.edam.type.SharedNotebook)

Example 5 with LinkedNotebook

use of com.evernote.edam.type.LinkedNotebook in project Notes by lguipeng.

the class EvernoteSearchHelper method findNotesInLinkedNotebook.

protected List<NotesMetadataList> findNotesInLinkedNotebook(Search search, LinkedNotebook linkedNotebook) throws Exception {
    EvernoteLinkedNotebookHelper linkedNotebookHelper = mClientFactory.getLinkedNotebookHelper(linkedNotebook);
    Notebook correspondingNotebook = linkedNotebookHelper.getCorrespondingNotebook();
    // create a deep copy so that we don't touch the initial search request values
    NoteFilter noteFilter = new NoteFilter(search.getNoteFilter());
    noteFilter.setNotebookGuid(correspondingNotebook.getGuid());
    return findAllNotes(search, linkedNotebookHelper.getClient(), noteFilter);
}
Also used : NoteFilter(com.evernote.edam.notestore.NoteFilter) Notebook(com.evernote.edam.type.Notebook) LinkedNotebook(com.evernote.edam.type.LinkedNotebook)

Aggregations

LinkedNotebook (com.evernote.edam.type.LinkedNotebook)6 Notebook (com.evernote.edam.type.Notebook)4 NoteFilter (com.evernote.edam.notestore.NoteFilter)2 SharedNotebook (com.evernote.edam.type.SharedNotebook)2 EvernoteSession (com.evernote.client.android.EvernoteSession)1 EvernoteNoteStoreClient (com.evernote.client.android.asyncclient.EvernoteNoteStoreClient)1