当前位置: 首页>>代码示例>>Java>>正文


Java TException类代码示例

本文整理汇总了Java中com.evernote.thrift.TException的典型用法代码示例。如果您正苦于以下问题:Java TException类的具体用法?Java TException怎么用?Java TException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TException类属于com.evernote.thrift包,在下文中一共展示了TException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBootstrapInfo

import com.evernote.thrift.TException; //导入依赖的package包/类
/**
 * Makes a web request to get the latest bootstrap information.
 * This is a requirement during the oauth process
 *
 * @return {@link BootstrapInfoWrapper}
 * @throws Exception
 */
BootstrapInfoWrapper getBootstrapInfo() throws Exception {
  Log.d(LOGTAG, "getBootstrapInfo()");
  BootstrapInfo bsInfo = null;
  try {
    if (mBootstrapServerUsed == null) {
      initializeUserStoreAndCheckVersion();
    }

    bsInfo = mEvernoteSession.getEvernoteClientFactory().getUserStoreClient(getUserStoreUrl(mBootstrapServerUsed), null).getBootstrapInfo(mLocale.toString());
    printBootstrapInfo(bsInfo);

  } catch (TException e) {
    Log.e(LOGTAG, "error getting bootstrap info", e);
  }

  return new BootstrapInfoWrapper(mBootstrapServerUsed, bsInfo);
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:25,代码来源:BootstrapManager.java

示例2: getLinkedHtmlHelper

import com.evernote.thrift.TException; //导入依赖的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;
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:25,代码来源:EvernoteClientFactory.java

示例3: createBusinessNotebook

import com.evernote.thrift.TException; //导入依赖的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);
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:22,代码来源:EvernoteBusinessNotebookHelper.java

示例4: loadNotebook

import com.evernote.thrift.TException; //导入依赖的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);
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:26,代码来源:NoteRef.java

示例5: loadLinkedNotebook

import com.evernote.thrift.TException; //导入依赖的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;
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:24,代码来源:NoteRef.java

示例6: findAllNotes

import com.evernote.thrift.TException; //导入依赖的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;
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:25,代码来源:EvernoteSearchHelper.java

示例7: getEvernoteHtmlHelper

import com.evernote.thrift.TException; //导入依赖的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;
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:14,代码来源:ViewHtmlActivity.java

示例8: createNote

import com.evernote.thrift.TException; //导入依赖的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);
    }
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:11,代码来源:CreateNewNoteTask.java

示例9: deleteLinkedNotebook

import com.evernote.thrift.TException; //导入依赖的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());
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:15,代码来源:EvernoteLinkedNotebookHelper.java

示例10: getLinkedNotebookHelper

import com.evernote.thrift.TException; //导入依赖的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;
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:22,代码来源:EvernoteClientFactory.java

示例11: createBusinessNotebookHelper

import com.evernote.thrift.TException; //导入依赖的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());
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:9,代码来源:EvernoteClientFactory.java

示例12: getHtmlHelperBusiness

import com.evernote.thrift.TException; //导入依赖的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;
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:13,代码来源:EvernoteClientFactory.java

示例13: getNoteStore

import com.evernote.thrift.TException; //导入依赖的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();
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:15,代码来源:NoteRefHelper.java

示例14: getLinkedNotebook

import com.evernote.thrift.TException; //导入依赖的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);
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:13,代码来源:NoteRefHelper.java

示例15: getCorrespondingNotebook

import com.evernote.thrift.TException; //导入依赖的package包/类
/**
 * @return The notebook for this linked notebook.
 */
public Notebook getCorrespondingNotebook() throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException {
    SharedNotebook sharedNotebook = mClient.getSharedNotebookByAuth();
    return mClient.getNotebook(sharedNotebook.getNotebookGuid());
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:8,代码来源:EvernoteLinkedNotebookHelper.java


注:本文中的com.evernote.thrift.TException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。