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.GetterUtil;
27  import com.liferay.portal.model.Account;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.util.Html;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  import java.util.Date;
39  
40  /**
41   * <a href="AccountModelImpl.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>Account</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portal.service.model.Account
56   * @see com.liferay.portal.service.model.AccountModel
57   * @see com.liferay.portal.service.model.impl.AccountImpl
58   *
59   */
60  public class AccountModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "Account_";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "accountId", new Integer(Types.BIGINT) },
64              
65  
66              { "companyId", new Integer(Types.BIGINT) },
67              
68  
69              { "userId", new Integer(Types.BIGINT) },
70              
71  
72              { "userName", new Integer(Types.VARCHAR) },
73              
74  
75              { "createDate", new Integer(Types.TIMESTAMP) },
76              
77  
78              { "modifiedDate", new Integer(Types.TIMESTAMP) },
79              
80  
81              { "parentAccountId", new Integer(Types.BIGINT) },
82              
83  
84              { "name", new Integer(Types.VARCHAR) },
85              
86  
87              { "legalName", new Integer(Types.VARCHAR) },
88              
89  
90              { "legalId", new Integer(Types.VARCHAR) },
91              
92  
93              { "legalType", new Integer(Types.VARCHAR) },
94              
95  
96              { "sicCode", new Integer(Types.VARCHAR) },
97              
98  
99              { "tickerSymbol", new Integer(Types.VARCHAR) },
100             
101 
102             { "industry", new Integer(Types.VARCHAR) },
103             
104 
105             { "type_", new Integer(Types.VARCHAR) },
106             
107 
108             { "size_", new Integer(Types.VARCHAR) }
109         };
110     public static final String TABLE_SQL_CREATE = "create table Account_ (accountId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,parentAccountId LONG,name VARCHAR(75) null,legalName VARCHAR(75) null,legalId VARCHAR(75) null,legalType VARCHAR(75) null,sicCode VARCHAR(75) null,tickerSymbol VARCHAR(75) null,industry VARCHAR(75) null,type_ VARCHAR(75) null,size_ VARCHAR(75) null)";
111     public static final String TABLE_SQL_DROP = "drop table Account_";
112     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
113                 "value.object.finder.cache.enabled.com.liferay.portal.model.Account"),
114             true);
115     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
116                 "lock.expiration.time.com.liferay.portal.model.Account"));
117 
118     public AccountModelImpl() {
119     }
120 
121     public long getPrimaryKey() {
122         return _accountId;
123     }
124 
125     public void setPrimaryKey(long pk) {
126         setAccountId(pk);
127     }
128 
129     public Serializable getPrimaryKeyObj() {
130         return new Long(_accountId);
131     }
132 
133     public long getAccountId() {
134         return _accountId;
135     }
136 
137     public void setAccountId(long accountId) {
138         if (accountId != _accountId) {
139             _accountId = accountId;
140         }
141     }
142 
143     public long getCompanyId() {
144         return _companyId;
145     }
146 
147     public void setCompanyId(long companyId) {
148         if (companyId != _companyId) {
149             _companyId = companyId;
150         }
151     }
152 
153     public long getUserId() {
154         return _userId;
155     }
156 
157     public void setUserId(long userId) {
158         if (userId != _userId) {
159             _userId = userId;
160         }
161     }
162 
163     public String getUserName() {
164         return GetterUtil.getString(_userName);
165     }
166 
167     public void setUserName(String userName) {
168         if (((userName == null) && (_userName != null)) ||
169                 ((userName != null) && (_userName == null)) ||
170                 ((userName != null) && (_userName != null) &&
171                 !userName.equals(_userName))) {
172             _userName = userName;
173         }
174     }
175 
176     public Date getCreateDate() {
177         return _createDate;
178     }
179 
180     public void setCreateDate(Date createDate) {
181         if (((createDate == null) && (_createDate != null)) ||
182                 ((createDate != null) && (_createDate == null)) ||
183                 ((createDate != null) && (_createDate != null) &&
184                 !createDate.equals(_createDate))) {
185             _createDate = createDate;
186         }
187     }
188 
189     public Date getModifiedDate() {
190         return _modifiedDate;
191     }
192 
193     public void setModifiedDate(Date modifiedDate) {
194         if (((modifiedDate == null) && (_modifiedDate != null)) ||
195                 ((modifiedDate != null) && (_modifiedDate == null)) ||
196                 ((modifiedDate != null) && (_modifiedDate != null) &&
197                 !modifiedDate.equals(_modifiedDate))) {
198             _modifiedDate = modifiedDate;
199         }
200     }
201 
202     public long getParentAccountId() {
203         return _parentAccountId;
204     }
205 
206     public void setParentAccountId(long parentAccountId) {
207         if (parentAccountId != _parentAccountId) {
208             _parentAccountId = parentAccountId;
209         }
210     }
211 
212     public String getName() {
213         return GetterUtil.getString(_name);
214     }
215 
216     public void setName(String name) {
217         if (((name == null) && (_name != null)) ||
218                 ((name != null) && (_name == null)) ||
219                 ((name != null) && (_name != null) && !name.equals(_name))) {
220             _name = name;
221         }
222     }
223 
224     public String getLegalName() {
225         return GetterUtil.getString(_legalName);
226     }
227 
228     public void setLegalName(String legalName) {
229         if (((legalName == null) && (_legalName != null)) ||
230                 ((legalName != null) && (_legalName == null)) ||
231                 ((legalName != null) && (_legalName != null) &&
232                 !legalName.equals(_legalName))) {
233             _legalName = legalName;
234         }
235     }
236 
237     public String getLegalId() {
238         return GetterUtil.getString(_legalId);
239     }
240 
241     public void setLegalId(String legalId) {
242         if (((legalId == null) && (_legalId != null)) ||
243                 ((legalId != null) && (_legalId == null)) ||
244                 ((legalId != null) && (_legalId != null) &&
245                 !legalId.equals(_legalId))) {
246             _legalId = legalId;
247         }
248     }
249 
250     public String getLegalType() {
251         return GetterUtil.getString(_legalType);
252     }
253 
254     public void setLegalType(String legalType) {
255         if (((legalType == null) && (_legalType != null)) ||
256                 ((legalType != null) && (_legalType == null)) ||
257                 ((legalType != null) && (_legalType != null) &&
258                 !legalType.equals(_legalType))) {
259             _legalType = legalType;
260         }
261     }
262 
263     public String getSicCode() {
264         return GetterUtil.getString(_sicCode);
265     }
266 
267     public void setSicCode(String sicCode) {
268         if (((sicCode == null) && (_sicCode != null)) ||
269                 ((sicCode != null) && (_sicCode == null)) ||
270                 ((sicCode != null) && (_sicCode != null) &&
271                 !sicCode.equals(_sicCode))) {
272             _sicCode = sicCode;
273         }
274     }
275 
276     public String getTickerSymbol() {
277         return GetterUtil.getString(_tickerSymbol);
278     }
279 
280     public void setTickerSymbol(String tickerSymbol) {
281         if (((tickerSymbol == null) && (_tickerSymbol != null)) ||
282                 ((tickerSymbol != null) && (_tickerSymbol == null)) ||
283                 ((tickerSymbol != null) && (_tickerSymbol != null) &&
284                 !tickerSymbol.equals(_tickerSymbol))) {
285             _tickerSymbol = tickerSymbol;
286         }
287     }
288 
289     public String getIndustry() {
290         return GetterUtil.getString(_industry);
291     }
292 
293     public void setIndustry(String industry) {
294         if (((industry == null) && (_industry != null)) ||
295                 ((industry != null) && (_industry == null)) ||
296                 ((industry != null) && (_industry != null) &&
297                 !industry.equals(_industry))) {
298             _industry = industry;
299         }
300     }
301 
302     public String getType() {
303         return GetterUtil.getString(_type);
304     }
305 
306     public void setType(String type) {
307         if (((type == null) && (_type != null)) ||
308                 ((type != null) && (_type == null)) ||
309                 ((type != null) && (_type != null) && !type.equals(_type))) {
310             _type = type;
311         }
312     }
313 
314     public String getSize() {
315         return GetterUtil.getString(_size);
316     }
317 
318     public void setSize(String size) {
319         if (((size == null) && (_size != null)) ||
320                 ((size != null) && (_size == null)) ||
321                 ((size != null) && (_size != null) && !size.equals(_size))) {
322             _size = size;
323         }
324     }
325 
326     public Account toEscapedModel() {
327         if (isEscapedModel()) {
328             return (Account)this;
329         }
330         else {
331             Account model = new AccountImpl();
332 
333             model.setEscapedModel(true);
334 
335             model.setAccountId(getAccountId());
336             model.setCompanyId(getCompanyId());
337             model.setUserId(getUserId());
338             model.setUserName(Html.escape(getUserName()));
339             model.setCreateDate(getCreateDate());
340             model.setModifiedDate(getModifiedDate());
341             model.setParentAccountId(getParentAccountId());
342             model.setName(Html.escape(getName()));
343             model.setLegalName(Html.escape(getLegalName()));
344             model.setLegalId(Html.escape(getLegalId()));
345             model.setLegalType(Html.escape(getLegalType()));
346             model.setSicCode(Html.escape(getSicCode()));
347             model.setTickerSymbol(Html.escape(getTickerSymbol()));
348             model.setIndustry(Html.escape(getIndustry()));
349             model.setType(Html.escape(getType()));
350             model.setSize(Html.escape(getSize()));
351 
352             model = (Account)Proxy.newProxyInstance(Account.class.getClassLoader(),
353                     new Class[] { Account.class },
354                     new ReadOnlyBeanHandler(model));
355 
356             return model;
357         }
358     }
359 
360     public Object clone() {
361         AccountImpl clone = new AccountImpl();
362 
363         clone.setAccountId(getAccountId());
364         clone.setCompanyId(getCompanyId());
365         clone.setUserId(getUserId());
366         clone.setUserName(getUserName());
367         clone.setCreateDate(getCreateDate());
368         clone.setModifiedDate(getModifiedDate());
369         clone.setParentAccountId(getParentAccountId());
370         clone.setName(getName());
371         clone.setLegalName(getLegalName());
372         clone.setLegalId(getLegalId());
373         clone.setLegalType(getLegalType());
374         clone.setSicCode(getSicCode());
375         clone.setTickerSymbol(getTickerSymbol());
376         clone.setIndustry(getIndustry());
377         clone.setType(getType());
378         clone.setSize(getSize());
379 
380         return clone;
381     }
382 
383     public int compareTo(Object obj) {
384         if (obj == null) {
385             return -1;
386         }
387 
388         AccountImpl account = (AccountImpl)obj;
389 
390         long pk = account.getPrimaryKey();
391 
392         if (getPrimaryKey() < pk) {
393             return -1;
394         }
395         else if (getPrimaryKey() > pk) {
396             return 1;
397         }
398         else {
399             return 0;
400         }
401     }
402 
403     public boolean equals(Object obj) {
404         if (obj == null) {
405             return false;
406         }
407 
408         AccountImpl account = null;
409 
410         try {
411             account = (AccountImpl)obj;
412         }
413         catch (ClassCastException cce) {
414             return false;
415         }
416 
417         long pk = account.getPrimaryKey();
418 
419         if (getPrimaryKey() == pk) {
420             return true;
421         }
422         else {
423             return false;
424         }
425     }
426 
427     public int hashCode() {
428         return (int)getPrimaryKey();
429     }
430 
431     private long _accountId;
432     private long _companyId;
433     private long _userId;
434     private String _userName;
435     private Date _createDate;
436     private Date _modifiedDate;
437     private long _parentAccountId;
438     private String _name;
439     private String _legalName;
440     private String _legalId;
441     private String _legalType;
442     private String _sicCode;
443     private String _tickerSymbol;
444     private String _industry;
445     private String _type;
446     private String _size;
447 }