001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.messageboards.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.GetterUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.impl.BaseModelImpl;
023    import com.liferay.portal.service.ServiceContext;
024    import com.liferay.portal.util.PortalUtil;
025    
026    import com.liferay.portlet.expando.model.ExpandoBridge;
027    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028    import com.liferay.portlet.messageboards.model.MBBan;
029    import com.liferay.portlet.messageboards.model.MBBanModel;
030    import com.liferay.portlet.messageboards.model.MBBanSoap;
031    
032    import java.io.Serializable;
033    
034    import java.lang.reflect.Proxy;
035    
036    import java.sql.Types;
037    
038    import java.util.ArrayList;
039    import java.util.Date;
040    import java.util.List;
041    
042    /**
043     * <p>
044     * This interface is a model that represents the MBBan table in the
045     * database.
046     * </p>
047     *
048     * @author    Brian Wing Shun Chan
049     * @see       MBBanImpl
050     * @see       com.liferay.portlet.messageboards.model.MBBan
051     * @see       com.liferay.portlet.messageboards.model.MBBanModel
052     * @generated
053     */
054    public class MBBanModelImpl extends BaseModelImpl<MBBan> implements MBBanModel {
055            public static final String TABLE_NAME = "MBBan";
056            public static final Object[][] TABLE_COLUMNS = {
057                            { "banId", new Integer(Types.BIGINT) },
058                            { "groupId", new Integer(Types.BIGINT) },
059                            { "companyId", new Integer(Types.BIGINT) },
060                            { "userId", new Integer(Types.BIGINT) },
061                            { "userName", new Integer(Types.VARCHAR) },
062                            { "createDate", new Integer(Types.TIMESTAMP) },
063                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
064                            { "banUserId", new Integer(Types.BIGINT) }
065                    };
066            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)";
067            public static final String TABLE_SQL_DROP = "drop table MBBan";
068            public static final String DATA_SOURCE = "liferayDataSource";
069            public static final String SESSION_FACTORY = "liferaySessionFactory";
070            public static final String TX_MANAGER = "liferayTransactionManager";
071            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
072                                    "value.object.entity.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
073                            true);
074            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
075                                    "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
076                            true);
077    
078            public static MBBan toModel(MBBanSoap soapModel) {
079                    MBBan model = new MBBanImpl();
080    
081                    model.setBanId(soapModel.getBanId());
082                    model.setGroupId(soapModel.getGroupId());
083                    model.setCompanyId(soapModel.getCompanyId());
084                    model.setUserId(soapModel.getUserId());
085                    model.setUserName(soapModel.getUserName());
086                    model.setCreateDate(soapModel.getCreateDate());
087                    model.setModifiedDate(soapModel.getModifiedDate());
088                    model.setBanUserId(soapModel.getBanUserId());
089    
090                    return model;
091            }
092    
093            public static List<MBBan> toModels(MBBanSoap[] soapModels) {
094                    List<MBBan> models = new ArrayList<MBBan>(soapModels.length);
095    
096                    for (MBBanSoap soapModel : soapModels) {
097                            models.add(toModel(soapModel));
098                    }
099    
100                    return models;
101            }
102    
103            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
104                                    "lock.expiration.time.com.liferay.portlet.messageboards.model.MBBan"));
105    
106            public MBBanModelImpl() {
107            }
108    
109            public long getPrimaryKey() {
110                    return _banId;
111            }
112    
113            public void setPrimaryKey(long pk) {
114                    setBanId(pk);
115            }
116    
117            public Serializable getPrimaryKeyObj() {
118                    return new Long(_banId);
119            }
120    
121            public long getBanId() {
122                    return _banId;
123            }
124    
125            public void setBanId(long banId) {
126                    _banId = banId;
127            }
128    
129            public long getGroupId() {
130                    return _groupId;
131            }
132    
133            public void setGroupId(long groupId) {
134                    _groupId = groupId;
135    
136                    if (!_setOriginalGroupId) {
137                            _setOriginalGroupId = true;
138    
139                            _originalGroupId = groupId;
140                    }
141            }
142    
143            public long getOriginalGroupId() {
144                    return _originalGroupId;
145            }
146    
147            public long getCompanyId() {
148                    return _companyId;
149            }
150    
151            public void setCompanyId(long companyId) {
152                    _companyId = companyId;
153            }
154    
155            public long getUserId() {
156                    return _userId;
157            }
158    
159            public void setUserId(long userId) {
160                    _userId = userId;
161            }
162    
163            public String getUserUuid() throws SystemException {
164                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
165            }
166    
167            public void setUserUuid(String userUuid) {
168                    _userUuid = userUuid;
169            }
170    
171            public String getUserName() {
172                    if (_userName == null) {
173                            return StringPool.BLANK;
174                    }
175                    else {
176                            return _userName;
177                    }
178            }
179    
180            public void setUserName(String userName) {
181                    _userName = userName;
182            }
183    
184            public Date getCreateDate() {
185                    return _createDate;
186            }
187    
188            public void setCreateDate(Date createDate) {
189                    _createDate = createDate;
190            }
191    
192            public Date getModifiedDate() {
193                    return _modifiedDate;
194            }
195    
196            public void setModifiedDate(Date modifiedDate) {
197                    _modifiedDate = modifiedDate;
198            }
199    
200            public long getBanUserId() {
201                    return _banUserId;
202            }
203    
204            public void setBanUserId(long banUserId) {
205                    _banUserId = banUserId;
206    
207                    if (!_setOriginalBanUserId) {
208                            _setOriginalBanUserId = true;
209    
210                            _originalBanUserId = banUserId;
211                    }
212            }
213    
214            public String getBanUserUuid() throws SystemException {
215                    return PortalUtil.getUserValue(getBanUserId(), "uuid", _banUserUuid);
216            }
217    
218            public void setBanUserUuid(String banUserUuid) {
219                    _banUserUuid = banUserUuid;
220            }
221    
222            public long getOriginalBanUserId() {
223                    return _originalBanUserId;
224            }
225    
226            public MBBan toEscapedModel() {
227                    if (isEscapedModel()) {
228                            return (MBBan)this;
229                    }
230                    else {
231                            return (MBBan)Proxy.newProxyInstance(MBBan.class.getClassLoader(),
232                                    new Class[] { MBBan.class }, new AutoEscapeBeanHandler(this));
233                    }
234            }
235    
236            public ExpandoBridge getExpandoBridge() {
237                    if (_expandoBridge == null) {
238                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
239                                            MBBan.class.getName(), getPrimaryKey());
240                    }
241    
242                    return _expandoBridge;
243            }
244    
245            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
246                    getExpandoBridge().setAttributes(serviceContext);
247            }
248    
249            public Object clone() {
250                    MBBanImpl clone = new MBBanImpl();
251    
252                    clone.setBanId(getBanId());
253                    clone.setGroupId(getGroupId());
254                    clone.setCompanyId(getCompanyId());
255                    clone.setUserId(getUserId());
256                    clone.setUserName(getUserName());
257                    clone.setCreateDate(getCreateDate());
258                    clone.setModifiedDate(getModifiedDate());
259                    clone.setBanUserId(getBanUserId());
260    
261                    return clone;
262            }
263    
264            public int compareTo(MBBan mbBan) {
265                    long pk = mbBan.getPrimaryKey();
266    
267                    if (getPrimaryKey() < pk) {
268                            return -1;
269                    }
270                    else if (getPrimaryKey() > pk) {
271                            return 1;
272                    }
273                    else {
274                            return 0;
275                    }
276            }
277    
278            public boolean equals(Object obj) {
279                    if (obj == null) {
280                            return false;
281                    }
282    
283                    MBBan mbBan = null;
284    
285                    try {
286                            mbBan = (MBBan)obj;
287                    }
288                    catch (ClassCastException cce) {
289                            return false;
290                    }
291    
292                    long pk = mbBan.getPrimaryKey();
293    
294                    if (getPrimaryKey() == pk) {
295                            return true;
296                    }
297                    else {
298                            return false;
299                    }
300            }
301    
302            public int hashCode() {
303                    return (int)getPrimaryKey();
304            }
305    
306            public String toString() {
307                    StringBundler sb = new StringBundler(17);
308    
309                    sb.append("{banId=");
310                    sb.append(getBanId());
311                    sb.append(", groupId=");
312                    sb.append(getGroupId());
313                    sb.append(", companyId=");
314                    sb.append(getCompanyId());
315                    sb.append(", userId=");
316                    sb.append(getUserId());
317                    sb.append(", userName=");
318                    sb.append(getUserName());
319                    sb.append(", createDate=");
320                    sb.append(getCreateDate());
321                    sb.append(", modifiedDate=");
322                    sb.append(getModifiedDate());
323                    sb.append(", banUserId=");
324                    sb.append(getBanUserId());
325                    sb.append("}");
326    
327                    return sb.toString();
328            }
329    
330            public String toXmlString() {
331                    StringBundler sb = new StringBundler(28);
332    
333                    sb.append("<model><model-name>");
334                    sb.append("com.liferay.portlet.messageboards.model.MBBan");
335                    sb.append("</model-name>");
336    
337                    sb.append(
338                            "<column><column-name>banId</column-name><column-value><![CDATA[");
339                    sb.append(getBanId());
340                    sb.append("]]></column-value></column>");
341                    sb.append(
342                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
343                    sb.append(getGroupId());
344                    sb.append("]]></column-value></column>");
345                    sb.append(
346                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
347                    sb.append(getCompanyId());
348                    sb.append("]]></column-value></column>");
349                    sb.append(
350                            "<column><column-name>userId</column-name><column-value><![CDATA[");
351                    sb.append(getUserId());
352                    sb.append("]]></column-value></column>");
353                    sb.append(
354                            "<column><column-name>userName</column-name><column-value><![CDATA[");
355                    sb.append(getUserName());
356                    sb.append("]]></column-value></column>");
357                    sb.append(
358                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
359                    sb.append(getCreateDate());
360                    sb.append("]]></column-value></column>");
361                    sb.append(
362                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
363                    sb.append(getModifiedDate());
364                    sb.append("]]></column-value></column>");
365                    sb.append(
366                            "<column><column-name>banUserId</column-name><column-value><![CDATA[");
367                    sb.append(getBanUserId());
368                    sb.append("]]></column-value></column>");
369    
370                    sb.append("</model>");
371    
372                    return sb.toString();
373            }
374    
375            private long _banId;
376            private long _groupId;
377            private long _originalGroupId;
378            private boolean _setOriginalGroupId;
379            private long _companyId;
380            private long _userId;
381            private String _userUuid;
382            private String _userName;
383            private Date _createDate;
384            private Date _modifiedDate;
385            private long _banUserId;
386            private String _banUserUuid;
387            private long _originalBanUserId;
388            private boolean _setOriginalBanUserId;
389            private transient ExpandoBridge _expandoBridge;
390    }