Source Code Cross Referenced for MissingTimeEntryNotifier.java in  » Project-Management » XPlanner-0.7b7 » com » technoetic » xplanner » mail » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Project Management » XPlanner 0.7b7 » com.technoetic.xplanner.mail 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) Mateusz Prokopowicz. All Rights Reserved.
003:         */
004:
005:        package com.technoetic.xplanner.mail;
006:
007:        import java.util.Calendar;
008:        import java.util.Collection;
009:        import java.util.Date;
010:        import java.util.HashMap;
011:        import java.util.Iterator;
012:        import java.util.Map;
013:
014:        import org.apache.log4j.Logger;
015:
016:        import com.technoetic.xplanner.db.TaskQueryHelper;
017:        import com.technoetic.xplanner.domain.Person;
018:        import com.technoetic.xplanner.domain.Project;
019:        import com.technoetic.xplanner.domain.Task;
020:        import com.technoetic.xplanner.domain.UserStory;
021:        import com.technoetic.xplanner.util.TimeGenerator;
022:
023:        /**
024:         * User: Mateusz Prokopowicz
025:         * Date: Apr 19, 2005
026:         * Time: 1:34:22 PM
027:         */
028:        public class MissingTimeEntryNotifier implements 
029:                com.technoetic.xplanner.Command {
030:            private static Logger log = Logger
031:                    .getLogger(MissingTimeEntryNotifier.class);
032:
033:            public static final String EMAIL_TASK_HEADER = "iteration.metrics.tableheading.task";
034:            public static final String EMAIL_STORY_HEADER = "iteration.metrics.tableheading.story";
035:            public static final String SUBJECT_FOR_ACCEPTORS = "job.emailnotifier.subjectForAcceptors";
036:            public static final String SUBJECT_FOR_PROJECT_LEADS = "job.emailnotifier.subjectForProjectLeeds";
037:            public static final String EMAIL_BODY_HEADER_FOR_ACCEPTORS = "job.emailnotifier.bodyHeaderForAcceptors";
038:            public static final String EMAIL_BODY_HEADER_FOR_PROJECT_LEADERS = "job.emailnotifier.bodyheaderForProjectLeeds";
039:            public static final String EMAIL_BODY_FOOTER = "job.emailnotifier.bodyFooter";
040:
041:            private TaskQueryHelper taskQueryHelper;
042:            private EmailNotificationSupport emailNotificationSupport;
043:            private TimeGenerator timeGenerator;
044:
045:            public void setTimeGenerator(TimeGenerator timeGenerator) {
046:                this .timeGenerator = timeGenerator;
047:            }
048:
049:            public MissingTimeEntryNotifier(TaskQueryHelper taskQueryHelper,
050:                    EmailNotificationSupport emailNotificationSupport) {
051:                this .taskQueryHelper = taskQueryHelper;
052:                this .emailNotificationSupport = emailNotificationSupport;
053:            }
054:
055:            public void sendMissingTimeEntryReportToLeads(Date endDate) {
056:                Collection col;
057:                HashMap notificationEmails = new HashMap();
058:                col = taskQueryHelper.getProjectLeedsEmailNotification(endDate);
059:                for (Iterator iterator = col.iterator(); iterator.hasNext();) {
060:                    Object[] objects = (Object[]) iterator.next();
061:                    Task task = (Task) objects[0];
062:                    UserStory story = (UserStory) objects[1];
063:                    Person receiver = (Person) objects[2];
064:                    Person acceptor = (Person) objects[3];
065:
066:                    emailNotificationSupport.compileEmail(notificationEmails,
067:                            receiver.getId(), acceptor, task, story);
068:                }
069:                emailNotificationSupport.sendNotifications(notificationEmails,
070:                        EMAIL_BODY_HEADER_FOR_PROJECT_LEADERS,
071:                        SUBJECT_FOR_PROJECT_LEADS);
072:                log.debug("Notifications have been sent to project leads.");
073:            }
074:
075:            public void sendMissingTimeEntryReminderToAcceptors(Date endDate) {
076:                Map projectsToBeNotified = new HashMap();
077:                Map notificationEmails = new HashMap();
078:                Collection col = taskQueryHelper
079:                        .getTaskAcceptorsEmailNotification(endDate);
080:                for (Iterator it = col.iterator(); it.hasNext();) {
081:                    Object[] objects = (Object[]) it.next();
082:                    Task task = (Task) objects[0];
083:                    UserStory story = (UserStory) objects[1];
084:                    Project project = (Project) objects[2];
085:                    if (emailNotificationSupport.isProjectToBeNotified(
086:                            projectsToBeNotified, project)) {
087:                        emailNotificationSupport.compileEmail(
088:                                notificationEmails, task.getAcceptorId(), null,
089:                                task, story);
090:                    }
091:                }
092:                emailNotificationSupport.sendNotifications(notificationEmails,
093:                        EMAIL_BODY_HEADER_FOR_ACCEPTORS, SUBJECT_FOR_ACCEPTORS);
094:                log.debug("Notifications have been sent to acceptors.");
095:            }
096:
097:            public void execute() {
098:                //fixme the notifier should be configured with a time window to check for idle started tasks. Right now we hard code the previous day which may not be the right day if the job schedule is changed and if team is distributed
099:                Date yesterdayMidnight = TimeGenerator.shiftDate(timeGenerator
100:                        .getTodaysMidnight(), Calendar.DATE, -1);
101:                log
102:                        .debug("Send notification for tasks with no time entry after "
103:                                + yesterdayMidnight);
104:                sendMissingTimeEntryReminderToAcceptors(yesterdayMidnight);
105:                sendMissingTimeEntryReportToLeads(yesterdayMidnight);
106:            }
107:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.