Package com.evernote.edam.type

Examples of com.evernote.edam.type.Note


                return null;
            }

            // Evernote オブジェクトの取得
            NoteStoreClient noteStoreClient = getNoteStoreClient(userModel);
            Note note = new Note();
            note.setTitle(getNoteTitle(activityModel));

            // ノートBody
            String nBody = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
            nBody += "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">";
            nBody += "<en-note>";

            nBody += "<div style=\"font-family: 'Helvetica Neue', Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif; color: rgb(88, 89, 87); font-size: 14px; line-height: 1.5; overflow-y: hidden; background: rgb(230, 230, 230);margin: -20px;\">";
            nBody += "<div style=\"height: 40px;\">&nbsp;</div>";
            nBody += "<div style=\"max-width: 600px;padding: 25px 0px 0px 0px;background-color: #fff;margin: 0 auto;box-shadow: 0 0px 5px rgba(0, 0, 0, 0.2);\">";

            nBody += Utils.removeLinkTags(getNoteContents(activityModel));
            nBody += getNoteAttachmentsContents(activityModel);

            // 下部メニュー
            nBody += "<div style=\"background: #f5f5f5;min-height: 16px;padding: 1px 30px;text-align: center;border-top: 1px solid #ebebeb;margin-top: 20px;\">";
            nBody += "<p style=\"color: #747474;line-height: 1.5em;\">";
            nBody += "<a href=\"" + activityModel.getUrlString() + "\" style=\"text-decoration: none;color: #747474;\" target=\"_blank\">Google+で見る</a>";
            nBody += "</p>";
            nBody += "</div>";

            nBody += "</div>";
            nBody += "<div style=\"height: 40px;\">&nbsp;</div>";
            nBody += "</div>";
            nBody += "</en-note>";

            note.setContent(nBody);
            if(userModel.getEvernoteNotebookId() != null) {
                note.setNotebookGuid(userModel.getEvernoteNotebookId());
            }

            noteStoreClient.createNote(note);

