Java Code Examples for com.in28minutes.domain.TodoItem#setDone()

The following examples show how to use com.in28minutes.domain.TodoItem#setDone() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TodoController.java    From SpringIn28Minutes with MIT License 5 votes vote down vote up
@RequestMapping(value = "/user/todos/new", method = RequestMethod.POST)
public String createNewTodo(@ModelAttribute TodoItem todoItem) {
	final User user = sessionData.getUser();
	todoItem.setDone(false);
	todoItem.setUserId(user.getId());
	todoService.create(todoItem);
	return REDIRECT_TO_VIEW_TODOS_CONTROLLER;
}
 
Example 2
Source File: UpdateTodoServlet.java    From MavenIn28Minutes with MIT License 4 votes vote down vote up
@Override
protected void doPost(HttpServletRequest request,
		HttpServletResponse response) throws ServletException, IOException {

	long todoId = Long.parseLong(request.getParameter("todoId"));

	TodoItem todoItem = todoService.getTodoById(todoId);

	todoItem.setTitle(request.getParameter("title"));
	todoItem.setDueDate(new Date(request.getParameter("dueDate")));
	todoItem.setDone(Boolean.valueOf(request.getParameter("status")));
	todoItem.setPriority(Priority.valueOf(request.getParameter("priority")));

	todoService.update(todoItem);

	request.getRequestDispatcher("/todos").forward(request, response);

}
 
Example 3
Source File: UpdateTodoServlet.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License 4 votes vote down vote up
@Override
protected void doPost(HttpServletRequest request,
		HttpServletResponse response) throws ServletException, IOException {

	long todoId = Long.parseLong(request.getParameter("todoId"));

	TodoItem todoItem = todoService.getTodoById(todoId);

	todoItem.setTitle(request.getParameter("title"));
	todoItem.setDueDate(new Date(request.getParameter("dueDate")));
	todoItem.setDone(Boolean.valueOf(request.getParameter("status")));
	todoItem.setPriority(Priority.valueOf(request.getParameter("priority")));

	todoService.update(todoItem);

	request.getRequestDispatcher("/todos").forward(request, response);

}