Package com.evernote.edam.type

Examples of com.evernote.edam.type.SavedSearch


     
//      if (authRefreshNeeded)
//        if (!refreshConnection())
//          return;
     
      SavedSearch enSearch = searches.get(i);
      try {
        if (enSearch.getUpdateSequenceNum() > 0)
          sequence = noteStore.updateSearch(authToken, enSearch);
        else {
          logger.log(logger.EXTREME, "New saved search found.");
          // Look for a tag with the same name.  If one is found, we don't need
          // to create another one
          boolean found = false;
          logger.log(logger.EXTREME, "Matching remote saved search names with local");
          for (int k=0; k<remoteList.size() && !found && keepRunning; k++) {
            if (remoteList.get(k).getName().equalsIgnoreCase(enSearch.getName())) {
              enSearch = remoteList.get(k);
              found = true;
              logger.log(logger.EXTREME, "Matching saved search found");
              sequence = enSearch.getUpdateSequenceNum();
            }
          }

          String oldGuid = enSearch.getGuid();
          if (!found)
            enSearch = noteStore.createSearch(authToken, enSearch);
          sequence = enSearch.getUpdateSequenceNum();
          logger.log(logger.EXTREME, "Updating tag guid in local database");
          conn.getSavedSearchTable().updateSavedSearchGuid(oldGuid, enSearch.getGuid());
        }
        logger.log(logger.EXTREME, "Updating tag sequence in local database");
        conn.getSavedSearchTable().updateSavedSearchSequence(enSearch.getGuid(), sequence);
        logger.log(logger.EXTREME, "Resetting tag dirty flag");
        conn.getSavedSearchTable().resetDirtyFlag(enSearch.getGuid());
        logger.log(logger.EXTREME, "Emitting sequence number to the main thread.");
        updateSequenceNumber = sequence;
        conn.getSyncTable().setUpdateSequenceNumber(updateSequenceNumber);
      } catch (EDAMUserException e) {
        logger.log(logger.LOW, "*** EDAM User Excepton syncLocalTags");
View Full Code Here


    NSqlQuery query = new NSqlQuery(db.getConnection());
    query.exec("Drop table SavedSearch");
  }
  // get all tags
  public List<SavedSearch> getAll() {
    SavedSearch tempSearch;
    List<SavedSearch> index = new ArrayList<SavedSearch>();
    boolean check;
           
        NSqlQuery query = new NSqlQuery(db.getConnection());
                       
    check = query.exec("Select guid, name, query, format, sequence"
        +" from SavedSearch");
    if (!check)
      logger.log(logger.EXTREME, "SavedSearch SQL retrieve has failed in getAll().");
    while (query.next()) {
      tempSearch = new SavedSearch();
      tempSearch.setGuid(query.valueString(0));
      tempSearch.setName(query.valueString(1));
      tempSearch.setQuery(query.valueString(2));
      int fmt = new Integer(query.valueString(3));
      if (fmt == 1)
        tempSearch.setFormat(QueryFormat.USER);
      else
        tempSearch.setFormat(QueryFormat.SEXP);
      int sequence = new Integer(query.valueString(4)).intValue();
      tempSearch.setUpdateSequenceNum(sequence);
      index.add(tempSearch);
   
    return index;
  }
View Full Code Here

      index.add(tempSearch);
   
    return index;
  }
  public SavedSearch getSavedSearch(String guid) {
    SavedSearch tempSearch = null;
    boolean check;
     
        NSqlQuery query = new NSqlQuery(db.getConnection());
                       
    check = query.prepare("Select guid, name, query, format, sequence"
        +" from SavedSearch where guid=:guid");
    if (!check)
      logger.log(logger.EXTREME, "SavedSearch SQL prepare has failed in getSavedSearch.");
    query.bindValue(":guid", guid);
    query.exec();
    if (!check)
      logger.log(logger.EXTREME, "SavedSearch SQL retrieve has failed in getSavedSearch.");
    if (query.next()) {
      tempSearch = new SavedSearch();
      tempSearch.setGuid(query.valueString(0));
      tempSearch.setName(query.valueString(1));
      tempSearch.setQuery(query.valueString(2));
      int fmt = new Integer(query.valueString(3));
      if (fmt == 1)
        tempSearch.setFormat(QueryFormat.USER);
      else
        tempSearch.setFormat(QueryFormat.SEXP);
      int sequence = new Integer(query.valueInteger(4));
      tempSearch.setUpdateSequenceNum(sequence);
    }
    return tempSearch;
  }
