com.evernote.edam.error.EDAMNotFoundException Java Examples

The following examples show how to use com.evernote.edam.error.EDAMNotFoundException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientFactory.java    From EverMemo with MIT License 5 votes vote down vote up
/**
 * Creates a LinkedNoteStoreClient from a {@link LinkedNotebook} synchronously
 *
 * @param linkedNotebook
 */
public AsyncLinkedNoteStoreClient createLinkedNoteStoreClient(LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException {
  com.evernote.client.android.AuthenticationResult authResult =
      EvernoteSession.getOpenSession().getAuthenticationResult();

  TEvernoteHttpClient transport =
      new TEvernoteHttpClient(linkedNotebook.getNoteStoreUrl(), mUserAgent, mTempDir);
  TBinaryProtocol protocol = new TBinaryProtocol(transport);

  AsyncLinkedNoteStoreClient sharedNoteStore = new AsyncLinkedNoteStoreClient(protocol, protocol, authResult.getAuthToken(), this);
  AuthenticationResult sharedAuthKey = sharedNoteStore.getAsyncClient().getClient().authenticateToSharedNotebook(linkedNotebook.getShareKey(), authResult.getAuthToken());
  sharedNoteStore.setAuthToken(sharedAuthKey.getAuthenticationToken());
  return sharedNoteStore;
}
 
Example #2
Source File: ClientFactory.java    From EverMemo-EverNote with MIT License 5 votes vote down vote up
/**
 * Creates a LinkedNoteStoreClient from a {@link LinkedNotebook} synchronously
 *
 * @param linkedNotebook
 */
public AsyncLinkedNoteStoreClient createLinkedNoteStoreClient(LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException {
  com.evernote.client.android.AuthenticationResult authResult =
      EvernoteSession.getOpenSession().getAuthenticationResult();

  TEvernoteHttpClient transport =
      new TEvernoteHttpClient(linkedNotebook.getNoteStoreUrl(), mUserAgent, mTempDir);
  TBinaryProtocol protocol = new TBinaryProtocol(transport);

  AsyncLinkedNoteStoreClient sharedNoteStore = new AsyncLinkedNoteStoreClient(protocol, protocol, authResult.getAuthToken(), this);
  AuthenticationResult sharedAuthKey = sharedNoteStore.getAsyncClient().getClient().authenticateToSharedNotebook(linkedNotebook.getShareKey(), authResult.getAuthToken());
  sharedNoteStore.setAuthToken(sharedAuthKey.getAuthenticationToken());
  return sharedNoteStore;
}
 
Example #3
Source File: AsyncNoteStoreClient.java    From EverMemo-EverNote with MIT License 5 votes vote down vote up
/**
 * Asynchronous wrapper
 *
 * @see NoteStore.Client#setSharedNotebookRecipientSettings(String, long,
 *      SharedNotebookRecipientSettings)
 */
public void setSharedNotebookRecipientSettings(final long sharedNotebookId,
    final SharedNotebookRecipientSettings recipientSettings, OnClientCallback<Integer> callback)
    throws EDAMUserException, EDAMNotFoundException, EDAMSystemException,
    TException {
  AsyncReflector.execute(mClient, callback, "setSharedNotebookRecipientSettings", mAuthenticationToken, sharedNotebookId, recipientSettings);
}
 
Example #4
Source File: AsyncLinkedNoteStoreClient.java    From EverMemo-EverNote with MIT License 5 votes vote down vote up
/**
 * Providing a LinkedNotebook referencing a linked account, perform a delete
 *
 * Synchronous call
 *
 * @return guid of notebook deleted
 */
public int deleteNotebook(LinkedNotebook linkedNotebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {

  SharedNotebook sharedNotebook = getAsyncClient().getClient().getSharedNotebookByAuth(getAuthenticationToken());

  Long[] ids = {sharedNotebook.getId()};
  getAsyncClient().getClient().expungeSharedNotebooks(getAuthenticationToken(), Arrays.asList(ids));
  return getAsyncPersonalClient().getClient().expungeLinkedNotebook(getAsyncPersonalClient().getAuthenticationToken(), linkedNotebook.getGuid());
}
 
Example #5
Source File: AsyncLinkedNoteStoreClient.java    From EverMemo-EverNote with MIT License 5 votes vote down vote up
/**
 * Create Linked Notebook from a Notebook
 *
 * Synchronous call
 *
 * @return {@link LinkedNotebook} with guid from server
 */
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(EvernoteSession.getOpenSession().getAuthenticationResult().getBusinessUser().getUsername());
  linkedNotebook.setShardId(EvernoteSession.getOpenSession().getAuthenticationResult().getBusinessUser().getShardId());

  return getAsyncPersonalClient().getClient().createLinkedNotebook(getAsyncPersonalClient().getAuthenticationToken(), linkedNotebook);
}
 
Example #6
Source File: AsyncBusinessNoteStoreClient.java    From EverMemo-EverNote with MIT License 5 votes vote down vote up
/**
 * Will return the {@link Notebook} associated with the {@link LinkedNotebook} from the business account
 *
 * Synchronous call
 *
 * @param linkedNotebook
 */
@Override
public Notebook getCorrespondingNotebook(LinkedNotebook linkedNotebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {
  //Get LinkedStore for auth information
  AsyncLinkedNoteStoreClient sharedNoteStore = getClientFactory().createLinkedNoteStoreClient(linkedNotebook);
  SharedNotebook sharedNotebook = sharedNoteStore.getAsyncClient().getClient().getSharedNotebookByAuth(sharedNoteStore.getAuthenticationToken());

  return getAsyncClient().getClient().getNotebook(getAuthenticationToken(), sharedNotebook.getNotebookGuid());
}
 
Example #7
Source File: AsyncBusinessNoteStoreClient.java    From EverMemo-EverNote with MIT License 5 votes vote down vote up
/**
 * Providing a LinkedNotebook referencing a Business notebook, perform a delete
 *
 * Synchronous call
 *
 * @return guid of notebook deleted
 */
@Override
public int deleteNotebook(LinkedNotebook linkedNotebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {

  AsyncLinkedNoteStoreClient sharedNoteStore = getClientFactory().createLinkedNoteStoreClient(linkedNotebook);
  SharedNotebook sharedNotebook = sharedNoteStore.getAsyncClient().getClient().getSharedNotebookByAuth(sharedNoteStore.getAuthenticationToken());

  Long[] ids = {sharedNotebook.getId()};
  getAsyncClient().getClient().expungeSharedNotebooks(getAuthenticationToken(), Arrays.asList(ids));
  return getAsyncPersonalClient().getClient().expungeLinkedNotebook(getAsyncPersonalClient().getAuthenticationToken(), linkedNotebook.getGuid());
}
 
Example #8
Source File: AsyncBusinessNoteStoreClient.java    From EverMemo-EverNote with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example #9
Source File: StoreOperationControllerExceptionIntegrationTest.java    From evernote-rest-webapp with Apache License 2.0 5 votes vote down vote up
@Test
public void testWhenEdamNotFoundExceptionThrown() throws Exception {
	EvernoteException evernoteException = new EvernoteException("MESSAGE", new EDAMNotFoundException());
	when(userStoreOperations.isBusinessUser()).thenThrow(evernoteException);

	performRequest("/userStore/isBusinessUser", "{}").andExpect(forwardedUrl("/error"));
	verify(userStoreOperations).isBusinessUser();
}
 
Example #10
Source File: AsyncNoteStoreClient.java    From EverMemo with MIT License 5 votes vote down vote up
/**
 * Asynchronous wrapper
 *
 * @see NoteStore.Client#setSharedNotebookRecipientSettings(String, long,
 *      SharedNotebookRecipientSettings)
 */
public void setSharedNotebookRecipientSettings(final long sharedNotebookId,
    final SharedNotebookRecipientSettings recipientSettings, OnClientCallback<Integer> callback)
    throws EDAMUserException, EDAMNotFoundException, EDAMSystemException,
    TException {
  AsyncReflector.execute(mClient, callback, "setSharedNotebookRecipientSettings", mAuthenticationToken, sharedNotebookId, recipientSettings);
}
 
Example #11
Source File: AsyncBusinessNoteStoreClient.java    From EverMemo with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example #12
Source File: AsyncLinkedNoteStoreClient.java    From EverMemo with MIT License 5 votes vote down vote up
/**
 * Providing a LinkedNotebook referencing a linked account, perform a delete
 *
 * Synchronous call
 *
 * @return guid of notebook deleted
 */
public int deleteNotebook(LinkedNotebook linkedNotebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {

  SharedNotebook sharedNotebook = getAsyncClient().getClient().getSharedNotebookByAuth(getAuthenticationToken());

  Long[] ids = {sharedNotebook.getId()};
  getAsyncClient().getClient().expungeSharedNotebooks(getAuthenticationToken(), Arrays.asList(ids));
  return getAsyncPersonalClient().getClient().expungeLinkedNotebook(getAsyncPersonalClient().getAuthenticationToken(), linkedNotebook.getGuid());
}
 
Example #13
Source File: AsyncLinkedNoteStoreClient.java    From EverMemo with MIT License 5 votes vote down vote up
/**
 * Create Linked Notebook from a Notebook
 *
 * Synchronous call
 *
 * @return {@link LinkedNotebook} with guid from server
 */
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(EvernoteSession.getOpenSession().getAuthenticationResult().getBusinessUser().getUsername());
  linkedNotebook.setShardId(EvernoteSession.getOpenSession().getAuthenticationResult().getBusinessUser().getShardId());

  return getAsyncPersonalClient().getClient().createLinkedNotebook(getAsyncPersonalClient().getAuthenticationToken(), linkedNotebook);
}
 
Example #14
Source File: AsyncBusinessNoteStoreClient.java    From EverMemo with MIT License 5 votes vote down vote up
/**
 * Providing a LinkedNotebook referencing a Business notebook, perform a delete
 *
 * Synchronous call
 *
 * @return guid of notebook deleted
 */
@Override
public int deleteNotebook(LinkedNotebook linkedNotebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {

  AsyncLinkedNoteStoreClient sharedNoteStore = getClientFactory().createLinkedNoteStoreClient(linkedNotebook);
  SharedNotebook sharedNotebook = sharedNoteStore.getAsyncClient().getClient().getSharedNotebookByAuth(sharedNoteStore.getAuthenticationToken());

  Long[] ids = {sharedNotebook.getId()};
  getAsyncClient().getClient().expungeSharedNotebooks(getAuthenticationToken(), Arrays.asList(ids));
  return getAsyncPersonalClient().getClient().expungeLinkedNotebook(getAsyncPersonalClient().getAuthenticationToken(), linkedNotebook.getGuid());
}
 
Example #15
Source File: AsyncBusinessNoteStoreClient.java    From EverMemo with MIT License 5 votes vote down vote up
/**
 * Will return the {@link Notebook} associated with the {@link LinkedNotebook} from the business account
 *
 * Synchronous call
 *
 * @param linkedNotebook
 */
@Override
public Notebook getCorrespondingNotebook(LinkedNotebook linkedNotebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {
  //Get LinkedStore for auth information
  AsyncLinkedNoteStoreClient sharedNoteStore = getClientFactory().createLinkedNoteStoreClient(linkedNotebook);
  SharedNotebook sharedNotebook = sharedNoteStore.getAsyncClient().getClient().getSharedNotebookByAuth(sharedNoteStore.getAuthenticationToken());

  return getAsyncClient().getClient().getNotebook(getAuthenticationToken(), sharedNotebook.getNotebookGuid());
}
 
Example #16
Source File: AsyncBusinessNoteStoreClient.java    From EverMemo with MIT License 3 votes vote down vote up
/**
 * Helper method to create a note synchronously in a business notebook
 *
 * @param note
 * @param linkedNotebook
 * @return
 * @throws com.evernote.edam.error.EDAMUserException
 *
 * @throws com.evernote.edam.error.EDAMSystemException
 *
 * @throws com.evernote.thrift.TException
 * @throws com.evernote.edam.error.EDAMNotFoundException
 *
 */
@Override
public Note createNote(Note note, LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException {

  AsyncLinkedNoteStoreClient sharedNoteStore = getClientFactory().createLinkedNoteStoreClient(linkedNotebook);
  SharedNotebook sharedNotebook = sharedNoteStore.getAsyncClient().getClient().getSharedNotebookByAuth(sharedNoteStore.getAuthenticationToken());

  note.setNotebookGuid(sharedNotebook.getNotebookGuid());
  sharedNoteStore.getAsyncClient().getClient().createNote(sharedNoteStore.getAuthenticationToken(), note);

  return note;
}
 
Example #17
Source File: AsyncLinkedNoteStoreClient.java    From EverMemo-EverNote with MIT License 3 votes vote down vote up
/**
 * Helper method to create a note synchronously in a linked notebook
 *
 * @param note
 * @param linkedNotebook
 * @return
 * @throws com.evernote.edam.error.EDAMUserException
 *
 * @throws com.evernote.edam.error.EDAMSystemException
 *
 * @throws com.evernote.thrift.TException
 * @throws com.evernote.edam.error.EDAMNotFoundException
 *
 */
public Note createNote(Note note, LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException {

  SharedNotebook sharedNotebook = getAsyncClient().getClient().getSharedNotebookByAuth(getAuthenticationToken());
  note.setNotebookGuid(sharedNotebook.getNotebookGuid());
  return getAsyncClient().getClient().createNote(getAuthenticationToken(), note);

}
 
Example #18
Source File: AsyncLinkedNoteStoreClient.java    From EverMemo with MIT License 3 votes vote down vote up
/**
 * Helper method to create a note synchronously in a linked notebook
 *
 * @param note
 * @param linkedNotebook
 * @return
 * @throws com.evernote.edam.error.EDAMUserException
 *
 * @throws com.evernote.edam.error.EDAMSystemException
 *
 * @throws com.evernote.thrift.TException
 * @throws com.evernote.edam.error.EDAMNotFoundException
 *
 */
public Note createNote(Note note, LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException {

  SharedNotebook sharedNotebook = getAsyncClient().getClient().getSharedNotebookByAuth(getAuthenticationToken());
  note.setNotebookGuid(sharedNotebook.getNotebookGuid());
  return getAsyncClient().getClient().createNote(getAuthenticationToken(), note);

}
 
Example #19
Source File: AsyncBusinessNoteStoreClient.java    From EverMemo-EverNote with MIT License 3 votes vote down vote up
/**
 * Helper method to create a note synchronously in a business notebook
 *
 * @param note
 * @param linkedNotebook
 * @return
 * @throws com.evernote.edam.error.EDAMUserException
 *
 * @throws com.evernote.edam.error.EDAMSystemException
 *
 * @throws com.evernote.thrift.TException
 * @throws com.evernote.edam.error.EDAMNotFoundException
 *
 */
@Override
public Note createNote(Note note, LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException {

  AsyncLinkedNoteStoreClient sharedNoteStore = getClientFactory().createLinkedNoteStoreClient(linkedNotebook);
  SharedNotebook sharedNotebook = sharedNoteStore.getAsyncClient().getClient().getSharedNotebookByAuth(sharedNoteStore.getAuthenticationToken());

  note.setNotebookGuid(sharedNotebook.getNotebookGuid());
  sharedNoteStore.getAsyncClient().getClient().createNote(sharedNoteStore.getAuthenticationToken(), note);

  return note;
}
 
Example #20
Source File: AsyncBusinessNoteStoreClient.java    From EverMemo-EverNote with MIT License 2 votes vote down vote up
/**
 * Create Business Notebook from a Notebook
 *
 * Synchronous call
 *
 * @return {@link LinkedNotebook} with guid from server
 */
@Override
public LinkedNotebook createNotebook(Notebook notebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {
  return super.createNotebook(notebook);
}
 
Example #21
Source File: AsyncLinkedNoteStoreClient.java    From EverMemo with MIT License 2 votes vote down vote up
/**
 * Helper method to list linked notebooks synchronously
 *
 * @see {@link com.evernote.edam.notestore.NoteStore.Client#listLinkedNotebooks(String)}
 *
 */
public List<LinkedNotebook> listNotebooks() throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException {
  return getAsyncPersonalClient().getClient().listLinkedNotebooks(getAsyncPersonalClient().getAuthenticationToken());
}
 
Example #22
Source File: AsyncLinkedNoteStoreClient.java    From EverMemo-EverNote with MIT License 2 votes vote down vote up
/**
 * Helper method to list linked notebooks synchronously
 *
 * @see {@link com.evernote.edam.notestore.NoteStore.Client#listLinkedNotebooks(String)}
 *
 */
public List<LinkedNotebook> listNotebooks() throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException {
  return getAsyncPersonalClient().getClient().listLinkedNotebooks(getAsyncPersonalClient().getAuthenticationToken());
}
 
Example #23
Source File: AsyncBusinessNoteStoreClient.java    From EverMemo with MIT License 2 votes vote down vote up
/**
 * Create Business Notebook from a Notebook
 *
 * Synchronous call
 *
 * @return {@link LinkedNotebook} with guid from server
 */
@Override
public LinkedNotebook createNotebook(Notebook notebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {
  return super.createNotebook(notebook);
}
 
Example #24
Source File: AsyncLinkedNoteStoreClient.java    From EverMemo-EverNote with MIT License 2 votes vote down vote up
/**
 * Will return the {@link com.evernote.edam.type.Notebook} associated with the {@link com.evernote.edam.type.LinkedNotebook} from the linked account
 *
 * Synchronous call
 *
 * @param linkedNotebook
 */
public Notebook getCorrespondingNotebook(LinkedNotebook linkedNotebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {
  SharedNotebook sharedNotebook = getAsyncClient().getClient().getSharedNotebookByAuth(getAuthenticationToken());
  return getAsyncClient().getClient().getNotebook(getAuthenticationToken(), sharedNotebook.getNotebookGuid());
}
 
Example #25
Source File: AsyncLinkedNoteStoreClient.java    From EverMemo-EverNote with MIT License 2 votes vote down vote up
/**
 * Checks writable permissions of {@link LinkedNotebook} on Linked account
 *
 * Synchronous call
 *
 * @param linkedNotebook
 */
public boolean isNotebookWritable(LinkedNotebook linkedNotebook) throws EDAMUserException, TException, EDAMSystemException, EDAMNotFoundException {
  Notebook notebook = getCorrespondingNotebook(linkedNotebook);
  return !notebook.getRestrictions().isNoCreateNotes();
}
 
Example #26
Source File: AsyncLinkedNoteStoreClient.java    From EverMemo with MIT License 2 votes vote down vote up
/**
 * Checks writable permissions of {@link LinkedNotebook} on Linked account
 *
 * Synchronous call
 *
 * @param linkedNotebook
 */
public boolean isNotebookWritable(LinkedNotebook linkedNotebook) throws EDAMUserException, TException, EDAMSystemException, EDAMNotFoundException {
  Notebook notebook = getCorrespondingNotebook(linkedNotebook);
  return !notebook.getRestrictions().isNoCreateNotes();
}
 
Example #27
Source File: AsyncLinkedNoteStoreClient.java    From EverMemo with MIT License 2 votes vote down vote up
/**
 * Will return the {@link com.evernote.edam.type.Notebook} associated with the {@link com.evernote.edam.type.LinkedNotebook} from the linked account
 *
 * Synchronous call
 *
 * @param linkedNotebook
 */
public Notebook getCorrespondingNotebook(LinkedNotebook linkedNotebook) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {
  SharedNotebook sharedNotebook = getAsyncClient().getClient().getSharedNotebookByAuth(getAuthenticationToken());
  return getAsyncClient().getClient().getNotebook(getAuthenticationToken(), sharedNotebook.getNotebookGuid());
}