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.MBBan;
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="MBBanModelImpl.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>MBBan</code> table
050: * in the database.
051: * </p>
052: *
053: * @author Brian Wing Shun Chan
054: *
055: * @see com.liferay.portlet.messageboards.service.model.MBBan
056: * @see com.liferay.portlet.messageboards.service.model.MBBanModel
057: * @see com.liferay.portlet.messageboards.service.model.impl.MBBanImpl
058: *
059: */
060: public class MBBanModelImpl extends BaseModelImpl {
061: public static final String TABLE_NAME = "MBBan";
062: public static final Object[][] TABLE_COLUMNS = {
063: { "banId", new Integer(Types.BIGINT) },
064:
065: { "groupId", new Integer(Types.BIGINT) },
066:
067: { "companyId", new Integer(Types.BIGINT) },
068:
069: { "userId", new Integer(Types.BIGINT) },
070:
071: { "userName", new Integer(Types.VARCHAR) },
072:
073: { "createDate", new Integer(Types.TIMESTAMP) },
074:
075: { "modifiedDate", new Integer(Types.TIMESTAMP) },
076:
077: { "banUserId", new Integer(Types.BIGINT) } };
078: public static final String TABLE_SQL_CREATE = "create table MBBan (banId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,banUserId LONG)";
079: public static final String TABLE_SQL_DROP = "drop table MBBan";
080: public static final boolean CACHE_ENABLED = GetterUtil
081: .getBoolean(
082: PropsUtil
083: .get("value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
084: true);
085: public static final long LOCK_EXPIRATION_TIME = GetterUtil
086: .getLong(PropsUtil
087: .get("lock.expiration.time.com.liferay.portlet.messageboards.model.MBBan"));
088:
089: public MBBanModelImpl() {
090: }
091:
092: public long getPrimaryKey() {
093: return _banId;
094: }
095:
096: public void setPrimaryKey(long pk) {
097: setBanId(pk);
098: }
099:
100: public Serializable getPrimaryKeyObj() {
101: return new Long(_banId);
102: }
103:
104: public long getBanId() {
105: return _banId;
106: }
107:
108: public void setBanId(long banId) {
109: if (banId != _banId) {
110: _banId = banId;
111: }
112: }
113:
114: public long getGroupId() {
115: return _groupId;
116: }
117:
118: public void setGroupId(long groupId) {
119: if (groupId != _groupId) {
120: _groupId = groupId;
121: }
122: }
123:
124: public long getCompanyId() {
125: return _companyId;
126: }
127:
128: public void setCompanyId(long companyId) {
129: if (companyId != _companyId) {
130: _companyId = companyId;
131: }
132: }
133:
134: public long getUserId() {
135: return _userId;
136: }
137:
138: public void setUserId(long userId) {
139: if (userId != _userId) {
140: _userId = userId;
141: }
142: }
143:
144: public String getUserName() {
145: return GetterUtil.getString(_userName);
146: }
147:
148: public void setUserName(String userName) {
149: if (((userName == null) && (_userName != null))
150: || ((userName != null) && (_userName == null))
151: || ((userName != null) && (_userName != null) && !userName
152: .equals(_userName))) {
153: _userName = userName;
154: }
155: }
156:
157: public Date getCreateDate() {
158: return _createDate;
159: }
160:
161: public void setCreateDate(Date createDate) {
162: if (((createDate == null) && (_createDate != null))
163: || ((createDate != null) && (_createDate == null))
164: || ((createDate != null) && (_createDate != null) && !createDate
165: .equals(_createDate))) {
166: _createDate = createDate;
167: }
168: }
169:
170: public Date getModifiedDate() {
171: return _modifiedDate;
172: }
173:
174: public void setModifiedDate(Date modifiedDate) {
175: if (((modifiedDate == null) && (_modifiedDate != null))
176: || ((modifiedDate != null) && (_modifiedDate == null))
177: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
178: .equals(_modifiedDate))) {
179: _modifiedDate = modifiedDate;
180: }
181: }
182:
183: public long getBanUserId() {
184: return _banUserId;
185: }
186:
187: public void setBanUserId(long banUserId) {
188: if (banUserId != _banUserId) {
189: _banUserId = banUserId;
190: }
191: }
192:
193: public MBBan toEscapedModel() {
194: if (isEscapedModel()) {
195: return (MBBan) this ;
196: } else {
197: MBBan model = new MBBanImpl();
198:
199: model.setEscapedModel(true);
200:
201: model.setBanId(getBanId());
202: model.setGroupId(getGroupId());
203: model.setCompanyId(getCompanyId());
204: model.setUserId(getUserId());
205: model.setUserName(Html.escape(getUserName()));
206: model.setCreateDate(getCreateDate());
207: model.setModifiedDate(getModifiedDate());
208: model.setBanUserId(getBanUserId());
209:
210: model = (MBBan) Proxy.newProxyInstance(MBBan.class
211: .getClassLoader(), new Class[] { MBBan.class },
212: new ReadOnlyBeanHandler(model));
213:
214: return model;
215: }
216: }
217:
218: public Object clone() {
219: MBBanImpl clone = new MBBanImpl();
220:
221: clone.setBanId(getBanId());
222: clone.setGroupId(getGroupId());
223: clone.setCompanyId(getCompanyId());
224: clone.setUserId(getUserId());
225: clone.setUserName(getUserName());
226: clone.setCreateDate(getCreateDate());
227: clone.setModifiedDate(getModifiedDate());
228: clone.setBanUserId(getBanUserId());
229:
230: return clone;
231: }
232:
233: public int compareTo(Object obj) {
234: if (obj == null) {
235: return -1;
236: }
237:
238: MBBanImpl mbBan = (MBBanImpl) obj;
239:
240: long pk = mbBan.getPrimaryKey();
241:
242: if (getPrimaryKey() < pk) {
243: return -1;
244: } else if (getPrimaryKey() > pk) {
245: return 1;
246: } else {
247: return 0;
248: }
249: }
250:
251: public boolean equals(Object obj) {
252: if (obj == null) {
253: return false;
254: }
255:
256: MBBanImpl mbBan = null;
257:
258: try {
259: mbBan = (MBBanImpl) obj;
260: } catch (ClassCastException cce) {
261: return false;
262: }
263:
264: long pk = mbBan.getPrimaryKey();
265:
266: if (getPrimaryKey() == pk) {
267: return true;
268: } else {
269: return false;
270: }
271: }
272:
273: public int hashCode() {
274: return (int) getPrimaryKey();
275: }
276:
277: private long _banId;
278: private long _groupId;
279: private long _companyId;
280: private long _userId;
281: private String _userName;
282: private Date _createDate;
283: private Date _modifiedDate;
284: private long _banUserId;
285: }
|