Package com.evernote.edam.type

Examples of com.evernote.edam.type.Note


      if (versionDate.toString().equals(selection))
        index = i;
    }
   
    if (index > -1 || selection.indexOf("Current") > -1) {
      Note historyNote = null;
      try {
        if (index > -1) {
          usn = versions.get(index).getUpdateSequenceNum();
          historyNote = syncRunner.localNoteStore.getNoteVersion(syncRunner.authToken, currentNoteGuid, usn, true, true, true);
        } else
View Full Code Here


      setMessage(tr("Note has been restored as a new note."));
    }
    @SuppressWarnings("unused")
  private void restoreHistoryNote() {
      setMessage(tr("Restoring note."));
      Note n = reloadHistoryWindow(historyWindow.historyCombo.currentText());
      conn.getNoteTable().expungeNote(n.getGuid(), true, false);
      n.setActive(true);
      n.setDeleted(0);
    for (int i=0; i<n.getResourcesSize(); i++) {
      n.getResources().get(i).setActive(true);
      conn.getNoteTable().noteResourceTable.saveNoteResource(n.getResources().get(i), true);
    }
    NoteMetadata metadata = new NoteMetadata();
    metadata.setGuid(n.getGuid());
      listManager.addNote(n, metadata);
      conn.getNoteTable().addNote(n, true);
      refreshEvernoteNote(true);
      setMessage(tr("Note has been restored."));
    }
View Full Code Here

         int row = selections.get(i).row();
        index = noteTableView.proxyModel.index(row, Global.noteTableGuidPosition);
        SortedMap<Integer, Object> ix = noteTableView.proxyModel.itemData(index);
           String selectedGuid = (String)ix.values().toArray()[0];
          
           Note n = conn.getNoteTable().getNote(selectedGuid, false, false, false, false, false);
           if (n.getUpdateSequenceNum() == 0 && !conn.getNotebookTable().isNotebookLocal(n.getNotebookGuid())) {
             QMessageBox.critical(this, tr("Please Synchronize") ,tr("Please either synchronize or move any " +
                 "new notes to a local notebook."));
             return;
           }
       }

       // Start building the URLs
      for (int i=0; i<selections.size(); i++) {
        QModelIndex index;
         int row = selections.get(i).row();
        index = noteTableView.proxyModel.index(row, Global.noteTableGuidPosition);
        SortedMap<Integer, Object> ix = noteTableView.proxyModel.itemData(index);
           String selectedGuid = (String)ix.values().toArray()[0];
           mime.setText(selectedGuid);
   
           String lid;
           String gid;
           Note selectedNote = conn.getNoteTable().getNote(selectedGuid, false, false, false, false, false);
           if (selectedNote.getUpdateSequenceNum() > 0) {
             gid = selectedGuid;
             lid = selectedGuid;
           } else {
             gid = "00000000-0000-0000-0000-000000000000";
             lid = selectedGuid;
View Full Code Here

            // If we can't get to the file, it is probably locked.  We'll try again later.
            logger.log(logger.LOW, "Unable to save externally edited file.  Saving for later.");
            importFilesKeep.add(list.get(i).absoluteFilePath());
          } else {

            Note newNote = importer.getNote();
            newNote.setNotebookGuid(notebook);
            newNote.setTitle(dir.at(i));
            NoteMetadata metadata = new NoteMetadata();
            metadata.setDirty(true);
            metadata.setGuid(newNote.getGuid());
            listManager.addNote(newNote, metadata);
            conn.getNoteTable().addNote(newNote, true);
            noteTableView.insertRow(newNote, metadata, true, -1);
            listManager.updateNoteContent(newNote.getGuid(), importer.getNoteContent());
            listManager.countNotebookResults(listManager.getNoteIndex());
            importedFiles.add(list.get(i).absoluteFilePath());
          }
        }
      }
View Full Code Here

          // If we can't get to the file, it is probably locked.  We'll try again later.
          logger.log(logger.LOW, "Unable to save externally edited file.  Saving for later.");
          importFilesKeep.add(list.get(i).absoluteFilePath());
        } else {
   
          Note newNote = importer.getNote();
          newNote.setNotebookGuid(notebook);
          newNote.setTitle(dir.at(i));
          NoteMetadata metadata = new NoteMetadata();
          metadata.setDirty(true);
          metadata.setGuid(newNote.getGuid());
          listManager.addNote(newNote, metadata);
          conn.getNoteTable().addNote(newNote, true);
          noteTableView.insertRow(newNote, metadata, true, -1);
          listManager.updateNoteContent(newNote.getGuid(), importer.getNoteContent());
          listManager.countNotebookResults(listManager.getNoteIndex());
          dir.remove(dir.at(i));
        }
      }
    }
