Package com.dyuproject.demos.deprecated.todolist.model

Examples of com.dyuproject.demos.deprecated.todolist.model.Todo


       
        String title = request.getParameter(Constants.TITLE);       
        String content = request.getParameter(Constants.CONTENT);
       
        boolean created = false;       
        Todo todo = null;
       
        if(title!=null && title.length()>0)
        {
            todo = new Todo();
            todo.setTitle(title);
            todo.setContent(content);
            todo.setUser(user);           
            created = _todoDao.create(todo);
        }
       
        if(Constants.XML.equals(mime))
        {                    
View Full Code Here


   
    protected void delete(HttpServletRequest request,
            HttpServletResponse response, String mime, String id)
            throws IOException, ServletException
    {
        Todo todo = _todoDao.get(Long.valueOf(id));
        if(todo==null)
        {
            response.sendError(404);
            return;
        }
View Full Code Here

   
    protected void read(HttpServletRequest request,
            HttpServletResponse response, String mime, String id)
            throws IOException, ServletException
    {       
        Todo todo = _todoDao.get(Long.valueOf(id));
        if(todo==null)
        {           
            response.sendError(404);
            return;
        }
View Full Code Here

       
        // preparse the boolean (for errors) before querying the db
        if(completedParam!=null)
            completed = Boolean.parseBoolean(completedParam);
       
        Todo todo = _todoDao.get(Long.valueOf(id));
       
        boolean updated = false;
        if(todo!=null)
        {
            if(title!=null)
            {
                updated = true;
                todo.setTitle(title);
            }
            if(content!=null)
            {
                updated = true;
                todo.setContent(content);
            }
            if(completed!=todo.isCompleted() && completedParam!=null)
            {
                updated = true;
                todo.setCompleted(completed);
            }
            updated =  updated ? _todoDao.update(todo) : false;
        }       
       
        if(Constants.XML.equals(mime))
View Full Code Here

            return;
        }
        Long id = Long.valueOf(request.getParameter(Constants.ID));       
        boolean updated = false;
       
        Todo todo = _todoDao.get(id);
        if(todo!=null && !todo.isCompleted())
        {
            todo.setCompleted(true);
            updated = _todoDao.update(todo);
        }
       
        if(Constants.XML.equals(mime))
        {
View Full Code Here

            HttpServletResponse response) throws ServletException, IOException
    {
        String method = request.getMethod();
        if(method.equals(GET))           
        {
            Todo todo = null;
            request.setAttribute(Constants.ACTION, Constants.ACTION_CREATE);
            dispatchToFormView(todo, request, response);
        }
        else if(method.equals(POST))
            create(request, response, mime);
View Full Code Here

        }
       
        String method = request.getMethod();
        if(method.equals(GET))
        {
            Todo todo = _todoDao.get(Long.valueOf(id));
            if(todo==null)
                request.setAttribute(Constants.MSG, Feedback.TODO_NOT_FOUND.getMsg());
            else
                request.setAttribute(Constants.TODO, todo);
            request.setAttribute(Constants.ACTION, Constants.ACTION_EDIT);
View Full Code Here

TOP

Related Classes of com.dyuproject.demos.deprecated.todolist.model.Todo

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.