本文整理汇总了Java中com.evernote.edam.error.EDAMUserException类的典型用法代码示例。如果您正苦于以下问题:Java EDAMUserException类的具体用法?Java EDAMUserException怎么用?Java EDAMUserException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EDAMUserException类属于com.evernote.edam.error包,在下文中一共展示了EDAMUserException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLinkedHtmlHelper
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
/**
* 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;
}
示例2: createBusinessNotebook
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
/**
* @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);
}
示例3: loadLinkedNotebook
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
/**
* @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;
}
示例4: loadNotebook
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
/**
* If this note is linked, then it loads the corresponding notebook for the linked notebook. Use
* {@link #loadLinkedNotebook()} to get the linked notebook.
*
* @return The note's notebook from server.
* @see #isLinked()
* @see EvernoteLinkedNotebookHelper#getCorrespondingNotebook()
*/
public Notebook loadNotebook() throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException {
if (mNotebookGuid == null) {
return null;
}
if (mLinked) {
LinkedNotebook linkedNotebook = NoteRefHelper.getLinkedNotebook(mNotebookGuid);
return NoteRefHelper.getSession().getEvernoteClientFactory().getLinkedNotebookHelper(linkedNotebook).getCorrespondingNotebook();
}
EvernoteNoteStoreClient noteStore = NoteRefHelper.getNoteStore(this);
if (noteStore == null) {
return null;
}
return noteStore.getNotebook(mNotebookGuid);
}
示例5: findAllNotes
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
protected List<NotesMetadataList> findAllNotes(Search search, EvernoteNoteStoreClient client, NoteFilter filter) throws Exception {
List<NotesMetadataList> result = new ArrayList<>();
final int maxNotes = search.getMaxNotes();
int offset = search.getOffset();
int remaining = maxNotes - offset;
while (remaining > 0) {
try {
NotesMetadataList notesMetadata = client.findNotesMetadata(filter, offset, maxNotes, search.getResultSpec());
remaining = notesMetadata.getTotalNotes() - (notesMetadata.getStartIndex() + notesMetadata.getNotesSize());
result.add(notesMetadata);
} catch (EDAMUserException | EDAMSystemException | TException | EDAMNotFoundException e) {
maybeRethrow(search, e);
remaining -= search.getPageSize();
}
offset += search.getPageSize();
}
return result;
}
示例6: getEvernoteHtmlHelper
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
protected EvernoteHtmlHelper getEvernoteHtmlHelper() throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException {
if (mEvernoteHtmlHelper == null) {
EvernoteClientFactory clientFactory = EvernoteSession.getInstance().getEvernoteClientFactory();
if (mNoteRef.isLinked()) {
mEvernoteHtmlHelper = clientFactory.getLinkedHtmlHelper(mNoteRef.loadLinkedNotebook());
} else {
mEvernoteHtmlHelper = clientFactory.getHtmlHelperDefault();
}
}
return mEvernoteHtmlHelper;
}
示例7: createNote
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
protected Note createNote(Note note) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException {
if (mNotebook == null && mLinkedNotebook != null) {
EvernoteLinkedNotebookHelper linkedNotebookHelper = EvernoteSession.getInstance().getEvernoteClientFactory().getLinkedNotebookHelper(mLinkedNotebook);
return linkedNotebookHelper.createNoteInLinkedNotebook(note);
} else {
EvernoteNoteStoreClient noteStoreClient = EvernoteSession.getInstance().getEvernoteClientFactory().getNoteStoreClient();
return noteStoreClient.createNote(note);
}
}
示例8: checkException
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
protected static void checkException(@NonNull final Exception e, @Nullable final Activity activity) {
if (e instanceof EDAMUserException) {
switch (((EDAMUserException) e).getErrorCode()) {
case AUTH_EXPIRED:
if (activity != null) {
Util.logout(activity);
}
break;
case PERMISSION_DENIED:
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
View view = activity.findViewById(android.R.id.content);
CoordinatorLayout fabCoordinator = ViewUtil.findFabCoordinator(view, R.id.coordinatorLayout);
if (fabCoordinator != null) {
view = fabCoordinator;
}
final Snackbar snackbar = Snackbar.make(view, ((EDAMUserException) e).getErrorCode().toString(), Snackbar.LENGTH_INDEFINITE);
snackbar.setActionTextColor(activity.getResources().getColor(R.color.tb_bg))
.setAction(android.R.string.ok, new View.OnClickListener() {
@Override
public void onClick(View v) {
snackbar.dismiss();
}
}).show();
}
});
}
break;
}
}
}
示例9: deleteLinkedNotebook
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
/**
* @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());
}
示例10: getLinkedNotebookHelper
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
/**
* 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;
}
示例11: createBusinessNotebookHelper
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
protected EvernoteBusinessNotebookHelper createBusinessNotebookHelper() throws TException, EDAMUserException, EDAMSystemException {
authenticateToBusiness();
EvernoteNoteStoreClient client = getNoteStoreClient(mBusinessAuthenticationResult.getNoteStoreUrl(), mBusinessAuthenticationResult.getAuthenticationToken());
User businessUser = mBusinessAuthenticationResult.getUser();
return new EvernoteBusinessNotebookHelper(client, mExecutorService, businessUser.getUsername(), businessUser.getShardId());
}
示例12: getHtmlHelperBusiness
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
/**
* Use this method, if you want to download a business note as HTML.
*
* @return An async wrapper to load a business note as HTML from the Evernote service.
*/
public synchronized EvernoteHtmlHelper getHtmlHelperBusiness() throws TException, EDAMUserException, EDAMSystemException {
if (mHtmlHelperBusiness == null) {
authenticateToBusiness();
mHtmlHelperBusiness = createHtmlHelper(mBusinessAuthenticationResult.getAuthenticationToken());
}
return mHtmlHelperBusiness;
}
示例13: listBusinessNotebooks
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
/**
* @param defaultClient The note store client, which references the user's note store.
* @return A list of {@link LinkedNotebook}s, which all have a business ID.
*/
public List<LinkedNotebook> listBusinessNotebooks(@NonNull EvernoteNoteStoreClient defaultClient) throws EDAMUserException,
EDAMSystemException, TException, EDAMNotFoundException {
List<LinkedNotebook> businessNotebooks = new ArrayList<>(defaultClient.listLinkedNotebooks());
Iterator<LinkedNotebook> iterator = businessNotebooks.iterator();
while (iterator.hasNext()) {
if (!isBusinessNotebook(iterator.next())) {
iterator.remove();
}
}
return businessNotebooks;
}
示例14: getNoteStore
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
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();
}
示例15: getLinkedNotebook
import com.evernote.edam.error.EDAMUserException; //导入依赖的package包/类
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);
}