Examples of NoteList


Examples of de.paulwein.notes.pojo.NoteList

  }

  @Override
  public NoteList loadNotesList(Key key) throws DAOException {
    EntityManager em = mEmf.createEntityManager();
    NoteList notesList = null;
    try{
      notesList = em.find(NoteList.class, key);
      notesList.getNotes(); // lazy loading
      em.detach(notesList);
    } catch (Exception e) {
      e.printStackTrace();
      throw new DAOException();
    } finally {
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

    return Note.class.getName();
  }

  @Override
  public Key createNotesList(String userId, String name) throws DAOException {
    NoteList notesList = new NoteList();
    notesList.setUserId(userId);
    notesList.setName(name);
   
    Entity entity = Transformer.notesList2Entity(notesList);
   
    Key key = datastore.put(entity);
   
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

  public void addNote(Key listId, Note note) throws DAOException {
    try {
      Transaction tx = datastore.beginTransaction();
     
      Entity entity = datastore.get(listId);
      NoteList notesList = Transformer.entity2NotesList(entity);
     
      Entity noteEntity = Transformer.note2Entity(note,listId);
      Key key = datastore.put(noteEntity);
     
      List<Key> keyList = notesList.getNoteKeys();
      if(keyList == null)
        keyList = new ArrayList<Key>();
      keyList.add(key);
      notesList.setNoteKeys(keyList);
      entity = Transformer.notesList2Entity(notesList);
      datastore.put(entity);
      tx.commit();
     
    } catch (EntityNotFoundException e) {
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

    try {
      Transaction tx = datastore.beginTransaction();
      Key noteKey = note.getKey();
      Key parentKey = noteKey.getParent();
      Entity entity = datastore.get(parentKey);
      NoteList notesList = Transformer.entity2NotesList(entity);

      datastore.delete(noteKey);
     
      List<Key> keyList = notesList.getNoteKeys();
      if(keyList == null)
        keyList = new ArrayList<Key>();
      keyList.remove(noteKey);
      notesList.setNoteKeys(keyList);
     
      entity = Transformer.notesList2Entity(notesList);
      datastore.put(entity);
      tx.commit();
     
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

    PreparedQuery pq = datastore.prepare(query);
   
    List<Entity> entities = pq.asList(FetchOptions.Builder.withDefaults());
    List<NoteList> notesLists = new ArrayList<NoteList>();
    for(Entity e : entities){
      NoteList notesList = Transformer.entity2NotesList(e);
      notesLists.add(notesList);
    }
   
    return notesLists;
  }
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

  @Override
  public NoteList loadNotesList(Key key) throws DAOException {
    try {
     
      Entity entity = datastore.get(key);
      NoteList notesList = Transformer.entity2NotesList(entity);
     
      Query query = new Query(ENTITY_KIND_NOTE).setAncestor(notesList.getKey());
      PreparedQuery pq = datastore.prepare(query);
     
      List<Entity> entities = pq.asList(FetchOptions.Builder.withDefaults());
      List<Note> notes = new ArrayList<Note>();
     
      for(Entity e : entities){
        Note note = Transformer.entity2Note(e);
        notes.add(note);
      }
     
      notesList.setNotes(notes);
     
      return notesList;
    } catch (EntityNotFoundException e) {
      e.printStackTrace();
      throw new DAOException("Entity not found!");
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

    Key key = entity.getKey();
    String userId = (String) entity.getProperty(NotesDAO.PROPERTY_USERID);
    String name = (String) entity.getProperty(NotesDAO.PROPERTY_NAME);
    List<Key> notesKeys = (List<Key>) entity.getProperty(NotesDAO.PROPERTY_NOTES);

    NoteList notesList = new NoteList();
    notesList.setKey(key);
    notesList.setUserId(userId);
    notesList.setName(name);
    notesList.setNoteKeys(notesKeys);
   
    return notesList;
  }
View Full Code Here

Examples of org.openntf.domino.big.impl.NoteList

    Document storeTest = log.createDocument();
    storeTest.replaceItemValue("form", "BinaryTest");
    Database db = session.getDatabase("", "imdb/movies.nsf");

    try {
      NoteList notelist = new NoteList();
      marktime = System.nanoTime();
      timelog("Beginning first notelist...");
      NoteCollection notecoll = db.createNoteCollection(false);
      notecoll.setSelectDocuments(true);
      notecoll.setSelectionFormula("@Begins(Title; \"B\")");
      notecoll.buildCollection();
      //      DocumentCollection coll = db.search("@Begins(Title; \"B\")");
      timelog("Starting note coordinates of " + notecoll.getCount() + " documents");
      //      for (Document doc : notecoll) {
      for (String nid : notecoll) {
        NoteCoordinate nc = new NoteCoordinate(notecoll, nid);
        notelist.add(nc);
      }

      //      Database eventDb = session.getDatabase("", "events4.nsf");
      //      NoteCollection eventNotecoll = eventDb.createNoteCollection(false);
      //      eventNotecoll.setSelectDocuments(true);
      //      eventNotecoll.buildCollection();
      //      timelog("Continuing note coordinates of " + eventNotecoll.getCount() + " documents");
      //      for (String nid : eventNotecoll) {
      //        NoteCoordinate nc = new NoteCoordinate(eventNotecoll, nid);
      //        notelist.add(nc);
      //      }
      //      Database xspextDb = session.getDatabase("", "openntf/xpagesext.nsf");
      //      NoteCollection xspextNotecoll = xspextDb.createNoteCollection(false);
      //      xspextNotecoll.setSelectDocuments(true);
      //      xspextNotecoll.buildCollection();
      //      timelog("Continuing note coordinates of " + xspextNotecoll.getCount() + " documents");
      //      for (String nid : xspextNotecoll) {
      //        NoteCoordinate nc = new NoteCoordinate(xspextNotecoll, nid);
      //        notelist.add(nc);
      //      }

      byte[] bytes = notelist.toByteArray();
      int byteSize = bytes.length;
      timelog("Resulting bytearray is " + bytes.length + " so we expect " + (bytes.length / (2500 * 24)) + " items");
      //      File file = File.createTempFile("foo", "bar");
      //      FileOutputStream fos = new FileOutputStream(file);
      //      fos.write(bytes);
      //      fos.close();

      storeTest.writeBinary("imdbNoteList", bytes, 2500 * 24);
      storeTest.save();
      String storeId = storeTest.getUniversalID();
      storeTest.recycle();
      storeTest = null;

      //      coll.recycle();
      //      coll = null;

      notecoll.recycle();
      notecoll = null;
      //      eventNotecoll.recycle();
      //      eventNotecoll = null;
      //      eventDb.recycle();
      //      eventDb = null;
      //      xspextNotecoll.recycle();
      //      xspextNotecoll = null;
      //      xspextDb.recycle();
      //      xspextDb = null;
      db.recycle();
      db = null;
      notelist = null;
      System.gc();

      timelog("Binary data serialized out. Reloading...");
      storeTest = log.getDocumentByUNID(storeId);
      //      FileInputStream fis = new FileInputStream(file);

      DbCache cache = new DbCache();
      NoteCoordinate.setDbCache(cache);
      NoteList notelist2 = new NoteList(cache, NoteList.getComparator("Title"));
      byte[] loaded = storeTest.readBinary("imdbNoteList");

      //      byte[] loaded = new byte[byteSize];
      //      fis.read(loaded);
      notelist2.loadByteArray(loaded);
      timelog("Done reloading " + notelist2.size() + " sorted notes. Iterating...");
      int notecount = 0;
      try {
        for (NoteCoordinate nc : notelist2) {
          Document doc = nc.getDocument();
          notecount++;
          //          System.out.println("doc " + doc.getNoteID() + " " + doc.getItemValue("$UpdatedBy", String.class));
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
      timelog("iterated over " + notecount + " notes out of " + notelist2.size());
      long endTime = System.nanoTime();
    } catch (Throwable t) {
      t.printStackTrace();
    }
    long testEndTime = System.nanoTime();
View Full Code Here

Examples of org.openntf.domino.big.impl.NoteList

  @Override
  public void addInEdge(final Edge edge) {
    boolean adding = false;
    String label = edge.getLabel();
    NoteList ins = getInEdgesSet(label);
    if (!ins.contains(edge.getId())) {
      adding = true;
      if (edge.getId() instanceof NoteCoordinate) {
        ins.add((NoteCoordinate) edge.getId());
      } else {
        //TODO
        //        ins.add((String) edge.getId());
      }
    }
View Full Code Here

Examples of org.openntf.domino.big.impl.NoteList

  @Override
  public void addOutEdge(final Edge edge) {
    boolean adding = false;
    String label = edge.getLabel();
    NoteList outs = getOutEdgesSet(label);
    if (!outs.contains(edge.getId())) {
      adding = true;
      if (edge.getId() instanceof NoteCoordinate) {
        outs.add((NoteCoordinate) edge.getId());
      } else {
        //TODO
        //        outs.add((String) edge.getId());
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.