com.in28minutes.domain.TodoItemList Java Examples

The following examples show how to use com.in28minutes.domain.TodoItemList. 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: ListTodoServlet.java    From MavenIn28Minutes with MIT License 6 votes vote down vote up
@Override
protected void doGet(HttpServletRequest request,
		HttpServletResponse response) throws ServletException, IOException {

	HttpSession session = request.getSession();
	User user = (User) session.getAttribute(TodoListUtils.SESSION_USER);
	TodoItemList todoList = todoService.getTodoListByUser(user.getId());

	// todo list is request scoped to avoid storing and synchronizing it in
	// session for each CRUD operation
	request.setAttribute("todoList", todoList.getItems());
	request.setAttribute("homeTabStyle", "active");

	request.setAttribute("totalCount", todoList.getCount());
	request.setAttribute("doneCount", todoList.getDoneCount());
	request.setAttribute("todoCount", todoList.getTodoCount());

	request.getRequestDispatcher(HOME_PAGE).forward(request, response);
}
 
Example #2
Source File: ListTodoServlet.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License 6 votes vote down vote up
@Override
protected void doGet(HttpServletRequest request,
		HttpServletResponse response) throws ServletException, IOException {

	HttpSession session = request.getSession();
	User user = (User) session.getAttribute(TodoListUtils.SESSION_USER);
	TodoItemList todoList = todoService.getTodoListByUser(user.getId());

	// todo list is request scoped to avoid storing and synchronizing it in
	// session for each CRUD operation
	request.setAttribute("todoList", todoList.getItems());
	request.setAttribute("homeTabStyle", "active");

	request.setAttribute("totalCount", todoList.getCount());
	request.setAttribute("doneCount", todoList.getDoneCount());
	request.setAttribute("todoCount", todoList.getTodoCount());

	request.getRequestDispatcher(HOME_PAGE).forward(request, response);
}
 
Example #3
Source File: TodoDataServiceImpl.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License 5 votes vote down vote up
public TodoItemList getTodoListByUserAndTitle(final long userId,
		final String title) {
	TypedQuery<TodoItem> query = entityManager.createNamedQuery(
			"findTodosByTitle", TodoItem.class);
	query.setParameter(1, userId);
	query.setParameter(2, "%" + title.toUpperCase() + "%");
	return new TodoItemList(query.getResultList());
}
 
Example #4
Source File: TodoDataServiceImpl.java    From MavenIn28Minutes with MIT License 5 votes vote down vote up
public TodoItemList getTodoListByUserAndTitle(final long userId,
		final String title) {
	TypedQuery<TodoItem> query = entityManager.createNamedQuery(
			"findTodosByTitle", TodoItem.class);
	query.setParameter(1, userId);
	query.setParameter(2, "%" + title.toUpperCase() + "%");
	return new TodoItemList(query.getResultList());
}
 
Example #5
Source File: TodoDataServiceImpl.java    From SpringIn28Minutes with MIT License 5 votes vote down vote up
public TodoItemList getTodoListByUserAndTitle(final long userId,
		final String title) {
	TypedQuery<TodoItem> query = entityManager.createNamedQuery(
			"findTodosByTitle", TodoItem.class);
	query.setParameter(1, userId);
	query.setParameter(2, "%" + title.toUpperCase() + "%");
	return new TodoItemList(query.getResultList());
}
 
Example #6
Source File: TodoController.java    From SpringIn28Minutes with MIT License 5 votes vote down vote up
@RequestMapping(value = "/user/todos/search", method = RequestMethod.GET)
public String searchTodo(@RequestParam String title, Model model) {
	TodoItemList todoList = todoService.searchTodoListByTitle(sessionData
			.getUser().getId(), title);
	model.addAttribute("todoList", todoList.getItems());
	model.addAttribute("title", title);
	return "todo/search";
}
 
Example #7
Source File: TodoServiceImpl.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License 4 votes vote down vote up
public TodoItemList searchTodoListByTitle(final long userId,
		final String title) {
	return todoDataService.getTodoListByUserAndTitle(userId, title);
}
 
Example #8
Source File: TodoServiceImpl.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License 4 votes vote down vote up
public TodoItemList getTodoListByUser(final long userId) {
	return todoDataService.getTodoListByUser(userId);
}
 
Example #9
Source File: TodoDataServiceImpl.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License 4 votes vote down vote up
public TodoItemList getTodoListByUser(final long userId) {
	TypedQuery<TodoItem> query = entityManager.createNamedQuery(
			"findTodosByUser", TodoItem.class);
	query.setParameter(1, userId);
	return new TodoItemList(query.getResultList());
}
 
