Package com.evernote.edam.type

Examples of com.evernote.edam.type.Note


    return notes; 
  }
  // Get a list of notes that need to be updated
  public List <Note> getDirtyLinkedNotes() {
    String guid;
    Note tempNote;
    List<Note> notes = new ArrayList<Note>();
    List<String> index = new ArrayList<String>();
   
    boolean check;     
        NSqlQuery query = new NSqlQuery(db.getConnection());
View Full Code Here


    return notes; 
  }
  // Get a list of notes that need to be updated
  public List <Note> getDirtyLinked(String notebookGuid) {
    String guid;
    Note tempNote;
    List<Note> notes = new ArrayList<Note>();
    List<String> index = new ArrayList<String>();
   
    boolean check;     
        NSqlQuery query = new NSqlQuery(db.getConnection());
View Full Code Here

    return false;     
  }
 
  // Update a note content's hash.  This happens if a resource is edited outside of NN
  public void updateResourceContentHash(String guid, String oldHash, String newHash) {
    Note n = getNote(guid, true, false, false, false,false);
    int position = n.getContent().indexOf("<en-media");
    int endPos;
    for (;position>-1;) {
      endPos = n.getContent().indexOf(">", position+1);
      String oldSegment = n.getContent().substring(position,endPos);
      int hashPos = oldSegment.indexOf("hash=\"");
      int hashEnd = oldSegment.indexOf("\"", hashPos+7);
      String hash = oldSegment.substring(hashPos+6, hashEnd);
      if (hash.equalsIgnoreCase(oldHash)) {
        String newSegment = oldSegment.replace(oldHash, newHash);
        String content = n.getContent().substring(0,position) +
                         newSegment +
                         n.getContent().substring(endPos);
        NSqlQuery query = new NSqlQuery(db.getConnection());
        query.prepare("update note set isdirty=true, thumbnailneeded=true, content=:content where guid=:guid");
        query.bindValue(":content", content);
        query.bindValue(":guid", n.getGuid());
        query.exec();
      }
     
      position = n.getContent().indexOf("<en-media", position+1);
    }
  }
View Full Code Here

    }
    titleCombo.activated.connect(this, "selectionChanged(String)");
   
    // Load the results into the combo box
    if (results.size() > 0)  {
      Note currentNote = conn.getNoteTable().getNote(results.get(0).getFirst(), true, true, false, true, true);
      setContent(currentNote);
    }
  }
View Full Code Here

  // When the selection changes, we refresh the browser window with the new content
  @SuppressWarnings("unused")
  private void selectionChanged(String text) {
    int pos = titleCombo.currentIndex();
    String guid = results.get(pos).getFirst();
    Note note = conn.getNoteTable().getNote(guid, true, true, false, true, true);
    setContent(note);
  }
View Full Code Here

    if (token == null) {
      client = mock(LinkedNoteStoreClient.class);

      NoteStoreClient noteStoreClient = mock(NoteStoreClient.class);

      Note createdNote = new Note();
      createdNote.setGuid("guid");
      stub(noteStoreClient.createNote(isA(Note.class))).toReturn(createdNote);

      NotebookRestrictions restrictions = new NotebookRestrictions();
      restrictions.setNoCreateNotes(false);
View Full Code Here

    }
  }

  @Test
  public void testCreateNote() throws Exception {
    Note note = new Note();
    note.setTitle("LinkedNoteStoreClientTest#testCreateNote");
    note.setContent("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
        + "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">"
        + "<en-note>" + "TEST" + "</en-note>");
    Note createdNote = client.createNote(note, linkedNotebook);
    assertNotNull(createdNote.getGuid());
  }
