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