1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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.SystemException;
26  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
27  import com.liferay.portal.kernel.util.GetterUtil;
28  import com.liferay.portal.kernel.util.HtmlUtil;
29  import com.liferay.portal.kernel.util.StringBundler;
30  import com.liferay.portal.model.impl.BaseModelImpl;
31  import com.liferay.portal.service.ServiceContext;
32  import com.liferay.portal.util.PortalUtil;
33  
34  import com.liferay.portlet.expando.model.ExpandoBridge;
35  import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
36  import com.liferay.portlet.messageboards.model.MBBan;
37  import com.liferay.portlet.messageboards.model.MBBanSoap;
38  
39  import java.io.Serializable;
40  
41  import java.lang.reflect.Proxy;
42  
43  import java.sql.Types;
44  
45  import java.util.ArrayList;
46  import java.util.Date;
47  import java.util.List;
48  
49  /**
50   * <a href="MBBanModelImpl.java.html"><b><i>View Source</i></b></a>
51   *
52   * <p>
53   * ServiceBuilder generated this class. Modifications in this class will be
54   * overwritten the next time is generated.
55   * </p>
56   *
57   * <p>
58   * This interface is a model that represents the MBBan table in the
59   * database.
60   * </p>
61   *
62   * @author    Brian Wing Shun Chan
63   * @see       MBBanImpl
64   * @see       com.liferay.portlet.messageboards.model.MBBan
65   * @see       com.liferay.portlet.messageboards.model.MBBanModel
66   * @generated
67   */
68  public class MBBanModelImpl extends BaseModelImpl<MBBan> {
69      public static final String TABLE_NAME = "MBBan";
70      public static final Object[][] TABLE_COLUMNS = {
71              { "banId", new Integer(Types.BIGINT) },
72              { "groupId", new Integer(Types.BIGINT) },
73              { "companyId", new Integer(Types.BIGINT) },
74              { "userId", new Integer(Types.BIGINT) },
75              { "userName", new Integer(Types.VARCHAR) },
76              { "createDate", new Integer(Types.TIMESTAMP) },
77              { "modifiedDate", new Integer(Types.TIMESTAMP) },
78              { "banUserId", new Integer(Types.BIGINT) }
79          };
80      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)";
81      public static final String TABLE_SQL_DROP = "drop table MBBan";
82      public static final String DATA_SOURCE = "liferayDataSource";
83      public static final String SESSION_FACTORY = "liferaySessionFactory";
84      public static final String TX_MANAGER = "liferayTransactionManager";
85      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
86                  "value.object.entity.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
87              true);
88      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
89                  "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBBan"),
90              true);
91  
92      public static MBBan toModel(MBBanSoap soapModel) {
93          MBBan model = new MBBanImpl();
94  
95          model.setBanId(soapModel.getBanId());
96          model.setGroupId(soapModel.getGroupId());
97          model.setCompanyId(soapModel.getCompanyId());
98          model.setUserId(soapModel.getUserId());
99          model.setUserName(soapModel.getUserName());
100         model.setCreateDate(soapModel.getCreateDate());
101         model.setModifiedDate(soapModel.getModifiedDate());
102         model.setBanUserId(soapModel.getBanUserId());
103 
104         return model;
105     }
106 
107     public static List<MBBan> toModels(MBBanSoap[] soapModels) {
108         List<MBBan> models = new ArrayList<MBBan>(soapModels.length);
109 
110         for (MBBanSoap soapModel : soapModels) {
111             models.add(toModel(soapModel));
112         }
113 
114         return models;
115     }
116 
117     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
118                 "lock.expiration.time.com.liferay.portlet.messageboards.model.MBBan"));
119 
120     public MBBanModelImpl() {
121     }
122 
123     public long getPrimaryKey() {
124         return _banId;
125     }
126 
127     public void setPrimaryKey(long pk) {
128         setBanId(pk);
129     }
130 
131     public Serializable getPrimaryKeyObj() {
132         return new Long(_banId);
133     }
134 
135     public long getBanId() {
136         return _banId;
137     }
138 
139     public void setBanId(long banId) {
140         _banId = banId;
141     }
142 
143     public long getGroupId() {
144         return _groupId;
145     }
146 
147     public void setGroupId(long groupId) {
148         _groupId = groupId;
149 
150         if (!_setOriginalGroupId) {
151             _setOriginalGroupId = true;
152 
153             _originalGroupId = groupId;
154         }
155     }
156 
157     public long getOriginalGroupId() {
158         return _originalGroupId;
159     }
160 
161     public long getCompanyId() {
162         return _companyId;
163     }
164 
165     public void setCompanyId(long companyId) {
166         _companyId = companyId;
167     }
168 
169     public long getUserId() {
170         return _userId;
171     }
172 
173     public void setUserId(long userId) {
174         _userId = userId;
175     }
176 
177     public String getUserUuid() throws SystemException {
178         return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
179     }
180 
181     public void setUserUuid(String userUuid) {
182         _userUuid = userUuid;
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 String getBanUserUuid() throws SystemException {
224         return PortalUtil.getUserValue(getBanUserId(), "uuid", _banUserUuid);
225     }
226 
227     public void setBanUserUuid(String banUserUuid) {
228         _banUserUuid = banUserUuid;
229     }
230 
231     public long getOriginalBanUserId() {
232         return _originalBanUserId;
233     }
234 
235     public MBBan toEscapedModel() {
236         if (isEscapedModel()) {
237             return (MBBan)this;
238         }
239         else {
240             MBBan model = new MBBanImpl();
241 
242             model.setNew(isNew());
243             model.setEscapedModel(true);
244 
245             model.setBanId(getBanId());
246             model.setGroupId(getGroupId());
247             model.setCompanyId(getCompanyId());
248             model.setUserId(getUserId());
249             model.setUserName(HtmlUtil.escape(getUserName()));
250             model.setCreateDate(getCreateDate());
251             model.setModifiedDate(getModifiedDate());
252             model.setBanUserId(getBanUserId());
253 
254             model = (MBBan)Proxy.newProxyInstance(MBBan.class.getClassLoader(),
255                     new Class[] { MBBan.class }, new ReadOnlyBeanHandler(model));
256 
257             return model;
258         }
259     }
260 
261     public ExpandoBridge getExpandoBridge() {
262         if (_expandoBridge == null) {
263             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(MBBan.class.getName(),
264                     getPrimaryKey());
265         }
266 
267         return _expandoBridge;
268     }
269 
270     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
271         getExpandoBridge().setAttributes(serviceContext);
272     }
273 
274     public Object clone() {
275         MBBanImpl clone = new MBBanImpl();
276 
277         clone.setBanId(getBanId());
278         clone.setGroupId(getGroupId());
279         clone.setCompanyId(getCompanyId());
280         clone.setUserId(getUserId());
281         clone.setUserName(getUserName());
282         clone.setCreateDate(getCreateDate());
283         clone.setModifiedDate(getModifiedDate());
284         clone.setBanUserId(getBanUserId());
285 
286         return clone;
287     }
288 
289     public int compareTo(MBBan mbBan) {
290         long pk = mbBan.getPrimaryKey();
291 
292         if (getPrimaryKey() < pk) {
293             return -1;
294         }
295         else if (getPrimaryKey() > pk) {
296             return 1;
297         }
298         else {
299             return 0;
300         }
301     }
302 
303     public boolean equals(Object obj) {
304         if (obj == null) {
305             return false;
306         }
307 
308         MBBan mbBan = null;
309 
310         try {
311             mbBan = (MBBan)obj;
312         }
313         catch (ClassCastException cce) {
314             return false;
315         }
316 
317         long pk = mbBan.getPrimaryKey();
318 
319         if (getPrimaryKey() == pk) {
320             return true;
321         }
322         else {
323             return false;
324         }
325     }
326 
327     public int hashCode() {
328         return (int)getPrimaryKey();
329     }
330 
331     public String toString() {
332         StringBundler sb = new StringBundler(17);
333 
334         sb.append("{banId=");
335         sb.append(getBanId());
336         sb.append(", groupId=");
337         sb.append(getGroupId());
338         sb.append(", companyId=");
339         sb.append(getCompanyId());
340         sb.append(", userId=");
341         sb.append(getUserId());
342         sb.append(", userName=");
343         sb.append(getUserName());
344         sb.append(", createDate=");
345         sb.append(getCreateDate());
346         sb.append(", modifiedDate=");
347         sb.append(getModifiedDate());
348         sb.append(", banUserId=");
349         sb.append(getBanUserId());
350         sb.append("}");
351 
352         return sb.toString();
353     }
354 
355     public String toXmlString() {
356         StringBundler sb = new StringBundler(28);
357 
358         sb.append("<model><model-name>");
359         sb.append("com.liferay.portlet.messageboards.model.MBBan");
360         sb.append("</model-name>");
361 
362         sb.append(
363             "<column><column-name>banId</column-name><column-value><![CDATA[");
364         sb.append(getBanId());
365         sb.append("]]></column-value></column>");
366         sb.append(
367             "<column><column-name>groupId</column-name><column-value><![CDATA[");
368         sb.append(getGroupId());
369         sb.append("]]></column-value></column>");
370         sb.append(
371             "<column><column-name>companyId</column-name><column-value><![CDATA[");
372         sb.append(getCompanyId());
373         sb.append("]]></column-value></column>");
374         sb.append(
375             "<column><column-name>userId</column-name><column-value><![CDATA[");
376         sb.append(getUserId());
377         sb.append("]]></column-value></column>");
378         sb.append(
379             "<column><column-name>userName</column-name><column-value><![CDATA[");
380         sb.append(getUserName());
381         sb.append("]]></column-value></column>");
382         sb.append(
383             "<column><column-name>createDate</column-name><column-value><![CDATA[");
384         sb.append(getCreateDate());
385         sb.append("]]></column-value></column>");
386         sb.append(
387             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
388         sb.append(getModifiedDate());
389         sb.append("]]></column-value></column>");
390         sb.append(
391             "<column><column-name>banUserId</column-name><column-value><![CDATA[");
392         sb.append(getBanUserId());
393         sb.append("]]></column-value></column>");
394 
395         sb.append("</model>");
396 
397         return sb.toString();
398     }
399 
400     private long _banId;
401     private long _groupId;
402     private long _originalGroupId;
403     private boolean _setOriginalGroupId;
404     private long _companyId;
405     private long _userId;
406     private String _userUuid;
407     private String _userName;
408     private Date _createDate;
409     private Date _modifiedDate;
410     private long _banUserId;
411     private String _banUserUuid;
412     private long _originalBanUserId;
413     private boolean _setOriginalBanUserId;
414     private transient ExpandoBridge _expandoBridge;
415 }