1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.messageboards.model.impl;
16  
17  import com.liferay.portal.SystemException;
18  import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
19  import com.liferay.portal.kernel.util.GetterUtil;
20  import com.liferay.portal.kernel.util.StringBundler;
21  import com.liferay.portal.kernel.util.StringPool;
22  import com.liferay.portal.model.impl.BaseModelImpl;
23  import com.liferay.portal.service.ServiceContext;
24  import com.liferay.portal.util.PortalUtil;
25  
26  import com.liferay.portlet.expando.model.ExpandoBridge;
27  import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
28  import com.liferay.portlet.messageboards.model.MBBan;
29  import com.liferay.portlet.messageboards.model.MBBanSoap;
30  
31  import java.io.Serializable;
32  
33  import java.lang.reflect.Proxy;
34  
35  import java.sql.Types;
36  
37  import java.util.ArrayList;
38  import java.util.Date;
39  import java.util.List;
40  
41  /**
42   * <a href="MBBanModelImpl.java.html"><b><i>View Source</i></b></a>
43   *
44   * <p>
45   * ServiceBuilder generated this class. Modifications in this class will be
46   * overwritten the next time is generated.
47   * </p>
48   *
49   * <p>
50   * This interface is a model that represents the MBBan table in the
51   * database.
52   * </p>
53   *
54   * @author    Brian Wing Shun Chan
55   * @see       MBBanImpl
56   * @see       com.liferay.portlet.messageboards.model.MBBan
57   * @see       com.liferay.portlet.messageboards.model.MBBanModel
58   * @generated
59   */
60  public class MBBanModelImpl extends BaseModelImpl<MBBan> {
61      public static final String TABLE_NAME = "MBBan";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "banId", new Integer(Types.BIGINT) },
64              { "groupId", new Integer(Types.BIGINT) },
65              { "companyId", new Integer(Types.BIGINT) },
66              { "userId", new Integer(Types.BIGINT) },
67              { "userName", new Integer(Types.VARCHAR) },
68              { "createDate", new Integer(Types.TIMESTAMP) },
69              { "modifiedDate", new Integer(Types.TIMESTAMP) },
70              { "banUserId", new Integer(Types.BIGINT) }
71          };
72      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)";
73      public static final String TABLE_SQL_DROP = "drop table MBBan";
74      public static final String DATA_SOURCE = "liferayDataSource";
75      public static final String SESSION_FACTORY = "liferaySessionFactory";
76      public static final String TX_MANAGER = "liferayTransactionManager";
77      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
78                  "value.object.entity.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
79              true);
80      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
81                  "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
82              true);
83  
84      public static MBBan toModel(MBBanSoap soapModel) {
85          MBBan model = new MBBanImpl();
86  
87          model.setBanId(soapModel.getBanId());
88          model.setGroupId(soapModel.getGroupId());
89          model.setCompanyId(soapModel.getCompanyId());
90          model.setUserId(soapModel.getUserId());
91          model.setUserName(soapModel.getUserName());
92          model.setCreateDate(soapModel.getCreateDate());
93          model.setModifiedDate(soapModel.getModifiedDate());
94          model.setBanUserId(soapModel.getBanUserId());
95  
96          return model;
97      }
98  
99      public static List<MBBan> toModels(MBBanSoap[] soapModels) {
100         List<MBBan> models = new ArrayList<MBBan>(soapModels.length);
101 
102         for (MBBanSoap soapModel : soapModels) {
103             models.add(toModel(soapModel));
104         }
105 
106         return models;
107     }
108 
109     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
110                 "lock.expiration.time.com.liferay.portlet.messageboards.model.MBBan"));
111 
112     public MBBanModelImpl() {
113     }
114 
115     public long getPrimaryKey() {
116         return _banId;
117     }
118 
119     public void setPrimaryKey(long pk) {
120         setBanId(pk);
121     }
122 
123     public Serializable getPrimaryKeyObj() {
124         return new Long(_banId);
125     }
126 
127     public long getBanId() {
128         return _banId;
129     }
130 
131     public void setBanId(long banId) {
132         _banId = banId;
133     }
134 
135     public long getGroupId() {
136         return _groupId;
137     }
138 
139     public void setGroupId(long groupId) {
140         _groupId = groupId;
141 
142         if (!_setOriginalGroupId) {
143             _setOriginalGroupId = true;
144 
145             _originalGroupId = groupId;
146         }
147     }
148 
149     public long getOriginalGroupId() {
150         return _originalGroupId;
151     }
152 
153     public long getCompanyId() {
154         return _companyId;
155     }
156 
157     public void setCompanyId(long companyId) {
158         _companyId = companyId;
159     }
160 
161     public long getUserId() {
162         return _userId;
163     }
164 
165     public void setUserId(long userId) {
166         _userId = userId;
167     }
168 
169     public String getUserUuid() throws SystemException {
170         return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
171     }
172 
173     public void setUserUuid(String userUuid) {
174         _userUuid = userUuid;
175     }
176 
177     public String getUserName() {
178         if (_userName == null) {
179             return StringPool.BLANK;
180         }
181         else {
182             return _userName;
183         }
184     }
185 
186     public void setUserName(String userName) {
187         _userName = userName;
188     }
189 
190     public Date getCreateDate() {
191         return _createDate;
192     }
193 
194     public void setCreateDate(Date createDate) {
195         _createDate = createDate;
196     }
197 
198     public Date getModifiedDate() {
199         return _modifiedDate;
200     }
201 
202     public void setModifiedDate(Date modifiedDate) {
203         _modifiedDate = modifiedDate;
204     }
205 
206     public long getBanUserId() {
207         return _banUserId;
208     }
209 
210     public void setBanUserId(long banUserId) {
211         _banUserId = banUserId;
212 
213         if (!_setOriginalBanUserId) {
214             _setOriginalBanUserId = true;
215 
216             _originalBanUserId = banUserId;
217         }
218     }
219 
220     public String getBanUserUuid() throws SystemException {
221         return PortalUtil.getUserValue(getBanUserId(), "uuid", _banUserUuid);
222     }
223 
224     public void setBanUserUuid(String banUserUuid) {
225         _banUserUuid = banUserUuid;
226     }
227 
228     public long getOriginalBanUserId() {
229         return _originalBanUserId;
230     }
231 
232     public MBBan toEscapedModel() {
233         if (isEscapedModel()) {
234             return (MBBan)this;
235         }
236         else {
237             return (MBBan)Proxy.newProxyInstance(MBBan.class.getClassLoader(),
238                 new Class[] { MBBan.class }, new AutoEscapeBeanHandler(this));
239         }
240     }
241 
242     public ExpandoBridge getExpandoBridge() {
243         if (_expandoBridge == null) {
244             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(MBBan.class.getName(),
245                     getPrimaryKey());
246         }
247 
248         return _expandoBridge;
249     }
250 
251     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
252         getExpandoBridge().setAttributes(serviceContext);
253     }
254 
255     public Object clone() {
256         MBBanImpl clone = new MBBanImpl();
257 
258         clone.setBanId(getBanId());
259         clone.setGroupId(getGroupId());
260         clone.setCompanyId(getCompanyId());
261         clone.setUserId(getUserId());
262         clone.setUserName(getUserName());
263         clone.setCreateDate(getCreateDate());
264         clone.setModifiedDate(getModifiedDate());
265         clone.setBanUserId(getBanUserId());
266 
267         return clone;
268     }
269 
270     public int compareTo(MBBan mbBan) {
271         long pk = mbBan.getPrimaryKey();
272 
273         if (getPrimaryKey() < pk) {
274             return -1;
275         }
276         else if (getPrimaryKey() > pk) {
277             return 1;
278         }
279         else {
280             return 0;
281         }
282     }
283 
284     public boolean equals(Object obj) {
285         if (obj == null) {
286             return false;
287         }
288 
289         MBBan mbBan = null;
290 
291         try {
292             mbBan = (MBBan)obj;
293         }
294         catch (ClassCastException cce) {
295             return false;
296         }
297 
298         long pk = mbBan.getPrimaryKey();
299 
300         if (getPrimaryKey() == pk) {
301             return true;
302         }
303         else {
304             return false;
305         }
306     }
307 
308     public int hashCode() {
309         return (int)getPrimaryKey();
310     }
311 
312     public String toString() {
313         StringBundler sb = new StringBundler(17);
314 
315         sb.append("{banId=");
316         sb.append(getBanId());
317         sb.append(", groupId=");
318         sb.append(getGroupId());
319         sb.append(", companyId=");
320         sb.append(getCompanyId());
321         sb.append(", userId=");
322         sb.append(getUserId());
323         sb.append(", userName=");
324         sb.append(getUserName());
325         sb.append(", createDate=");
326         sb.append(getCreateDate());
327         sb.append(", modifiedDate=");
328         sb.append(getModifiedDate());
329         sb.append(", banUserId=");
330         sb.append(getBanUserId());
331         sb.append("}");
332 
333         return sb.toString();
334     }
335 
336     public String toXmlString() {
337         StringBundler sb = new StringBundler(28);
338 
339         sb.append("<model><model-name>");
340         sb.append("com.liferay.portlet.messageboards.model.MBBan");
341         sb.append("</model-name>");
342 
343         sb.append(
344             "<column><column-name>banId</column-name><column-value><![CDATA[");
345         sb.append(getBanId());
346         sb.append("]]></column-value></column>");
347         sb.append(
348             "<column><column-name>groupId</column-name><column-value><![CDATA[");
349         sb.append(getGroupId());
350         sb.append("]]></column-value></column>");
351         sb.append(
352             "<column><column-name>companyId</column-name><column-value><![CDATA[");
353         sb.append(getCompanyId());
354         sb.append("]]></column-value></column>");
355         sb.append(
356             "<column><column-name>userId</column-name><column-value><![CDATA[");
357         sb.append(getUserId());
358         sb.append("]]></column-value></column>");
359         sb.append(
360             "<column><column-name>userName</column-name><column-value><![CDATA[");
361         sb.append(getUserName());
362         sb.append("]]></column-value></column>");
363         sb.append(
364             "<column><column-name>createDate</column-name><column-value><![CDATA[");
365         sb.append(getCreateDate());
366         sb.append("]]></column-value></column>");
367         sb.append(
368             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
369         sb.append(getModifiedDate());
370         sb.append("]]></column-value></column>");
371         sb.append(
372             "<column><column-name>banUserId</column-name><column-value><![CDATA[");
373         sb.append(getBanUserId());
374         sb.append("]]></column-value></column>");
375 
376         sb.append("</model>");
377 
378         return sb.toString();
379     }
380 
381     private long _banId;
382     private long _groupId;
383     private long _originalGroupId;
384     private boolean _setOriginalGroupId;
385     private long _companyId;
386     private long _userId;
387     private String _userUuid;
388     private String _userName;
389     private Date _createDate;
390     private Date _modifiedDate;
391     private long _banUserId;
392     private String _banUserUuid;
393     private long _originalBanUserId;
394     private boolean _setOriginalBanUserId;
395     private transient ExpandoBridge _expandoBridge;
396 }