1   /**
2    * Copyright (c) 2000-2008 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.portal.model.impl;
24  
25  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.DateUtil;
27  import com.liferay.portal.kernel.util.GetterUtil;
28  import com.liferay.portal.model.Website;
29  import com.liferay.portal.util.PropsUtil;
30  
31  import com.liferay.util.Html;
32  
33  import java.io.Serializable;
34  
35  import java.lang.reflect.Proxy;
36  
37  import java.sql.Types;
38  
39  import java.util.Date;
40  
41  /**
42   * <a href="WebsiteModelImpl.java.html"><b><i>View Source</i></b></a>
43   *
44   * <p>
45   * ServiceBuilder generated this class. Modifications in this class will be
46   * overwritten the next time is generated.
47   * </p>
48   *
49   * <p>
50   * This class is a model that represents the <code>Website</code> table
51   * in the database.
52   * </p>
53   *
54   * @author Brian Wing Shun Chan
55   *
56   * @see com.liferay.portal.service.model.Website
57   * @see com.liferay.portal.service.model.WebsiteModel
58   * @see com.liferay.portal.service.model.impl.WebsiteImpl
59   *
60   */
61  public class WebsiteModelImpl extends BaseModelImpl {
62      public static final String TABLE_NAME = "Website";
63      public static final Object[][] TABLE_COLUMNS = {
64              { "websiteId", new Integer(Types.BIGINT) },
65              
66  
67              { "companyId", new Integer(Types.BIGINT) },
68              
69  
70              { "userId", new Integer(Types.BIGINT) },
71              
72  
73              { "userName", new Integer(Types.VARCHAR) },
74              
75  
76              { "createDate", new Integer(Types.TIMESTAMP) },
77              
78  
79              { "modifiedDate", new Integer(Types.TIMESTAMP) },
80              
81  
82              { "classNameId", new Integer(Types.BIGINT) },
83              
84  
85              { "classPK", new Integer(Types.BIGINT) },
86              
87  
88              { "url", new Integer(Types.VARCHAR) },
89              
90  
91              { "typeId", new Integer(Types.INTEGER) },
92              
93  
94              { "primary_", new Integer(Types.BOOLEAN) }
95          };
96      public static final String TABLE_SQL_CREATE = "create table Website (websiteId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,url STRING null,typeId INTEGER,primary_ BOOLEAN)";
97      public static final String TABLE_SQL_DROP = "drop table Website";
98      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
99                  "value.object.finder.cache.enabled.com.liferay.portal.model.Website"),
100             true);
101     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
102                 "lock.expiration.time.com.liferay.portal.model.Website"));
103 
104     public WebsiteModelImpl() {
105     }
106 
107     public long getPrimaryKey() {
108         return _websiteId;
109     }
110 
111     public void setPrimaryKey(long pk) {
112         setWebsiteId(pk);
113     }
114 
115     public Serializable getPrimaryKeyObj() {
116         return new Long(_websiteId);
117     }
118 
119     public long getWebsiteId() {
120         return _websiteId;
121     }
122 
123     public void setWebsiteId(long websiteId) {
124         if (websiteId != _websiteId) {
125             _websiteId = websiteId;
126         }
127     }
128 
129     public long getCompanyId() {
130         return _companyId;
131     }
132 
133     public void setCompanyId(long companyId) {
134         if (companyId != _companyId) {
135             _companyId = companyId;
136         }
137     }
138 
139     public long getUserId() {
140         return _userId;
141     }
142 
143     public void setUserId(long userId) {
144         if (userId != _userId) {
145             _userId = userId;
146         }
147     }
148 
149     public String getUserName() {
150         return GetterUtil.getString(_userName);
151     }
152 
153     public void setUserName(String userName) {
154         if (((userName == null) && (_userName != null)) ||
155                 ((userName != null) && (_userName == null)) ||
156                 ((userName != null) && (_userName != null) &&
157                 !userName.equals(_userName))) {
158             _userName = userName;
159         }
160     }
161 
162     public Date getCreateDate() {
163         return _createDate;
164     }
165 
166     public void setCreateDate(Date createDate) {
167         if (((createDate == null) && (_createDate != null)) ||
168                 ((createDate != null) && (_createDate == null)) ||
169                 ((createDate != null) && (_createDate != null) &&
170                 !createDate.equals(_createDate))) {
171             _createDate = createDate;
172         }
173     }
174 
175     public Date getModifiedDate() {
176         return _modifiedDate;
177     }
178 
179     public void setModifiedDate(Date modifiedDate) {
180         if (((modifiedDate == null) && (_modifiedDate != null)) ||
181                 ((modifiedDate != null) && (_modifiedDate == null)) ||
182                 ((modifiedDate != null) && (_modifiedDate != null) &&
183                 !modifiedDate.equals(_modifiedDate))) {
184             _modifiedDate = modifiedDate;
185         }
186     }
187 
188     public long getClassNameId() {
189         return _classNameId;
190     }
191 
192     public void setClassNameId(long classNameId) {
193         if (classNameId != _classNameId) {
194             _classNameId = classNameId;
195         }
196     }
197 
198     public long getClassPK() {
199         return _classPK;
200     }
201 
202     public void setClassPK(long classPK) {
203         if (classPK != _classPK) {
204             _classPK = classPK;
205         }
206     }
207 
208     public String getUrl() {
209         return GetterUtil.getString(_url);
210     }
211 
212     public void setUrl(String url) {
213         if (((url == null) && (_url != null)) ||
214                 ((url != null) && (_url == null)) ||
215                 ((url != null) && (_url != null) && !url.equals(_url))) {
216             _url = url;
217         }
218     }
219 
220     public int getTypeId() {
221         return _typeId;
222     }
223 
224     public void setTypeId(int typeId) {
225         if (typeId != _typeId) {
226             _typeId = typeId;
227         }
228     }
229 
230     public boolean getPrimary() {
231         return _primary;
232     }
233 
234     public boolean isPrimary() {
235         return _primary;
236     }
237 
238     public void setPrimary(boolean primary) {
239         if (primary != _primary) {
240             _primary = primary;
241         }
242     }
243 
244     public Website toEscapedModel() {
245         if (isEscapedModel()) {
246             return (Website)this;
247         }
248         else {
249             Website model = new WebsiteImpl();
250 
251             model.setEscapedModel(true);
252 
253             model.setWebsiteId(getWebsiteId());
254             model.setCompanyId(getCompanyId());
255             model.setUserId(getUserId());
256             model.setUserName(Html.escape(getUserName()));
257             model.setCreateDate(getCreateDate());
258             model.setModifiedDate(getModifiedDate());
259             model.setClassNameId(getClassNameId());
260             model.setClassPK(getClassPK());
261             model.setUrl(Html.escape(getUrl()));
262             model.setTypeId(getTypeId());
263             model.setPrimary(getPrimary());
264 
265             model = (Website)Proxy.newProxyInstance(Website.class.getClassLoader(),
266                     new Class[] { Website.class },
267                     new ReadOnlyBeanHandler(model));
268 
269             return model;
270         }
271     }
272 
273     public Object clone() {
274         WebsiteImpl clone = new WebsiteImpl();
275 
276         clone.setWebsiteId(getWebsiteId());
277         clone.setCompanyId(getCompanyId());
278         clone.setUserId(getUserId());
279         clone.setUserName(getUserName());
280         clone.setCreateDate(getCreateDate());
281         clone.setModifiedDate(getModifiedDate());
282         clone.setClassNameId(getClassNameId());
283         clone.setClassPK(getClassPK());
284         clone.setUrl(getUrl());
285         clone.setTypeId(getTypeId());
286         clone.setPrimary(getPrimary());
287 
288         return clone;
289     }
290 
291     public int compareTo(Object obj) {
292         if (obj == null) {
293             return -1;
294         }
295 
296         WebsiteImpl website = (WebsiteImpl)obj;
297 
298         int value = 0;
299 
300         value = DateUtil.compareTo(getCreateDate(), website.getCreateDate());
301 
302         if (value != 0) {
303             return value;
304         }
305 
306         return 0;
307     }
308 
309     public boolean equals(Object obj) {
310         if (obj == null) {
311             return false;
312         }
313 
314         WebsiteImpl website = null;
315 
316         try {
317             website = (WebsiteImpl)obj;
318         }
319         catch (ClassCastException cce) {
320             return false;
321         }
322 
323         long pk = website.getPrimaryKey();
324 
325         if (getPrimaryKey() == pk) {
326             return true;
327         }
328         else {
329             return false;
330         }
331     }
332 
333     public int hashCode() {
334         return (int)getPrimaryKey();
335     }
336 
337     private long _websiteId;
338     private long _companyId;
339     private long _userId;
340     private String _userName;
341     private Date _createDate;
342     private Date _modifiedDate;
343     private long _classNameId;
344     private long _classPK;
345     private String _url;
346     private int _typeId;
347     private boolean _primary;
348 }