01: package com.technoetic.xplanner.db;
02:
03: import java.util.Collection;
04: import java.util.Date;
05:
06: /**
07: * TODO move to task repository.
08: *
09: * @see com.technoetic.xplanner.domain.repository.TaskRepositoryHibernate
10: */
11: public class TaskQueryHelper {
12: public static final String EMAIL_TO_LEADS_QUERY = "com.technoetic.xplanner.domain.TimeEntryEmailNotificationToProjectSpecificLeads";
13: public static final String EMAIL_TO_ACCEPTORS_QUERY = "com.technoetic.xplanner.domain.TimeEntryEmailNotificationToAcceptors";
14:
15: private Collection cache = null;
16: private int personId;
17:
18: private TaskQuery taskQuery;
19:
20: public TaskQueryHelper() {
21: }
22:
23: public TaskQueryHelper(TaskQuery taskQuery) {
24: this .taskQuery = taskQuery;
25: }
26:
27: public void setPersonId(int personId) {
28: this .personId = personId;
29: }
30:
31: public Collection getCurrentActiveTasksForPerson() {
32: return taskQuery.query(cache, personId, Boolean.FALSE,
33: Boolean.TRUE);
34: }
35:
36: public Collection getCurrentPendingTasksForPerson() {
37: return taskQuery.query(cache, personId, Boolean.FALSE,
38: Boolean.FALSE);
39: }
40:
41: public Collection getCurrentCompletedTasksForPerson() {
42: return taskQuery.query(cache, personId, Boolean.TRUE, null);
43: }
44:
45: public Collection getFutureTasksForPerson() {
46: return taskQuery.queryTasks("tasks.planned.future", personId);
47: }
48:
49: public Collection getTaskAcceptorsEmailNotification(Date date) {
50: return taskQuery.queryTasks(EMAIL_TO_ACCEPTORS_QUERY, date);
51: }
52:
53: public Collection getProjectLeedsEmailNotification(Date date) {
54: return taskQuery.queryTasks(EMAIL_TO_LEADS_QUERY, date);
55: }
56:
57: public void setTaskQuery(TaskQuery taskQuery) {
58: this.taskQuery = taskQuery;
59: }
60: }
|