KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > notification > CmsNotificationCause


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/notification/CmsNotificationCause.java,v $
3  * Date : $Date: 2006/03/27 14:52:46 $
4  * Version: $Revision: 1.2 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (C) 2002 - 2004 Alkacon Software (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, 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.notification;
33
34 import org.opencms.util.CmsUUID;
35
36 import java.io.Serializable JavaDoc;
37
38 /**
39  * Objects of this class are serialized in the additional infos of a user to store, which resources were
40  * already confirmed by the user.
41  * This class is the counterpart to <code>{@link org.opencms.notification.CmsExtendedNotificationCause}</code>, to be used
42  * for serialization in the AdditionalInfos of a <code>{@link org.opencms.file.CmsUser}</code>, and therefore only
43  * contains the essential information
44  * <p>
45  *
46  * @author Jan Baudisch
47  *
48  */

49 public class CmsNotificationCause implements Serializable JavaDoc {
50
51     /** Serial version UID required for safe serialization. */
52     private static final long serialVersionUID = 257325098377830418L;
53
54     /** The reason that the resource occures in the notification. */
55     private int m_cause;
56
57     /** The resource. */
58     private CmsUUID m_resourceId;
59
60     /**
61      * Creates a new CmsNotificationResourceInfo.<p>
62      *
63      * @param resource the specific resource
64      * @param cause that the resource occures in the notification
65      */

66     public CmsNotificationCause(CmsUUID resource, int cause) {
67
68         m_resourceId = resource;
69         m_cause = cause;
70     }
71
72     /**
73      *
74      * @see java.lang.Object#hashCode()
75      */

76     public int hashCode() {
77
78         return m_cause + m_resourceId.hashCode();
79     }
80
81     /**
82      * Returns true if the Object equals to the corresponding CmsNotificationCause, that means a notification cause
83      * with the same resource and cause.
84      *
85      * @return true if the resource info is equal to a notification cause or resource info with the same resource and cause
86      *
87      * @param o the object to check for equality
88      *
89      * @see org.opencms.notification.CmsExtendedNotificationCause#equals(java.lang.Object)
90      */

91     public boolean equals(Object JavaDoc o) {
92
93         if (!(o instanceof CmsExtendedNotificationCause) || !(o instanceof CmsNotificationCause)) {
94             return false;
95         }
96         return hashCode() == o.hashCode();
97     }
98
99     /**
100      * Returns the cause.<p>
101      *
102      * @return the cause
103      */

104     public int getCause() {
105
106         return m_cause;
107     }
108
109     /**
110      * Returns the resource.<p>
111      *
112      * @return the resource
113      */

114     public CmsUUID getResourceId() {
115
116         return m_resourceId;
117     }
118
119     /**
120      * Sets the cause.<p>
121      *
122      * @param cause the cause to set
123      */

124     public void setCause(int cause) {
125
126         m_cause = cause;
127     }
128
129     /**
130      * Sets the resource.<p>
131      *
132      * @param resourceId the resource to set
133      */

134     public void setResourceId(CmsUUID resourceId) {
135
136         m_resourceId = resourceId;
137     }
138 }
139
Popular Tags