1
22
23 package com.liferay.portlet.wiki.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.impl.BaseModelImpl;
28 import com.liferay.portal.util.PropsUtil;
29
30 import com.liferay.portlet.wiki.model.WikiPage;
31
32 import com.liferay.util.Html;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.Date;
41
42
62 public class WikiPageModelImpl extends BaseModelImpl {
63 public static final String TABLE_NAME = "WikiPage";
64 public static final Object[][] TABLE_COLUMNS = {
65 { "uuid_", new Integer(Types.VARCHAR) },
66
67
68 { "pageId", new Integer(Types.BIGINT) },
69
70
71 { "resourcePrimKey", new Integer(Types.BIGINT) },
72
73
74 { "companyId", new Integer(Types.BIGINT) },
75
76
77 { "userId", new Integer(Types.BIGINT) },
78
79
80 { "userName", new Integer(Types.VARCHAR) },
81
82
83 { "createDate", new Integer(Types.TIMESTAMP) },
84
85
86 { "nodeId", new Integer(Types.BIGINT) },
87
88
89 { "title", new Integer(Types.VARCHAR) },
90
91
92 { "version", new Integer(Types.DOUBLE) },
93
94
95 { "content", new Integer(Types.CLOB) },
96
97
98 { "format", new Integer(Types.VARCHAR) },
99
100
101 { "head", new Integer(Types.BOOLEAN) }
102 };
103 public static final String TABLE_SQL_CREATE = "create table WikiPage (uuid_ VARCHAR(75) null,pageId LONG not null primary key,resourcePrimKey LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,nodeId LONG,title VARCHAR(75) null,version DOUBLE,content TEXT null,format VARCHAR(75) null,head BOOLEAN)";
104 public static final String TABLE_SQL_DROP = "drop table WikiPage";
105 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
106 "value.object.finder.cache.enabled.com.liferay.portlet.wiki.model.WikiPage"),
107 true);
108 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
109 "lock.expiration.time.com.liferay.portlet.wiki.model.WikiPage"));
110
111 public WikiPageModelImpl() {
112 }
113
114 public long getPrimaryKey() {
115 return _pageId;
116 }
117
118 public void setPrimaryKey(long pk) {
119 setPageId(pk);
120 }
121
122 public Serializable getPrimaryKeyObj() {
123 return new Long(_pageId);
124 }
125
126 public String getUuid() {
127 return GetterUtil.getString(_uuid);
128 }
129
130 public void setUuid(String uuid) {
131 if ((uuid != null) && (uuid != _uuid)) {
132 _uuid = uuid;
133 }
134 }
135
136 public long getPageId() {
137 return _pageId;
138 }
139
140 public void setPageId(long pageId) {
141 if (pageId != _pageId) {
142 _pageId = pageId;
143 }
144 }
145
146 public long getResourcePrimKey() {
147 return _resourcePrimKey;
148 }
149
150 public void setResourcePrimKey(long resourcePrimKey) {
151 if (resourcePrimKey != _resourcePrimKey) {
152 _resourcePrimKey = resourcePrimKey;
153 }
154 }
155
156 public long getCompanyId() {
157 return _companyId;
158 }
159
160 public void setCompanyId(long companyId) {
161 if (companyId != _companyId) {
162 _companyId = companyId;
163 }
164 }
165
166 public long getUserId() {
167 return _userId;
168 }
169
170 public void setUserId(long userId) {
171 if (userId != _userId) {
172 _userId = userId;
173 }
174 }
175
176 public String getUserName() {
177 return GetterUtil.getString(_userName);
178 }
179
180 public void setUserName(String userName) {
181 if (((userName == null) && (_userName != null)) ||
182 ((userName != null) && (_userName == null)) ||
183 ((userName != null) && (_userName != null) &&
184 !userName.equals(_userName))) {
185 _userName = userName;
186 }
187 }
188
189 public Date getCreateDate() {
190 return _createDate;
191 }
192
193 public void setCreateDate(Date createDate) {
194 if (((createDate == null) && (_createDate != null)) ||
195 ((createDate != null) && (_createDate == null)) ||
196 ((createDate != null) && (_createDate != null) &&
197 !createDate.equals(_createDate))) {
198 _createDate = createDate;
199 }
200 }
201
202 public long getNodeId() {
203 return _nodeId;
204 }
205
206 public void setNodeId(long nodeId) {
207 if (nodeId != _nodeId) {
208 _nodeId = nodeId;
209 }
210 }
211
212 public String getTitle() {
213 return GetterUtil.getString(_title);
214 }
215
216 public void setTitle(String title) {
217 if (((title == null) && (_title != null)) ||
218 ((title != null) && (_title == null)) ||
219 ((title != null) && (_title != null) && !title.equals(_title))) {
220 _title = title;
221 }
222 }
223
224 public double getVersion() {
225 return _version;
226 }
227
228 public void setVersion(double version) {
229 if (version != _version) {
230 _version = version;
231 }
232 }
233
234 public String getContent() {
235 return GetterUtil.getString(_content);
236 }
237
238 public void setContent(String content) {
239 if (((content == null) && (_content != null)) ||
240 ((content != null) && (_content == null)) ||
241 ((content != null) && (_content != null) &&
242 !content.equals(_content))) {
243 _content = content;
244 }
245 }
246
247 public String getFormat() {
248 return GetterUtil.getString(_format);
249 }
250
251 public void setFormat(String format) {
252 if (((format == null) && (_format != null)) ||
253 ((format != null) && (_format == null)) ||
254 ((format != null) && (_format != null) &&
255 !format.equals(_format))) {
256 _format = format;
257 }
258 }
259
260 public boolean getHead() {
261 return _head;
262 }
263
264 public boolean isHead() {
265 return _head;
266 }
267
268 public void setHead(boolean head) {
269 if (head != _head) {
270 _head = head;
271 }
272 }
273
274 public WikiPage toEscapedModel() {
275 if (isEscapedModel()) {
276 return (WikiPage)this;
277 }
278 else {
279 WikiPage model = new WikiPageImpl();
280
281 model.setEscapedModel(true);
282
283 model.setUuid(Html.escape(getUuid()));
284 model.setPageId(getPageId());
285 model.setResourcePrimKey(getResourcePrimKey());
286 model.setCompanyId(getCompanyId());
287 model.setUserId(getUserId());
288 model.setUserName(Html.escape(getUserName()));
289 model.setCreateDate(getCreateDate());
290 model.setNodeId(getNodeId());
291 model.setTitle(Html.escape(getTitle()));
292 model.setVersion(getVersion());
293 model.setContent(Html.escape(getContent()));
294 model.setFormat(Html.escape(getFormat()));
295 model.setHead(getHead());
296
297 model = (WikiPage)Proxy.newProxyInstance(WikiPage.class.getClassLoader(),
298 new Class[] { WikiPage.class },
299 new ReadOnlyBeanHandler(model));
300
301 return model;
302 }
303 }
304
305 public Object clone() {
306 WikiPageImpl clone = new WikiPageImpl();
307
308 clone.setUuid(getUuid());
309 clone.setPageId(getPageId());
310 clone.setResourcePrimKey(getResourcePrimKey());
311 clone.setCompanyId(getCompanyId());
312 clone.setUserId(getUserId());
313 clone.setUserName(getUserName());
314 clone.setCreateDate(getCreateDate());
315 clone.setNodeId(getNodeId());
316 clone.setTitle(getTitle());
317 clone.setVersion(getVersion());
318 clone.setContent(getContent());
319 clone.setFormat(getFormat());
320 clone.setHead(getHead());
321
322 return clone;
323 }
324
325 public int compareTo(Object obj) {
326 if (obj == null) {
327 return -1;
328 }
329
330 WikiPageImpl wikiPage = (WikiPageImpl)obj;
331
332 int value = 0;
333
334 if (getNodeId() < wikiPage.getNodeId()) {
335 value = -1;
336 }
337 else if (getNodeId() > wikiPage.getNodeId()) {
338 value = 1;
339 }
340 else {
341 value = 0;
342 }
343
344 if (value != 0) {
345 return value;
346 }
347
348 value = getTitle().toLowerCase().compareTo(wikiPage.getTitle()
349 .toLowerCase());
350
351 if (value != 0) {
352 return value;
353 }
354
355 if (getVersion() < wikiPage.getVersion()) {
356 value = -1;
357 }
358 else if (getVersion() > wikiPage.getVersion()) {
359 value = 1;
360 }
361 else {
362 value = 0;
363 }
364
365 if (value != 0) {
366 return value;
367 }
368
369 return 0;
370 }
371
372 public boolean equals(Object obj) {
373 if (obj == null) {
374 return false;
375 }
376
377 WikiPageImpl wikiPage = null;
378
379 try {
380 wikiPage = (WikiPageImpl)obj;
381 }
382 catch (ClassCastException cce) {
383 return false;
384 }
385
386 long pk = wikiPage.getPrimaryKey();
387
388 if (getPrimaryKey() == pk) {
389 return true;
390 }
391 else {
392 return false;
393 }
394 }
395
396 public int hashCode() {
397 return (int)getPrimaryKey();
398 }
399
400 private String _uuid;
401 private long _pageId;
402 private long _resourcePrimKey;
403 private long _companyId;
404 private long _userId;
405 private String _userName;
406 private Date _createDate;
407 private long _nodeId;
408 private String _title;
409 private double _version;
410 private String _content;
411 private String _format;
412 private boolean _head;
413 }