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.messageboards.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.messageboards.model.MBDiscussion;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: /**
037: * <a href="MBDiscussionModelImpl.java.html"><b><i>View Source</i></b></a>
038: *
039: * <p>
040: * ServiceBuilder generated this class. Modifications in this class will be
041: * overwritten the next time is generated.
042: * </p>
043: *
044: * <p>
045: * This class is a model that represents the <code>MBDiscussion</code> table
046: * in the database.
047: * </p>
048: *
049: * @author Brian Wing Shun Chan
050: *
051: * @see com.liferay.portlet.messageboards.service.model.MBDiscussion
052: * @see com.liferay.portlet.messageboards.service.model.MBDiscussionModel
053: * @see com.liferay.portlet.messageboards.service.model.impl.MBDiscussionImpl
054: *
055: */
056: public class MBDiscussionModelImpl extends BaseModelImpl {
057: public static final String TABLE_NAME = "MBDiscussion";
058: public static final Object[][] TABLE_COLUMNS = {
059: { "discussionId", new Integer(Types.BIGINT) },
060:
061: { "classNameId", new Integer(Types.BIGINT) },
062:
063: { "classPK", new Integer(Types.BIGINT) },
064:
065: { "threadId", new Integer(Types.BIGINT) } };
066: public static final String TABLE_SQL_CREATE = "create table MBDiscussion (discussionId LONG not null primary key,classNameId LONG,classPK LONG,threadId LONG)";
067: public static final String TABLE_SQL_DROP = "drop table MBDiscussion";
068: public static final boolean CACHE_ENABLED = GetterUtil
069: .getBoolean(
070: PropsUtil
071: .get("value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBDiscussion"),
072: true);
073: public static final long LOCK_EXPIRATION_TIME = GetterUtil
074: .getLong(PropsUtil
075: .get("lock.expiration.time.com.liferay.portlet.messageboards.model.MBDiscussion"));
076:
077: public MBDiscussionModelImpl() {
078: }
079:
080: public long getPrimaryKey() {
081: return _discussionId;
082: }
083:
084: public void setPrimaryKey(long pk) {
085: setDiscussionId(pk);
086: }
087:
088: public Serializable getPrimaryKeyObj() {
089: return new Long(_discussionId);
090: }
091:
092: public long getDiscussionId() {
093: return _discussionId;
094: }
095:
096: public void setDiscussionId(long discussionId) {
097: if (discussionId != _discussionId) {
098: _discussionId = discussionId;
099: }
100: }
101:
102: public long getClassNameId() {
103: return _classNameId;
104: }
105:
106: public void setClassNameId(long classNameId) {
107: if (classNameId != _classNameId) {
108: _classNameId = classNameId;
109: }
110: }
111:
112: public long getClassPK() {
113: return _classPK;
114: }
115:
116: public void setClassPK(long classPK) {
117: if (classPK != _classPK) {
118: _classPK = classPK;
119: }
120: }
121:
122: public long getThreadId() {
123: return _threadId;
124: }
125:
126: public void setThreadId(long threadId) {
127: if (threadId != _threadId) {
128: _threadId = threadId;
129: }
130: }
131:
132: public MBDiscussion toEscapedModel() {
133: if (isEscapedModel()) {
134: return (MBDiscussion) this ;
135: } else {
136: MBDiscussion model = new MBDiscussionImpl();
137:
138: model.setEscapedModel(true);
139:
140: model.setDiscussionId(getDiscussionId());
141: model.setClassNameId(getClassNameId());
142: model.setClassPK(getClassPK());
143: model.setThreadId(getThreadId());
144:
145: model = (MBDiscussion) Proxy.newProxyInstance(
146: MBDiscussion.class.getClassLoader(),
147: new Class[] { MBDiscussion.class },
148: new ReadOnlyBeanHandler(model));
149:
150: return model;
151: }
152: }
153:
154: public Object clone() {
155: MBDiscussionImpl clone = new MBDiscussionImpl();
156:
157: clone.setDiscussionId(getDiscussionId());
158: clone.setClassNameId(getClassNameId());
159: clone.setClassPK(getClassPK());
160: clone.setThreadId(getThreadId());
161:
162: return clone;
163: }
164:
165: public int compareTo(Object obj) {
166: if (obj == null) {
167: return -1;
168: }
169:
170: MBDiscussionImpl mbDiscussion = (MBDiscussionImpl) obj;
171:
172: long pk = mbDiscussion.getPrimaryKey();
173:
174: if (getPrimaryKey() < pk) {
175: return -1;
176: } else if (getPrimaryKey() > pk) {
177: return 1;
178: } else {
179: return 0;
180: }
181: }
182:
183: public boolean equals(Object obj) {
184: if (obj == null) {
185: return false;
186: }
187:
188: MBDiscussionImpl mbDiscussion = null;
189:
190: try {
191: mbDiscussion = (MBDiscussionImpl) obj;
192: } catch (ClassCastException cce) {
193: return false;
194: }
195:
196: long pk = mbDiscussion.getPrimaryKey();
197:
198: if (getPrimaryKey() == pk) {
199: return true;
200: } else {
201: return false;
202: }
203: }
204:
205: public int hashCode() {
206: return (int) getPrimaryKey();
207: }
208:
209: private long _discussionId;
210: private long _classNameId;
211: private long _classPK;
212: private long _threadId;
213: }
|