Source Code Cross Referenced for EMailMessage.java in  » GIS » deegree » org » deegree » framework » 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 » GIS » deegree » org.deegree.framework.mail 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/framework/mail/EMailMessage.java $
002:        /*----------------    FILE HEADER  ------------------------------------------
003:
004:         This file is part of deegree.
005:         Copyright (C) 2001-2008 by:
006:         EXSE, Department of Geography, University of Bonn
007:         http://www.giub.uni-bonn.de/deegree/
008:         lat/lon GmbH
009:         http://www.lat-lon.de
010:
011:         This library is free software; you can redistribute it and/or
012:         modify it under the terms of the GNU Lesser General Public
013:         License as published by the Free Software Foundation; either
014:         version 2.1 of the License, or (at your option) any later version.
015:
016:         This library is distributed in the hope that it will be useful,
017:         but WITHOUT ANY WARRANTY; without even the implied warranty of
018:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019:         Lesser General Public License for more details.
020:
021:         You should have received a copy of the GNU Lesser General Public
022:         License along with this library; if not, write to the Free Software
023:         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024:
025:         Contact:
026:
027:         Andreas Poth
028:         lat/lon GmbH
029:         Aennchenstr. 19
030:         53115 Bonn
031:         Germany
032:         E-Mail: poth@lat-lon.de
033:
034:         Prof. Dr. Klaus Greve
035:         Department of Geography
036:         University of Bonn
037:         Meckenheimer Allee 166
038:         53115 Bonn
039:         Germany
040:         E-Mail: greve@giub.uni-bonn.de
041:
042:        
043:         ---------------------------------------------------------------------------*/
044:        package org.deegree.framework.mail;
045:
046:        /**
047:         * This class encapsulates all the info need to send an email message. This object is passed to the
048:         * MailerEJB sendMail(...) method.
049:         * 
050:         * 
051:         * @author <a href="mailto:tfr@users.sourceforge.net">Torsten Friebe</A>
052:         * @author last edited by: $Author: apoth $
053:         * 
054:         * @version $Revision: 9339 $,$Date: 2007-12-27 04:31:52 -0800 (Thu, 27 Dec 2007) $
055:         */
056:        public class EMailMessage implements  java.io.Serializable, MailMessage {
057:
058:            private String sender;
059:
060:            private String subject;
061:
062:            private String htmlContents;
063:
064:            private String emailReceiver;
065:
066:            private String mimeType;
067:
068:            /**
069:             * Creates an empty email message with the default MIME type plain text.
070:             */
071:            private EMailMessage() {
072:                try {
073:                    this .setMimeType(MailMessage.PLAIN_TEXT);
074:                } catch (Exception ex) {
075:                    // nothing to do
076:                }
077:            }
078:
079:            /**
080:             * Creates a new mail message with MIME type text/plain.
081:             * 
082:             * @param from
083:             *            the sender
084:             * @param to
085:             *            the receiver list
086:             * @param subject
087:             *            the subject
088:             * @param messageBody
089:             *            the content of the message
090:             */
091:            public EMailMessage(String from, String to, String subject,
092:                    String messageBody) {
093:                this ();
094:
095:                this .setSender(from);
096:                this .setReceiver(to);
097:                this .setSubject(subject);
098:                this .setMessageBody(messageBody);
099:            }
100:
101:            /**
102:             * Creates a new mail message with the given MIME type.
103:             * 
104:             * @param from
105:             *            the sender
106:             * @param to
107:             *            the receiver list
108:             * @param subject
109:             *            the subject
110:             * @param messageBody
111:             *            the content of the message
112:             * @param mimeType
113:             *            the MIME type of the message body
114:             * @throws UnknownMimeTypeException
115:             *             if the given mimeType is not supported
116:             */
117:            public EMailMessage(String from, String to, String subject,
118:                    String messageBody, String mimeType)
119:                    throws UnknownMimeTypeException {
120:                this (from, to, subject, messageBody);
121:                this .setMimeType(mimeType);
122:            }
123:
124:            /**
125:             * Returns the state of this message. If sender and receiver are unequal null then this message
126:             * is valid otherwise invalid.
127:             * 
128:             * @return validation state, <code>true</code> if sender and receiver are not
129:             *         <code>null</code>, otherwise <code>false</code>
130:             */
131:            public boolean isValid() {
132:                if (this .getSender() != null && this .getReceiver() != null) {
133:                    return true;
134:                }
135:                return false;
136:            }
137:
138:            /**
139:             * Return mail header including sender, receiver and subject.
140:             * 
141:             * @return string with sender, receiver and subject
142:             */
143:            public String getHeader() {
144:                return ("From:" + this .getSender() + ", To:"
145:                        + this .getReceiver() + ", Subject:" + this .getSubject());
146:            }
147:
148:            /**
149:             * Description of the Method
150:             * 
151:             * @return Description of the Return Value
152:             */
153:            public String toString() {
154:                return ("From:" + this .getSender() + ", To:"
155:                        + this .getReceiver() + ", Subject:" + this .getSubject()
156:                        + ",Body: " + this .getMessageBody());
157:            }
158:
159:            /**
160:             * Method declaration
161:             * 
162:             * @return sender
163:             */
164:            public String getSender() {
165:                return this .sender;
166:            }
167:
168:            /**
169:             * Method declaration
170:             * 
171:             * @return The messageBody value
172:             */
173:            public String getMessageBody() {
174:                return this .htmlContents;
175:            }
176:
177:            /**
178:             * Method declaration
179:             * 
180:             * @return emailReceiver
181:             */
182:            public String getReceiver() {
183:                return this .emailReceiver;
184:            }
185:
186:            /**
187:             * Method declaration
188:             * 
189:             * @param to
190:             */
191:            public void setReceiver(String to) {
192:                this .emailReceiver = to;
193:            }
194:
195:            /**
196:             * Method declaration
197:             * 
198:             * @param message
199:             */
200:            public void setMessageBody(String message) {
201:                this .htmlContents = message;
202:            }
203:
204:            /**
205:             * Method declaration
206:             * 
207:             * @param from
208:             */
209:            public void setSender(String from) {
210:                this .sender = from;
211:            }
212:
213:            /**
214:             * Method declaration
215:             * 
216:             * @param title
217:             */
218:            public void setSubject(String title) {
219:                this .subject = title;
220:            }
221:
222:            /**
223:             * Gets the subject attribute of the EMailMessage object
224:             * 
225:             * @return The subject value
226:             */
227:            public String getSubject() {
228:                return subject;
229:            }
230:
231:            /**
232:             * Sets the mimeType attribute of the EMailMessage object
233:             * 
234:             * @param mimeType
235:             *            The new mimeType value
236:             * @throws UnknownMimeTypeException
237:             *             if the given MIME type is not supported
238:             */
239:            public void setMimeType(String mimeType)
240:                    throws UnknownMimeTypeException {
241:                if (mimeType.equalsIgnoreCase(MailMessage.PLAIN_TEXT)) {
242:                    this .mimeType = mimeType;
243:                } else if (mimeType.equalsIgnoreCase(MailMessage.TEXT_HTML)) {
244:                    this .mimeType = mimeType;
245:                } else {
246:                    throw new UnknownMimeTypeException(getClass().getName(),
247:                            mimeType);
248:                }
249:            }
250:
251:            /**
252:             * Gets the mimeType attribute of the EMailMessage object
253:             * 
254:             * @return The mimeType value
255:             */
256:            public String getMimeType() {
257:                return this.mimeType;
258:            }
259:
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.