View Full Code Here

    }
   
    List<Note> noteIndex = noteTable.getAllNotes();
    List<Note> guids = new ArrayList<Note>();
    for (int i=0; i<noteIndex.size(); i++) {
      Note n = noteIndex.get(i);
      boolean good = true;
     
      if (!validGuids.contains(n.getGuid()) && subSelect)
        good = false;
           
      // Start matching special stuff, like tags & notebooks
      if (any) {
        if (good && !matchTagsAny(n.getTagNames(), getTags()))
          good = false;
        if (good && !matchNotebook(n.getNotebookGuid()))
          good = false;
        if (good && !matchNotebookStack(n.getNotebookGuid()))
          good = false;
        if (good && !matchListAny(getIntitle(), n.getTitle()))
          good = false;
        if (good && !matchListAny(getAuthor(), n.getAttributes().getAuthor()))
          good = false;
        if (good && !matchListAny(getSource(), n.getAttributes().getSource()))
          good = false;
        if (good && !matchListAny(getSourceApplication(), n.getAttributes().getSourceApplication()))
          good = false;
        if (good && !matchContentAny(n))
          good = false;
        if (good && !matchDatesAny(getCreated(), n.getCreated()))
          good = false;
        if (good && !matchDatesAny(getUpdated(), n.getUpdated()))
          good = false;
        if (good && n.getAttributes() != null && !matchDatesAny(getSubjectDate(), n.getAttributes().getSubjectDate()))
          good = false;
      } else {
        if (good && !matchTagsAll(n.getTagNames(), getTags()))
          good = false;
        if (good && !matchNotebook(n.getNotebookGuid()))
          good = false;
        if (good && !matchNotebookStack(n.getNotebookGuid()))
          good = false;
        if (good && !matchListAll(getIntitle(), n.getTitle()))
          good = false;
        if (good && !matchListAll(getAuthor(), n.getAttributes().getAuthor()))
          good = false;
        if (good && !matchListAll(getSource(), n.getAttributes().getSource()))
          good = false;
        if (good && !matchListAll(getSourceApplication(), n.getAttributes().getSourceApplication()))
          good = false;
        if (good && !matchContentAll(n))
          good = false;
        if (good && !matchDatesAll(getCreated(), n.getCreated()))
          good = false;
        if (good && !matchDatesAll(getUpdated(), n.getUpdated()))
          good = false;
        if (good && n.getAttributes() != null && !matchDatesAll(getSubjectDate(), n.getAttributes().getSubjectDate()))
          good = false;
      }
      if (good) {
        guids.add(n);
      }
View Full Code Here

    }
    logger.log(logger.EXTREME, "TableView.load() Filling table data from scratch");
 
    for (int i=0; i<runner.getMasterNoteIndex().size(); i++) {
      if (runner.getMasterNoteIndex().get(i) != null) { 
        Note note = runner.getMasterNoteIndex().get(i);
        NoteMetadata meta = runner.getNoteMetadata().get(note.getGuid());
        insertRow(runner.getMasterNoteIndex().get(i), meta, false, i);             
      }
    }
    proxyModel.invalidate();
   
View Full Code Here

      logger.log(logger.EXTREME, "SQL Retrieve failed for note guid " +noteGuid + " in getNote()");
      logger.log(logger.EXTREME, " -> " +query.lastError().toString());
      logger.log(logger.EXTREME, " -> " +query.lastError());
      return null;
    }
    Note n = mapNoteFromQuery(query, loadContent, loadResources, loadRecognition, loadBinary, loadTags);
    n.setContent(fixCarriageReturn(n.getContent()));
    n.getAttributes().setContentClassIsSet(false);
    return n;
  }