View Full Code Here

   * Create a new note containing a little text and the Evernote icon.
   */
  private void createNote() throws Exception {
    // To create a new note, simply create a new Note object and fill in
    // attributes such as the note's title.
    Note note = new Note();
    note.setTitle("Test note from EDAMDemo.java");

    String fileName = "enlogo.png";
    String mimeType = "image/png";

    // To include an attachment such as an image in a note, first create a
    // Resource
    // for the attachment. At a minimum, the Resource contains the binary
    // attachment
    // data, an MD5 hash of the binary data, and the attachment MIME type.
    // It can also
    // include attributes such as filename and location.
    Resource resource = new Resource();
    resource.setData(readFileAsData(fileName));
    resource.setMime(mimeType);
    ResourceAttributes attributes = new ResourceAttributes();
    attributes.setFileName(fileName);
    resource.setAttributes(attributes);

    // Now, add the new Resource to the note's list of resources
    note.addToResources(resource);

    // To display the Resource as part of the note's content, include an
    // <en-media>
    // tag in the note's ENML content. The en-media tag identifies the
    // corresponding
    // Resource using the MD5 hash.
    String hashHex = bytesToHex(resource.getData().getBodyHash());

    // The content of an Evernote note is represented using Evernote Markup
    // Language
    // (ENML). The full ENML specification can be found in the Evernote API
    // Overview
    // at http://dev.evernote.com/documentation/cloud/chapters/ENML.php
    String content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
        + "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">"
        + "<en-note>"
        + "<span style=\"color:green;\">Here's the Evernote logo:</span><br/>"
        + "<en-media type=\"image/png\" hash=\"" + hashHex + "\"/>"
        + "</en-note>";
    note.setContent(content);

    // Finally, send the new note to Evernote using the createNote method
    // The new Note object that is returned will contain server-generated
    // attributes such as the new note's unique GUID.
    Note createdNote = noteStore.createNote(note);
    newNoteGuid = createdNote.getGuid();

    System.out.println("Successfully created a new note with GUID: "
        + newNoteGuid);
    System.out.println();
  }
View Full Code Here

    NoteList notes = noteStore.findNotes(filter, 0, 50);
    System.out.println("Found " + notes.getTotalNotes() + " matching notes");

    Iterator<Note> iter = notes.getNotesIterator();
    while (iter.hasNext()) {
      Note note = iter.next();
      System.out.println("Note: " + note.getTitle());

      // Note objects returned by findNotes() only contain note attributes
      // such as title, GUID, creation date, update date, etc. The note
      // content
      // and binary resource data are omitted, although resource metadata
      // is included.
      // To get the note content and/or binary resources, call getNote()
      // using the note's GUID.
      Note fullNote = noteStore.getNote(note.getGuid(), true, true, false,
          false);
      System.out.println("Note contains " + fullNote.getResourcesSize()
          + " resources");
      System.out.println();
    }
  }
View Full Code Here

    // In this sample code, we fetch the note that we created earlier,
    // including
    // the full note content and all resources. A real application might
    // do something with the note, then update a note attribute such as a
    // tag.
    Note note = noteStore.getNote(newNoteGuid, true, true, false, false);

    // Do something with the note contents or resources...

    // Now, update the note. Because we're not changing them, we unset
    // the content and resources. All we want to change is the tags.
    note.unsetContent();
    note.unsetResources();

    // We want to apply the tag "TestTag"
    note.addToTagNames("TestTag");

    // Now update the note. Because we haven't set the content or resources,
    // they won't be changed.
    noteStore.updateNote(note);
    System.out.println("Successfully added tag to existing note");

    // To prove that we didn't destroy the note, let's fetch it again and
    // verify that it still has 1 resource.
    note = noteStore.getNote(newNoteGuid, false, false, false, false);
    System.out.println("After update, note has " + note.getResourcesSize()
        + " resource(s)");
    System.out.println("After update, note tags are: ");
    for (String tagGuid : note.getTagGuids()) {
      Tag tag = noteStore.getTag(tagGuid);
      System.out.println("* " + tag.getName());
    }

    System.out.println();
View Full Code Here

TOP

Related Classes of com.evernote.edam.type.Note

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.