Package com.dyuproject.demos.todolist.model

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


   
    @HttpResource(location="/todos/$")
    @Get
    public void getById(RequestContext rc) throws IOException, ServletException
    {
        Todo todo = _todoDao.get(Long.valueOf(rc.getPathElement(1)));
        if(todo==null)
        {
            rc.getResponse().sendError(404);
            return;
        }
View Full Code Here


    @Delete
    public void deleteById(RequestContext rc) throws IOException, ServletException
    {
        HttpServletRequest request = rc.getRequest();
       
        Todo todo = _todoDao.get(Long.valueOf(rc.getPathElement(1)));
        if(todo==null)
        {
            rc.getResponse().sendError(404);
            return;
        }
View Full Code Here

    public void updateById(RequestContext rc) throws IOException, ServletException
    {
        HttpServletRequest request = rc.getRequest();
        HttpServletResponse response = rc.getResponse()
       
        Todo todo = _todoDao.get(Long.valueOf(rc.getPathElement(1)));
        if(todo==null)
        {
            response.sendError(404);
            return;
        }
View Full Code Here

        {
            response.sendError(404);
            return;
        }
         
        Todo todo = null;
        try
        {
            todo = (Todo)rc.getConsumer().consume(rc);
        }
        catch(ValidationException ve)
        {
            request.setAttribute(Constants.MSG, ve.getMessage());
            request.setAttribute(Constants.ACTION, Constants.ACTION_CREATE);
            dispatchToFormView((Todo)ve.getPojo(), rc, getWebContext());
            return;
        }
       
        todo.setUser(user);
        boolean created = _todoDao.create(todo);
       
        if(created)
        {
            /*request.setAttribute(Constants.MSG, Feedback.TODO_CREATED.getMsg());
View Full Code Here

    public void verb_delete(RequestContext rc) throws IOException, ServletException
    {
        HttpServletRequest request = rc.getRequest();
        HttpServletResponse response = rc.getResponse();

        Todo todo = _todoDao.get(Long.valueOf(rc.getPathElement(1)));
        if(todo==null)
        {
            rc.getResponse().sendError(404);
            return;
        }
View Full Code Here

    @Get
    public void verb_edit(RequestContext rc) throws IOException, ServletException
    {
        HttpServletRequest request = rc.getRequest();
       
        Todo todo = _todoDao.get(Long.valueOf(rc.getPathElement(1)));
        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

    public void verb_complete(RequestContext rc) throws IOException, ServletException
    {
        HttpServletRequest request = rc.getRequest();
        HttpServletResponse response = rc.getResponse();
       
        Todo todo = _todoDao.get(Long.valueOf(rc.getPathElement(1)));
        boolean updated = false;
        if(todo!=null && !todo.isCompleted())
        {
            todo.setCompleted(true);
            updated = TodoDao.executeUpdate();
        }
       
        if(updated)
            response.sendRedirect(request.getHeader("Referer"));
View Full Code Here

TOP

Related Classes of com.dyuproject.demos.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.