Package de.paulwein.notes.dao

Examples of de.paulwein.notes.dao.DAOFactory


   
    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);
View Full Code Here


  // load note lists and show them in jsp page
  @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) {
View Full Code Here

    super.doPost(req,resp);

    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);
      }
View Full Code Here

      errorOccured(resp);
      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) {
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");
View Full Code Here

    String keyString = req.getParameter("key");
    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) {
View Full Code Here

    // fill textareas with old entries
    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.setNote(note);
    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());
View Full Code Here

TOP

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

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.