1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.messageboards.model.impl;
24  
25  import com.liferay.portal.SystemException;
26  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
27  import com.liferay.portal.kernel.util.GetterUtil;
28  import com.liferay.portal.kernel.util.HtmlUtil;
29  import com.liferay.portal.model.impl.BaseModelImpl;
30  import com.liferay.portal.util.PortalUtil;
31  
32  import com.liferay.portlet.messageboards.model.MBBan;
33  import com.liferay.portlet.messageboards.model.MBBanSoap;
34  
35  import java.io.Serializable;
36  
37  import java.lang.reflect.Proxy;
38  
39  import java.sql.Types;
40  
41  import java.util.ArrayList;
42  import java.util.Date;
43  import java.util.List;
44  
45  /**
46   * <a href="MBBanModelImpl.java.html"><b><i>View Source</i></b></a>
47   *
48   * <p>
49   * ServiceBuilder generated this class. Modifications in this class will be
50   * overwritten the next time is generated.
51   * </p>
52   *
53   * <p>
54   * This class is a model that represents the <code>MBBan</code> table
55   * in the database.
56   * </p>
57   *
58   * @author Brian Wing Shun Chan
59   *
60   * @see com.liferay.portlet.messageboards.model.MBBan
61   * @see com.liferay.portlet.messageboards.model.MBBanModel
62   * @see com.liferay.portlet.messageboards.model.impl.MBBanImpl
63   *
64   */
65  public class MBBanModelImpl extends BaseModelImpl<MBBan> {
66      public static final String TABLE_NAME = "MBBan";
67      public static final Object[][] TABLE_COLUMNS = {
68              { "banId", new Integer(Types.BIGINT) },
69              
70  
71              { "groupId", new Integer(Types.BIGINT) },
72              
73  
74              { "companyId", new Integer(Types.BIGINT) },
75              
76  
77              { "userId", new Integer(Types.BIGINT) },
78              
79  
80              { "userName", new Integer(Types.VARCHAR) },
81              
82  
83              { "createDate", new Integer(Types.TIMESTAMP) },
84              
85  
86              { "modifiedDate", new Integer(Types.TIMESTAMP) },
87              
88  
89              { "banUserId", new Integer(Types.BIGINT) }
90          };
91      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)";
92      public static final String TABLE_SQL_DROP = "drop table MBBan";
93      public static final String DATA_SOURCE = "liferayDataSource";
94      public static final String SESSION_FACTORY = "liferaySessionFactory";
95      public static final String TX_MANAGER = "liferayTransactionManager";
96      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
97                  "value.object.entity.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
98              true);
99      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
100                 "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
101             true);
102 
103     public static MBBan toModel(MBBanSoap soapModel) {
104         MBBan model = new MBBanImpl();
105 
106         model.setBanId(soapModel.getBanId());
107         model.setGroupId(soapModel.getGroupId());
108         model.setCompanyId(soapModel.getCompanyId());
109         model.setUserId(soapModel.getUserId());
110         model.setUserName(soapModel.getUserName());
111         model.setCreateDate(soapModel.getCreateDate());
112         model.setModifiedDate(soapModel.getModifiedDate());
113         model.setBanUserId(soapModel.getBanUserId());
114 
115         return model;
116     }
117 
118     public static List<MBBan> toModels(MBBanSoap[] soapModels) {
119         List<MBBan> models = new ArrayList<MBBan>(soapModels.length);
120 
121         for (MBBanSoap soapModel : soapModels) {
122             models.add(toModel(soapModel));
123         }
124 
125         return models;
126     }
127 
128     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
129                 "lock.expiration.time.com.liferay.portlet.messageboards.model.MBBan"));
130 
131     public MBBanModelImpl() {
132     }
133 
134     public long getPrimaryKey() {
135         return _banId;
136     }
137 
138     public void setPrimaryKey(long pk) {
139         setBanId(pk);
140     }
141 
142     public Serializable getPrimaryKeyObj() {
143         return new Long(_banId);
144     }
145 
146     public long getBanId() {
147         return _banId;
148     }
149 
150     public void setBanId(long banId) {
151         _banId = banId;
152     }
153 
154     public long getGroupId() {
155         return _groupId;
156     }
157 
158     public void setGroupId(long groupId) {
159         _groupId = groupId;
160 
161         if (!_setOriginalGroupId) {
162             _setOriginalGroupId = true;
163 
164             _originalGroupId = groupId;
165         }
166     }
167 
168     public long getOriginalGroupId() {
169         return _originalGroupId;
170     }
171 
172     public long getCompanyId() {
173         return _companyId;
174     }
175 
176     public void setCompanyId(long companyId) {
177         _companyId = companyId;
178     }
179 
180     public long getUserId() {
181         return _userId;
182     }
183 
184     public void setUserId(long userId) {
185         _userId = userId;
186     }
187 
188     public String getUserUuid() throws SystemException {
189         return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
190     }
191 
192     public void setUserUuid(String userUuid) {
193         _userUuid = userUuid;
194     }
195 
196     public String getUserName() {
197         return GetterUtil.getString(_userName);
198     }
199 
200     public void setUserName(String userName) {
201         _userName = userName;
202     }
203 
204     public Date getCreateDate() {
205         return _createDate;
206     }
207 
208     public void setCreateDate(Date createDate) {
209         _createDate = createDate;
210     }
211 
212     public Date getModifiedDate() {
213         return _modifiedDate;
214     }
215 
216     public void setModifiedDate(Date modifiedDate) {
217         _modifiedDate = modifiedDate;
218     }
219 
220     public long getBanUserId() {
221         return _banUserId;
222     }
223 
224     public void setBanUserId(long banUserId) {
225         _banUserId = banUserId;
226 
227         if (!_setOriginalBanUserId) {
228             _setOriginalBanUserId = true;
229 
230             _originalBanUserId = banUserId;
231         }
232     }
233 
234     public String getBanUserUuid() throws SystemException {
235         return PortalUtil.getUserValue(getBanUserId(), "uuid", _banUserUuid);
236     }
237 
238     public void setBanUserUuid(String banUserUuid) {
239         _banUserUuid = banUserUuid;
240     }
241 
242     public long getOriginalBanUserId() {
243         return _originalBanUserId;
244     }
245 
246     public MBBan toEscapedModel() {
247         if (isEscapedModel()) {
248             return (MBBan)this;
249         }
250         else {
251             MBBan model = new MBBanImpl();
252 
253             model.setNew(isNew());
254             model.setEscapedModel(true);
255 
256             model.setBanId(getBanId());
257             model.setGroupId(getGroupId());
258             model.setCompanyId(getCompanyId());
259             model.setUserId(getUserId());
260             model.setUserName(HtmlUtil.escape(getUserName()));
261             model.setCreateDate(getCreateDate());
262             model.setModifiedDate(getModifiedDate());
263             model.setBanUserId(getBanUserId());
264 
265             model = (MBBan)Proxy.newProxyInstance(MBBan.class.getClassLoader(),
266                     new Class[] { MBBan.class }, new ReadOnlyBeanHandler(model));
267 
268             return model;
269         }
270     }
271 
272     public Object clone() {
273         MBBanImpl clone = new MBBanImpl();
274 
275         clone.setBanId(getBanId());
276         clone.setGroupId(getGroupId());
277         clone.setCompanyId(getCompanyId());
278         clone.setUserId(getUserId());
279         clone.setUserName(getUserName());
280         clone.setCreateDate(getCreateDate());
281         clone.setModifiedDate(getModifiedDate());
282         clone.setBanUserId(getBanUserId());
283 
284         return clone;
285     }
286 
287     public int compareTo(MBBan mbBan) {
288         long pk = mbBan.getPrimaryKey();
289 
290         if (getPrimaryKey() < pk) {
291             return -1;
292         }
293         else if (getPrimaryKey() > pk) {
294             return 1;
295         }
296         else {
297             return 0;
298         }
299     }
300 
301     public boolean equals(Object obj) {
302         if (obj == null) {
303             return false;
304         }
305 
306         MBBan mbBan = null;
307 
308         try {
309             mbBan = (MBBan)obj;
310         }
311         catch (ClassCastException cce) {
312             return false;
313         }
314 
315         long pk = mbBan.getPrimaryKey();
316 
317         if (getPrimaryKey() == pk) {
318             return true;
319         }
320         else {
321             return false;
322         }
323     }
324 
325     public int hashCode() {
326         return (int)getPrimaryKey();
327     }
328 
329     public String toString() {
330         StringBuilder sb = new StringBuilder();
331 
332         sb.append("{banId=");
333         sb.append(getBanId());
334         sb.append(", groupId=");
335         sb.append(getGroupId());
336         sb.append(", companyId=");
337         sb.append(getCompanyId());
338         sb.append(", userId=");
339         sb.append(getUserId());
340         sb.append(", userName=");
341         sb.append(getUserName());
342         sb.append(", createDate=");
343         sb.append(getCreateDate());
344         sb.append(", modifiedDate=");
345         sb.append(getModifiedDate());
346         sb.append(", banUserId=");
347         sb.append(getBanUserId());
348         sb.append("}");
349 
350         return sb.toString();
351     }
352 
353     public String toXmlString() {
354         StringBuilder sb = new StringBuilder();
355 
356         sb.append("<model><model-name>");
357         sb.append("com.liferay.portlet.messageboards.model.MBBan");
358         sb.append("</model-name>");
359 
360         sb.append(
361             "<column><column-name>banId</column-name><column-value><![CDATA[");
362         sb.append(getBanId());
363         sb.append("]]></column-value></column>");
364         sb.append(
365             "<column><column-name>groupId</column-name><column-value><![CDATA[");
366         sb.append(getGroupId());
367         sb.append("]]></column-value></column>");
368         sb.append(
369             "<column><column-name>companyId</column-name><column-value><![CDATA[");
370         sb.append(getCompanyId());
371         sb.append("]]></column-value></column>");
372         sb.append(
373             "<column><column-name>userId</column-name><column-value><![CDATA[");
374         sb.append(getUserId());
375         sb.append("]]></column-value></column>");
376         sb.append(
377             "<column><column-name>userName</column-name><column-value><![CDATA[");
378         sb.append(getUserName());
379         sb.append("]]></column-value></column>");
380         sb.append(
381             "<column><column-name>createDate</column-name><column-value><![CDATA[");
382         sb.append(getCreateDate());
383         sb.append("]]></column-value></column>");
384         sb.append(
385             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
386         sb.append(getModifiedDate());
387         sb.append("]]></column-value></column>");
388         sb.append(
389             "<column><column-name>banUserId</column-name><column-value><![CDATA[");
390         sb.append(getBanUserId());
391         sb.append("]]></column-value></column>");
392 
393         sb.append("</model>");
394 
395         return sb.toString();
396     }
397 
398     private long _banId;
399     private long _groupId;
400     private long _originalGroupId;
401     private boolean _setOriginalGroupId;
402     private long _companyId;
403     private long _userId;
404     private String _userUuid;
405     private String _userName;
406     private Date _createDate;
407     private Date _modifiedDate;
408     private long _banUserId;
409     private long _originalBanUserId;
410     private boolean _setOriginalBanUserId;
411     private String _banUserUuid;
412 }