001: /**
002: * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
003: *
004: * This program is free software; you can redistribute it and/or modify
005: * it under the terms of the latest version of the GNU Lesser General
006: * Public License as published by the Free Software Foundation;
007: *
008: * This program is distributed in the hope that it will be useful,
009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011: * GNU Lesser General Public License for more details.
012: *
013: * You should have received a copy of the GNU Lesser General Public License
014: * along with this program (LICENSE.txt); if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
016: */package org.jamwiki.model;
017:
018: import java.sql.Timestamp;
019: import org.jamwiki.utils.WikiLogger;
020:
021: /**
022: * Provides an object representing a Wiki recent change.
023: */
024: public class RecentChange {
025:
026: private static final WikiLogger logger = WikiLogger
027: .getLogger(RecentChange.class.getName());
028: private Integer authorId = null;
029: private String authorName = null;
030: private String editComment = null;
031: private Timestamp editDate = null;
032: private int editType = -1;
033: private Integer previousTopicVersionId = null;
034: private int topicId = -1;
035: private String topicName = null;
036: private int topicVersionId = -1;
037: private String virtualWiki = null;
038:
039: /**
040: *
041: */
042: public RecentChange() {
043: }
044:
045: /**
046: *
047: */
048: public RecentChange(Topic topic, TopicVersion topicVersion,
049: String authorName) {
050: this .topicId = topic.getTopicId();
051: this .topicName = topic.getName();
052: this .topicVersionId = topicVersion.getTopicVersionId();
053: this .previousTopicVersionId = topicVersion
054: .getPreviousTopicVersionId();
055: this .authorId = topicVersion.getAuthorId();
056: this .authorName = authorName;
057: this .editComment = topicVersion.getEditComment();
058: this .editDate = topicVersion.getEditDate();
059: this .editType = topicVersion.getEditType();
060: this .virtualWiki = topic.getVirtualWiki();
061: }
062:
063: /**
064: *
065: */
066: public Integer getAuthorId() {
067: return this .authorId;
068: }
069:
070: /**
071: *
072: */
073: public void setAuthorId(Integer authorId) {
074: this .authorId = authorId;
075: }
076:
077: /**
078: *
079: */
080: public String getAuthorName() {
081: return this .authorName;
082: }
083:
084: /**
085: *
086: */
087: public void setAuthorName(String authorName) {
088: this .authorName = authorName;
089: }
090:
091: /**
092: *
093: */
094: public String getChangeTypeNotification() {
095: String changeTypeNotification = "";
096: if (this .previousTopicVersionId == null) {
097: changeTypeNotification += "n";
098: }
099: if (this .editType == TopicVersion.EDIT_MINOR) {
100: changeTypeNotification += "m";
101: }
102: if (this .editType == TopicVersion.EDIT_DELETE) {
103: changeTypeNotification += "d";
104: }
105: if (this .editType == TopicVersion.EDIT_UNDELETE) {
106: changeTypeNotification += "u";
107: }
108: return changeTypeNotification;
109: }
110:
111: /**
112: *
113: */
114: public boolean getDelete() {
115: return this .editType == TopicVersion.EDIT_DELETE;
116: }
117:
118: /**
119: *
120: */
121: public String getEditComment() {
122: return this .editComment;
123: }
124:
125: /**
126: *
127: */
128: public void setEditComment(String editComment) {
129: this .editComment = editComment;
130: }
131:
132: /**
133: *
134: */
135: public Timestamp getEditDate() {
136: return this .editDate;
137: }
138:
139: /**
140: *
141: */
142: public void setEditDate(Timestamp editDate) {
143: this .editDate = editDate;
144: }
145:
146: /**
147: *
148: */
149: public int getEditType() {
150: return this .editType;
151: }
152:
153: /**
154: *
155: */
156: public void setEditType(int editType) {
157: this .editType = editType;
158: }
159:
160: /**
161: *
162: */
163: public boolean getMinor() {
164: return this .editType == TopicVersion.EDIT_MINOR;
165: }
166:
167: /**
168: *
169: */
170: public boolean getMove() {
171: return this .editType == TopicVersion.EDIT_MOVE;
172: }
173:
174: /**
175: *
176: */
177: public boolean getNormal() {
178: return this .editType == TopicVersion.EDIT_NORMAL;
179: }
180:
181: /**
182: *
183: */
184: public Integer getPreviousTopicVersionId() {
185: return this .previousTopicVersionId;
186: }
187:
188: /**
189: *
190: */
191: public void setPreviousTopicVersionId(Integer previousTopicVersionId) {
192: this .previousTopicVersionId = previousTopicVersionId;
193: }
194:
195: /**
196: *
197: */
198: public int getTopicId() {
199: return this .topicId;
200: }
201:
202: /**
203: *
204: */
205: public void setTopicId(int topicId) {
206: this .topicId = topicId;
207: }
208:
209: /**
210: *
211: */
212: public String getTopicName() {
213: return this .topicName;
214: }
215:
216: /**
217: *
218: */
219: public void setTopicName(String topicName) {
220: this .topicName = topicName;
221: }
222:
223: /**
224: *
225: */
226: public int getTopicVersionId() {
227: return this .topicVersionId;
228: }
229:
230: /**
231: *
232: */
233: public void setTopicVersionId(int topicVersionId) {
234: this .topicVersionId = topicVersionId;
235: }
236:
237: /**
238: *
239: */
240: public boolean getUndelete() {
241: return this .editType == TopicVersion.EDIT_UNDELETE;
242: }
243:
244: /**
245: *
246: */
247: public String getVirtualWiki() {
248: return this .virtualWiki;
249: }
250:
251: /**
252: *
253: */
254: public void setVirtualWiki(String virtualWiki) {
255: this.virtualWiki = virtualWiki;
256: }
257: }
|