KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > newsletter > CmsNewsletterContent


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/newsletter/CmsNewsletterContent.java,v $
3  * Date : $Date: 2006/03/27 14:52:48 $
4  * Version: $Revision: 1.2 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (C) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.newsletter;
33
34 /**
35  * Content for newsletters.<p>
36  *
37  * @author Alexander Kandzior
38  * @author Jan Baudisch
39  */

40 public class CmsNewsletterContent implements I_CmsNewsletterContent {
41
42     /** The output channel for this content. */
43     String JavaDoc m_channel;
44
45     /** The content String. */
46     String JavaDoc m_content;
47
48     /** The order of this content. */
49     int m_order;
50
51     /** The type of this content. */
52     CmsNewsletterContentType m_type;
53
54     /**
55      * Creates a new CmsNewsletterContent instance.<p>
56      *
57      * @param order the order of the newsletter content
58      * @param content the content
59      * @param type the newsletter contents' type
60      */

61     public CmsNewsletterContent(int order, String JavaDoc content, CmsNewsletterContentType type) {
62
63         m_order = order;
64         m_content = content;
65         m_type = type;
66     }
67
68     /**
69      *
70      * @see java.lang.Comparable#compareTo(java.lang.Object)
71      */

72     public int compareTo(Object JavaDoc o) {
73
74         return new Integer JavaDoc(m_order).compareTo(new Integer JavaDoc(((CmsNewsletterContent)o).getOrder()));
75     }
76
77     /**
78      *
79      * @see java.lang.Object#equals(java.lang.Object)
80      */

81     public boolean equals(Object JavaDoc obj) {
82
83         if (!(obj instanceof CmsNewsletterContent)) {
84             return false;
85         }
86         CmsNewsletterContent newsletterContent = (CmsNewsletterContent)obj;
87         if (getOrder() != newsletterContent.getOrder()) {
88             return false;
89         }
90         if (!getContent().equals(newsletterContent.getContent())) {
91             return false;
92         }
93         if (!getChannel().equals(newsletterContent.getChannel())) {
94             return false;
95         }
96         if (!getType().equals(newsletterContent.getType())) {
97             return false;
98         }
99         return true;
100     }
101     
102     /**
103      *
104      * @see java.lang.Object#hashCode()
105      */

106     public int hashCode() {
107         
108         return m_channel.hashCode() + m_content.hashCode() + m_order + m_type.hashCode();
109     }
110
111     /**
112      * @see org.opencms.newsletter.I_CmsNewsletterContent#getChannel()
113      */

114     public String JavaDoc getChannel() {
115
116         return m_channel;
117     }
118
119     /**
120      * @see org.opencms.newsletter.I_CmsNewsletterContent#getContent()
121      */

122     public String JavaDoc getContent() {
123
124         return m_content;
125     }
126
127     /**
128      * @see org.opencms.newsletter.I_CmsNewsletterContent#getOrder()
129      */

130     public int getOrder() {
131
132         return m_order;
133     }
134
135     /**
136      * @see org.opencms.newsletter.I_CmsNewsletterContent#getType()
137      */

138     public CmsNewsletterContentType getType() {
139
140         return m_type;
141     }
142 }
Popular Tags