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