View Full Code Here

  // Get a note by Guid
  public Note mapNoteFromQuery(NSqlQuery query, boolean loadContent, boolean loadResources, boolean loadRecognition, boolean loadBinary, boolean loadTags) {
    DateFormat indfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
//    indfm = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");

    Note n = new Note();
    NoteAttributes na = new NoteAttributes();
    n.setAttributes(na);
   
    n.setGuid(query.valueString(0));
    n.setUpdateSequenceNum(new Integer(query.valueString(1)));
    n.setTitle(query.valueString(2));

    try {
      n.setCreated(indfm.parse(query.valueString(3)).getTime());
      n.setUpdated(indfm.parse(query.valueString(4)).getTime());
      n.setDeleted(indfm.parse(query.valueString(5)).getTime());
    } catch (ParseException e) {
      e.printStackTrace();
    }

    n.setActive(query.valueBoolean(6,true));
    n.setNotebookGuid(query.valueString(7));
   
    try {
      String attributeSubjectDate = query.valueString(8);
      if (!attributeSubjectDate.equals(""))
        na.setSubjectDate(indfm.parse(attributeSubjectDate).getTime());
    } catch (ParseException e) {
      e.printStackTrace();
    }
    na.setLatitude(new Float(query.valueString(9)));
    na.setLongitude(new Float(query.valueString(10)));
    na.setAltitude(new Float(query.valueString(11)));
    na.setAuthor(query.valueString(12));
    na.setSource(query.valueString(13));
    na.setSourceURL(query.valueString(14));
    na.setSourceApplication(query.valueString(15));
    na.setContentClass(query.valueString(16));
   
    if (loadTags) {
      List<String> tagGuids = noteTagsTable.getNoteTags(n.getGuid());
      List<String> tagNames = new ArrayList<String>();
      TagTable tagTable = db.getTagTable();
      for (int i=0; i<tagGuids.size(); i++) {
        String currentGuid = tagGuids.get(i);
        Tag tag = tagTable.getTag(currentGuid);
        if (tag.getName() != null)
          tagNames.add(tag.getName());
        else
          tagNames.add("");
      }

      n.setTagNames(tagNames);
      n.setTagGuids(tagGuids);   
    }
   
    if (loadContent) {
      QTextCodec codec = QTextCodec.codecForLocale();
      codec = QTextCodec.codecForName("UTF-8");
          String unicode =  codec.fromUnicode(query.valueString(17)).toString();

          // This is a hack.  Basically I need to convert HTML Entities to "normal" text, but if I
          // convert the &lt; character to < it will mess up the XML parsing.  So, to get around this
          // I am "bit stuffing" the &lt; to &&lt; so StringEscapeUtils doesn't unescape it.  After
          // I'm done I convert it back.
          StringBuffer buffer = new StringBuffer(unicode);
          if (Global.enableHTMLEntitiesFix && unicode.indexOf("&#") > 0) {
            unicode = query.valueString(17);
            //System.out.println(unicode);
            //unicode = unicode.replace("&lt;", "&_lt;");
            //unicode = codec.fromUnicode(StringEscapeUtils.unescapeHtml(unicode)).toString();
            //unicode = unicode.replace("&_lt;", "&lt;");
            //System.out.println("************************");
            int j=1;
            for (int i=buffer.indexOf("&#"); i != -1 && buffer.indexOf("&#", i)>0; i=buffer.indexOf("&#",i+1)) {
              j = buffer.indexOf(";",i)+1;
              if (i<j) {
                String entity = buffer.substring(i,j).toString();
                int len = entity.length()-1;
                String tempEntity = entity.substring(2, len);
                try {
                  Integer.parseInt(tempEntity);
                  entity = codec.fromUnicode(StringEscapeUtils.unescapeHtml4(entity)).toString();
                  buffer.delete(i, j);
                  buffer.insert(i, entity);
                } catch (Exception e){ }
               
              }
            }
          }
           
          n.setContent(unicode);
//      n.setContent(query.valueString(16).toString());
     
      String contentHash = query.valueString(18);
      if (contentHash != null)
        n.setContentHash(contentHash.getBytes());
      n.setContentLength(new Integer(query.valueString(19)));
    }
    if (loadResources)
      n.setResources(noteResourceTable.getNoteResources(n.getGuid(), loadBinary));
    if (loadRecognition) {
      if (n.getResources() == null) {
        List<Resource> resources = noteResourceTable.getNoteResourcesRecognition(n.getGuid());
        n.setResources(resources);
      } else {
        // We need to merge the recognition resources with the note resources retrieved earlier
        for (int i=0; i<n.getResources().size(); i++) {
          Resource r = noteResourceTable.getNoteResourceRecognition(n.getResources().get(i).getGuid());
          n.getResources().get(i).setRecognition(r.getRecognition());
        }
      }
    }
    n.setContent(fixCarriageReturn(n.getContent()));
    return n;
  }
View Full Code Here

    logger.log(logger.HIGH, "Leaving NoteTable.syncNote");
  }
  // Get a list of notes that need to be updated
  public List <Note> getDirty() {
    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

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.