File Source: WeblogEntryComment.java
/*
P/P * Method: void readObject(ObjectInputStream)
*
* Preconditions:
* Param_1 != null
*
* Presumptions:
* init'ed(org.apache.openjpa.enhance.PersistenceCapable.DESERIALIZED)
*
* Postconditions:
* Param_0.pcDetachedState == org.apache.openjpa.enhance.PersistenceCapable.DESERIALIZED
* (soft) init'ed(Param_0.pcDetachedState)
*/
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. The ASF licenses this file to You
4 * under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. For additional information regarding
15 * copyright in this work, please see the NOTICE file in the top level
16 * directory of this distribution.
17 */
18
19 package org.apache.roller.weblogger.pojos;
20
21 import java.io.Serializable;
22 import java.sql.Timestamp;
23 import org.apache.commons.lang.builder.EqualsBuilder;
24 import org.apache.commons.lang.builder.HashCodeBuilder;
25 import org.apache.roller.util.UUIDGenerator;
26
27
28 /**
29 * WeblogEntry comment bean.
30 */
31 public class WeblogEntryComment implements Serializable {
32
33 public static final long serialVersionUID = -6668122596726478462L;
34
35 // status options
36 public static final String APPROVED = "APPROVED";
37 public static final String DISAPPROVED = "DISAPPROVED";
38 public static final String SPAM = "SPAM";
39 public static final String PENDING = "PENDING";
40
41 // attributes
42 private String id = UUIDGenerator.generateUUID();
43 private String name = null;
44 private String email = null;
45 private String url = null;
46 private String content = null;
47 private Timestamp postTime = null;
48 private String status = APPROVED;
49 private Boolean notify = Boolean.FALSE;
50 private String remoteHost = null;
51 private String referrer = null;
52 private String userAgent = null;
53 private String plugins = null;
54 private String contentType = "text/plain";
55
56
57 // associations
58 private WeblogEntry weblogEntry = null;
59
60
/*
P/P * Method: void org.apache.roller.weblogger.pojos.WeblogEntryComment()
*
* Presumptions:
* init'ed(java.lang.Boolean.FALSE)
*
* Postconditions:
* this.content == null
* this.email == null
* this.name == null
* this.plugins == null
* this.postTime == null
* this.referrer == null
* this.remoteHost == null
* this.url == null
* this.userAgent == null
* this.weblogEntry == null
* ...
*/
61 public WeblogEntryComment() {}
62
63
64 /**
65 * Database ID of comment
66 */
67 public String getId() {
/*
P/P * Method: String pcgetId()
*
* Preconditions:
* init'ed(this.id)
*
* Postconditions:
* return_value == this.id
* init'ed(return_value)
*/
68 return this.id;
69 }
70
71 /**
72 * Database ID of comment
73 */
74 public void setId(String id) {
/*
P/P * Method: void pcsetId(String)
*
* Postconditions:
* this.id == Param_1
* init'ed(this.id)
*/
75 this.id = id;
76 }
77
78
79 /**
80 * Weblog entry associated with comment.
81 */
82 public WeblogEntry getWeblogEntry() {
/*
P/P * Method: WeblogEntry pcgetWeblogEntry()
*
* Preconditions:
* init'ed(this.weblogEntry)
*
* Postconditions:
* return_value == this.weblogEntry
* init'ed(return_value)
*/
83 return weblogEntry;
84 }
85
86 /**
87 * Weblog entry assocaited with comment
88 */
89 public void setWeblogEntry(WeblogEntry entry) {
/*
P/P * Method: void pcsetWeblogEntry(WeblogEntry)
*
* Postconditions:
* this.weblogEntry == Param_1
* init'ed(this.weblogEntry)
*/
90 weblogEntry = entry;
91 }
92
93
94 /**
95 * Name of person who wrote comment.
96 */
97 public String getName() {
/*
P/P * Method: String pcgetName()
*
* Preconditions:
* init'ed(this.name)
*
* Postconditions:
* return_value == this.name
* init'ed(return_value)
*/
98 return this.name;
99 }
100
101 /**
102 * Name of person who wrote comment.
103 */
104 public void setName(String name) {
/*
P/P * Method: void pcsetName(String)
*
* Postconditions:
* this.name == Param_1
* init'ed(this.name)
*/
105 this.name = name;
106 }
107
108
109 /**
110 * Email of person who wrote comment.
111 */
112 public String getEmail() {
/*
P/P * Method: String pcgetEmail()
*
* Preconditions:
* init'ed(this.email)
*
* Postconditions:
* return_value == this.email
* init'ed(return_value)
*/
113 return this.email;
114 }
115
116 /**
117 * Email of person who wrote comment.
118 */
119 public void setEmail(String email) {
/*
P/P * Method: void pcsetEmail(String)
*
* Postconditions:
* this.email == Param_1
* init'ed(this.email)
*/
120 this.email = email;
121 }
122
123
124 /**
125 * URL of person who wrote comment.
126 */
127 public String getUrl() {
/*
P/P * Method: String pcgetUrl()
*
* Preconditions:
* init'ed(this.url)
*
* Postconditions:
* return_value == this.url
* init'ed(return_value)
*/
128 return this.url;
129 }
130
131 /**
132 * URL of person who wrote comment.
133 */
134 public void setUrl(String url) {
/*
P/P * Method: void pcsetUrl(String)
*
* Postconditions:
* this.url == Param_1
* init'ed(this.url)
*/
135 this.url = url;
136 }
137
138
139 /**
140 * Content of comment.
141 */
142 public String getContent() {
/*
P/P * Method: String pcgetContent()
*
* Preconditions:
* init'ed(this.content)
*
* Postconditions:
* return_value == this.content
* init'ed(return_value)
*/
143 return this.content;
144 }
145
146 /**
147 * Content of comment.
148 */
149 public void setContent(String content) {
/*
P/P * Method: void pcsetContent(String)
*
* Postconditions:
* this.content == Param_1
* init'ed(this.content)
*/
150 this.content = content;
151 }
152
153
154 /**
155 * Time that comment was posted.
156 */
157 public Timestamp getPostTime() {
/*
P/P * Method: Timestamp pcgetPostTime()
*
* Preconditions:
* init'ed(this.postTime)
*
* Postconditions:
* return_value == this.postTime
* init'ed(return_value)
*/
158 return this.postTime;
159 }
160
161 /**
162 * Time that comment was posted.
163 */
164 public void setPostTime(Timestamp postTime) {
/*
P/P * Method: void pcsetPostTime(Timestamp)
*
* Postconditions:
* this.postTime == Param_1
* init'ed(this.postTime)
*/
165 this.postTime = postTime;
166 }
167
168
169 /**
170 * Status of the comment, i.e. APPROVED, SPAM, PENDING, etc.
171 */
172 public String getStatus() {
/*
P/P * Method: String pcgetStatus()
*
* Preconditions:
* init'ed(this.status)
*
* Postconditions:
* return_value == this.status
* init'ed(return_value)
*/
173 return status;
174 }
175
176 /**
177 * Status of the comment, i.e. APPROVED, SPAM, PENDING, etc.
178 */
179 public void setStatus(String status) {
/*
P/P * Method: void pcsetStatus(String)
*
* Postconditions:
* this.status == Param_1
* init'ed(this.status)
*/
180 this.status = status;
181 }
182
183
184 /**
185 * True if person who wrote comment wishes to be notified of new comments
186 * on the same weblog entry.
187 */
188 public Boolean getNotify() {
/*
P/P * Method: Boolean pcgetNotify()
*
* Preconditions:
* init'ed(this.notify)
*
* Postconditions:
* return_value == this.notify
* init'ed(return_value)
*/
189 return this.notify;
190 }
191
192 /**
193 * True if person who wrote comment wishes to be notified of new comments
194 * on the same weblog entry.
195 */
196 public void setNotify(Boolean notify) {
/*
P/P * Method: void pcsetNotify(Boolean)
*
* Postconditions:
* this.notify == Param_1
* init'ed(this.notify)
*/
197 this.notify = notify;
198 }
199
200
201 /**
202 * Host name or IP of person who wrote comment.
203 */
204 public String getRemoteHost() {
/*
P/P * Method: String pcgetRemoteHost()
*
* Preconditions:
* init'ed(this.remoteHost)
*
* Postconditions:
* return_value == this.remoteHost
* init'ed(return_value)
*/
205 return this.remoteHost;
206 }
207
208 /**
209 * Host name or IP of person who wrote comment.
210 */
211 public void setRemoteHost(String remoteHost) {
/*
P/P * Method: void pcsetRemoteHost(String)
*
* Postconditions:
* this.remoteHost == Param_1
* init'ed(this.remoteHost)
*/
212 this.remoteHost = remoteHost;
213 }
214
215
216 /**
217 * HTTP referrer from comment post request
218 */
219 public String getReferrer() {
/*
P/P * Method: String pcgetReferrer()
*
* Preconditions:
* init'ed(this.referrer)
*
* Postconditions:
* return_value == this.referrer
* init'ed(return_value)
*/
220 return referrer;
221 }
222
223 /**
224 * HTTP referrer from comment post request
225 */
226 public void setReferrer(String referrer) {
/*
P/P * Method: void pcsetReferrer(String)
*
* Postconditions:
* this.referrer == Param_1
* init'ed(this.referrer)
*/
227 this.referrer = referrer;
228 }
229
230
231 /**
232 * HTTP user-agent from comment post request
233 */
234 public String getUserAgent() {
/*
P/P * Method: String pcgetUserAgent()
*
* Preconditions:
* init'ed(this.userAgent)
*
* Postconditions:
* return_value == this.userAgent
* init'ed(return_value)
*/
235 return userAgent;
236 }
237
238 /**
239 * HTTP user-agent from comment post request
240 */
241 public void setUserAgent(String userAgent) {
/*
P/P * Method: void pcsetUserAgent(String)
*
* Postconditions:
* this.userAgent == Param_1
* init'ed(this.userAgent)
*/
242 this.userAgent = userAgent;
243 }
244
245
246 /**
247 * Comma separated list of comment plugins to apply.
248 */
249 public String getPlugins() {
/*
P/P * Method: String pcgetPlugins()
*
* Preconditions:
* init'ed(this.plugins)
*
* Postconditions:
* return_value == this.plugins
* init'ed(return_value)
*/
250 return plugins;
251 }
252
253 /**
254 * Comma separated list of comment plugins to apply.
255 */
256 public void setPlugins(String plugins) {
/*
P/P * Method: void pcsetPlugins(String)
*
* Postconditions:
* this.plugins == Param_1
* init'ed(this.plugins)
*/
257 this.plugins = plugins;
258 }
259
260
261 /**
262 * The content-type of the comment.
263 */
264 public String getContentType() {
/*
P/P * Method: String pcgetContentType()
*
* Preconditions:
* init'ed(this.contentType)
*
* Postconditions:
* return_value == this.contentType
* init'ed(return_value)
*/
265 return contentType;
266 }
267
268 /**
269 * The content-type of the comment.
270 */
271 public void setContentType(String contentType) {
/*
P/P * Method: void pcsetContentType(String)
*
* Postconditions:
* this.contentType == Param_1
* init'ed(this.contentType)
*/
272 this.contentType = contentType;
273 }
274
275
276 /**
277 * Indicates that weblog owner considers this comment to be spam.
278 */
279 public Boolean getSpam() {
/*
P/P * Method: Boolean getSpam()
*
* Preconditions:
* init'ed(this.status)
*
* Postconditions:
* return_value == &new Boolean(getSpam#1)
* new Boolean(getSpam#1) num objects == 1
*/
280 return new Boolean(SPAM.equals(this.status));
281 }
282
283
284 /**
285 * True if comment has is pending moderator approval.
286 */
287 public Boolean getPending() {
/*
P/P * Method: Boolean getPending()
*
* Preconditions:
* init'ed(this.status)
*
* Postconditions:
* return_value == &new Boolean(getPending#1)
* new Boolean(getPending#1) num objects == 1
*/
288 return new Boolean(PENDING.equals(this.status));
289 }
290
291
292 /**
293 * Indicates that comment has been approved for display on weblog.
294 */
295 public Boolean getApproved() {
/*
P/P * Method: Boolean getApproved()
*
* Preconditions:
* init'ed(this.status)
*
* Postconditions:
* return_value == &new Boolean(getApproved#1)
* new Boolean(getApproved#1) num objects == 1
*/
296 return new Boolean(APPROVED.equals(this.status));
297 }
298
299
300 /**
301 * Timestamp to be used to formulate comment permlink.
302 */
303 public String getTimestamp() {
/*
P/P * Method: String getTimestamp()
*
* Preconditions:
* init'ed(this.postTime)
*
* Postconditions:
* init'ed(return_value)
*
* Test Vectors:
* this.postTime: Addr_Set{null}, Inverse{null}
*/
304 if (postTime != null) {
305 return Long.toString(postTime.getTime());
306 }
307 return null;
308 }
309
310 //------------------------------------------------------- Good citizenship
311
312 public String toString() {
/*
P/P * Method: String toString()
*
* Preconditions:
* init'ed(this.email)
* init'ed(this.id)
* init'ed(this.name)
* init'ed(this.postTime)
*
* Postconditions:
* java.lang.StringBuffer:toString(...)._tainted == this.email._tainted | this.id._tainted | this.name._tainted
* init'ed(java.lang.StringBuffer:toString(...)._tainted)
* return_value == &java.lang.StringBuffer:toString(...)
*/
313 StringBuffer buf = new StringBuffer();
314 buf.append("{");
315 buf.append(this.id);
316 buf.append(", ").append(this.name);
317 buf.append(", ").append(this.email);
318 buf.append(", ").append(this.postTime);
319 buf.append("}");
320 return buf.toString();
321 }
322
323 public boolean equals(Object other) {
/*
P/P * Method: bool equals(Object)
*
* Preconditions:
* (soft) init'ed(other.name)
* (soft) init'ed(other.pcStateManager)
* (soft) init'ed(other.postTime)
* (soft) init'ed(other.weblogEntry)
* (soft) pcInheritedFieldCount <= 232-14
* (soft) init'ed(this.name)
* (soft) init'ed(this.pcStateManager)
* (soft) init'ed(this.postTime)
* (soft) init'ed(this.weblogEntry)
*
* Presumptions:
* org.apache.commons.lang.builder.EqualsBuilder:append(...)@327 != null
*
* Postconditions:
* init'ed(return_value)
*
* Test Vectors:
* other == this: {0}, {1}
*/
324 if (other == this) return true;
325 if (other instanceof WeblogEntryComment != true) return false;
326 WeblogEntryComment o = (WeblogEntryComment)other;
327 return new EqualsBuilder()
328 .append(getName(), o.getName())
329 .append(getPostTime(), o.getPostTime())
330 .append(getWeblogEntry(), o.getWeblogEntry())
331 .isEquals();
332 }
333
334 public int hashCode() {
/*
P/P * Method: int hashCode()
*
* Preconditions:
* init'ed(this.name)
* init'ed(this.pcStateManager)
* init'ed(this.postTime)
* init'ed(this.weblogEntry)
* (soft) pcInheritedFieldCount <= 232-14
*
* Presumptions:
* org.apache.commons.lang.builder.HashCodeBuilder:append(...)@335 != null
*
* Postconditions:
* init'ed(return_value)
*/
335 return new HashCodeBuilder()
336 .append(getName())
337 .append(getPostTime())
338 .append(getWeblogEntry())
339 .toHashCode();
340 }
341
342 }
+ 343 Other Messages
SofCheck Inspector Build Version : 2.18479
| WeblogEntryComment.java |
2009-Jan-02 14:24:46 |
| WeblogEntryComment.class |
2009-Sep-04 03:12:38 |