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.WikiNode;
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="WikiNodeModelImpl.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>WikiNode</code> table
050: * in the database.
051: * </p>
052: *
053: * @author Brian Wing Shun Chan
054: *
055: * @see com.liferay.portlet.wiki.service.model.WikiNode
056: * @see com.liferay.portlet.wiki.service.model.WikiNodeModel
057: * @see com.liferay.portlet.wiki.service.model.impl.WikiNodeImpl
058: *
059: */
060: public class WikiNodeModelImpl extends BaseModelImpl {
061: public static final String TABLE_NAME = "WikiNode";
062: public static final Object[][] TABLE_COLUMNS = {
063: { "uuid_", new Integer(Types.VARCHAR) },
064:
065: { "nodeId", new Integer(Types.BIGINT) },
066:
067: { "groupId", 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: { "modifiedDate", new Integer(Types.TIMESTAMP) },
078:
079: { "name", new Integer(Types.VARCHAR) },
080:
081: { "description", new Integer(Types.VARCHAR) },
082:
083: { "lastPostDate", new Integer(Types.TIMESTAMP) } };
084: public static final String TABLE_SQL_CREATE = "create table WikiNode (uuid_ VARCHAR(75) null,nodeId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,name VARCHAR(75) null,description STRING null,lastPostDate DATE null)";
085: public static final String TABLE_SQL_DROP = "drop table WikiNode";
086: public static final boolean CACHE_ENABLED = GetterUtil
087: .getBoolean(
088: PropsUtil
089: .get("value.object.finder.cache.enabled.com.liferay.portlet.wiki.model.WikiNode"),
090: true);
091: public static final long LOCK_EXPIRATION_TIME = GetterUtil
092: .getLong(PropsUtil
093: .get("lock.expiration.time.com.liferay.portlet.wiki.model.WikiNode"));
094:
095: public WikiNodeModelImpl() {
096: }
097:
098: public long getPrimaryKey() {
099: return _nodeId;
100: }
101:
102: public void setPrimaryKey(long pk) {
103: setNodeId(pk);
104: }
105:
106: public Serializable getPrimaryKeyObj() {
107: return new Long(_nodeId);
108: }
109:
110: public String getUuid() {
111: return GetterUtil.getString(_uuid);
112: }
113:
114: public void setUuid(String uuid) {
115: if ((uuid != null) && (uuid != _uuid)) {
116: _uuid = uuid;
117: }
118: }
119:
120: public long getNodeId() {
121: return _nodeId;
122: }
123:
124: public void setNodeId(long nodeId) {
125: if (nodeId != _nodeId) {
126: _nodeId = nodeId;
127: }
128: }
129:
130: public long getGroupId() {
131: return _groupId;
132: }
133:
134: public void setGroupId(long groupId) {
135: if (groupId != _groupId) {
136: _groupId = groupId;
137: }
138: }
139:
140: public long getCompanyId() {
141: return _companyId;
142: }
143:
144: public void setCompanyId(long companyId) {
145: if (companyId != _companyId) {
146: _companyId = companyId;
147: }
148: }
149:
150: public long getUserId() {
151: return _userId;
152: }
153:
154: public void setUserId(long userId) {
155: if (userId != _userId) {
156: _userId = userId;
157: }
158: }
159:
160: public String getUserName() {
161: return GetterUtil.getString(_userName);
162: }
163:
164: public void setUserName(String userName) {
165: if (((userName == null) && (_userName != null))
166: || ((userName != null) && (_userName == null))
167: || ((userName != null) && (_userName != null) && !userName
168: .equals(_userName))) {
169: _userName = userName;
170: }
171: }
172:
173: public Date getCreateDate() {
174: return _createDate;
175: }
176:
177: public void setCreateDate(Date createDate) {
178: if (((createDate == null) && (_createDate != null))
179: || ((createDate != null) && (_createDate == null))
180: || ((createDate != null) && (_createDate != null) && !createDate
181: .equals(_createDate))) {
182: _createDate = createDate;
183: }
184: }
185:
186: public Date getModifiedDate() {
187: return _modifiedDate;
188: }
189:
190: public void setModifiedDate(Date modifiedDate) {
191: if (((modifiedDate == null) && (_modifiedDate != null))
192: || ((modifiedDate != null) && (_modifiedDate == null))
193: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
194: .equals(_modifiedDate))) {
195: _modifiedDate = modifiedDate;
196: }
197: }
198:
199: public String getName() {
200: return GetterUtil.getString(_name);
201: }
202:
203: public void setName(String name) {
204: if (((name == null) && (_name != null))
205: || ((name != null) && (_name == null))
206: || ((name != null) && (_name != null) && !name
207: .equals(_name))) {
208: _name = name;
209: }
210: }
211:
212: public String getDescription() {
213: return GetterUtil.getString(_description);
214: }
215:
216: public void setDescription(String description) {
217: if (((description == null) && (_description != null))
218: || ((description != null) && (_description == null))
219: || ((description != null) && (_description != null) && !description
220: .equals(_description))) {
221: _description = description;
222: }
223: }
224:
225: public Date getLastPostDate() {
226: return _lastPostDate;
227: }
228:
229: public void setLastPostDate(Date lastPostDate) {
230: if (((lastPostDate == null) && (_lastPostDate != null))
231: || ((lastPostDate != null) && (_lastPostDate == null))
232: || ((lastPostDate != null) && (_lastPostDate != null) && !lastPostDate
233: .equals(_lastPostDate))) {
234: _lastPostDate = lastPostDate;
235: }
236: }
237:
238: public WikiNode toEscapedModel() {
239: if (isEscapedModel()) {
240: return (WikiNode) this ;
241: } else {
242: WikiNode model = new WikiNodeImpl();
243:
244: model.setEscapedModel(true);
245:
246: model.setUuid(Html.escape(getUuid()));
247: model.setNodeId(getNodeId());
248: model.setGroupId(getGroupId());
249: model.setCompanyId(getCompanyId());
250: model.setUserId(getUserId());
251: model.setUserName(Html.escape(getUserName()));
252: model.setCreateDate(getCreateDate());
253: model.setModifiedDate(getModifiedDate());
254: model.setName(Html.escape(getName()));
255: model.setDescription(Html.escape(getDescription()));
256: model.setLastPostDate(getLastPostDate());
257:
258: model = (WikiNode) Proxy.newProxyInstance(WikiNode.class
259: .getClassLoader(), new Class[] { WikiNode.class },
260: new ReadOnlyBeanHandler(model));
261:
262: return model;
263: }
264: }
265:
266: public Object clone() {
267: WikiNodeImpl clone = new WikiNodeImpl();
268:
269: clone.setUuid(getUuid());
270: clone.setNodeId(getNodeId());
271: clone.setGroupId(getGroupId());
272: clone.setCompanyId(getCompanyId());
273: clone.setUserId(getUserId());
274: clone.setUserName(getUserName());
275: clone.setCreateDate(getCreateDate());
276: clone.setModifiedDate(getModifiedDate());
277: clone.setName(getName());
278: clone.setDescription(getDescription());
279: clone.setLastPostDate(getLastPostDate());
280:
281: return clone;
282: }
283:
284: public int compareTo(Object obj) {
285: if (obj == null) {
286: return -1;
287: }
288:
289: WikiNodeImpl wikiNode = (WikiNodeImpl) obj;
290:
291: int value = 0;
292:
293: value = getName().toLowerCase().compareTo(
294: wikiNode.getName().toLowerCase());
295:
296: if (value != 0) {
297: return value;
298: }
299:
300: return 0;
301: }
302:
303: public boolean equals(Object obj) {
304: if (obj == null) {
305: return false;
306: }
307:
308: WikiNodeImpl wikiNode = null;
309:
310: try {
311: wikiNode = (WikiNodeImpl) obj;
312: } catch (ClassCastException cce) {
313: return false;
314: }
315:
316: long pk = wikiNode.getPrimaryKey();
317:
318: if (getPrimaryKey() == pk) {
319: return true;
320: } else {
321: return false;
322: }
323: }
324:
325: public int hashCode() {
326: return (int) getPrimaryKey();
327: }
328:
329: private String _uuid;
330: private long _nodeId;
331: private long _groupId;
332: private long _companyId;
333: private long _userId;
334: private String _userName;
335: private Date _createDate;
336: private Date _modifiedDate;
337: private String _name;
338: private String _description;
339: private Date _lastPostDate;
340: }
|