Package com.evernote.edam.type

Examples of com.evernote.edam.type.Notebook


        NoteStoreClient noteStoreClient = new ClientFactory(evernoteAuth).createNoteStoreClient();

        // アクセストークンが期限切れで再設定する場合、NoteBookは既に作成されている可能性があるため
        // 作成する前に既存のNotebookが存在するかをチェック
        Notebook notebook = null;
        if(loginUserModel.getEvernoteNotebookId() == null) {
            notebook = createNotebook(noteStoreClient);

        }else {
            try {
                notebook = noteStoreClient.getNotebook(loginUserModel.getEvernoteNotebookId());

            } catch (Exception e) {
                // ユーザーに削除された場合再作成する もしく アカウント変更した場合
                notebook = createNotebook(noteStoreClient);
            }
        }

        loginUserModel.setEvernoteAccessToken(new Text(evernoteAuth.getToken()));
        if(notebook != null) {
            loginUserModel.setEvernoteNotebookId(notebook.getGuid());
        }

        // ユーザー情報を更新
        UserService.put(loginUserModel);
View Full Code Here


     * @throws TException
     * @throws EDAMSystemException
     * @throws Exception
     */
    private Notebook createNotebook(NoteStoreClient noteStoreClient) {
        Notebook notebook = new Notebook();
        notebook.setName("PluCial");
        try {
            notebook =  noteStoreClient.createNotebook(notebook);
        } catch (Exception e) {
        }

View Full Code Here

 

 
  private void processNotebookNode() {
    notebook = new Notebook();
    Publishing p = new Publishing();
    notebook.setPublishing(p);
    notebookIsDirty = false;
    notebookIsLocal = false;
    notebookIsReadOnly = false;
View Full Code Here

     
//      if (authRefreshNeeded)
//        if (!refreshConnection())
//          return;
     
      Notebook enNotebook = notebooks.get(i);
      try {
        if (enNotebook.getUpdateSequenceNum() > 0) {
          logger.log(logger.EXTREME, "Existing notebook is dirty");
          sequence = noteStore.updateNotebook(authToken, enNotebook);
        } else {
          logger.log(logger.EXTREME, "New dirty notebook found");
          String oldGuid = enNotebook.getGuid();
          boolean found = false;
         
          // Look for a notebook with the same name.  If one is found, we don't need
          // to create another one
          logger.log(logger.EXTREME, "Looking for matching notebook name");
          for (int k=0; k<remoteList.size() && !found && keepRunning; k++) {
            if (remoteList.get(k).getName().equalsIgnoreCase(enNotebook.getName())) {
              enNotebook = remoteList.get(k);
              logger.log(logger.EXTREME, "Matching notebook found");
              found = true;
            }
          }
          if (!found)
            enNotebook = noteStore.createNotebook(authToken, enNotebook);
         
          logger.log(logger.EXTREME, "Updating notebook in database");
          conn.getNotebookTable().updateNotebookGuid(oldGuid, enNotebook.getGuid());
          sequence = enNotebook.getUpdateSequenceNum();
        }
        logger.log(logger.EXTREME, "Updating notebook sequence in database");
        conn.getNotebookTable().updateNotebookSequence(enNotebook.getGuid(), sequence);
        logger.log(logger.EXTREME, "Resetting dirty flag in notebook");
        conn.getNotebookTable().resetDirtyFlag(enNotebook.getGuid());
        updateSequenceNumber = sequence;
        logger.log(logger.EXTREME, "Emitting sequence number to main thread");
        conn.getSyncTable().setUpdateSequenceNumber(updateSequenceNumber);
      } catch (EDAMUserException e) {
        logger.log(logger.LOW, "*** EDAM User Excepton syncLocalNotebooks");
        logger.log(logger.LOW, e.toString() + ": Stack : " +enNotebook.getStack())
        error = true;
      } catch (EDAMSystemException e) {
        logger.log(logger.LOW, "*** EDAM System Excepton syncLocalNotebooks");
        logger.log(logger.LOW, e.toString());   
        error = true;
View Full Code Here

        currentTime = new GregorianCalendar();
        l=currentTime.getTimeInMillis();
      }
      String randint = new String(Long.toString(l));
   
      Notebook newBook = new Notebook();
      newBook.setUpdateSequenceNum(0);
      newBook.setGuid(randint);
      newBook.setName("Conflicting Changes");
      newBook.setServiceCreated(new Date().getTime());
      newBook.setServiceUpdated(new Date().getTime());
      newBook.setDefaultNotebook(false);
      newBook.setPublished(false);
     
      conn.getNotebookTable().addNotebook(newBook, false, true);
      notebookSignal.listChanged.emit();
      notebookGuid = newBook.getGuid();
      refreshNeeded = true;
    }
   
    // Now that we have a good notebook guid, we need to move the conflicting note
    // to the local notebook
View Full Code Here

            "isDirty boolean, "+
            "autoEncrypt boolean, "+
            "local boolean, "+
            "archived boolean)"))             
          logger.log(logger.HIGH, "Table "+dbName+" creation FAILED!!!");  
        Notebook newnote = new Notebook();
        newnote.setDefaultNotebook(true);
        newnote.setName("My Notebook");
        newnote.setPublished(false);
        newnote.setGuid("1");
       
        // Setup an initial notebook
    SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
        query = new NSqlQuery(db.getConnection());
    query.prepare("Insert Into "+dbName+" (guid, sequence, name, defaultNotebook, "
        +"serviceCreated, serviceUpdated, published, "  
        + "isDirty, autoEncrypt, "
        + "local, archived) Values("
        +":guid, :sequence, :name, :defaultNotebook,  "
        +":serviceCreated, :serviceUpdated, :published, "
        +":isDirty, :autoEncrypt, "
        +":local, false)");
    query.bindValue(":guid", newnote.getGuid());
    query.bindValue(":sequence", newnote.getUpdateSequenceNum());
    query.bindValue(":name", newnote.getName());
    query.bindValue(":defaultNotebook", newnote.isDefaultNotebook());
   
    StringBuilder serviceCreated = new StringBuilder(simple.format(newnote.getServiceCreated()));     
    StringBuilder serviceUpdated = new StringBuilder(simple.format(newnote.getServiceUpdated()));
    if (serviceUpdated.toString() == null)
      serviceUpdated = serviceCreated;
    query.bindValue(":serviceCreated", serviceCreated.toString());
    query.bindValue(":serviceUpdated", serviceCreated.toString());
    query.bindValue(":published",newnote.isPublished());
   
    query.bindValue(":isDirty", true);
    query.bindValue(":autoEncrypt", false);
    query.bindValue(":local", false);
