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