Source Code Cross Referenced for TaskBean.java in  » Portal » Open-Portal » com » sun » portal » wireless » taglibs » cal » 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 » Portal » Open Portal » com.sun.portal.wireless.taglibs.cal 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: TaskBean.java,v 1.22 2005/09/21 10:51:11 dg154973 Exp $
003:         * Copyright 2003 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.wireless.taglibs.cal;
014:
015:        import com.sun.comclient.calendar.VTodo;
016:        import com.sun.comclient.calendar.DateTime;
017:        import com.sun.portal.wireless.taglibs.base.Util;
018:        import com.sun.portal.log.common.PortalLogger;
019:
020:        import java.util.logging.Logger;
021:        import java.util.logging.Level;
022:
023:        public class TaskBean extends SchedulingBean implements  Comparable {
024:
025:            private VTodo theTask;
026:            private boolean isDueTime = false;
027:
028:            // Create a logger for this class
029:            private static Logger debugLogger = PortalLogger
030:                    .getLogger(TaskBean.class);
031:
032:            public TaskBean(VTodo task) {
033:                super (task);
034:                this .theTask = task;
035:            }
036:
037:            public VTodo getTask() {
038:                return theTask;
039:            }
040:
041:            /**
042:             * Returns the Todo due date. 
043:             * This method returns same value as getStart() in Component
044:             * <br><br>
045:             * @return DateTime object of the task due date
046:             * @see com.sun.portal.wireless.taglibs.cal.DateTimeTag
047:             */
048:
049:            public DateTime getDueDate() throws Exception {
050:                return theTask.getDueTime();
051:            }
052:
053:            /**
054:             * Does this task have a due date
055:             * <br><br>
056:             * @return true if it has a due date
057:             */
058:            public boolean isValidDueDate() throws Exception {
059:                if (theTask.getDueTime() != null) {
060:                    return true;
061:                } else {
062:                    this .setDueTimeField("false");
063:                    return false;
064:                }
065:            }
066:
067:            /**
068:             * Does this task have a due completion time 
069:             * <br><br>
070:             * @return true if the task has a due completion time
071:             */
072:
073:            public boolean isDueTime() {
074:                return isDueTime;
075:            }
076:
077:            /**
078:             * specifies the due time status for a task
079:             * @param String "true" if this task has a due completion time
080:             * <br><br>
081:             */
082:
083:            public void setDueTimeField(String isdue) {
084:                if (isdue.equalsIgnoreCase("true")) {
085:                    isDueTime = true;
086:                } else {
087:                    isDueTime = false;
088:                }
089:            }
090:
091:            /**
092:             * Sets the status of the task
093:             * @param status status of this task
094:             */
095:
096:            public void setStatus(String status) throws Exception {
097:                if (status != null) {
098:                    theTask.setStatus(status.trim());
099:                }
100:            }
101:
102:            /**
103:             * Returns a DateTime object indicating due time,
104:             * if duetime exists
105:             * <br><br>
106:             * @return true if due time exists
107:             * @throws Exception indicating processing error
108:             * @see com.sun.comclient.calendar.DateTime
109:             */
110:
111:            public String getDueTimeField() throws Exception {
112:                return theTask.getDueTime().toString();
113:            }
114:
115:            /**
116:             * Sets the due date of the todo with the 
117:             * supplied DateTime object
118:             * <br><br>
119:             * @param dtDue due time of the todo
120:             * @throws Exception indicating processing error
121:             */
122:
123:            public void setDueDate(DateTime dtDue) throws Exception {
124:                theTask.setStart(dtDue);
125:                theTask.setDueTime(dtDue);
126:            }
127:
128:            /**
129:             * Returns true is todo status is comleted
130:             * <br><br>
131:             * @return true when todo status is complete
132:             */
133:
134:            public boolean isCompleted() {
135:                try {
136:                    return theTask.isCompleted();
137:                } catch (Exception e) {
138:                    return false;
139:                }
140:            }
141:
142:            /**
143:             * @returns the task as a string.
144:             * <br><br>
145:             */
146:
147:            public String toString() {
148:                return theTask.toString();
149:            }
150:
151:            /**
152:             * Get the id of the todo
153:             * <br><br>
154:             * @return unique id for this todo
155:             * @throws Exception indicating processing error
156:             */
157:
158:            public Object getID() throws Exception {
159:                return theTask.getID();
160:            }
161:
162:            /**
163:             * Checks if the todo is overdue
164:             * @return true if the todo is overdue. default is false.
165:             */
166:
167:            public boolean isOverDue() {
168:                boolean taskOverdue = false;
169:                DateTime dt = new DateTime();
170:                try {
171:                    DateTime taskDT = theTask.getDueTime();
172:                    if (taskDT == null) {
173:                        return taskOverdue;
174:                    }
175:                    if ((taskDT.before(dt)) && (!isCompleted())) {
176:                        taskOverdue = true;
177:                    }
178:                } catch (Exception e) {
179:                    debugLogger.log(Level.INFO, "PSMA_CSPWTC0001", e);
180:                }
181:
182:                return taskOverdue;
183:            }
184:
185:            /**
186:             * This is requied for comparable
187:             */
188:
189:            public int compareTo(Object o) {
190:                int result = -1;
191:                try {
192:                    if (o instanceof  TaskBean) {
193:                        TaskBean taskObj = (TaskBean) o;
194:                        if (isValidDueDate() && taskObj.isValidDueDate()) {
195:                            if (getDueDate().before(taskObj.getDueDate())) {
196:                                result = -1;
197:                                //When returns 0 , TreeSet does not add to the Collection
198:                            } else {
199:                                result = 1;
200:                            }
201:                        }
202:                    }
203:                } catch (Exception ex) {
204:                    ex.printStackTrace();
205:                }
206:                return result;
207:            }
208:
209:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.