Package de.paulwein.notes.dao

Examples of de.paulwein.notes.dao.NotesDAO


    if(action != null && action.equals("edit")){
      req.setAttribute("edit", "edit");
      Key noteKey = KeyFactory.stringToKey(keyString);
      try {
        DAOFactory df = DAOFactory.getInstance();
        NotesDAO notesDAO = df.getDAO(Note.class, NotesDAO.class);
        Note note = notesDAO.loadNote(noteKey);
        req.setAttribute("note",note);
      } catch (DAOException e) {
        errorOccured(resp);
      }
    }
View Full Code Here


    n.setUserId(user.getUserId());
    String action = req.getParameter("action");
   
    try {
      DAOFactory df = DAOFactory.getInstance();
      NotesDAO notesDAO = df.getDAO(Note.class, NotesDAO.class);
      // update Note
      if(action != null && action.equals("edit")){
        n.setKey(listKey);
        notesDAO.updateNote(n);
        keyString = KeyFactory.keyToString(listKey.getParent());
      }
      else // create new note and persist it
        notesDAO.addNote(listKey, n);
    } catch (DAOException e) {
      errorOccured(resp);
    }
    resp.sendRedirect(NOTELIST_SERVLET + "?key=" + keyString);
  }
View Full Code Here

    String keyString = req.getParameter("key");
    Key listKey = KeyFactory.stringToKey(keyString);
   
    try {
      DAOFactory df = DAOFactory.getInstance();
      NotesDAO nDao = df.getDAO(Note.class, NotesDAO.class);
      NoteList notesList = nDao.loadNotesList(listKey);
      req.setAttribute("key", keyString);
      req.setAttribute("list", notesList.getNotes());
      RequestDispatcher requestDispatcher = req.getRequestDispatcher(NOTELIST_SERVLET + ".jsp");
      requestDispatcher.forward(req, resp);
    } catch (DAOException e) {
View Full Code Here

  @Override
  public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    super.doGet(req, resp);
    try {
      DAOFactory df = DAOFactory.getInstance();
      NotesDAO nDao = df.getDAO(Note.class, NotesDAO.class);
      List<NoteList> notesLists = nDao.fetchNotesLists(user.getUserId());
      req.setAttribute("list", notesLists);
      RequestDispatcher requestDispatcher = req.getRequestDispatcher(NOTELISTS_SERVLET + ".jsp");
      requestDispatcher.forward(req, resp);
    } catch (DAOException e) {
      errorOccured(resp);
View Full Code Here

    String action = req.getParameter("action");
   
    try {
      DAOFactory df = DAOFactory.getInstance();
      NotesDAO nDao = df.getDAO(Note.class, NotesDAO.class);
      if(action.equals("create")){
        String name = req.getParameter("name");
        if(name != null && !name.equals(""))
          nDao.createNotesList(user.getUserId(), name);
      }
     
      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) {
      errorOccured(resp);
View Full Code Here

      return;
    }
   
    try {
      DAOFactory df = DAOFactory.getInstance();
      NotesDAO notesDAO = df.getDAO(Note.class, NotesDAO.class);
      List<Note> notes = notesDAO.search(search, user.getUserId());
      req.setAttribute("list", notes);
      RequestDispatcher requestDispatcher = req.getRequestDispatcher(SEARCH_SERVLET + ".jsp");
      requestDispatcher.forward(req, resp);
    } catch (DAOException e) {
      errorOccured(resp);
View Full Code Here

    String key = req.getParameter("key");   
    Key mKey = KeyFactory.stringToKey(key);
   
    try {
      DAOFactory df = DAOFactory.getInstance();
      NotesDAO nDao = df.getDAO(Note.class, NotesDAO.class);
      Note note = nDao.loadNote(mKey);

      req.setAttribute("note", note);
      req.setAttribute("key", key);
      RequestDispatcher requestDispatcher = req.getRequestDispatcher(NOTE_SERVLET + ".jsp");
      requestDispatcher.forward(req, resp);
View Full Code Here

    Key mKey = KeyFactory.stringToKey(keyString);
   
    if(action.equals("delete")){
      try {
        DAOFactory df = DAOFactory.getInstance();
        NotesDAO nDao = df.getDAO(Note.class, NotesDAO.class);
        Note note = new Note();
        note.setKey(mKey);
        nDao.deleteNote(note);
        resp.sendRedirect(NOTELISTS_SERVLET);
      } catch (Exception e) {
        errorOccured(resp);
      }
     
View Full Code Here

TOP

Related Classes of de.paulwein.notes.dao.NotesDAO

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.