View Full Code Here

    }   
  }
 
 
  private void processSavedSearchNode() {
    search = new SavedSearch();
    searchIsDirty = false;
   
    boolean atEnd = false;
    while(!atEnd) {
      if (reader.isStartElement()) {
View Full Code Here

  public void setIcons(HashMap<String, QIcon> i) {
    icons = i;
  }
 
  public void load(List<SavedSearch> tempList) {
      SavedSearch search;
      List<NTreeWidgetItem> index = new ArrayList<NTreeWidgetItem>();
         
      //Clear out the tree & reload
      clear();
      String iconPath = new String("classpath:cx/fbn/nevernote/icons/");
    QIcon icon = new QIcon(iconPath+"search.png");
     
       for (int i=0; i<tempList.size(); i++) {
         search = tempList.get(i);
         NTreeWidgetItem child = new NTreeWidgetItem();
      child.setText(0, search.getName());
        if (icons != null && !icons.containsKey(search.getGuid())) {
          child.setIcon(0, icon);
        } else {
          child.setIcon(0, icons.get(search.getGuid()));
         }
      child.setText(1, search.getGuid());
      index.add(child);
      addTopLevelItem(child);
     }
      sortItems(0, SortOrder.AscendingOrder);
  }
View Full Code Here

    }
  }
  // Delete a tag
  public void expungeSavedSearch(String guid, boolean needsSync) {
    boolean check;
    SavedSearch s = getSavedSearch(guid);
        NSqlQuery query = new NSqlQuery(db.getConnection());

         check = query.prepare("delete from SavedSearch "
           +"where guid=:guid");
    if (!check) {
      logger.log(logger.EXTREME, "SavedSearch SQL delete prepare has failed.");
      logger.log(logger.EXTREME, query.lastError().toString());
    }
    query.bindValue(":guid", guid);
    check = query.exec();
    if (!check) {
      logger.log(logger.MEDIUM, "Saved Search delete failed.");
      logger.log(logger.EXTREME, query.lastError().toString());
    }

    // Add the work to the parent queue
    if (needsSync && s != null && s.getUpdateSequenceNum() > 0) {
      DeletedTable del = new DeletedTable(logger, db);
      del.addDeletedItem(guid, "SavedSearch");
    }
  }
View Full Code Here

      logger.log(logger.MEDIUM, query.lastError());
    }
  }
  // Get dirty tags
  public List<SavedSearch> getDirty() {
    SavedSearch search;
    List<SavedSearch> index = new ArrayList<SavedSearch>();
    boolean check;
           
        NSqlQuery query = new NSqlQuery(db.getConnection());
                       
    check = query.exec("Select guid, query, sequence, name, format"
        +" from SavedSearch where isDirty = true");
    if (!check)
      logger.log(logger.EXTREME, "SavedSearch getDirty prepare has failed.");
    while (query.next()) {
      search = new SavedSearch();
      search.setGuid(query.valueString(0));
      search.setQuery(query.valueString(1));
      int sequence = new Integer(query.valueString(2)).intValue();
      search.setUpdateSequenceNum(sequence);
      search.setName(query.valueString(3));
      int fmt = new Integer(query.valueString(4)).intValue();
      if (fmt == 1)
        search.setFormat(QueryFormat.USER);
      else
        search.setFormat(QueryFormat.SEXP);
      index.add(search);
   
    return index;
  }
View Full Code Here

       
    Calendar currentTime = new GregorianCalendar();   
     Long l = new Long(currentTime.getTimeInMillis());
    String randint = new String(Long.toString(l));
 
    SavedSearch search = new SavedSearch();
    search.setUpdateSequenceNum(0);
    search.setGuid(randint);
    search.setName(edit.getName());
    search.setQuery(edit.getQuery());
    search.setFormat(QueryFormat.USER);
    listManager.getSavedSearchIndex().add(search);
    conn.getSavedSearchTable().addSavedSearch(search, true);
    savedSearchIndexUpdated();
    logger.log(logger.HIGH, "Leaving NeverNote.addSavedSearch");
  }
View Full Code Here

    edit.setTitle(tr("Edit Search"));
    List<QTreeWidgetItem> selections = savedSearchTree.selectedItems();
    QTreeWidgetItem currentSelection;
    currentSelection = selections.get(0);
    String guid = currentSelection.text(1);
    SavedSearch s = conn.getSavedSearchTable().getSavedSearch(guid);
    edit.setName(currentSelection.text(0));
    edit.setQuery(s.getQuery());
    edit.setSearchList(listManager.getSavedSearchIndex());
    edit.exec();
 
    if (!edit.okPressed())
      return;
       
    List<SavedSearch> list = listManager.getSavedSearchIndex();
    SavedSearch search = null;
    boolean found = false;
    for (int i=0; i<list.size(); i++) {
      search = list.get(i);
      if (search.getGuid().equals(guid)) {
        i=list.size();
        found = true;
      }
    }
    if (!found)
      return;
    search.setName(edit.getName());
    search.setQuery(edit.getQuery());
    conn.getSavedSearchTable().updateSavedSearch(search, true);
    savedSearchIndexUpdated();
    logger.log(logger.HIGH, "Leaving NeverNote.editSavedSearch");
  }
View Full Code Here

      if (selections.size() > 0) {
        menuBar.savedSearchEditAction.setEnabled(true);
        menuBar.savedSearchDeleteAction.setEnabled(true);
        menuBar.savedSearchIconAction.setEnabled(true);
        selectedSavedSearchGUID = selections.get(0).text(1);
        SavedSearch s = conn.getSavedSearchTable().getSavedSearch(selectedSavedSearchGUID);
        searchField.setEditText(s.getQuery());
      } else {
          menuBar.savedSearchEditAction.setEnabled(false);
          menuBar.savedSearchDeleteAction.setEnabled(false);
          menuBar.savedSearchIconAction.setEnabled(false);
          selectedSavedSearchGUID = "";
View Full Code Here

TOP

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

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.