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