import com.yuji.ec.db.INoteItem;
public class EvernoteUtil {
+ private static final int N = 50;
private String username;
private String password;
return filter;
}
- public NoteList getNoteList() {
+ public List<NoteList> getNoteList() {
NoteFilter filter = getDefaultFilter();
return getNoteList(filter);
}
- public NoteList getNoteListByNotebook(String notebookGuid) {
+ public List<NoteList> getNoteListByNotebook(String notebookGuid) {
NoteFilter filter = getDefaultFilter();
filter.setNotebookGuid(notebookGuid);
return getNoteList(filter);
}
- public NoteList getNoteListByTag(String tagGuid) {
+ public List<NoteList> getNoteListByTag(String tagGuid) {
NoteFilter filter = getDefaultFilter();
List<String> tagGuids = new ArrayList<String>();
tagGuids.add(tagGuid);
return getNoteList(filter);
}
- public NoteList getNoteList(NoteFilter filter) {
+ public List<NoteList> getNoteList(NoteFilter filter) {
errorCode = Error.OTHER;
- NoteList noteList = null;
+ List<NoteList> list = new ArrayList<NoteList>();
try {
String token = getAuthenticationToken();
if (token == null) {
return null;
}
- // TODO #28107
- noteList = noteStore.findNotes(token, filter, 0, 1000);
+ int index = 0;
+ while (true){
+ NoteList noteList = noteStore.findNotes(token, filter, index, N);
+ int size = noteList.getNotesSize();
+
+ if (size <= 0){
+ break;
+ }
+ list.add(noteList);
+ if (size < N){
+ break;
+ }
+ index += size;
+ }
errorCode = Error.NONE;
} catch (EDAMUserException e) {
Debug.d(this, null, e);
+ list = null;
} catch (EDAMSystemException e) {
Debug.d(this, null, e);
+ list = null;
} catch (EDAMNotFoundException e) {
Debug.d(this, null, e);
+ list = null;
} catch (TException e) {
Debug.d(this, null, e);
if (e.getCause() instanceof ConnectException) {
errorCode = Error.CONNECT;
}
+ list = null;
}
- return noteList;
+ return list;
}
public List<Notebook> getNoteBookList() {
return note;
}
+ public List<com.yuji.ec.db.Note> getNoteContentList(List<NoteList> noteListList) {
+ List<com.yuji.ec.db.Note> list = new ArrayList<com.yuji.ec.db.Note>();
+ for (NoteList noteList : noteListList){
+ List<com.yuji.ec.db.Note> l = getNoteContentList(noteList);
+ if (l == null){
+ return null;
+ }
+ list.addAll(l);
+ }
+ return list;
+ }
+
public List<com.yuji.ec.db.Note> getNoteContentList(NoteList noteList) {
errorCode = Error.OTHER;
try {
List<Note> notes = noteList.getNotes();
+ int s = noteList.getNotesSize();
+ System.out.println("" + s);
for (Note n : notes) {
String guid = n.getGuid();
Note nc = getNote(guid);
com.yuji.ec.db.Note note = toNote(nc, text);
list.add(note);
}
+ notes = noteList.getNotes();
+ s = noteList.getNotesSize();
errorCode = Error.NONE;
} catch (EDAMNotFoundException e) {
errorCode = Error.NOT_FOUND;