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.MBMessageFlag;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: /**
037: * <a href="MBMessageFlagModelImpl.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>MBMessageFlag</code> table
046: * in the database.
047: * </p>
048: *
049: * @author Brian Wing Shun Chan
050: *
051: * @see com.liferay.portlet.messageboards.service.model.MBMessageFlag
052: * @see com.liferay.portlet.messageboards.service.model.MBMessageFlagModel
053: * @see com.liferay.portlet.messageboards.service.model.impl.MBMessageFlagImpl
054: *
055: */
056: public class MBMessageFlagModelImpl extends BaseModelImpl {
057: public static final String TABLE_NAME = "MBMessageFlag";
058: public static final Object[][] TABLE_COLUMNS = {
059: { "messageFlagId", new Integer(Types.BIGINT) },
060:
061: { "userId", new Integer(Types.BIGINT) },
062:
063: { "messageId", new Integer(Types.BIGINT) },
064:
065: { "flag", new Integer(Types.INTEGER) } };
066: public static final String TABLE_SQL_CREATE = "create table MBMessageFlag (messageFlagId LONG not null primary key,userId LONG,messageId LONG,flag INTEGER)";
067: public static final String TABLE_SQL_DROP = "drop table MBMessageFlag";
068: public static final boolean CACHE_ENABLED = GetterUtil
069: .getBoolean(
070: PropsUtil
071: .get("value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBMessageFlag"),
072: true);
073: public static final long LOCK_EXPIRATION_TIME = GetterUtil
074: .getLong(PropsUtil
075: .get("lock.expiration.time.com.liferay.portlet.messageboards.model.MBMessageFlag"));
076:
077: public MBMessageFlagModelImpl() {
078: }
079:
080: public long getPrimaryKey() {
081: return _messageFlagId;
082: }
083:
084: public void setPrimaryKey(long pk) {
085: setMessageFlagId(pk);
086: }
087:
088: public Serializable getPrimaryKeyObj() {
089: return new Long(_messageFlagId);
090: }
091:
092: public long getMessageFlagId() {
093: return _messageFlagId;
094: }
095:
096: public void setMessageFlagId(long messageFlagId) {
097: if (messageFlagId != _messageFlagId) {
098: _messageFlagId = messageFlagId;
099: }
100: }
101:
102: public long getUserId() {
103: return _userId;
104: }
105:
106: public void setUserId(long userId) {
107: if (userId != _userId) {
108: _userId = userId;
109: }
110: }
111:
112: public long getMessageId() {
113: return _messageId;
114: }
115:
116: public void setMessageId(long messageId) {
117: if (messageId != _messageId) {
118: _messageId = messageId;
119: }
120: }
121:
122: public int getFlag() {
123: return _flag;
124: }
125:
126: public void setFlag(int flag) {
127: if (flag != _flag) {
128: _flag = flag;
129: }
130: }
131:
132: public MBMessageFlag toEscapedModel() {
133: if (isEscapedModel()) {
134: return (MBMessageFlag) this ;
135: } else {
136: MBMessageFlag model = new MBMessageFlagImpl();
137:
138: model.setEscapedModel(true);
139:
140: model.setMessageFlagId(getMessageFlagId());
141: model.setUserId(getUserId());
142: model.setMessageId(getMessageId());
143: model.setFlag(getFlag());
144:
145: model = (MBMessageFlag) Proxy.newProxyInstance(
146: MBMessageFlag.class.getClassLoader(),
147: new Class[] { MBMessageFlag.class },
148: new ReadOnlyBeanHandler(model));
149:
150: return model;
151: }
152: }
153:
154: public Object clone() {
155: MBMessageFlagImpl clone = new MBMessageFlagImpl();
156:
157: clone.setMessageFlagId(getMessageFlagId());
158: clone.setUserId(getUserId());
159: clone.setMessageId(getMessageId());
160: clone.setFlag(getFlag());
161:
162: return clone;
163: }
164:
165: public int compareTo(Object obj) {
166: if (obj == null) {
167: return -1;
168: }
169:
170: MBMessageFlagImpl mbMessageFlag = (MBMessageFlagImpl) obj;
171:
172: long pk = mbMessageFlag.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: MBMessageFlagImpl mbMessageFlag = null;
189:
190: try {
191: mbMessageFlag = (MBMessageFlagImpl) obj;
192: } catch (ClassCastException cce) {
193: return false;
194: }
195:
196: long pk = mbMessageFlag.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 _messageFlagId;
210: private long _userId;
211: private long _messageId;
212: private int _flag;
213: }
|