本文整理汇总了Java中com.evernote.edam.notestore.NoteFilter类的典型用法代码示例。如果您正苦于以下问题:Java NoteFilter类的具体用法?Java NoteFilter怎么用?Java NoteFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NoteFilter类属于com.evernote.edam.notestore包,在下文中一共展示了NoteFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findAllNotes
import com.evernote.edam.notestore.NoteFilter; //导入依赖的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;
}
示例2: listNoteBooks
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
public List<Notebook> listNoteBooks() throws Exception {
List<Notebook> notebooks = noteStore.listNotebooks();
for (Notebook notebook : notebooks) {
NoteFilter filter = new NoteFilter();
filter.setNotebookGuid(notebook.getGuid());
filter.setOrder(NoteSortOrder.CREATED.getValue());
filter.setAscending(true);
NoteList noteList = noteStore.findNotes(filter, 0, 100);
List<Note> notes = noteList.getNotes();
for (Note note : notes) {
System.out.println(" * " + note.getTitle());
}
}
return notebooks;
}
示例3: listNotes
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
/**
* Retrieve and display a list of the user's notes.
*/
private void listNotes() throws Exception {
// List the notes in the user's account
System.out.println("Listing notes:");
// First, get a list of all notebooks
List<Notebook> notebooks = noteStore.listNotebooks();
for (Notebook notebook : notebooks) {
System.out.println("Notebook: " + notebook.getName());
// Next, search for the first 100 notes in this notebook, ordering
// by creation date
NoteFilter filter = new NoteFilter();
filter.setNotebookGuid(notebook.getGuid());
filter.setOrder(NoteSortOrder.CREATED.getValue());
filter.setAscending(true);
NoteList noteList = noteStore.findNotes(filter, 0, 100);
List<Note> notes = noteList.getNotes();
for (Note note : notes) {
System.out.println(" * " + note.getTitle());
}
}
System.out.println();
}
示例4: FindNotesTask
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public FindNotesTask(int offset, int maxNotes, @Nullable Notebook notebook, @Nullable LinkedNotebook linkedNotebook, @Nullable String query) {
super((Class) List.class);
NoteFilter noteFilter = new NoteFilter();
noteFilter.setOrder(NoteSortOrder.UPDATED.getValue());
if (!TextUtils.isEmpty(query)) {
noteFilter.setWords(query);
}else{
//TODO: let the user choose a tag he wants here we just use favorit as tag to filter by
List<String> list = new ArrayList();
list.add("03750a45-c107-4e8b-afbf-29fa22777244");
noteFilter.setTagGuids(list);
}
if (notebook != null) {
noteFilter.setNotebookGuid(notebook.getGuid());
}
mSearch = new EvernoteSearchHelper.Search()
.setOffset(offset)
.setMaxNotes(maxNotes)
.setNoteFilter(noteFilter);
if (linkedNotebook != null) {
mSearch.addLinkedNotebook(linkedNotebook);
} else {
mSearch.addScope(EvernoteSearchHelper.Scope.PERSONAL_NOTES);
}
}
示例5: findNotesAsync
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
public Future<NoteList> findNotesAsync(final NoteFilter filter, final int offset, final int maxNotes, EvernoteCallback<NoteList> callback) {
return submitTask(new Callable<NoteList>() {
@Override
public NoteList call() throws Exception {
return findNotes(filter, offset, maxNotes);
}
}, callback);
}
示例6: findNoteOffsetAsync
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
public Future<Integer> findNoteOffsetAsync(final NoteFilter filter, final String guid, EvernoteCallback<Integer> callback) {
return submitTask(new Callable<Integer>() {
@Override
public Integer call() throws Exception {
return findNoteOffset(filter, guid);
}
}, callback);
}
示例7: findNotesMetadataAsync
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
public Future<NotesMetadataList> findNotesMetadataAsync(final NoteFilter filter, final int offset, final int maxNotes,
final NotesMetadataResultSpec resultSpec, EvernoteCallback<NotesMetadataList> callback) {
return submitTask(new Callable<NotesMetadataList>() {
@Override
public NotesMetadataList call() throws Exception {
return findNotesMetadata(filter, offset, maxNotes, resultSpec);
}
}, callback);
}
示例8: findNoteCountsAsync
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
public Future<NoteCollectionCounts> findNoteCountsAsync(final NoteFilter filter, final boolean withTrash, EvernoteCallback<NoteCollectionCounts> callback) {
return submitTask(new Callable<NoteCollectionCounts>() {
@Override
public NoteCollectionCounts call() throws Exception {
return findNoteCounts(filter, withTrash);
}
}, callback);
}
示例9: findNotesInLinkedNotebook
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
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);
}
示例10: findNotesInBusinessNotebook
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
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);
}
示例11: findNoteBySource
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
/**
* Search for note using the note's source attribute
*
* @param source The source attribute to search for
* @return
* @throws Exception
*/
public NoteList findNoteBySource(String source) throws Exception {
NoteFilter filter = new NoteFilter();
String query = "source:\"" + source + "\"";
filter.setWords(query);
NoteList notes = noteStore.findNotes(filter, 0, 10);
return notes;
}
示例12: listNotesWithinNotebook
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
/**
* return a user's all notes(uuid-ENNote) inside the specified notebook.
*
* @param args
* all things needed to list notes, such as notebook guid.
* @return The notes in the certain notebook.
*/
@Override
public Map<String, ENNote> listNotesWithinNotebook(final ENNote args) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException {
NoteFilter filter = new NoteFilter();
filter.setInactive(false);
if (StringUtils.isNotBlank(args.getNotebook().getGuid())) {
filter.setNotebookGuid(args.getNotebook().getGuid());
}
if (StringUtils.isNotBlank(args.getName())) {
filter.setWords(Constants.EDAM_SYNTAX_INTITLE + StringUtil.toQuotedString(args.getName()));
}
NotesMetadataResultSpec resultSpec = new NotesMetadataResultSpec();
resultSpec.setIncludeTitle(true);
NoteStoreClient client = factory.getNoteStoreClient();
if (args.getNotebook().getType() == ENObjectType.LINKED) {
// args.getNotebook().getLinkedObject() should NOT be null
client = factory.getLinkedNoteStoreClient((LinkedNotebook) args.getNotebook().getLinkedObject());
}
List<NoteMetadata> noteList = ListUtil.list();
int offset = 0, pageSize = com.evernote.edam.limits.Constants.EDAM_USER_NOTES_MAX;
NotesMetadataList notesMetadataList = null;
do {
notesMetadataList = client.findNotesMetadata(filter, offset, pageSize, resultSpec);
noteList.addAll(notesMetadataList.getNotes());
offset = offset + notesMetadataList.getNotesSize();
} while (notesMetadataList != null && offset < notesMetadataList.getTotalNotes());
Map<String, ENNote> map = MapUtil.map();
for (NoteMetadata n : noteList) {
if (map.containsKey(n.getTitle())) {
map.put(n.getTitle() + ConstantsUtil.LEFT_PARENTHESIS + n.getGuid() + ConstantsUtil.RIGHT_PARENTHESIS, ENNoteImpl.forNameAndGuid(n.getTitle(), n.getGuid()));
} else {
map.put(n.getTitle(), ENNoteImpl.forNameAndGuid(n.getTitle(), n.getGuid()));
}
}
return map;
}
示例13: listNotes
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
public List<Note> listNotes(Notebook notebook) throws Exception {
NoteFilter filter = new NoteFilter();
filter.setNotebookGuid(notebook.getGuid());
filter.setOrder(NoteSortOrder.CREATED.getValue());
filter.setAscending(true);
NoteList noteList = noteStore.findNotes(filter, 0, 100);
List<Note> notes = noteList.getNotes();
return notes;
}
示例14: onResume
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
// ここで読みに行く
ClientFactory factory = mProvider.getEvernoteSession()
.getClientFactory();
try {
AsyncNoteStoreClient client = factory.createNoteStoreClient();
NoteFilter filter = new NoteFilter();
filter.setOrder(NoteSortOrder.UPDATED.getValue());
filter.setWords("evernote_sample");
client.findNotes(filter, 0, 20, new OnClientCallback<NoteList>() {
public void onSuccess(NoteList data) {
ArrayAdapter<String> adapter = (ArrayAdapter<String>) getListAdapter();
adapter.clear();
for (Note note : data.getNotes()) {
adapter.add(note.getTitle());
}
adapter.notifyDataSetChanged();
};
@Override
public void onException(Exception exception) {
exception.printStackTrace();
Toast.makeText(getActivity(), "接続に失敗しました",
Toast.LENGTH_SHORT).show();
}
});
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(getActivity(), "接続に失敗しました", Toast.LENGTH_SHORT)
.show();
}
}
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:36,代码来源:MainFragment.java
示例15: findNotes
import com.evernote.edam.notestore.NoteFilter; //导入依赖的package包/类
public NoteList findNotes(NoteFilter filter, int offset, int maxNotes) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException {
return mClient.findNotes(mAuthenticationToken, filter, offset, maxNotes);
}