1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.messageboards.model.impl;
21  
22  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.kernel.util.HtmlUtil;
25  import com.liferay.portal.model.impl.BaseModelImpl;
26  
27  import com.liferay.portlet.expando.model.ExpandoBridge;
28  import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
29  import com.liferay.portlet.messageboards.model.MBBan;
30  import com.liferay.portlet.messageboards.model.MBBanSoap;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  import java.util.ArrayList;
39  import java.util.Date;
40  import java.util.List;
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.model.MBBan
58   * @see com.liferay.portlet.messageboards.model.MBBanModel
59   * @see com.liferay.portlet.messageboards.model.impl.MBBanImpl
60   *
61   */
62  public class MBBanModelImpl extends BaseModelImpl<MBBan> {
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 String DATA_SOURCE = "liferayDataSource";
91      public static final String SESSION_FACTORY = "liferaySessionFactory";
92      public static final String TX_MANAGER = "liferayTransactionManager";
93      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
94                  "value.object.entity.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
95              true);
96      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
97                  "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
98              true);
99  
100     public static MBBan toModel(MBBanSoap soapModel) {
101         MBBan model = new MBBanImpl();
102 
103         model.setBanId(soapModel.getBanId());
104         model.setGroupId(soapModel.getGroupId());
105         model.setCompanyId(soapModel.getCompanyId());
106         model.setUserId(soapModel.getUserId());
107         model.setUserName(soapModel.getUserName());
108         model.setCreateDate(soapModel.getCreateDate());
109         model.setModifiedDate(soapModel.getModifiedDate());
110         model.setBanUserId(soapModel.getBanUserId());
111 
112         return model;
113     }
114 
115     public static List<MBBan> toModels(MBBanSoap[] soapModels) {
116         List<MBBan> models = new ArrayList<MBBan>(soapModels.length);
117 
118         for (MBBanSoap soapModel : soapModels) {
119             models.add(toModel(soapModel));
120         }
121 
122         return models;
123     }
124 
125     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
126                 "lock.expiration.time.com.liferay.portlet.messageboards.model.MBBan"));
127 
128     public MBBanModelImpl() {
129     }
130 
131     public long getPrimaryKey() {
132         return _banId;
133     }
134 
135     public void setPrimaryKey(long pk) {
136         setBanId(pk);
137     }
138 
139     public Serializable getPrimaryKeyObj() {
140         return new Long(_banId);
141     }
142 
143     public long getBanId() {
144         return _banId;
145     }
146 
147     public void setBanId(long banId) {
148         _banId = banId;
149     }
150 
151     public long getGroupId() {
152         return _groupId;
153     }
154 
155     public void setGroupId(long groupId) {
156         _groupId = groupId;
157 
158         if (!_setOriginalGroupId) {
159             _setOriginalGroupId = true;
160 
161             _originalGroupId = groupId;
162         }
163     }
164 
165     public long getOriginalGroupId() {
166         return _originalGroupId;
167     }
168 
169     public long getCompanyId() {
170         return _companyId;
171     }
172 
173     public void setCompanyId(long companyId) {
174         _companyId = companyId;
175     }
176 
177     public long getUserId() {
178         return _userId;
179     }
180 
181     public void setUserId(long userId) {
182         _userId = userId;
183     }
184 
185     public String getUserName() {
186         return GetterUtil.getString(_userName);
187     }
188 
189     public void setUserName(String userName) {
190         _userName = userName;
191     }
192 
193     public Date getCreateDate() {
194         return _createDate;
195     }
196 
197     public void setCreateDate(Date createDate) {
198         _createDate = createDate;
199     }
200 
201     public Date getModifiedDate() {
202         return _modifiedDate;
203     }
204 
205     public void setModifiedDate(Date modifiedDate) {
206         _modifiedDate = modifiedDate;
207     }
208 
209     public long getBanUserId() {
210         return _banUserId;
211     }
212 
213     public void setBanUserId(long banUserId) {
214         _banUserId = banUserId;
215 
216         if (!_setOriginalBanUserId) {
217             _setOriginalBanUserId = true;
218 
219             _originalBanUserId = banUserId;
220         }
221     }
222 
223     public long getOriginalBanUserId() {
224         return _originalBanUserId;
225     }
226 
227     public MBBan toEscapedModel() {
228         if (isEscapedModel()) {
229             return (MBBan)this;
230         }
231         else {
232             MBBan model = new MBBanImpl();
233 
234             model.setNew(isNew());
235             model.setEscapedModel(true);
236 
237             model.setBanId(getBanId());
238             model.setGroupId(getGroupId());
239             model.setCompanyId(getCompanyId());
240             model.setUserId(getUserId());
241             model.setUserName(HtmlUtil.escape(getUserName()));
242             model.setCreateDate(getCreateDate());
243             model.setModifiedDate(getModifiedDate());
244             model.setBanUserId(getBanUserId());
245 
246             model = (MBBan)Proxy.newProxyInstance(MBBan.class.getClassLoader(),
247                     new Class[] { MBBan.class }, new ReadOnlyBeanHandler(model));
248 
249             return model;
250         }
251     }
252 
253     public ExpandoBridge getExpandoBridge() {
254         if (_expandoBridge == null) {
255             _expandoBridge = new ExpandoBridgeImpl(MBBan.class.getName(),
256                     getPrimaryKey());
257         }
258 
259         return _expandoBridge;
260     }
261 
262     public Object clone() {
263         MBBanImpl clone = new MBBanImpl();
264 
265         clone.setBanId(getBanId());
266         clone.setGroupId(getGroupId());
267         clone.setCompanyId(getCompanyId());
268         clone.setUserId(getUserId());
269         clone.setUserName(getUserName());
270         clone.setCreateDate(getCreateDate());
271         clone.setModifiedDate(getModifiedDate());
272         clone.setBanUserId(getBanUserId());
273 
274         return clone;
275     }
276 
277     public int compareTo(MBBan mbBan) {
278         long pk = mbBan.getPrimaryKey();
279 
280         if (getPrimaryKey() < pk) {
281             return -1;
282         }
283         else if (getPrimaryKey() > pk) {
284             return 1;
285         }
286         else {
287             return 0;
288         }
289     }
290 
291     public boolean equals(Object obj) {
292         if (obj == null) {
293             return false;
294         }
295 
296         MBBan mbBan = null;
297 
298         try {
299             mbBan = (MBBan)obj;
300         }
301         catch (ClassCastException cce) {
302             return false;
303         }
304 
305         long pk = mbBan.getPrimaryKey();
306 
307         if (getPrimaryKey() == pk) {
308             return true;
309         }
310         else {
311             return false;
312         }
313     }
314 
315     public int hashCode() {
316         return (int)getPrimaryKey();
317     }
318 
319     public String toString() {
320         StringBuilder sb = new StringBuilder();
321 
322         sb.append("{banId=");
323         sb.append(getBanId());
324         sb.append(", groupId=");
325         sb.append(getGroupId());
326         sb.append(", companyId=");
327         sb.append(getCompanyId());
328         sb.append(", userId=");
329         sb.append(getUserId());
330         sb.append(", userName=");
331         sb.append(getUserName());
332         sb.append(", createDate=");
333         sb.append(getCreateDate());
334         sb.append(", modifiedDate=");
335         sb.append(getModifiedDate());
336         sb.append(", banUserId=");
337         sb.append(getBanUserId());
338         sb.append("}");
339 
340         return sb.toString();
341     }
342 
343     public String toXmlString() {
344         StringBuilder sb = new StringBuilder();
345 
346         sb.append("<model><model-name>");
347         sb.append("com.liferay.portlet.messageboards.model.MBBan");
348         sb.append("</model-name>");
349 
350         sb.append(
351             "<column><column-name>banId</column-name><column-value><![CDATA[");
352         sb.append(getBanId());
353         sb.append("]]></column-value></column>");
354         sb.append(
355             "<column><column-name>groupId</column-name><column-value><![CDATA[");
356         sb.append(getGroupId());
357         sb.append("]]></column-value></column>");
358         sb.append(
359             "<column><column-name>companyId</column-name><column-value><![CDATA[");
360         sb.append(getCompanyId());
361         sb.append("]]></column-value></column>");
362         sb.append(
363             "<column><column-name>userId</column-name><column-value><![CDATA[");
364         sb.append(getUserId());
365         sb.append("]]></column-value></column>");
366         sb.append(
367             "<column><column-name>userName</column-name><column-value><![CDATA[");
368         sb.append(getUserName());
369         sb.append("]]></column-value></column>");
370         sb.append(
371             "<column><column-name>createDate</column-name><column-value><![CDATA[");
372         sb.append(getCreateDate());
373         sb.append("]]></column-value></column>");
374         sb.append(
375             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
376         sb.append(getModifiedDate());
377         sb.append("]]></column-value></column>");
378         sb.append(
379             "<column><column-name>banUserId</column-name><column-value><![CDATA[");
380         sb.append(getBanUserId());
381         sb.append("]]></column-value></column>");
382 
383         sb.append("</model>");
384 
385         return sb.toString();
386     }
387 
388     private long _banId;
389     private long _groupId;
390     private long _originalGroupId;
391     private boolean _setOriginalGroupId;
392     private long _companyId;
393     private long _userId;
394     private String _userName;
395     private Date _createDate;
396     private Date _modifiedDate;
397     private long _banUserId;
398     private long _originalBanUserId;
399     private boolean _setOriginalBanUserId;
400     private transient ExpandoBridge _expandoBridge;
401 }