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