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.kernel.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.GetterUtil;
27  import com.liferay.portal.kernel.util.HtmlUtil;
28  import com.liferay.portal.model.impl.BaseModelImpl;
29  
30  import com.liferay.portlet.expando.model.ExpandoBridge;
31  import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
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 getUserName() {
189         return GetterUtil.getString(_userName);
190     }
191 
192     public void setUserName(String userName) {
193         _userName = userName;
194     }
195 
196     public Date getCreateDate() {
197         return _createDate;
198     }
199 
200     public void setCreateDate(Date createDate) {
201         _createDate = createDate;
202     }
203 
204     public Date getModifiedDate() {
205         return _modifiedDate;
206     }
207 
208     public void setModifiedDate(Date modifiedDate) {
209         _modifiedDate = modifiedDate;
210     }
211 
212     public long getBanUserId() {
213         return _banUserId;
214     }
215 
216     public void setBanUserId(long banUserId) {
217         _banUserId = banUserId;
218 
219         if (!_setOriginalBanUserId) {
220             _setOriginalBanUserId = true;
221 
222             _originalBanUserId = banUserId;
223         }
224     }
225 
226     public long getOriginalBanUserId() {
227         return _originalBanUserId;
228     }
229 
230     public MBBan toEscapedModel() {
231         if (isEscapedModel()) {
232             return (MBBan)this;
233         }
234         else {
235             MBBan model = new MBBanImpl();
236 
237             model.setNew(isNew());
238             model.setEscapedModel(true);
239 
240             model.setBanId(getBanId());
241             model.setGroupId(getGroupId());
242             model.setCompanyId(getCompanyId());
243             model.setUserId(getUserId());
244             model.setUserName(HtmlUtil.escape(getUserName()));
245             model.setCreateDate(getCreateDate());
246             model.setModifiedDate(getModifiedDate());
247             model.setBanUserId(getBanUserId());
248 
249             model = (MBBan)Proxy.newProxyInstance(MBBan.class.getClassLoader(),
250                     new Class[] { MBBan.class }, new ReadOnlyBeanHandler(model));
251 
252             return model;
253         }
254     }
255 
256     public ExpandoBridge getExpandoBridge() {
257         if (_expandoBridge == null) {
258             _expandoBridge = new ExpandoBridgeImpl(MBBan.class.getName(),
259                     getPrimaryKey());
260         }
261 
262         return _expandoBridge;
263     }
264 
265     public Object clone() {
266         MBBanImpl clone = new MBBanImpl();
267 
268         clone.setBanId(getBanId());
269         clone.setGroupId(getGroupId());
270         clone.setCompanyId(getCompanyId());
271         clone.setUserId(getUserId());
272         clone.setUserName(getUserName());
273         clone.setCreateDate(getCreateDate());
274         clone.setModifiedDate(getModifiedDate());
275         clone.setBanUserId(getBanUserId());
276 
277         return clone;
278     }
279 
280     public int compareTo(MBBan mbBan) {
281         long pk = mbBan.getPrimaryKey();
282 
283         if (getPrimaryKey() < pk) {
284             return -1;
285         }
286         else if (getPrimaryKey() > pk) {
287             return 1;
288         }
289         else {
290             return 0;
291         }
292     }
293 
294     public boolean equals(Object obj) {
295         if (obj == null) {
296             return false;
297         }
298 
299         MBBan mbBan = null;
300 
301         try {
302             mbBan = (MBBan)obj;
303         }
304         catch (ClassCastException cce) {
305             return false;
306         }
307 
308         long pk = mbBan.getPrimaryKey();
309 
310         if (getPrimaryKey() == pk) {
311             return true;
312         }
313         else {
314             return false;
315         }
316     }
317 
318     public int hashCode() {
319         return (int)getPrimaryKey();
320     }
321 
322     public String toString() {
323         StringBuilder sb = new StringBuilder();
324 
325         sb.append("{banId=");
326         sb.append(getBanId());
327         sb.append(", groupId=");
328         sb.append(getGroupId());
329         sb.append(", companyId=");
330         sb.append(getCompanyId());
331         sb.append(", userId=");
332         sb.append(getUserId());
333         sb.append(", userName=");
334         sb.append(getUserName());
335         sb.append(", createDate=");
336         sb.append(getCreateDate());
337         sb.append(", modifiedDate=");
338         sb.append(getModifiedDate());
339         sb.append(", banUserId=");
340         sb.append(getBanUserId());
341         sb.append("}");
342 
343         return sb.toString();
344     }
345 
346     public String toXmlString() {
347         StringBuilder sb = new StringBuilder();
348 
349         sb.append("<model><model-name>");
350         sb.append("com.liferay.portlet.messageboards.model.MBBan");
351         sb.append("</model-name>");
352 
353         sb.append(
354             "<column><column-name>banId</column-name><column-value><![CDATA[");
355         sb.append(getBanId());
356         sb.append("]]></column-value></column>");
357         sb.append(
358             "<column><column-name>groupId</column-name><column-value><![CDATA[");
359         sb.append(getGroupId());
360         sb.append("]]></column-value></column>");
361         sb.append(
362             "<column><column-name>companyId</column-name><column-value><![CDATA[");
363         sb.append(getCompanyId());
364         sb.append("]]></column-value></column>");
365         sb.append(
366             "<column><column-name>userId</column-name><column-value><![CDATA[");
367         sb.append(getUserId());
368         sb.append("]]></column-value></column>");
369         sb.append(
370             "<column><column-name>userName</column-name><column-value><![CDATA[");
371         sb.append(getUserName());
372         sb.append("]]></column-value></column>");
373         sb.append(
374             "<column><column-name>createDate</column-name><column-value><![CDATA[");
375         sb.append(getCreateDate());
376         sb.append("]]></column-value></column>");
377         sb.append(
378             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
379         sb.append(getModifiedDate());
380         sb.append("]]></column-value></column>");
381         sb.append(
382             "<column><column-name>banUserId</column-name><column-value><![CDATA[");
383         sb.append(getBanUserId());
384         sb.append("]]></column-value></column>");
385 
386         sb.append("</model>");
387 
388         return sb.toString();
389     }
390 
391     private long _banId;
392     private long _groupId;
393     private long _originalGroupId;
394     private boolean _setOriginalGroupId;
395     private long _companyId;
396     private long _userId;
397     private String _userName;
398     private Date _createDate;
399     private Date _modifiedDate;
400     private long _banUserId;
401     private long _originalBanUserId;
402     private boolean _setOriginalBanUserId;
403     private transient ExpandoBridge _expandoBridge;
404 }