Example #10
Source File: TodoServiceImpl.java    From SpringIn28Minutes with MIT License 4 votes vote down vote up
public TodoItemList searchTodoListByTitle(final long userId,
		final String title) {
	return todoDataService.getTodoListByUserAndTitle(userId, title);
}
 
Example #11
Source File: TodoServiceImpl.java    From SpringIn28Minutes with MIT License 4 votes vote down vote up
public TodoItemList getTodoListByUser(final long userId) {
	return todoDataService.getTodoListByUser(userId);
}
 
Example #12
Source File: TodoDataServiceImpl.java    From SpringIn28Minutes with MIT License 4 votes vote down vote up
public TodoItemList getTodoListByUser(final long userId) {
	TypedQuery<TodoItem> query = entityManager.createNamedQuery(
			"findTodosByUser", TodoItem.class);
	query.setParameter(1, userId);
	return new TodoItemList(query.getResultList());
}
 
Example #13
Source File: TodoController.java    From SpringIn28Minutes with MIT License 4 votes vote down vote up
@RequestMapping("/user/todos")
public ModelAndView loadTodoList() {

	ModelAndView modelAndView = new ModelAndView();

	// user login is ensured by the login filter/interceptor

	TodoItemList todoList = todoService.getTodoListByUser(sessionData
			.getUser().getId());

	modelAndView.addObject("todoList", todoList.getItems());

	modelAndView.addObject("totalCount", todoList.getCount());
	modelAndView.addObject("doneCount", todoList.getDoneCount());
	modelAndView.addObject("todoCount", todoList.getTodoCount());
	modelAndView.addObject("homeTabStyle", "active");

	modelAndView.setViewName("todo/list");
	return modelAndView;

}
 
Example #14
Source File: TodoServiceImpl.java    From MavenIn28Minutes with MIT License 4 votes vote down vote up
public TodoItemList searchTodoListByTitle(final long userId,
		final String title) {
	return todoDataService.getTodoListByUserAndTitle(userId, title);
}
 
Example #15
Source File: TodoServiceImpl.java    From MavenIn28Minutes with MIT License 4 votes vote down vote up
public TodoItemList getTodoListByUser(final long userId) {
	return todoDataService.getTodoListByUser(userId);
}
 
Example #16
Source File: TodoDataServiceImpl.java    From MavenIn28Minutes with MIT License 4 votes vote down vote up
public TodoItemList getTodoListByUser(final long userId) {
	TypedQuery<TodoItem> query = entityManager.createNamedQuery(
			"findTodosByUser", TodoItem.class);
	query.setParameter(1, userId);
	return new TodoItemList(query.getResultList());
}
 
Example #17
Source File: TodoDataService.java    From SpringIn28Minutes with MIT License votes vote down vote up
TodoItemList getTodoListByUserAndTitle(final long userId, final String title); 
Example #18
Source File: TodoDataService.java    From SpringIn28Minutes with MIT License votes vote down vote up
TodoItemList getTodoListByUser(final long userId); 
Example #19
Source File: TodoService.java    From SpringIn28Minutes with MIT License votes vote down vote up
TodoItemList getTodoListByUser(final long userId); 
Example #20
Source File: TodoService.java    From SpringIn28Minutes with MIT License votes vote down vote up
TodoItemList searchTodoListByTitle(final long userId, final String title); 
Example #21
Source File: TodoService.java    From MavenIn28Minutes with MIT License votes vote down vote up
TodoItemList searchTodoListByTitle(final long userId, final String title); 
Example #22
Source File: TodoDataService.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License votes vote down vote up
TodoItemList getTodoListByUser(final long userId); 
Example #23
Source File: TodoDataService.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License votes vote down vote up
TodoItemList getTodoListByUserAndTitle(final long userId, final String title); 
Example #24
Source File: TodoService.java    From MavenIn28Minutes with MIT License votes vote down vote up
TodoItemList getTodoListByUser(final long userId); 
Example #25
Source File: TodoService.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License votes vote down vote up
TodoItemList getTodoListByUser(final long userId); 
Example #26
Source File: TodoService.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License votes vote down vote up
TodoItemList searchTodoListByTitle(final long userId, final String title); 
Example #27
Source File: TodoDataService.java    From MavenIn28Minutes with MIT License votes vote down vote up
TodoItemList getTodoListByUserAndTitle(final long userId, final String title); 
Example #28
Source File: TodoDataService.java    From MavenIn28Minutes with MIT License votes vote down vote up
TodoItemList getTodoListByUser(final long userId);