1   /**
2    * Copyright (c) 2000-2008 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.service.model.MBBan
59   * @see com.liferay.portlet.messageboards.service.model.MBBanModel
60   * @see com.liferay.portlet.messageboards.service.model.impl.MBBanImpl
61   *
62   */
63  public class MBBanModelImpl extends BaseModelImpl {
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 CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
95                  "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
96              true);
97  
98      public static MBBan toModel(MBBanSoap soapModel) {
99          MBBan model = new MBBanImpl();
100 
101         model.setBanId(soapModel.getBanId());
102         model.setGroupId(soapModel.getGroupId());
103         model.setCompanyId(soapModel.getCompanyId());
104         model.setUserId(soapModel.getUserId());
105         model.setUserName(soapModel.getUserName());
106         model.setCreateDate(soapModel.getCreateDate());
107         model.setModifiedDate(soapModel.getModifiedDate());
108         model.setBanUserId(soapModel.getBanUserId());
109 
110         return model;
111     }
112 
113     public static List<MBBan> toModels(MBBanSoap[] soapModels) {
114         List<MBBan> models = new ArrayList<MBBan>(soapModels.length);
115 
116         for (MBBanSoap soapModel : soapModels) {
117             models.add(toModel(soapModel));
118         }
119 
120         return models;
121     }
122 
123     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
124                 "lock.expiration.time.com.liferay.portlet.messageboards.model.MBBan"));
125 
126     public MBBanModelImpl() {
127     }
128 
129     public long getPrimaryKey() {
130         return _banId;
131     }
132 
133     public void setPrimaryKey(long pk) {
134         setBanId(pk);
135     }
136 
137     public Serializable getPrimaryKeyObj() {
138         return new Long(_banId);
139     }
140 
141     public long getBanId() {
142         return _banId;
143     }
144 
145     public void setBanId(long banId) {
146         if (banId != _banId) {
147             _banId = banId;
148         }
149     }
150 
151     public long getGroupId() {
152         return _groupId;
153     }
154 
155     public void setGroupId(long groupId) {
156         if (groupId != _groupId) {
157             _groupId = groupId;
158         }
159     }
160 
161     public long getCompanyId() {
162         return _companyId;
163     }
164 
165     public void setCompanyId(long companyId) {
166         if (companyId != _companyId) {
167             _companyId = companyId;
168         }
169     }
170 
171     public long getUserId() {
172         return _userId;
173     }
174 
175     public void setUserId(long userId) {
176         if (userId != _userId) {
177             _userId = userId;
178         }
179     }
180 
181     public String getUserName() {
182         return GetterUtil.getString(_userName);
183     }
184 
185     public void setUserName(String userName) {
186         if (((userName == null) && (_userName != null)) ||
187                 ((userName != null) && (_userName == null)) ||
188                 ((userName != null) && (_userName != null) &&
189                 !userName.equals(_userName))) {
190             _userName = userName;
191         }
192     }
193 
194     public Date getCreateDate() {
195         return _createDate;
196     }
197 
198     public void setCreateDate(Date createDate) {
199         if (((createDate == null) && (_createDate != null)) ||
200                 ((createDate != null) && (_createDate == null)) ||
201                 ((createDate != null) && (_createDate != null) &&
202                 !createDate.equals(_createDate))) {
203             _createDate = createDate;
204         }
205     }
206 
207     public Date getModifiedDate() {
208         return _modifiedDate;
209     }
210 
211     public void setModifiedDate(Date modifiedDate) {
212         if (((modifiedDate == null) && (_modifiedDate != null)) ||
213                 ((modifiedDate != null) && (_modifiedDate == null)) ||
214                 ((modifiedDate != null) && (_modifiedDate != null) &&
215                 !modifiedDate.equals(_modifiedDate))) {
216             _modifiedDate = modifiedDate;
217         }
218     }
219 
220     public long getBanUserId() {
221         return _banUserId;
222     }
223 
224     public void setBanUserId(long banUserId) {
225         if (banUserId != _banUserId) {
226             _banUserId = banUserId;
227         }
228     }
229 
230     public MBBan toEscapedModel() {
231         if (isEscapedModel()) {
232             return (MBBan)this;
233         }
234         else {
235             MBBan model = new MBBanImpl();
236 
237             model.setEscapedModel(true);
238 
239             model.setBanId(getBanId());
240             model.setGroupId(getGroupId());
241             model.setCompanyId(getCompanyId());
242             model.setUserId(getUserId());
243             model.setUserName(HtmlUtil.escape(getUserName()));
244             model.setCreateDate(getCreateDate());
245             model.setModifiedDate(getModifiedDate());
246             model.setBanUserId(getBanUserId());
247 
248             model = (MBBan)Proxy.newProxyInstance(MBBan.class.getClassLoader(),
249                     new Class[] { MBBan.class }, new ReadOnlyBeanHandler(model));
250 
251             return model;
252         }
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(Object obj) {
271         if (obj == null) {
272             return -1;
273         }
274 
275         MBBanImpl mbBan = (MBBanImpl)obj;
276 
277         long pk = mbBan.getPrimaryKey();
278 
279         if (getPrimaryKey() < pk) {
280             return -1;
281         }
282         else if (getPrimaryKey() > pk) {
283             return 1;
284         }
285         else {
286             return 0;
287         }
288     }
289 
290     public boolean equals(Object obj) {
291         if (obj == null) {
292             return false;
293         }
294 
295         MBBanImpl mbBan = null;
296 
297         try {
298             mbBan = (MBBanImpl)obj;
299         }
300         catch (ClassCastException cce) {
301             return false;
302         }
303 
304         long pk = mbBan.getPrimaryKey();
305 
306         if (getPrimaryKey() == pk) {
307             return true;
308         }
309         else {
310             return false;
311         }
312     }
313 
314     public int hashCode() {
315         return (int)getPrimaryKey();
316     }
317 
318     private long _banId;
319     private long _groupId;
320     private long _companyId;
321     private long _userId;
322     private String _userName;
323     private Date _createDate;
324     private Date _modifiedDate;
325     private long _banUserId;
326 }