001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.wiki.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.impl.BaseModelImpl;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.portlet.wiki.model.WikiPage;
029:
030: import com.liferay.util.Html;
031:
032: import java.io.Serializable;
033:
034: import java.lang.reflect.Proxy;
035:
036: import java.sql.Types;
037:
038: import java.util.Date;
039:
040: /**
041: * <a href="WikiPageModelImpl.java.html"><b><i>View Source</i></b></a>
042: *
043: * <p>
044: * ServiceBuilder generated this class. Modifications in this class will be
045: * overwritten the next time is generated.
046: * </p>
047: *
048: * <p>
049: * This class is a model that represents the <code>WikiPage</code> table
050: * in the database.
051: * </p>
052: *
053: * @author Brian Wing Shun Chan
054: *
055: * @see com.liferay.portlet.wiki.service.model.WikiPage
056: * @see com.liferay.portlet.wiki.service.model.WikiPageModel
057: * @see com.liferay.portlet.wiki.service.model.impl.WikiPageImpl
058: *
059: */
060: public class WikiPageModelImpl extends BaseModelImpl {
061: public static final String TABLE_NAME = "WikiPage";
062: public static final Object[][] TABLE_COLUMNS = {
063: { "uuid_", new Integer(Types.VARCHAR) },
064:
065: { "pageId", new Integer(Types.BIGINT) },
066:
067: { "resourcePrimKey", new Integer(Types.BIGINT) },
068:
069: { "companyId", new Integer(Types.BIGINT) },
070:
071: { "userId", new Integer(Types.BIGINT) },
072:
073: { "userName", new Integer(Types.VARCHAR) },
074:
075: { "createDate", new Integer(Types.TIMESTAMP) },
076:
077: { "nodeId", new Integer(Types.BIGINT) },
078:
079: { "title", new Integer(Types.VARCHAR) },
080:
081: { "version", new Integer(Types.DOUBLE) },
082:
083: { "content", new Integer(Types.CLOB) },
084:
085: { "format", new Integer(Types.VARCHAR) },
086:
087: { "head", new Integer(Types.BOOLEAN) } };
088: 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)";
089: public static final String TABLE_SQL_DROP = "drop table WikiPage";
090: public static final boolean CACHE_ENABLED = GetterUtil
091: .getBoolean(
092: PropsUtil
093: .get("value.object.finder.cache.enabled.com.liferay.portlet.wiki.model.WikiPage"),
094: true);
095: public static final long LOCK_EXPIRATION_TIME = GetterUtil
096: .getLong(PropsUtil
097: .get("lock.expiration.time.com.liferay.portlet.wiki.model.WikiPage"));
098:
099: public WikiPageModelImpl() {
100: }
101:
102: public long getPrimaryKey() {
103: return _pageId;
104: }
105:
106: public void setPrimaryKey(long pk) {
107: setPageId(pk);
108: }
109:
110: public Serializable getPrimaryKeyObj() {
111: return new Long(_pageId);
112: }
113:
114: public String getUuid() {
115: return GetterUtil.getString(_uuid);
116: }
117:
118: public void setUuid(String uuid) {
119: if ((uuid != null) && (uuid != _uuid)) {
120: _uuid = uuid;
121: }
122: }
123:
124: public long getPageId() {
125: return _pageId;
126: }
127:
128: public void setPageId(long pageId) {
129: if (pageId != _pageId) {
130: _pageId = pageId;
131: }
132: }
133:
134: public long getResourcePrimKey() {
135: return _resourcePrimKey;
136: }
137:
138: public void setResourcePrimKey(long resourcePrimKey) {
139: if (resourcePrimKey != _resourcePrimKey) {
140: _resourcePrimKey = resourcePrimKey;
141: }
142: }
143:
144: public long getCompanyId() {
145: return _companyId;
146: }
147:
148: public void setCompanyId(long companyId) {
149: if (companyId != _companyId) {
150: _companyId = companyId;
151: }
152: }
153:
154: public long getUserId() {
155: return _userId;
156: }
157:
158: public void setUserId(long userId) {
159: if (userId != _userId) {
160: _userId = userId;
161: }
162: }
163:
164: public String getUserName() {
165: return GetterUtil.getString(_userName);
166: }
167:
168: public void setUserName(String userName) {
169: if (((userName == null) && (_userName != null))
170: || ((userName != null) && (_userName == null))
171: || ((userName != null) && (_userName != null) && !userName
172: .equals(_userName))) {
173: _userName = userName;
174: }
175: }
176:
177: public Date getCreateDate() {
178: return _createDate;
179: }
180:
181: public void setCreateDate(Date createDate) {
182: if (((createDate == null) && (_createDate != null))
183: || ((createDate != null) && (_createDate == null))
184: || ((createDate != null) && (_createDate != null) && !createDate
185: .equals(_createDate))) {
186: _createDate = createDate;
187: }
188: }
189:
190: public long getNodeId() {
191: return _nodeId;
192: }
193:
194: public void setNodeId(long nodeId) {
195: if (nodeId != _nodeId) {
196: _nodeId = nodeId;
197: }
198: }
199:
200: public String getTitle() {
201: return GetterUtil.getString(_title);
202: }
203:
204: public void setTitle(String title) {
205: if (((title == null) && (_title != null))
206: || ((title != null) && (_title == null))
207: || ((title != null) && (_title != null) && !title
208: .equals(_title))) {
209: _title = title;
210: }
211: }
212:
213: public double getVersion() {
214: return _version;
215: }
216:
217: public void setVersion(double version) {
218: if (version != _version) {
219: _version = version;
220: }
221: }
222:
223: public String getContent() {
224: return GetterUtil.getString(_content);
225: }
226:
227: public void setContent(String content) {
228: if (((content == null) && (_content != null))
229: || ((content != null) && (_content == null))
230: || ((content != null) && (_content != null) && !content
231: .equals(_content))) {
232: _content = content;
233: }
234: }
235:
236: public String getFormat() {
237: return GetterUtil.getString(_format);
238: }
239:
240: public void setFormat(String format) {
241: if (((format == null) && (_format != null))
242: || ((format != null) && (_format == null))
243: || ((format != null) && (_format != null) && !format
244: .equals(_format))) {
245: _format = format;
246: }
247: }
248:
249: public boolean getHead() {
250: return _head;
251: }
252:
253: public boolean isHead() {
254: return _head;
255: }
256:
257: public void setHead(boolean head) {
258: if (head != _head) {
259: _head = head;
260: }
261: }
262:
263: public WikiPage toEscapedModel() {
264: if (isEscapedModel()) {
265: return (WikiPage) this ;
266: } else {
267: WikiPage model = new WikiPageImpl();
268:
269: model.setEscapedModel(true);
270:
271: model.setUuid(Html.escape(getUuid()));
272: model.setPageId(getPageId());
273: model.setResourcePrimKey(getResourcePrimKey());
274: model.setCompanyId(getCompanyId());
275: model.setUserId(getUserId());
276: model.setUserName(Html.escape(getUserName()));
277: model.setCreateDate(getCreateDate());
278: model.setNodeId(getNodeId());
279: model.setTitle(Html.escape(getTitle()));
280: model.setVersion(getVersion());
281: model.setContent(Html.escape(getContent()));
282: model.setFormat(Html.escape(getFormat()));
283: model.setHead(getHead());
284:
285: model = (WikiPage) Proxy.newProxyInstance(WikiPage.class
286: .getClassLoader(), new Class[] { WikiPage.class },
287: new ReadOnlyBeanHandler(model));
288:
289: return model;
290: }
291: }
292:
293: public Object clone() {
294: WikiPageImpl clone = new WikiPageImpl();
295:
296: clone.setUuid(getUuid());
297: clone.setPageId(getPageId());
298: clone.setResourcePrimKey(getResourcePrimKey());
299: clone.setCompanyId(getCompanyId());
300: clone.setUserId(getUserId());
301: clone.setUserName(getUserName());
302: clone.setCreateDate(getCreateDate());
303: clone.setNodeId(getNodeId());
304: clone.setTitle(getTitle());
305: clone.setVersion(getVersion());
306: clone.setContent(getContent());
307: clone.setFormat(getFormat());
308: clone.setHead(getHead());
309:
310: return clone;
311: }
312:
313: public int compareTo(Object obj) {
314: if (obj == null) {
315: return -1;
316: }
317:
318: WikiPageImpl wikiPage = (WikiPageImpl) obj;
319:
320: int value = 0;
321:
322: if (getNodeId() < wikiPage.getNodeId()) {
323: value = -1;
324: } else if (getNodeId() > wikiPage.getNodeId()) {
325: value = 1;
326: } else {
327: value = 0;
328: }
329:
330: if (value != 0) {
331: return value;
332: }
333:
334: value = getTitle().toLowerCase().compareTo(
335: wikiPage.getTitle().toLowerCase());
336:
337: if (value != 0) {
338: return value;
339: }
340:
341: if (getVersion() < wikiPage.getVersion()) {
342: value = -1;
343: } else if (getVersion() > wikiPage.getVersion()) {
344: value = 1;
345: } else {
346: value = 0;
347: }
348:
349: if (value != 0) {
350: return value;
351: }
352:
353: return 0;
354: }
355:
356: public boolean equals(Object obj) {
357: if (obj == null) {
358: return false;
359: }
360:
361: WikiPageImpl wikiPage = null;
362:
363: try {
364: wikiPage = (WikiPageImpl) obj;
365: } catch (ClassCastException cce) {
366: return false;
367: }
368:
369: long pk = wikiPage.getPrimaryKey();
370:
371: if (getPrimaryKey() == pk) {
372: return true;
373: } else {
374: return false;
375: }
376: }
377:
378: public int hashCode() {
379: return (int) getPrimaryKey();
380: }
381:
382: private String _uuid;
383: private long _pageId;
384: private long _resourcePrimKey;
385: private long _companyId;
386: private long _userId;
387: private String _userName;
388: private Date _createDate;
389: private long _nodeId;
390: private String _title;
391: private double _version;
392: private String _content;
393: private String _format;
394: private boolean _head;
395: }
|