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.model.impl.BaseModelImpl;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.portlet.messageboards.model.MBBan;
31  
32  import com.liferay.util.Html;
33  
34  import java.io.Serializable;
35  
36  import java.lang.reflect.Proxy;
37  
38  import java.sql.Types;
39  
40  import java.util.Date;
41  
42  /**
43   * <a href="MBBanModelImpl.java.html"><b><i>View Source</i></b></a>
44   *
45   * <p>
46   * ServiceBuilder generated this class. Modifications in this class will be
47   * overwritten the next time is generated.
48   * </p>
49   *
50   * <p>
51   * This class is a model that represents the <code>MBBan</code> table
52   * in the database.
53   * </p>
54   *
55   * @author Brian Wing Shun Chan
56   *
57   * @see com.liferay.portlet.messageboards.service.model.MBBan
58   * @see com.liferay.portlet.messageboards.service.model.MBBanModel
59   * @see com.liferay.portlet.messageboards.service.model.impl.MBBanImpl
60   *
61   */
62  public class MBBanModelImpl extends BaseModelImpl {
63      public static final String TABLE_NAME = "MBBan";
64      public static final Object[][] TABLE_COLUMNS = {
65              { "banId", new Integer(Types.BIGINT) },
66              
67  
68              { "groupId", new Integer(Types.BIGINT) },
69              
70  
71              { "companyId", new Integer(Types.BIGINT) },
72              
73  
74              { "userId", new Integer(Types.BIGINT) },
75              
76  
77              { "userName", new Integer(Types.VARCHAR) },
78              
79  
80              { "createDate", new Integer(Types.TIMESTAMP) },
81              
82  
83              { "modifiedDate", new Integer(Types.TIMESTAMP) },
84              
85  
86              { "banUserId", new Integer(Types.BIGINT) }
87          };
88      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)";
89      public static final String TABLE_SQL_DROP = "drop table MBBan";
90      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
91                  "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
92              true);
93      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
94                  "lock.expiration.time.com.liferay.portlet.messageboards.model.MBBan"));
95  
96      public MBBanModelImpl() {
97      }
98  
99      public long getPrimaryKey() {
100         return _banId;
101     }
102 
103     public void setPrimaryKey(long pk) {
104         setBanId(pk);
105     }
106 
107     public Serializable getPrimaryKeyObj() {
108         return new Long(_banId);
109     }
110 
111     public long getBanId() {
112         return _banId;
113     }
114 
115     public void setBanId(long banId) {
116         if (banId != _banId) {
117             _banId = banId;
118         }
119     }
120 
121     public long getGroupId() {
122         return _groupId;
123     }
124 
125     public void setGroupId(long groupId) {
126         if (groupId != _groupId) {
127             _groupId = groupId;
128         }
129     }
130 
131     public long getCompanyId() {
132         return _companyId;
133     }
134 
135     public void setCompanyId(long companyId) {
136         if (companyId != _companyId) {
137             _companyId = companyId;
138         }
139     }
140 
141     public long getUserId() {
142         return _userId;
143     }
144 
145     public void setUserId(long userId) {
146         if (userId != _userId) {
147             _userId = userId;
148         }
149     }
150 
151     public String getUserName() {
152         return GetterUtil.getString(_userName);
153     }
154 
155     public void setUserName(String userName) {
156         if (((userName == null) && (_userName != null)) ||
157                 ((userName != null) && (_userName == null)) ||
158                 ((userName != null) && (_userName != null) &&
159                 !userName.equals(_userName))) {
160             _userName = userName;
161         }
162     }
163 
164     public Date getCreateDate() {
165         return _createDate;
166     }
167 
168     public void setCreateDate(Date createDate) {
169         if (((createDate == null) && (_createDate != null)) ||
170                 ((createDate != null) && (_createDate == null)) ||
171                 ((createDate != null) && (_createDate != null) &&
172                 !createDate.equals(_createDate))) {
173             _createDate = createDate;
174         }
175     }
176 
177     public Date getModifiedDate() {
178         return _modifiedDate;
179     }
180 
181     public void setModifiedDate(Date modifiedDate) {
182         if (((modifiedDate == null) && (_modifiedDate != null)) ||
183                 ((modifiedDate != null) && (_modifiedDate == null)) ||
184                 ((modifiedDate != null) && (_modifiedDate != null) &&
185                 !modifiedDate.equals(_modifiedDate))) {
186             _modifiedDate = modifiedDate;
187         }
188     }
189 
190     public long getBanUserId() {
191         return _banUserId;
192     }
193 
194     public void setBanUserId(long banUserId) {
195         if (banUserId != _banUserId) {
196             _banUserId = banUserId;
197         }
198     }
199 
200     public MBBan toEscapedModel() {
201         if (isEscapedModel()) {
202             return (MBBan)this;
203         }
204         else {
205             MBBan model = new MBBanImpl();
206 
207             model.setEscapedModel(true);
208 
209             model.setBanId(getBanId());
210             model.setGroupId(getGroupId());
211             model.setCompanyId(getCompanyId());
212             model.setUserId(getUserId());
213             model.setUserName(Html.escape(getUserName()));
214             model.setCreateDate(getCreateDate());
215             model.setModifiedDate(getModifiedDate());
216             model.setBanUserId(getBanUserId());
217 
218             model = (MBBan)Proxy.newProxyInstance(MBBan.class.getClassLoader(),
219                     new Class[] { MBBan.class }, new ReadOnlyBeanHandler(model));
220 
221             return model;
222         }
223     }
224 
225     public Object clone() {
226         MBBanImpl clone = new MBBanImpl();
227 
228         clone.setBanId(getBanId());
229         clone.setGroupId(getGroupId());
230         clone.setCompanyId(getCompanyId());
231         clone.setUserId(getUserId());
232         clone.setUserName(getUserName());
233         clone.setCreateDate(getCreateDate());
234         clone.setModifiedDate(getModifiedDate());
235         clone.setBanUserId(getBanUserId());
236 
237         return clone;
238     }
239 
240     public int compareTo(Object obj) {
241         if (obj == null) {
242             return -1;
243         }
244 
245         MBBanImpl mbBan = (MBBanImpl)obj;
246 
247         long pk = mbBan.getPrimaryKey();
248 
249         if (getPrimaryKey() < pk) {
250             return -1;
251         }
252         else if (getPrimaryKey() > pk) {
253             return 1;
254         }
255         else {
256             return 0;
257         }
258     }
259 
260     public boolean equals(Object obj) {
261         if (obj == null) {
262             return false;
263         }
264 
265         MBBanImpl mbBan = null;
266 
267         try {
268             mbBan = (MBBanImpl)obj;
269         }
270         catch (ClassCastException cce) {
271             return false;
272         }
273 
274         long pk = mbBan.getPrimaryKey();
275 
276         if (getPrimaryKey() == pk) {
277             return true;
278         }
279         else {
280             return false;
281         }
282     }
283 
284     public int hashCode() {
285         return (int)getPrimaryKey();
286     }
287 
288     private long _banId;
289     private long _groupId;
290     private long _companyId;
291     private long _userId;
292     private String _userName;
293     private Date _createDate;
294     private Date _modifiedDate;
295     private long _banUserId;
296 }