Source Code Cross Referenced for ImapMailControllerImpl.java in  » Chat » claros-intouch » org » claros » intouch » webmail » controllers » 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 » Chat » claros intouch » org.claros.intouch.webmail.controllers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.claros.intouch.webmail.controllers;
002:
003:        import javax.mail.Message;
004:
005:        import org.claros.commons.auth.models.AuthProfile;
006:        import org.claros.commons.mail.models.ConnectionMetaHandler;
007:        import org.claros.commons.mail.models.ConnectionProfile;
008:        import org.claros.commons.mail.models.Email;
009:        import org.claros.commons.mail.parser.MessageParser;
010:        import org.claros.commons.mail.protocols.ImapProtocolImpl;
011:        import org.claros.commons.mail.protocols.Protocol;
012:        import org.claros.commons.mail.protocols.ProtocolFactory;
013:        import org.claros.intouch.webmail.models.MsgDbObject;
014:
015:        /**
016:         * @author Umut Gokbayrak
017:         */
018:        public class ImapMailControllerImpl implements  MailController {
019:            //	private static Log log = LogFactory.getLog(DbMailController.class);
020:            private AuthProfile auth;
021:            private ConnectionProfile profile;
022:            private ConnectionMetaHandler handler;
023:            private String folder;
024:
025:            private ImapMailControllerImpl() {
026:                super ();
027:            }
028:
029:            public ImapMailControllerImpl(AuthProfile auth,
030:                    ConnectionProfile profile, ConnectionMetaHandler handler,
031:                    String folder) {
032:                this .auth = auth;
033:                this .profile = profile;
034:                this .handler = handler;
035:                this .folder = folder;
036:            }
037:
038:            /* (non-Javadoc)
039:             * @see org.claros.groupware.webmail.controllers.MailController#getEmailById(java.lang.Long)
040:             */
041:            public Email getEmailById(Long emailId) throws Exception {
042:                ProtocolFactory factory = new ProtocolFactory(profile, auth,
043:                        handler);
044:                ImapProtocolImpl protocol = (ImapProtocolImpl) factory
045:                        .getProtocol(folder);
046:                Message msg = protocol.getMessage(emailId.intValue());
047:                /*
048:                if (!msg.getFolder().isOpen()) {
049:                	msg.getFolder().open(Constants.CONNECTION_READ_WRITE);
050:                }
051:                 */
052:                Email email = MessageParser.parseMessage(msg);
053:                //		msg.getFolder().close(true);
054:                email.setMsgId(emailId);
055:                return email;
056:            }
057:
058:            /* (non-Javadoc)
059:             * @see org.claros.groupware.webmail.controllers.MailController#deleteEmail(java.lang.Long)
060:             */
061:            public void deleteEmail(Long emailId) throws Exception {
062:                ProtocolFactory factory = new ProtocolFactory(profile, auth,
063:                        handler);
064:                Protocol protocol = factory.getProtocol(folder);
065:                protocol.deleteMessages(new int[] { emailId.intValue() });
066:            }
067:
068:            /* (non-Javadoc)
069:             * @see org.claros.groupware.webmail.controllers.MailController#moveEmail(java.lang.Long, java.lang.String)
070:             */
071:            public void moveEmail(Long msgId, String destFolder)
072:                    throws Exception {
073:                ProtocolFactory factory = new ProtocolFactory(profile, auth,
074:                        handler);
075:                ImapProtocolImpl protocol = (ImapProtocolImpl) factory
076:                        .getImap(folder);
077:                protocol.moveEmail(msgId, destFolder);
078:            }
079:
080:            /* (non-Javadoc)
081:             * @see org.claros.groupware.webmail.controllers.MailController#appendEmail(org.claros.groupware.webmail.models.EmailDbItem)
082:             */
083:            public void appendEmail(MsgDbObject item) throws Exception {
084:                ProtocolFactory factory = new ProtocolFactory(profile, auth,
085:                        handler);
086:                ImapProtocolImpl protocol = (ImapProtocolImpl) factory
087:                        .getImap(folder);
088:                protocol.appendEmail(item.getEmail());
089:            }
090:
091:            /* (non-Javadoc)
092:             * @see org.claros.groupware.webmail.controllers.MailController#markAsRead(java.lang.Long)
093:             */
094:            public void markAsRead(Long msgId) throws Exception {
095:                ProtocolFactory factory = new ProtocolFactory(profile, auth,
096:                        handler);
097:                ImapProtocolImpl protocol = (ImapProtocolImpl) factory
098:                        .getImap(folder);
099:                protocol.markAsRead(msgId);
100:            }
101:
102:            /* (non-Javadoc)
103:             * @see org.claros.groupware.webmail.controllers.MailController#deleteEmails(int[])
104:             */
105:            public void deleteEmails(int[] msgs) throws Exception {
106:                ProtocolFactory factory = new ProtocolFactory(profile, auth,
107:                        handler);
108:                ImapProtocolImpl protocol = (ImapProtocolImpl) factory
109:                        .getImap(folder);
110:                protocol.deleteMessages(msgs);
111:            }
112:
113:            /**
114:             * 
115:             */
116:            public void moveEmails(int[] msgs, String destFolder)
117:                    throws Exception {
118:                ProtocolFactory factory = new ProtocolFactory(profile, auth,
119:                        handler);
120:                ImapProtocolImpl protocol = (ImapProtocolImpl) factory
121:                        .getImap(folder);
122:                protocol.moveEmails(msgs, destFolder);
123:            }
124:
125:            /**
126:             * 
127:             */
128:            public void moveEmails(int[] msgs, String destFolders[])
129:                    throws Exception {
130:                ProtocolFactory factory = new ProtocolFactory(profile, auth,
131:                        handler);
132:                ImapProtocolImpl protocol = (ImapProtocolImpl) factory
133:                        .getImap(folder);
134:                protocol.moveEmails(msgs, destFolders);
135:            }
136:
137:            /**
138:             * 
139:             */
140:            public void markAsDeleted(int[] ids) throws Exception {
141:                ProtocolFactory factory = new ProtocolFactory(profile, auth,
142:                        handler);
143:                ImapProtocolImpl protocol = (ImapProtocolImpl) factory
144:                        .getImap(folder);
145:                protocol.flagAsDeleted(ids);
146:            }
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.