Examples of NoteList


Examples of de.paulwein.notes.pojo.NoteList

      }
     
      else if(action.equals("delete")){
        String keyString = req.getParameter("key");
        Key notesListKey = KeyFactory.stringToKey(keyString);
        NoteList nl = new NoteList();
        nl.setKey(notesListKey);
        nDao.deleteNotesList(nl);
      }
     
      resp.sendRedirect(NOTELISTS_SERVLET);
    } catch (DAOException e) {
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

  @Override
  public Key createNotesList(String userId, String name) throws DAOException {
    PersistenceManager pm = mPmf.getPersistenceManager();

    NoteList notesList = new NoteList();
    notesList.setName(name);
    notesList.setUserId(userId);
   
    try{
      notesList = pm.makePersistent(notesList);
    } finally{
      pm.close();
    }
   
    return notesList.getKey();
  }
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

    PersistenceManager pm = mPmf.getPersistenceManager();

    try {
      pm.currentTransaction().begin();
     
      NoteList notesList = pm.getObjectById(NoteList.class, listId);
      List<Note> notes = notesList.getNotes();     
      if(notes == null){
        notes = new ArrayList<Note>();
      }
      notes.add(note);
      notesList.setNotes(notes);
      pm.makePersistent(notesList)
     
      pm.currentTransaction().commit();
    } catch (Exception ex) {
      pm.currentTransaction().rollback();
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

    PersistenceManager pm = mPmf.getPersistenceManager();
    Key parentKey = note.getKey().getParent();
    try{
      pm.currentTransaction().begin();

      NoteList notesList = pm.getObjectById(NoteList.class, parentKey);
      note = pm.getObjectById(Note.class, note.getKey());
      notesList.getNotes().remove(note);
      pm.makePersistent(notesList);

      pm.currentTransaction().commit();
    }catch (Exception ex) {
      pm.currentTransaction().rollback();
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

    PersistenceManager pm = mPmf.getPersistenceManager();
    Key parentKey = note.getKey().getParent();
    try{
      pm.currentTransaction().begin();

      NoteList notesList = pm.getObjectById(NoteList.class, parentKey);
      notesList.getNotes().remove(note);
      notesList.getNotes().add(note); // TODO maybe findObjectById(note.getKey) before add/remove
      pm.makePersistent(notesList);

      pm.currentTransaction().commit();
    }catch (Exception ex) {
      pm.currentTransaction().rollback();
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

  }

  @Override
  public NoteList loadNotesList(Key key) throws DAOException {
    PersistenceManager pm = mPmf.getPersistenceManager();
    NoteList notesList = null;
    try {
      notesList = pm.getObjectById(NoteList.class, key);
      notesList.getNotes(); // lazyfetch
    } catch (Exception ex) {
      throw new DAOException();
    } finally {
      pm.close()
    }
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

  @Override
  public Key createNotesList(String userId, String name) throws DAOException {
    EntityManager em = mEmf.createEntityManager();
   
    NoteList notesList = new NoteList();
    notesList.setName(name);
    notesList.setUserId(userId);
   
    try{
      em.getTransaction().begin();
      em.persist(notesList);
      em.getTransaction().commit();
    } finally {
      em.close();
    }
   
    return notesList.getKey();
  }
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

  public void addNote(Key listId, Note note) throws DAOException {
    EntityManager em = mEmf.createEntityManager();
   
    try {
      em.getTransaction().begin();
      NoteList notesList = em.find(NoteList.class, listId);
     
      List<Note> notes = notesList.getNotes();     
      if(notes == null){
        notes = new ArrayList<Note>();
      }
      notes.add(note);
      notesList.setNotes(notes);
      em.getTransaction().commit();
     
    } catch (Exception ex) {
      em.getTransaction().rollback();
      ex.printStackTrace();
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

    EntityManager em = mEmf.createEntityManager();
    Key parentKey = note.getKey().getParent();
    try{
      em.getTransaction().begin();

      NoteList notesList = em.find(NoteList.class, parentKey);
      note = em.find(Note.class, note.getKey());
      notesList.getNotes().remove(note);

      em.getTransaction().commit();
    }catch (Exception ex) {
      em.getTransaction().rollback();
      throw new DAOException();
View Full Code Here

Examples of de.paulwein.notes.pojo.NoteList

    EntityManager em = mEmf.createEntityManager();
    Key parentKey = note.getKey().getParent();
    try{
      em.getTransaction().begin();

      NoteList notesList = em.find(NoteList.class, parentKey);
      notesList.getNotes().remove(note);
      notesList.getNotes().add(note);

      em.getTransaction().commit();
    }catch (Exception ex) {
      em.getTransaction().rollback();
      throw new DAOException();
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.