001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. The ASF licenses this file to You
004: * under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License. For additional information regarding
015: * copyright in this work, please see the NOTICE file in the top level
016: * directory of this distribution.
017: */
018:
019: package org.apache.roller.ui.rendering.util;
020:
021: import org.apache.roller.pojos.CommentData;
022: import org.apache.roller.pojos.WeblogEntryData;
023: import org.apache.roller.pojos.wrapper.CommentDataWrapper;
024: import org.apache.roller.pojos.wrapper.WeblogEntryDataWrapper;
025:
026: /**
027: * A simple class to represent the comment form displayed on a weblog entry
028: * permalink page. We use this class to manage the interaction with that form.
029: */
030: public class WeblogEntryCommentForm {
031:
032: private boolean error = false;
033: private String message = null;
034:
035: private String name = "";
036: private String email = "";
037: private String url = "";
038: private String content = "";
039: private boolean notify = false;
040:
041: private CommentData previewComment = null;
042:
043: public WeblogEntryCommentForm() {
044: }
045:
046: public void setPreview(CommentData preview) {
047: this .previewComment = preview;
048: setData(preview);
049: }
050:
051: public void setData(CommentData comment) {
052: this .name = comment.getName();
053: this .email = comment.getEmail();
054: this .url = comment.getUrl();
055: this .content = comment.getContent();
056: this .notify = comment.getNotify().booleanValue();
057: }
058:
059: public void setError(String errorMessage) {
060: this .error = true;
061: this .message = errorMessage;
062: }
063:
064: public CommentDataWrapper getPreviewComment() {
065: return CommentDataWrapper.wrap(previewComment);
066: }
067:
068: public boolean isPreview() {
069: return (this .previewComment != null);
070: }
071:
072: public String getName() {
073: return name;
074: }
075:
076: public void setName(String name) {
077: this .name = name;
078: }
079:
080: public String getEmail() {
081: return email;
082: }
083:
084: public void setEmail(String email) {
085: this .email = email;
086: }
087:
088: public String getUrl() {
089: return url;
090: }
091:
092: public void setUrl(String url) {
093: this .url = url;
094: }
095:
096: public String getContent() {
097: return content;
098: }
099:
100: public void setContent(String content) {
101: this .content = content;
102: }
103:
104: public boolean isNotify() {
105: return notify;
106: }
107:
108: public void setNotify(boolean notify) {
109: this .notify = notify;
110: }
111:
112: public boolean isError() {
113: return error;
114: }
115:
116: public void setError(boolean error) {
117: this .error = error;
118: }
119:
120: public String getMessage() {
121: return message;
122: }
123:
124: public void setMessage(String message) {
125: this.message = message;
126: }
127:
128: }
|