View Full Code Here


                    || facet.USN<note.getUpdateSequenceNum()
                    || facet.contentHash==null
                    || !Arrays.equals(facet.contentHash, note.getContentHash())
                    || facet.contentLength!=note.getContentLength())
                {
                    Note freshlyRetrievedNote = noteStore.getNote(note.getGuid(), true, true, true, true);
                    facet.timeUpdated = System.currentTimeMillis();
                    if (freshlyRetrievedNote.isSetUpdateSequenceNum())
                        facet.USN = freshlyRetrievedNote.getUpdateSequenceNum();
                    if (freshlyRetrievedNote.isSetContentHash())
                        facet.contentHash = freshlyRetrievedNote.getContentHash();
                    if (freshlyRetrievedNote.isSetContentLength())
                        facet.contentLength = freshlyRetrievedNote.getContentLength();
                    Map<String, String> mapHashtoURL = new HashMap<String, String>();
                    if (freshlyRetrievedNote.isSetCreated()) {
                        facet.created = freshlyRetrievedNote.getCreated();
                        facet.start = facet.created;
                        facet.end = facet.created;
                    }
                    if (freshlyRetrievedNote.isSetUpdated()) {
                        facet.updated = freshlyRetrievedNote.getUpdated();
                        facet.start = facet.updated;
                        facet.end = facet.updated;
                    }
                    if (freshlyRetrievedNote.isSetNotebookGuid())
                        facet.notebookGuid = freshlyRetrievedNote.getNotebookGuid();
                    if (freshlyRetrievedNote.isSetResources()) {
                        for (Resource resource : freshlyRetrievedNote.getResources()) {
                            createOrUpdateResource(updateInfo, resource);
                            // save the resource a second time as a photo -
                            // the facet will hold a reference to the original resource facet
                            if (resource.isSetAttributes()&&resource.getAttributes().isSetCameraMake())
                                createOrUpdatePhoto(updateInfo, resource, facet.start);
                            String webResourcePath = new StringBuilder("/evernote/res/")
                                    .append(updateInfo.apiKey.getId())
                                    .append("/")
                                    .append(resource.getGuid()).toString();
                            mapHashtoURL.put(resource.getGuid(), webResourcePath);
                        }
                    }
                    if (freshlyRetrievedNote.isSetContent()) {
                        facet.content = freshlyRetrievedNote.getContent();
                        // WARNING!! The first time this gets called, a lengthy DTD processing operation
                        // needs to happen which can take a long while (~1min) - after that the conversion
                        // from enml to xhtml is very fast
                        try {
                            final String htmlContent = processor.noteToHTMLString(freshlyRetrievedNote, mapHashtoURL);
                            facet.htmlContent = htmlContent;
                        } catch (Throwable t) {
                            logger.warn("error parsing enml note: " + t.getMessage());
                            System.out.println(ExceptionUtils.getStackTrace(t));
                            facet.htmlContent = "Sorry, there was an error parsing this note (" + t.getMessage() +")";
                        }
                    }
                    facet.clearTags();
                    if (freshlyRetrievedNote.isSetTagNames()) {
                        final List<String> tagNames = freshlyRetrievedNote.getTagNames();
                        facet.addTags(StringUtils.join(tagNames, ","), ',');
                    }
                    if (freshlyRetrievedNote.isSetTagGuids()) {
                        final List<String> tagGuids = freshlyRetrievedNote.getTagGuids();
                        facet.setTagGuids(tagGuids);
                    }
                    if (freshlyRetrievedNote.isSetTitle())
                        facet.title = freshlyRetrievedNote.getTitle();

                    if (freshlyRetrievedNote.isSetActive())
                        facet.active = freshlyRetrievedNote.isActive();

                    if (freshlyRetrievedNote.isSetAttributes()) {
                        final NoteAttributes attributes = freshlyRetrievedNote.getAttributes();
                        if (attributes.isSetAltitude())
                            facet.altitude = attributes.getAltitude();
                        if (attributes.isSetAuthor())
                            facet.author = attributes.getAuthor();
                        if (attributes.isSetContentClass())
                            facet.contentClass = attributes.getContentClass();
                        if (attributes.isSetCreatorId())
                            facet.creatorId = attributes.getCreatorId();
                        if (attributes.isSetLastEditedBy())
                            facet.lastEditedBy = attributes.getLastEditedBy();
                        if (attributes.isSetLastEditorId())
                            facet.lastEditorId = attributes.getLastEditorId();
                        if (attributes.isSetLatitude())
                            facet.latitude = attributes.getLatitude();
                        if (attributes.isSetLongitude())
                            facet.longitude = attributes.getLongitude();
                        if (attributes.isSetPlaceName())
                            facet.placeName = attributes.getPlaceName();
                        if (attributes.isSetReminderDoneTime())
                            facet.reminderDoneTime = attributes.getReminderDoneTime();
                        if (attributes.isSetReminderOrder())
                            facet.reminderOrder = attributes.getReminderOrder();
                        if (attributes.isSetReminderTime())
                            facet.reminderTime = attributes.getReminderTime();
                        if (attributes.isSetShareDate())
                            facet.shareDate = attributes.getShareDate();
                        if (attributes.isSetSource())
                            facet.source = attributes.getSource();
                        if (attributes.isSetSourceApplication())
                            facet.sourceApplication = attributes.getSourceApplication();
                        if (attributes.isSetSourceURL())
                            facet.sourceURL = attributes.getSourceURL();
                        if (attributes.isSetSubjectDate())
                            facet.subjectDate = attributes.getSubjectDate();
                        if (attributes.isSetLatitude()&&attributes.isSetLongitude()&&freshlyRetrievedNote.isSetCreated()){
                            addGuestLocation(updateInfo, facet.latitude, facet.longitude, facet.altitude, facet.created, facet.guid);
                        }
                    }

                    if (freshlyRetrievedNote.isSetDeleted()) {
                        facet.deleted = freshlyRetrievedNote.getDeleted();
                        // if the note was deleted:
                        // remove locations that were attached to this note and its associated resources
                        if (freshlyRetrievedNote.isSetGuid())
                            removeLocationFacets(updateInfo.apiKey.getId(), freshlyRetrievedNote.getGuid());
                    } else if (!freshlyRetrievedNote.isSetDeleted()&&facet.deleted!=null) {
                        facet.deleted = null;
                        // this means that this note was restored from trash and we need to restore
                        // its associated resources' locations
                        if (freshlyRetrievedNote.isSetGuid())
                            restoreNoteResourceLocations(updateInfo, freshlyRetrievedNote.getGuid());
                    }
                }
                return facet;
            }
        };
