Package de.paulwein.notes.pojo

Examples of de.paulwein.notes.pojo.Note


      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


    String subject = req.getParameter("subject");
    String note = req.getParameter("note");
    String keyString = req.getParameter("key");
    Key listKey = KeyFactory.stringToKey(keyString);
   
    Note n = new Note();
    n.setDate(new Date());
    n.setSubject(subject);
    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());
      }
      else // create new note and persist it
        notesDAO.addNote(listKey, n);
View Full Code Here

    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

   
    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

  }

  @Override
  public Note loadNote(Key key) throws DAOException {
    PersistenceManager pm = mPmf.getPersistenceManager();
    Note note = null;
    try {
      note = pm.getObjectById(Note.class, key);
    } catch (Exception ex) {
      ex.printStackTrace();
      throw new DAOException();
View Full Code Here

  }

  @Override
  public Note loadNote(Key key) throws DAOException {
    EntityManager em = mEmf.createEntityManager();
    Note note = null;
    try{
    note = em.find(Note.class, key);
    } catch (Exception e) {
      e.printStackTrace();
      throw new DAOException();
View Full Code Here

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

  @Override
  public Note loadNote(Key key) throws DAOException {
    try {
      Entity entity = datastore.get(key);
      Note note = Transformer.entity2Note(entity);
      return note;
    } catch (EntityNotFoundException e) {
      e.printStackTrace();
      throw new DAOException();
    }
View Full Code Here

    Query q = new Query(ENTITY_KIND_NOTE).setFilter(queryFilter);
    PreparedQuery prepq = datastore.prepare(q);
    List<Entity> notes = prepq.asList(FetchOptions.Builder.withDefaults());
    List<Note> results = new ArrayList<Note>();
    for(Entity eNote : notes){
      Note note = Transformer.entity2Note(eNote);
      results.add(note);
    }
    return results;
  }
View Full Code Here

    Date date = (Date) entity.getProperty(NotesDAO.PROPERTY_DATE);
    String subject = (String) entity.getProperty(NotesDAO.PROPERTY_SUBJECT);
    String note = (String) entity.getProperty(NotesDAO.PROPERTY_NOTE);
    String userId = (String) entity.getProperty(NotesDAO.PROPERTY_USERID);
   
    Note n = new Note();
    n.setKey(key);
    n.setDate(date);
    n.setSubject(subject);
    n.setNote(note);
    n.setUserId(userId);
    return n;
  }
View Full Code Here

TOP

Related Classes of de.paulwein.notes.pojo.Note

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.