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.portal.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="AccountModelImpl.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>Account_</code> table in the
47   * database.
48   * </p>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   * @see com.liferay.portal.service.model.Account
53   * @see com.liferay.portal.service.model.AccountModel
54   * @see com.liferay.portal.service.model.impl.AccountImpl
55   *
56   */
57  public class AccountModelImpl extends BaseModelImpl {
58      public static String TABLE_NAME = "Account_";
59      public static Object[][] TABLE_COLUMNS = {
60              { "accountId", 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              { "parentAccountId", new Integer(Types.BIGINT) },
67              { "name", new Integer(Types.VARCHAR) },
68              { "legalName", new Integer(Types.VARCHAR) },
69              { "legalId", new Integer(Types.VARCHAR) },
70              { "legalType", new Integer(Types.VARCHAR) },
71              { "sicCode", new Integer(Types.VARCHAR) },
72              { "tickerSymbol", new Integer(Types.VARCHAR) },
73              { "industry", new Integer(Types.VARCHAR) },
74              { "type_", new Integer(Types.VARCHAR) },
75              { "size_", new Integer(Types.VARCHAR) }
76          };
77      public static 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)";
78      public static String TABLE_SQL_DROP = "drop table Account_";
79      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
80                  "xss.allow.com.liferay.portal.model.Account"), XSS_ALLOW);
81      public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
82                  "xss.allow.com.liferay.portal.model.Account.userName"),
83              XSS_ALLOW_BY_MODEL);
84      public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
85                  "xss.allow.com.liferay.portal.model.Account.name"),
86              XSS_ALLOW_BY_MODEL);
87      public static boolean XSS_ALLOW_LEGALNAME = GetterUtil.getBoolean(PropsUtil.get(
88                  "xss.allow.com.liferay.portal.model.Account.legalName"),
89              XSS_ALLOW_BY_MODEL);
90      public static boolean XSS_ALLOW_LEGALID = GetterUtil.getBoolean(PropsUtil.get(
91                  "xss.allow.com.liferay.portal.model.Account.legalId"),
92              XSS_ALLOW_BY_MODEL);
93      public static boolean XSS_ALLOW_LEGALTYPE = GetterUtil.getBoolean(PropsUtil.get(
94                  "xss.allow.com.liferay.portal.model.Account.legalType"),
95              XSS_ALLOW_BY_MODEL);
96      public static boolean XSS_ALLOW_SICCODE = GetterUtil.getBoolean(PropsUtil.get(
97                  "xss.allow.com.liferay.portal.model.Account.sicCode"),
98              XSS_ALLOW_BY_MODEL);
99      public static boolean XSS_ALLOW_TICKERSYMBOL = GetterUtil.getBoolean(PropsUtil.get(
100                 "xss.allow.com.liferay.portal.model.Account.tickerSymbol"),
101             XSS_ALLOW_BY_MODEL);
102     public static boolean XSS_ALLOW_INDUSTRY = GetterUtil.getBoolean(PropsUtil.get(
103                 "xss.allow.com.liferay.portal.model.Account.industry"),
104             XSS_ALLOW_BY_MODEL);
105     public static boolean XSS_ALLOW_TYPE = GetterUtil.getBoolean(PropsUtil.get(
106                 "xss.allow.com.liferay.portal.model.Account.type"),
107             XSS_ALLOW_BY_MODEL);
108     public static boolean XSS_ALLOW_SIZE = GetterUtil.getBoolean(PropsUtil.get(
109                 "xss.allow.com.liferay.portal.model.Account.size"),
110             XSS_ALLOW_BY_MODEL);
111     public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
112                 "lock.expiration.time.com.liferay.portal.model.AccountModel"));
113 
114     public AccountModelImpl() {
115     }
116 
117     public long getPrimaryKey() {
118         return _accountId;
119     }
120 
121     public void setPrimaryKey(long pk) {
122         setAccountId(pk);
123     }
124 
125     public Serializable getPrimaryKeyObj() {
126         return new Long(_accountId);
127     }
128 
129     public long getAccountId() {
130         return _accountId;
131     }
132 
133     public void setAccountId(long accountId) {
134         if (accountId != _accountId) {
135             _accountId = accountId;
136         }
137     }
138 
139     public long getCompanyId() {
140         return _companyId;
141     }
142 
143     public void setCompanyId(long companyId) {
144         if (companyId != _companyId) {
145             _companyId = companyId;
146         }
147     }
148 
149     public long getUserId() {
150         return _userId;
151     }
152 
153     public void setUserId(long userId) {
154         if (userId != _userId) {
155             _userId = userId;
156         }
157     }
158 
159     public String getUserName() {
160         return GetterUtil.getString(_userName);
161     }
162 
163     public void setUserName(String userName) {
164         if (((userName == null) && (_userName != null)) ||
165                 ((userName != null) && (_userName == null)) ||
166                 ((userName != null) && (_userName != null) &&
167                 !userName.equals(_userName))) {
168             if (!XSS_ALLOW_USERNAME) {
169                 userName = XSSUtil.strip(userName);
170             }
171 
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             if (!XSS_ALLOW_NAME) {
221                 name = XSSUtil.strip(name);
222             }
223 
224             _name = name;
225         }
226     }
227 
228     public String getLegalName() {
229         return GetterUtil.getString(_legalName);
230     }
231 
232     public void setLegalName(String legalName) {
233         if (((legalName == null) && (_legalName != null)) ||
234                 ((legalName != null) && (_legalName == null)) ||
235                 ((legalName != null) && (_legalName != null) &&
236                 !legalName.equals(_legalName))) {
237             if (!XSS_ALLOW_LEGALNAME) {
238                 legalName = XSSUtil.strip(legalName);
239             }
240 
241             _legalName = legalName;
242         }
243     }
244 
245     public String getLegalId() {
246         return GetterUtil.getString(_legalId);
247     }
248 
249     public void setLegalId(String legalId) {
250         if (((legalId == null) && (_legalId != null)) ||
251                 ((legalId != null) && (_legalId == null)) ||
252                 ((legalId != null) && (_legalId != null) &&
253                 !legalId.equals(_legalId))) {
254             if (!XSS_ALLOW_LEGALID) {
255                 legalId = XSSUtil.strip(legalId);
256             }
257 
258             _legalId = legalId;
259         }
260     }
261 
262     public String getLegalType() {
263         return GetterUtil.getString(_legalType);
264     }
265 
266     public void setLegalType(String legalType) {
267         if (((legalType == null) && (_legalType != null)) ||
268                 ((legalType != null) && (_legalType == null)) ||
269                 ((legalType != null) && (_legalType != null) &&
270                 !legalType.equals(_legalType))) {
271             if (!XSS_ALLOW_LEGALTYPE) {
272                 legalType = XSSUtil.strip(legalType);
273             }
274 
275             _legalType = legalType;
276         }
277     }
278 
279     public String getSicCode() {
280         return GetterUtil.getString(_sicCode);
281     }
282 
283     public void setSicCode(String sicCode) {
284         if (((sicCode == null) && (_sicCode != null)) ||
285                 ((sicCode != null) && (_sicCode == null)) ||
286                 ((sicCode != null) && (_sicCode != null) &&
287                 !sicCode.equals(_sicCode))) {
288             if (!XSS_ALLOW_SICCODE) {
289                 sicCode = XSSUtil.strip(sicCode);
290             }
291 
292             _sicCode = sicCode;
293         }
294     }
295 
296     public String getTickerSymbol() {
297         return GetterUtil.getString(_tickerSymbol);
298     }
299 
300     public void setTickerSymbol(String tickerSymbol) {
301         if (((tickerSymbol == null) && (_tickerSymbol != null)) ||
302                 ((tickerSymbol != null) && (_tickerSymbol == null)) ||
303                 ((tickerSymbol != null) && (_tickerSymbol != null) &&
304                 !tickerSymbol.equals(_tickerSymbol))) {
305             if (!XSS_ALLOW_TICKERSYMBOL) {
306                 tickerSymbol = XSSUtil.strip(tickerSymbol);
307             }
308 
309             _tickerSymbol = tickerSymbol;
310         }
311     }
312 
313     public String getIndustry() {
314         return GetterUtil.getString(_industry);
315     }
316 
317     public void setIndustry(String industry) {
318         if (((industry == null) && (_industry != null)) ||
319                 ((industry != null) && (_industry == null)) ||
320                 ((industry != null) && (_industry != null) &&
321                 !industry.equals(_industry))) {
322             if (!XSS_ALLOW_INDUSTRY) {
323                 industry = XSSUtil.strip(industry);
324             }
325 
326             _industry = industry;
327         }
328     }
329 
330     public String getType() {
331         return GetterUtil.getString(_type);
332     }
333 
334     public void setType(String type) {
335         if (((type == null) && (_type != null)) ||
336                 ((type != null) && (_type == null)) ||
337                 ((type != null) && (_type != null) && !type.equals(_type))) {
338             if (!XSS_ALLOW_TYPE) {
339                 type = XSSUtil.strip(type);
340             }
341 
342             _type = type;
343         }
344     }
345 
346     public String getSize() {
347         return GetterUtil.getString(_size);
348     }
349 
350     public void setSize(String size) {
351         if (((size == null) && (_size != null)) ||
352                 ((size != null) && (_size == null)) ||
353                 ((size != null) && (_size != null) && !size.equals(_size))) {
354             if (!XSS_ALLOW_SIZE) {
355                 size = XSSUtil.strip(size);
356             }
357 
358             _size = size;
359         }
360     }
361 
362     public Object clone() {
363         AccountImpl clone = new AccountImpl();
364         clone.setAccountId(getAccountId());
365         clone.setCompanyId(getCompanyId());
366         clone.setUserId(getUserId());
367         clone.setUserName(getUserName());
368         clone.setCreateDate(getCreateDate());
369         clone.setModifiedDate(getModifiedDate());
370         clone.setParentAccountId(getParentAccountId());
371         clone.setName(getName());
372         clone.setLegalName(getLegalName());
373         clone.setLegalId(getLegalId());
374         clone.setLegalType(getLegalType());
375         clone.setSicCode(getSicCode());
376         clone.setTickerSymbol(getTickerSymbol());
377         clone.setIndustry(getIndustry());
378         clone.setType(getType());
379         clone.setSize(getSize());
380 
381         return clone;
382     }
383 
384     public int compareTo(Object obj) {
385         if (obj == null) {
386             return -1;
387         }
388 
389         AccountImpl account = (AccountImpl)obj;
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 }