View Full Code Here

    }
   
    for (int i=0; i<notes.size(); i++) {
      String guid = notes.get(i).getGuid();
      logger.log(logger.EXTREME, "Getting note " +guid +" : " +notes.get(i).getTitle());
      Note note = conn.getNoteTable().getNote(guid, true, true, true, true, true);
      logger.log(logger.EXTREME, "Writing note XML");
      writeNote(note);
    }
   
    writeNotebooks();
View Full Code Here

      return 0;
  }

 
  private Object valueAt(int row, int col) {
    Note note = listManager.getMasterNoteIndex().get(row);
   
    if (col == Global.noteTableGuidPosition)
      return note.getGuid();
    if (col == Global.noteTableCreationPosition)
      return note.getCreated();
    if (col == Global.noteTableChangedPosition)
      return note.getUpdated();
    if (col == Global.noteTableSubjectDatePosition) {
      if (note.getAttributes().getSubjectDate() > 0)
        return note.getAttributes().getSubjectDate();
      else
        return note.getCreated();       
    }
    if (col == Global.noteTableTitlePosition)
      return note.getTitle();
    if (col == Global.noteTableAuthorPosition)
      return note.getAttributes().getAuthor();
    if (col == Global.noteTableSourceUrlPosition)
      return note.getAttributes().getSourceURL();
    if (col == Global.noteTableSynchronizedPosition) {
      String iconPath = new String("classpath:cx/fbn/nevernote/icons/");
      QIcon dotIcon = new QIcon(iconPath+"dot.png");
      String guid = note.getGuid();
      if (metaData.containsKey(guid) && metaData.get(guid).isDirty())
        return dotIcon;
      return null;
    }
    if (col == Global.noteTablePinnedPosition) {
      String guid = note.getGuid();
      if (metaData.containsKey(guid) && metaData.get(guid).isPinned()) {
        String iconPath = new String("classpath:cx/fbn/nevernote/icons/");
        QIcon dotIcon = new QIcon(iconPath+"dot.png");
        return dotIcon;
      }
      return null;
    }
    if (col == Global.noteTableTagPosition) {
      String tags = new String();
      List<String> tagNames = new ArrayList<String>();
      for (int i=0; i<note.getTagNamesSize(); i++) {
        tagNames.add(note.getTagNames().get(i));
      }
     
      while (tagNames.size() > 0) {
        int position = 0;
        for (int i=0; i<tagNames.size()-1; i++) {
          String name1 = tagNames.get(i);
          String name2 = tagNames.get(i+1);
          if (name1.compareTo(name2) > 0) {
            position = i+1;
          }
        }
       
        tags = tags + tagNames.get(position);
        tagNames.remove(position);
        if (tagNames.size() > 0)
          tags = tags + ", ";
      }
      return tags;
    }
    if (col == Global.noteTableNotebookPosition) {
      for (int i=0; i<listManager.getNotebookIndex().size(); i++) {
        if (listManager.getNotebookIndex().get(i).getGuid().equals(note.getNotebookGuid()))
          return listManager.getNotebookIndex().get(i).getName();
      }
    }
    if (col == Global.noteTableGuidPosition) {
      return note.getGuid();
    }
    if (col == Global.noteTableThumbnailPosition) {
      if (!Global.enableThumbnails())
        return null;
      if (Global.getListView() == Global.View_List_Wide) {
//        QImage img = listManager.getThumbnail(note.getGuid());
        QPixmap img = listManager.getThumbnailPixmap(note.getGuid());
        if (img != null)
          return img.scaled(Global.smallThumbnailSize,
            AspectRatioMode.KeepAspectRatio, TransformationMode.SmoothTransformation);
        else
          return null;
      }
      else {
        QImage img = listManager.getThumbnail(note.getGuid());
        if (img != null)
          return img.scaled(Global.largeThumbnailSize,
            AspectRatioMode.KeepAspectRatio, TransformationMode.SmoothTransformation);
        else
          return null;
View Full Code Here

    foundWords.clear();
   
    logger.log(logger.EXTREME, "Entering indexRunner.indexNoteContent()");
   
    logger.log(logger.EXTREME, "Getting note content");
    Note n = conn.getNoteTable().getNote(guid,true,false,true,true, true);
    String data;
    if (indexNoteBody) {
      data = n.getContent();
      data = conn.getNoteTable().getNoteContentNoUTFConversion(n.getGuid());
   
      logger.log(logger.EXTREME, "Removing any encrypted data");
      data = removeEnCrypt(data.toString());
      logger.log(logger.EXTREME, "Removing xml markups");
    } else
      data = "";
    String text;
    if (indexNoteTitle)
      text =  removeTags(StringEscapeUtils.unescapeHtml4(data) +" "+ n.getTitle());
    else
      text = removeTags(StringEscapeUtils.unescapeHtml4(data));
       
    logger.log(logger.EXTREME, "Splitting words");
    String[] result = text.toString().split(regex);
    conn.commitTransaction();
    conn.beginTransaction();
    logger.log(logger.EXTREME, "Deleting existing words for note from index");
    conn.getWordsTable().expungeFromWordIndex(guid, "CONTENT");
   
    logger.log(logger.EXTREME, "Number of words found: " +result.length);
    for (int j=0; j<result.length && keepRunning; j++) {
      if (interrupt) {
        processInterrupt();
      }
      if (!result[j].trim().equals("")) {
        logger.log(logger.EXTREME, "Result word: " +result[j].trim());
        addToIndex(guid, result[j], "CONTENT");
      }
    }
   
    // Add tags
    for (int j=0; j<n.getTagNamesSize(); j++) {
      if (n.getTagNames() != null && n.getTagNames().get(j) != null && !n.getTagNames().get(j).trim().equals(""))
        addToIndex(guid, n.getTagNames().get(j), "CONTENT");
    }
   
    // If we were interrupted, we will reindex this note next time
    if (Global.keepRunning) {
      logger.log(logger.EXTREME, "Resetting note guid needed");
View Full Code Here

    xmlFile.close();
  }
 
 
  private void processNoteNode() {
    note = new Note();
    note.setResources(new ArrayList<Resource>());

    boolean atEnd = false;
    while(!atEnd) {
      if (reader.isStartElement()) {
View Full Code Here

    xmlFile.close();
  }
 
 
  private void processNoteNode() {
    note = new Note();
    newGuid = QUuid.createUuid().toString().replace("{", "").replace("}", "");
    note.setGuid(newGuid);
    note.setResources(new ArrayList<Resource>());
   
    boolean atEnd = false;
View Full Code Here

      currentTime = new GregorianCalendar();
      l = currentTime.getTimeInMillis();
    }
    String newGuid = new String(Long.toString(l));
         
    Note oldNote = conn.getNoteTable().getNote(guid, true, true, false, false, false);
    for (int i=0; i<oldNote.getResources().size() && keepRunning; i++) {
      l = new Long(currentTime.getTimeInMillis());
      String newResG = new String(Long.toString(l));
      String oldResG = oldNote.getResources().get(i).getGuid();
      conn.getNoteTable().noteResourceTable.resetUpdateSequenceNumber(oldResG, true);
      conn.getNoteTable().noteResourceTable.updateNoteResourceGuid(oldResG, newResG, true);
    }
   
    conn.getNoteTable().resetNoteSequence(guid);
View Full Code Here

  private void findNewLinkedTags(Client noteStore, List<Note> newNotes, String token) {
    if (newNotes == null)
      return;
    for (int i=0; i<newNotes.size(); i++) {
      Note n = newNotes.get(i);
      for (int j=0; j<n.getTagGuidsSize(); j++) {
        String tag = n.getTagGuids().get(j);
        if (!conn.getTagTable().exists(tag)) {
          Tag newTag;
          try {
            newTag = noteStore.getTag(token, tag);
            conn.getTagTable().addTag(newTag, false);
View Full Code Here

  }
  // get/set current note
  public void setNote(Note n) {
    currentNote = n;
    if (n == null)
      n = new Note();
    saveNoteTitle = n.getTitle();

  }
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.