Package com.evernote.edam.type

Examples of com.evernote.edam.type.Tag


      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);
View Full Code Here


  }
  // Get tags for a specific notebook
  // get all tags
  public List<Tag> getTagsForNotebook(String notebookGuid) {
    
    Tag tempTag;
    List<Tag> index = new ArrayList<Tag>();
    boolean check;
           
        NSqlQuery query = new NSqlQuery(db.getConnection());
                       
    check = query.prepare("Select guid, parentGuid, sequence, name"
        +" from Tag where notebookGuid=:notebookGuid");
    if (!check) {
      logger.log(logger.EXTREME, "Tag SQL prepare getTagsForNotebook has failed.");
      logger.log(logger.EXTREME, query.lastError());
    }
    query.bindValue(":notebookGuid", notebookGuid);
    query.exec();
    while (query.next()) {
      tempTag = new Tag();
      tempTag.setGuid(query.valueString(0));
      if (query.valueString(1) != null)
        tempTag.setParentGuid(query.valueString(1));
      else
        tempTag.setParentGuid(null);
      int sequence = new Integer(query.valueString(2)).intValue();
      tempTag.setUpdateSequenceNum(sequence);
      tempTag.setName(query.valueString(3));
      index.add(tempTag);
   
    
    return index;
  }
View Full Code Here

    return index;
  }
  // get all tags
  public List<Tag> getAll() {
    
    Tag tempTag;
    List<Tag> index = new ArrayList<Tag>();
    boolean check;
           
        NSqlQuery query = new NSqlQuery(db.getConnection());
                       
    check = query.exec("Select guid, parentGuid, sequence, name"
        +" from Tag where notebookguid not in (select guid from notebook where archived=true)");
    if (!check) {
      logger.log(logger.EXTREME, "Tag SQL retrieve has failed.");
      logger.log(logger.EXTREME, query.lastError());
    }
    while (query.next()) {
      tempTag = new Tag();
      tempTag.setGuid(query.valueString(0));
      if (query.valueString(1) != null)
        tempTag.setParentGuid(query.valueString(1));
      else
        tempTag.setParentGuid(null);
      int sequence = new Integer(query.valueString(2)).intValue();
      tempTag.setUpdateSequenceNum(sequence);
      tempTag.setName(query.valueString(3));
      index.add(tempTag);
   
    
    return index;
  }
View Full Code Here

   
    
    return index;
  }
  public Tag getTag(String guid) {
    Tag tempTag = new Tag();   
    
        NSqlQuery query = new NSqlQuery(db.getConnection());
                         
    if (!query.prepare("Select guid, parentGuid, sequence, name"
        +" from Tag where guid=:guid"))
      logger.log(logger.EXTREME, "Tag select by guid SQL prepare has failed.");

    query.bindValue(":guid", guid);
    if (!query.exec())
      logger.log(logger.EXTREME, "Tag select by guid SQL exec has failed.");
   
    if (!query.next())  {
      return tempTag;
    }
    tempTag.setGuid(query.valueString(0));
    tempTag.setParentGuid(query.valueString(1));
    int sequence = new Integer(query.valueString(2)).intValue();
    tempTag.setUpdateSequenceNum(sequence);
    tempTag.setName(query.valueString(3));
    return tempTag;
  }
View Full Code Here

    
  }
  // Delete a tag
  public void expungeTag(String guid, boolean needsSync) {
    boolean check;
    Tag t = getTag(guid);
   
    
        NSqlQuery query = new NSqlQuery(db.getConnection());

         check = query.prepare("delete from Tag "
           +"where guid=:guid");
    if (!check) {
      logger.log(logger.EXTREME, "Tag SQL delete prepare has failed.");
      logger.log(logger.EXTREME, query.lastError());
    }
    query.bindValue(":guid", guid);
    check = query.exec();
    if (!check)
      logger.log(logger.MEDIUM, "Tag delete failed.");
   
         check = query.prepare("delete from NoteTags "
           +"where tagGuid=:guid");
    if (!check) {
      logger.log(logger.EXTREME, "NoteTags SQL delete prepare has failed.");
      logger.log(logger.EXTREME, query.lastError());
    }
   
    query.bindValue(":guid", guid);
    check = query.exec();
    if (!check)
      logger.log(logger.MEDIUM, "NoteTags delete failed.");
   
    // Add the work to the parent queue
    if (needsSync && t!= null && t.getUpdateSequenceNum() > 0) {
      DeletedTable del = new DeletedTable(logger, db);
      del.addDeletedItem(guid, "Tag");
    }
  }
View Full Code Here

      logger.log(logger.MEDIUM, query.lastError());
    }
  }
  //Save tags from Evernote
  public void saveTags(List<Tag> tags) {
    Tag tempTag;
    for (int i=0; i<tags.size(); i++) {
      tempTag = tags.get(i);
      addTag(tempTag, false);
    }   
  }
View Full Code Here

    }
    
  }
  // Get dirty tags
  public List<Tag> getDirty() {
    Tag tempTag;
    List<Tag> index = new ArrayList<Tag>();
    boolean check;
           
    
        NSqlQuery query = new NSqlQuery(db.getConnection());
                       
    check = query.exec("Select guid, parentGuid, sequence, name"
        +" from Tag where isDirty = true");
    if (!check)
      logger.log(logger.EXTREME, "Tag SQL retrieve has failed.");
    while (query.next()) {
      tempTag = new Tag();
      tempTag.setGuid(query.valueString(0));
      tempTag.setParentGuid(query.valueString(1));
      int sequence = new Integer(query.valueString(2)).intValue();
      tempTag.setUpdateSequenceNum(sequence);
      tempTag.setName(query.valueString(3));
      if (tempTag.getParentGuid() != null && tempTag.getParentGuid().equals(""))
        tempTag.setParentGuid(null);
      index.add(tempTag);
    }
    return index;
  }
View Full Code Here

    return retval;
  }
  // This is a convience method to check if a tag exists & update/create based upon it
  public void syncLinkedTag(Tag tag, String notebookGuid, boolean isDirty) {
    if (exists(tag.getGuid())) {
      Tag t = getTag(tag.getGuid());
      String realName = tag.getName();
      tag.setName(t.getName());
      updateTag(tag, isDirty, realName);
    }
    else
      addTag(tag, isDirty, true, tag.getName(), notebookGuid);
  }
View Full Code Here

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

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.