01: package com.technoetic.xplanner.actions;
02:
03: import javax.servlet.http.HttpServletRequest;
04: import javax.servlet.http.HttpServletResponse;
05:
06: import java.util.Collection;
07:
08: import org.apache.struts.action.ActionForward;
09: import org.apache.struts.action.ActionMapping;
10: import org.apache.struts.action.ActionForm;
11:
12: import com.technoetic.xplanner.domain.repository.TaskRepository;
13: import com.technoetic.xplanner.domain.repository.StoryRepository;
14:
15: /**
16: * User: Mateusz Prokopowicz
17: * Date: Jul 5, 2005
18: * Time: 2:45:56 PM
19: */
20: public class ViewPersonAction extends ViewObjectAction {
21: TaskRepository taskRepository;
22: StoryRepository storyRepository;
23:
24: public void setStoryRepository(StoryRepository storyRepository) {
25: this .storyRepository = storyRepository;
26: }
27:
28: public void setTaskRepository(TaskRepository taskRepository) {
29: this .taskRepository = taskRepository;
30: }
31:
32: protected ActionForward doExecute(ActionMapping actionMapping,
33: ActionForm form, HttpServletRequest request,
34: HttpServletResponse reply) throws Exception {
35:
36: int personId = Integer.parseInt(request.getParameter("oid"));
37:
38: // grab a list of all active tasks
39: Collection tasks = taskRepository
40: .getCurrentTasksForPerson(personId);
41:
42: // use the utility methods on the task repository to filter the results
43: request.setAttribute("currentActiveTasksForPerson",
44: taskRepository.getCurrentActiveTasks(tasks));
45: request.setAttribute("currentPendingTasksForPerson",
46: taskRepository.getCurrentPendingTasks(tasks));
47: request.setAttribute("currentCompletedTasksForPerson",
48: taskRepository.getCurrentCompletedTasks(tasks));
49: request.setAttribute("futureTasksForPerson", taskRepository
50: .getFutureTasksForPerson(personId));
51: request.setAttribute("storiesForCustomer", storyRepository
52: .getStoriesForPersonWhereCustomer(personId));
53: request.setAttribute("storiesForTracker", storyRepository
54: .getStoriesForPersonWhereTracker(personId));
55:
56: return super.doExecute(actionMapping, form, request, reply);
57: }
58: }
|