View Full Code Here

    }
  }
  // Delete the notebook based on a guid
  public void expungeNotebook(String guid, boolean needsSync) {
    boolean check;
    Notebook n;
    n = getNotebook(guid);
        NSqlQuery query = new NSqlQuery(db.getConnection());

         check = query.prepare("delete from "+dbName+" where guid=:guid");
    if (!check) {
      logger.log(logger.EXTREME, dbName+" 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, dbName+" delete failed.");
   
    // Signal the parent that work needs to be done
    if  (needsSync && n!=null && n.getUpdateSequenceNum() > 0) {
      DeletedTable deletedTable = new DeletedTable(logger, db);
      deletedTable.addDeletedItem(guid, dbName);
    }
  }
View Full Code Here

      logger.log(logger.MEDIUM, query.lastError().toString());
    }
  }
  // Load notebooks from the database
  public List<Notebook> getAll() {
    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+" order by name");
    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));
      tempNotebook.setDefaultNotebook(query.valueBoolean(3, false));
      DateFormat indfm = null;
      try {
        indfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
//        indfm = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");
      } catch (Exception e) {  }
      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)));
      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)));
        tempNotebook.setPublishing(p);
      }
      index.add(tempNotebook);
   
    return index;
 
View Full Code Here

      index.add(tempNotebook);
   
    return index;
 
  public List<Notebook> getAllLocal() {
    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 from "+dbName+" where local=true order by name");
    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");
//      indfm = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");
      try {
        tempNotebook.setServiceCreated(indfm.parse(query.valueString(4)).getTime());
        tempNotebook.setServiceUpdated(indfm.parse(query.valueString(5)).getTime());
      } catch (ParseException e) {
        e.printStackTrace();
      }
      if (query.valueString(7) != null && !query.valueString(7).trim().equals(""))
        tempNotebook.setStack(query.valueString(7));
      index.add(tempNotebook);
   
    return index;
  }
View Full Code Here

    query.bindValue(":archived", val);
    query.exec();
  }
  // Load non-archived notebooks from the database
  public List<Notebook> getAllArchived() {
    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 archived=true order by name");
    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");
//      indfm = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");
      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)));
        tempNotebook.setPublishing(p);
      }
     
      index.add(tempNotebook);
   
    return index;
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.