/** * @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); }
boolean this_present_shareName = true && this.isSetShareName(); boolean that_present_shareName = true && that.isSetShareName(); if (this_present_shareName || that_present_shareName) { if (!(this_present_shareName && that_present_shareName)) boolean this_present_username = true && this.isSetUsername(); boolean that_present_username = true && that.isSetUsername(); if (this_present_username || that_present_username) { if (!(this_present_username && that_present_username)) boolean this_present_shardId = true && this.isSetShardId(); boolean that_present_shardId = true && that.isSetShardId(); if (this_present_shardId || that_present_shardId) { if (!(this_present_shardId && that_present_shardId)) boolean this_present_shareKey = true && this.isSetShareKey(); boolean that_present_shareKey = true && that.isSetShareKey(); if (this_present_shareKey || that_present_shareKey) { if (!(this_present_shareKey && that_present_shareKey)) boolean this_present_uri = true && this.isSetUri(); boolean that_present_uri = true && that.isSetUri(); if (this_present_uri || that_present_uri) { if (!(this_present_uri && that_present_uri)) boolean this_present_guid = true && this.isSetGuid(); boolean that_present_guid = true && that.isSetGuid(); if (this_present_guid || that_present_guid) { if (!(this_present_guid && that_present_guid))
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof LinkedNotebook) return this.equals((LinkedNotebook)that); return false; }
inkedNotebook linkedNotebook1 = new LinkedNotebook(); linkedNotebook1.setShareName("<Name of notebook>"); linkedNotebook1.setUsername("evernote user id"); linkedNotebook1.setUri("uri of the public notebook"); notestore.createLinkedNotebook(linkedNotebook1, new OnClientCallback<LinkedNotebook>() { public void onSuccess(LinkedNotebook data) { notestore.getLinkedNotebookSyncChunk(data, 0, 100, true, new OnClientCallback<SyncChunk>() { public void onSuccess(SyncChunk Syncdata) { SharedNotes = data.getNotes(); } } } } );
case 2: // LINKED_NOTEBOOK if (field.type == TType.STRUCT) { this.linkedNotebook = new com.evernote.edam.type.LinkedNotebook(); this.linkedNotebook.read(iprot); } else { TProtocolUtil.skip(iprot, field.type);
LinkedNotebook linkedNotebook = new LinkedNotebook(); linkedNotebook.SharedNotebookGlobalId = <the shareKey you got from the server> linkedNotebook.ShareName = <the name of the Shared Notebook> linkedNotebook.Username = <the username of user A; i.e. the owner of the Shared Notebook> linkedNotebook.ShardId = <the shardId of the notebook in user A's account> LinkedNotebook createdLinkedNotebook = noteStore.createLinkedNotebook(authenticationToken, linkedNotebook);
protected EvernoteLinkedNotebookHelper createLinkedNotebookHelper(@NonNull LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException { String url = linkedNotebook.getNoteStoreUrl(); EvernoteNoteStoreClient client = getNoteStoreClient(url, EvernotePreconditions.checkNotEmpty(mEvernoteSession.getAuthToken())); AuthenticationResult authenticationResult = client.authenticateToSharedNotebook(linkedNotebook.getShareKey()); client = getNoteStoreClient(url, authenticationResult.getAuthenticationToken()); return new EvernoteLinkedNotebookHelper(client, linkedNotebook, mExecutorService); }
/** * 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; }
/** * @return {@code true} if this linked notebook has a business ID. */ public static boolean isBusinessNotebook(LinkedNotebook linkedNotebook) { return linkedNotebook.isSetBusinessId(); } }
case 2: // LINKED_NOTEBOOK if (field.type == TType.STRUCT) { this.linkedNotebook = new com.evernote.edam.type.LinkedNotebook(); this.linkedNotebook.read(iprot); } else { TProtocolUtil.skip(iprot, field.type);
public LinkedNotebook deepCopy() { return new LinkedNotebook(this); }
/** * Creates a LinkedNoteStoreClient from a {@link LinkedNotebook} synchronously * * @param linkedNotebook */ public LinkedNoteStoreClient createLinkedNoteStoreClient( LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException { NoteStoreClient mainNoteStoreClient = createNoteStoreClient(); AuthenticationResult sharedAuth = mainNoteStoreClient .authenticateToSharedNotebook(linkedNotebook.getShareKey()); NoteStoreClient linkedNoteStoreClient = createStoreClient( NoteStoreClient.class, linkedNotebook.getNoteStoreUrl(), sharedAuth.getAuthenticationToken()); return new LinkedNoteStoreClient(mainNoteStoreClient, linkedNoteStoreClient, sharedAuth); }
/** * Helper method to list business notebooks synchronously * * @return * @throws EDAMUserException * @throws EDAMSystemException * @throws TException * @throws EDAMNotFoundException */ @Override public List<LinkedNotebook> listNotebooks() throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException { List<LinkedNotebook> linkedNotebooks = new ArrayList<LinkedNotebook>(); for (LinkedNotebook notebook : super.listNotebooks()) { if (notebook.isSetBusinessId()) { linkedNotebooks.add(notebook); } } return linkedNotebooks; }
boolean this_present_shareName = true && this.isSetShareName(); boolean that_present_shareName = true && that.isSetShareName(); if (this_present_shareName || that_present_shareName) { if (!(this_present_shareName && that_present_shareName)) boolean this_present_username = true && this.isSetUsername(); boolean that_present_username = true && that.isSetUsername(); if (this_present_username || that_present_username) { if (!(this_present_username && that_present_username)) boolean this_present_shardId = true && this.isSetShardId(); boolean that_present_shardId = true && that.isSetShardId(); if (this_present_shardId || that_present_shardId) { if (!(this_present_shardId && that_present_shardId)) boolean this_present_shareKey = true && this.isSetShareKey(); boolean that_present_shareKey = true && that.isSetShareKey(); if (this_present_shareKey || that_present_shareKey) { if (!(this_present_shareKey && that_present_shareKey)) boolean this_present_uri = true && this.isSetUri(); boolean that_present_uri = true && that.isSetUri(); if (this_present_uri || that_present_uri) { if (!(this_present_uri && that_present_uri)) boolean this_present_guid = true && this.isSetGuid(); boolean that_present_guid = true && that.isSetGuid(); if (this_present_guid || that_present_guid) { if (!(this_present_guid && that_present_guid))
/** * Create Linked Notebook from a Notebook * * @return {@link LinkedNotebook} with guid from server */ public LinkedNotebook createNotebook(Notebook notebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException { Notebook originalNotebook = getClient().createNotebook(notebook); SharedNotebook sharedNotebook = originalNotebook.getSharedNotebooks() .get(0); LinkedNotebook linkedNotebook = new LinkedNotebook(); linkedNotebook.setShareKey(sharedNotebook.getShareKey()); linkedNotebook.setShareName(originalNotebook.getName()); linkedNotebook.setUsername(getAuthenticationResult().getUser() .getUsername()); linkedNotebook.setShardId(getAuthenticationResult().getUser().getShardId()); return getPersonalClient().createLinkedNotebook(linkedNotebook); }
case 2: // LINKED_NOTEBOOK if (field.type == TType.STRUCT) { this.linkedNotebook = new com.evernote.edam.type.LinkedNotebook(); this.linkedNotebook.read(iprot); } else { TProtocolUtil.skip(iprot, field.type);
public LinkedNotebook deepCopy() { return new LinkedNotebook(this); }
/** * Creates a LinkedNoteStoreClient from a {@link LinkedNotebook} synchronously * * @param linkedNotebook */ public LinkedNoteStoreClient createLinkedNoteStoreClient( LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException { NoteStoreClient mainNoteStoreClient = createNoteStoreClient(); AuthenticationResult sharedAuth = mainNoteStoreClient .authenticateToSharedNotebook(linkedNotebook.getShareKey()); NoteStoreClient linkedNoteStoreClient = createStoreClient( NoteStoreClient.class, linkedNotebook.getNoteStoreUrl(), sharedAuth.getAuthenticationToken()); return new LinkedNoteStoreClient(mainNoteStoreClient, linkedNoteStoreClient, sharedAuth); }
/** * Helper method to list business notebooks synchronously * * @return * @throws EDAMUserException * @throws EDAMSystemException * @throws TException * @throws EDAMNotFoundException */ @Override public List<LinkedNotebook> listNotebooks() throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException { List<LinkedNotebook> linkedNotebooks = new ArrayList<LinkedNotebook>(); for (LinkedNotebook notebook : super.listNotebooks()) { if (notebook.isSetBusinessId()) { linkedNotebooks.add(notebook); } } return linkedNotebooks; }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof LinkedNotebook) return this.equals((LinkedNotebook)that); return false; }