Package com.evernote.edam.type

Examples of com.evernote.edam.type.Notebook


      logger.log(logger.MEDIUM, query.lastError().toString());
    }
  }
  // Get a list of notes that need to be updated
  public List <Notebook> getDirty() {
    Notebook tempNotebook;
    List<Notebook> index = new ArrayList<Notebook>();
    boolean check;
           
        NSqlQuery query = new NSqlQuery(db.getConnection());
               
    check = query.exec("Select guid, sequence, name, defaultNotebook, " +
        "serviceCreated, serviceUpdated, published, stack, "+
        "publishinguri, publishingascending, publishingPublicDescription, "+
        "publishingOrder " +
        "from "+dbName+" where isDirty=true and local=false and linked=false");
    if (!check)
      logger.log(logger.EXTREME, dbName+" SQL retrieve has failed.");
    while (query.next()) {
      tempNotebook = new Notebook();
      tempNotebook.setGuid(query.valueString(0));
      int sequence = new Integer(query.valueString(1)).intValue();
      tempNotebook.setUpdateSequenceNum(sequence);
      tempNotebook.setName(query.valueString(2));
     
      DateFormat indfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
      try {
        tempNotebook.setServiceCreated(indfm.parse(query.valueString(4)).getTime());
        tempNotebook.setServiceUpdated(indfm.parse(query.valueString(5)).getTime());
      } catch (ParseException e) {
        e.printStackTrace();
      }
      tempNotebook.setPublished(new Boolean(query.valueString(6)));
      if (query.valueString(7) != null && !query.valueString(7).trim().equals(""))
        tempNotebook.setStack(query.valueString(7));
     
      if (tempNotebook.isPublished()) {
        Publishing p = new Publishing();
        p.setUri(query.valueString(8));
        p.setAscending(query.valueBoolean(9, false));
        p.setPublicDescription(query.valueString(10));
        p.setOrder(NoteSortOrder.findByValue(query.valueInteger(11)));
        if (p.getPublicDescription() != null && p.getPublicDescription().trim().equalsIgnoreCase(""))
          p.setPublicDescription(null);
        tempNotebook.setPublishing(p);
      }
     
      index.add(tempNotebook);
   
    return index; 
View Full Code Here


   
    return index; 
  }
  // Get a list of notes that need to be updated
  public Notebook getNotebook(String guid) {
    Notebook tempNotebook;
    boolean check;
           
        NSqlQuery query = new NSqlQuery(db.getConnection());
               
    query.prepare("Select guid, sequence, name, defaultNotebook, " +
        "serviceCreated, serviceUpdated, published, stack, "+
        "publishinguri, publishingascending, publishingPublicDescription, "+
        "publishingOrder " +
        "from "+dbName+" where guid=:guid");
    query.bindValue(":guid", guid);
    check  = query.exec();
    if (!check)
      logger.log(logger.EXTREME, dbName+" SQL retrieve has failed.");
    while (query.next()) {
      tempNotebook = new Notebook();
      tempNotebook.setGuid(query.valueString(0));
      int sequence = new Integer(query.valueString(1)).intValue();
      tempNotebook.setUpdateSequenceNum(sequence);
      tempNotebook.setName(query.valueString(2));
     
      DateFormat indfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
      try {
        tempNotebook.setServiceCreated(indfm.parse(query.valueString(4)).getTime());
        tempNotebook.setServiceUpdated(indfm.parse(query.valueString(5)).getTime());
      } catch (ParseException e) {
        e.printStackTrace();
      }
      tempNotebook.setPublished(new Boolean(query.valueString(6)));
      if (query.valueString(7) != null && !query.valueString(7).trim().equals(""))
        tempNotebook.setStack(query.valueString(7));
     
      if (tempNotebook.isPublished()) {
        Publishing p = new Publishing();
        p.setUri(query.valueString(8));
        p.setAscending(query.valueBoolean(9, false));
        p.setPublicDescription(query.valueString(10));
        p.setOrder(NoteSortOrder.findByValue(query.valueInteger(11)));
        if (p.getPublicDescription() != null && p.getPublicDescription().trim().equalsIgnoreCase(""))
          p.setPublicDescription(null);
        tempNotebook.setPublishing(p);
      }
     
      return tempNotebook;
   
    return null
View Full Code Here

    return greenIcon;
  }
 
  public void load(List<Notebook> books, List<String> localBooks) {
      Notebook book;
      NTreeWidgetItem child;
     
      /* First, let's find out which stacks are expanded */
      QTreeWidgetItem root =   invisibleRootItem();
      List<String> expandedStacks = new ArrayList<String>();
      for (int i=0; i<root.childCount(); i++) {
        if (root.child(i).isExpanded())
          expandedStacks.add(root.child(i).text(0));
      }
     
      clear();
      stacks.clear();
     
      if (books == null)
        return;
      Qt.Alignment ra = new Qt.Alignment(Qt.AlignmentFlag.AlignRight);
      for (int i=0; i<books.size(); i++) {
      book = books.get(i);
      child = new NTreeWidgetItem();
      child.setChildIndicatorPolicy(ChildIndicatorPolicy.DontShowIndicatorWhenChildless);
      child.setText(0, book.getName());
        if (icons != null && !icons.containsKey(book.getGuid())) {
          QIcon icon = findDefaultIcon(book.getGuid(), book.getName(), localBooks, book.isPublished());
          child.setIcon(0, icon);
        } else {
          child.setIcon(0, icons.get(book.getGuid()));
        }
        child.setTextAlignment(1, ra.value());
        child.setText(2, book.getGuid());
        if (book.getStack() == null || book.getStack().equalsIgnoreCase(""))
          addTopLevelItem(child);
        else {
          String stackName = book.getStack();
          QTreeWidgetItem parent;
          if (!stacks.containsKey(stackName)) {
            parent = createStackIcon(stackName, ra);
            addTopLevelItem(parent);
            stacks.put(stackName, parent);
View Full Code Here

        selectedNotebookGUIDs.add(guid);
        menuBar.notebookIconAction.setEnabled(true);
      } else {
        menuBar.notebookIconAction.setEnabled(true);
      for (int j=0; j<listManager.getNotebookIndex().size(); j++) {
        Notebook book = listManager.getNotebookIndex().get(j);
        if (book.getStack() != null && book.getStack().equalsIgnoreCase(stackName))
          selectedNotebookGUIDs.add(book.getGuid());
      }
      }
      listManager.setSelectedNotebooks(selectedNotebookGUIDs);
      listManager.loadNotesIndex();
      noteIndexUpdated(false);
View Full Code Here

       
    Calendar currentTime = new GregorianCalendar();
    Long l = new Long(currentTime.getTimeInMillis());
    String randint = new String(Long.toString(l));
 
    Notebook newBook = new Notebook();
    newBook.setUpdateSequenceNum(0);
    newBook.setGuid(randint);
    newBook.setName(edit.getNotebook());
    newBook.setServiceCreated(new Date().getTime());
    newBook.setServiceUpdated(new Date().getTime());
    newBook.setDefaultNotebook(false);
    newBook.setPublished(false);
   
    listManager.getNotebookIndex().add(newBook);
    if (edit.isLocal())
      listManager.getLocalNotebooks().add(newBook.getGuid());
    conn.getNotebookTable().addNotebook(newBook, true, edit.isLocal());
    notebookIndexUpdated();
    listManager.countNotebookResults(listManager.getNoteIndex());
//    notebookTree.updateCounts(listManager.getNotebookIndex(), listManager.getNotebookCounter());
    logger.log(logger.HIGH, "Leaving NeverNote.addNotebook");
View Full Code Here

    String guid = currentSelection.text(2);

    if (guid.equalsIgnoreCase("STACK") || guid.equalsIgnoreCase(""))
      return;
   
    Notebook n = null;
    int position = 0;
    for (int i=0; i<listManager.getNotebookIndex().size(); i++) {
      if (guid.equals(listManager.getNotebookIndex().get(i).getGuid())) {
        n = listManager.getNotebookIndex().get(i);
        position = i;
        i = listManager.getNotebookIndex().size();
      }
    }
    if (n == null)
      return;
   
    PublishNotebook publish = new PublishNotebook(Global.username, Global.getServer(), n);
    publish.exec();
   
    if (!publish.okClicked())
      return;
   
    Publishing p = publish.getPublishing();
    boolean isPublished = !publish.isStopPressed();
    conn.getNotebookTable().setPublishing(n.getGuid(), isPublished, p);
    n.setPublished(isPublished);
    n.setPublishing(p);
    listManager.getNotebookIndex().set(position, n);
    notebookIndexUpdated();
  }
View Full Code Here

    String guid = currentSelection.text(2);

    if (guid.equalsIgnoreCase("STACK") || guid.equalsIgnoreCase(""))
      return;
   
    Notebook n = null;;
    for (int i=0; i<listManager.getNotebookIndex().size(); i++) {
      if (guid.equals(listManager.getNotebookIndex().get(i).getGuid())) {
        n = listManager.getNotebookIndex().get(i);
        i = listManager.getNotebookIndex().size();
      }
    }
       
    String authToken = null;
    if (syncRunner.isConnected)
      authToken = syncRunner.authToken;
    ShareNotebook share = new ShareNotebook(n.getName(), conn, n, syncRunner);
    share.exec();
   
  }
View Full Code Here

   
    for (int i=na.getClosedBookList().count()-1; i>=0; i--) {
      String text = na.getClosedBookList().takeItem(i).text();
      for (int j=0; j<listManager.getNotebookIndex().size(); j++) {
        if (listManager.getNotebookIndex().get(j).getName().equalsIgnoreCase(text)) {
          Notebook n = listManager.getNotebookIndex().get(j);
          conn.getNotebookTable().setArchived(n.getGuid(),true);
          listManager.getArchiveNotebookIndex().add(n);
          j=listManager.getNotebookIndex().size();
        }
      }
    }
   
    for (int i=na.getOpenBookList().count()-1; i>=0; i--) {
      String text = na.getOpenBookList().takeItem(i).text();
      for (int j=0; j<listManager.getNotebookIndex().size(); j++) {
        if (listManager.getNotebookIndex().get(j).getName().equalsIgnoreCase(text)) {
          Notebook n = listManager.getNotebookIndex().get(j);
          conn.getNotebookTable().setArchived(n.getGuid(),false);
          j=listManager.getNotebookIndex().size();
        }
      }
    }
    notebookTreeSelection();
View Full Code Here

    List<String> newNotebooks = new ArrayList<String>();
    for (int i=ignore.getIgnoredBookList().count()-1; i>=0; i--) {
      String text = ignore.getIgnoredBookList().takeItem(i).text();
      for (int j=0; j<notebooks.size(); j++) {
        if (notebooks.get(j).getName().equalsIgnoreCase(text)) {
          Notebook n = notebooks.get(j);
          conn.getSyncTable().addRecord("IGNORENOTEBOOK-"+n.getGuid(), n.getGuid());
          j=notebooks.size();
          newNotebooks.add(n.getGuid());
        }
      }
    }
   
    // Clear out old tags & add new ones
View Full Code Here

   * @return {@link LinkedNotebook} with guid from server
   */
  public LinkedNotebook createNotebook(Notebook notebook) throws TException,
      EDAMUserException, EDAMSystemException, EDAMNotFoundException {

    Notebook originalNotebook = getClient().createNotebook(notebook);

    SharedNotebook sharedNotebook = originalNotebook.getSharedNotebooks()
        .get(0);
    LinkedNotebook linkedNotebook = new LinkedNotebook();
    linkedNotebook.setShareKey(sharedNotebook.getShareKey());
    linkedNotebook.setShareName(originalNotebook.getName());
    linkedNotebook.setUsername(getAuthenticationResult().getUser()
        .getUsername());
    linkedNotebook.setShardId(getAuthenticationResult().getUser().getShardId());

    return getPersonalClient().createLinkedNotebook(linkedNotebook);
View Full Code Here

TOP

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

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.