1
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
56 public class UserModelImpl extends BaseModelImpl {
57 public static String TABLE_NAME = "User_";
58 public static Object[][] TABLE_COLUMNS = {
59 { "userId", new Integer(Types.BIGINT) },
60 { "companyId", new Integer(Types.BIGINT) },
61 { "createDate", new Integer(Types.TIMESTAMP) },
62 { "modifiedDate", new Integer(Types.TIMESTAMP) },
63 { "defaultUser", new Integer(Types.BOOLEAN) },
64 { "contactId", new Integer(Types.BIGINT) },
65 { "password_", new Integer(Types.VARCHAR) },
66 { "passwordEncrypted", new Integer(Types.BOOLEAN) },
67 { "passwordReset", new Integer(Types.BOOLEAN) },
68 { "passwordModifiedDate", new Integer(Types.TIMESTAMP) },
69 { "graceLoginCount", new Integer(Types.INTEGER) },
70 { "screenName", new Integer(Types.VARCHAR) },
71 { "emailAddress", new Integer(Types.VARCHAR) },
72 { "portraitId", new Integer(Types.BIGINT) },
73 { "languageId", new Integer(Types.VARCHAR) },
74 { "timeZoneId", new Integer(Types.VARCHAR) },
75 { "greeting", new Integer(Types.VARCHAR) },
76 { "comments", new Integer(Types.VARCHAR) },
77 { "loginDate", new Integer(Types.TIMESTAMP) },
78 { "loginIP", new Integer(Types.VARCHAR) },
79 { "lastLoginDate", new Integer(Types.TIMESTAMP) },
80 { "lastLoginIP", new Integer(Types.VARCHAR) },
81 { "lastFailedLoginDate", new Integer(Types.TIMESTAMP) },
82 { "failedLoginAttempts", new Integer(Types.INTEGER) },
83 { "lockout", new Integer(Types.BOOLEAN) },
84 { "lockoutDate", new Integer(Types.TIMESTAMP) },
85 { "agreedToTermsOfUse", new Integer(Types.BOOLEAN) },
86 { "active_", new Integer(Types.BOOLEAN) }
87 };
88 public static String TABLE_SQL_CREATE = "create table User_ (userId LONG not null primary key,companyId LONG,createDate DATE null,modifiedDate DATE null,defaultUser BOOLEAN,contactId LONG,password_ VARCHAR(75) null,passwordEncrypted BOOLEAN,passwordReset BOOLEAN,passwordModifiedDate DATE null,graceLoginCount INTEGER,screenName VARCHAR(75) null,emailAddress VARCHAR(75) null,portraitId LONG,languageId VARCHAR(75) null,timeZoneId VARCHAR(75) null,greeting VARCHAR(75) null,comments STRING null,loginDate DATE null,loginIP VARCHAR(75) null,lastLoginDate DATE null,lastLoginIP VARCHAR(75) null,lastFailedLoginDate DATE null,failedLoginAttempts INTEGER,lockout BOOLEAN,lockoutDate DATE null,agreedToTermsOfUse BOOLEAN,active_ BOOLEAN)";
89 public static String TABLE_SQL_DROP = "drop table User_";
90 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
91 "xss.allow.com.liferay.portal.model.User"), XSS_ALLOW);
92 public static boolean XSS_ALLOW_PASSWORD = GetterUtil.getBoolean(PropsUtil.get(
93 "xss.allow.com.liferay.portal.model.User.password"),
94 XSS_ALLOW_BY_MODEL);
95 public static boolean XSS_ALLOW_SCREENNAME = GetterUtil.getBoolean(PropsUtil.get(
96 "xss.allow.com.liferay.portal.model.User.screenName"),
97 XSS_ALLOW_BY_MODEL);
98 public static boolean XSS_ALLOW_EMAILADDRESS = GetterUtil.getBoolean(PropsUtil.get(
99 "xss.allow.com.liferay.portal.model.User.emailAddress"),
100 XSS_ALLOW_BY_MODEL);
101 public static boolean XSS_ALLOW_LANGUAGEID = GetterUtil.getBoolean(PropsUtil.get(
102 "xss.allow.com.liferay.portal.model.User.languageId"),
103 XSS_ALLOW_BY_MODEL);
104 public static boolean XSS_ALLOW_TIMEZONEID = GetterUtil.getBoolean(PropsUtil.get(
105 "xss.allow.com.liferay.portal.model.User.timeZoneId"),
106 XSS_ALLOW_BY_MODEL);
107 public static boolean XSS_ALLOW_GREETING = GetterUtil.getBoolean(PropsUtil.get(
108 "xss.allow.com.liferay.portal.model.User.greeting"),
109 XSS_ALLOW_BY_MODEL);
110 public static boolean XSS_ALLOW_COMMENTS = GetterUtil.getBoolean(PropsUtil.get(
111 "xss.allow.com.liferay.portal.model.User.comments"),
112 XSS_ALLOW_BY_MODEL);
113 public static boolean XSS_ALLOW_LOGINIP = GetterUtil.getBoolean(PropsUtil.get(
114 "xss.allow.com.liferay.portal.model.User.loginIP"),
115 XSS_ALLOW_BY_MODEL);
116 public static boolean XSS_ALLOW_LASTLOGINIP = GetterUtil.getBoolean(PropsUtil.get(
117 "xss.allow.com.liferay.portal.model.User.lastLoginIP"),
118 XSS_ALLOW_BY_MODEL);
119 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
120 "lock.expiration.time.com.liferay.portal.model.UserModel"));
121
122 public UserModelImpl() {
123 }
124
125 public long getPrimaryKey() {
126 return _userId;
127 }
128
129 public void setPrimaryKey(long pk) {
130 setUserId(pk);
131 }
132
133 public Serializable getPrimaryKeyObj() {
134 return new Long(_userId);
135 }
136
137 public long getUserId() {
138 return _userId;
139 }
140
141 public void setUserId(long userId) {
142 if (userId != _userId) {
143 _userId = userId;
144 }
145 }
146
147 public long getCompanyId() {
148 return _companyId;
149 }
150
151 public void setCompanyId(long companyId) {
152 if (companyId != _companyId) {
153 _companyId = companyId;
154 }
155 }
156
157 public Date getCreateDate() {
158 return _createDate;
159 }
160
161 public void setCreateDate(Date createDate) {
162 if (((createDate == null) && (_createDate != null)) ||
163 ((createDate != null) && (_createDate == null)) ||
164 ((createDate != null) && (_createDate != null) &&
165 !createDate.equals(_createDate))) {
166 _createDate = createDate;
167 }
168 }
169
170 public Date getModifiedDate() {
171 return _modifiedDate;
172 }
173
174 public void setModifiedDate(Date modifiedDate) {
175 if (((modifiedDate == null) && (_modifiedDate != null)) ||
176 ((modifiedDate != null) && (_modifiedDate == null)) ||
177 ((modifiedDate != null) && (_modifiedDate != null) &&
178 !modifiedDate.equals(_modifiedDate))) {
179 _modifiedDate = modifiedDate;
180 }
181 }
182
183 public boolean getDefaultUser() {
184 return _defaultUser;
185 }
186
187 public boolean isDefaultUser() {
188 return _defaultUser;
189 }
190
191 public void setDefaultUser(boolean defaultUser) {
192 if (defaultUser != _defaultUser) {
193 _defaultUser = defaultUser;
194 }
195 }
196
197 public long getContactId() {
198 return _contactId;
199 }
200
201 public void setContactId(long contactId) {
202 if (contactId != _contactId) {
203 _contactId = contactId;
204 }
205 }
206
207 public String getPassword() {
208 return GetterUtil.getString(_password);
209 }
210
211 public void setPassword(String password) {
212 if (((password == null) && (_password != null)) ||
213 ((password != null) && (_password == null)) ||
214 ((password != null) && (_password != null) &&
215 !password.equals(_password))) {
216 if (!XSS_ALLOW_PASSWORD) {
217 password = XSSUtil.strip(password);
218 }
219
220 _password = password;
221 }
222 }
223
224 public boolean getPasswordEncrypted() {
225 return _passwordEncrypted;
226 }
227
228 public boolean isPasswordEncrypted() {
229 return _passwordEncrypted;
230 }
231
232 public void setPasswordEncrypted(boolean passwordEncrypted) {
233 if (passwordEncrypted != _passwordEncrypted) {
234 _passwordEncrypted = passwordEncrypted;
235 }
236 }
237
238 public boolean getPasswordReset() {
239 return _passwordReset;
240 }
241
242 public boolean isPasswordReset() {
243 return _passwordReset;
244 }
245
246 public void setPasswordReset(boolean passwordReset) {
247 if (passwordReset != _passwordReset) {
248 _passwordReset = passwordReset;
249 }
250 }
251
252 public Date getPasswordModifiedDate() {
253 return _passwordModifiedDate;
254 }
255
256 public void setPasswordModifiedDate(Date passwordModifiedDate) {
257 if (((passwordModifiedDate == null) && (_passwordModifiedDate != null)) ||
258 ((passwordModifiedDate != null) &&
259 (_passwordModifiedDate == null)) ||
260 ((passwordModifiedDate != null) &&
261 (_passwordModifiedDate != null) &&
262 !passwordModifiedDate.equals(_passwordModifiedDate))) {
263 _passwordModifiedDate = passwordModifiedDate;
264 }
265 }
266
267 public int getGraceLoginCount() {
268 return _graceLoginCount;
269 }
270
271 public void setGraceLoginCount(int graceLoginCount) {
272 if (graceLoginCount != _graceLoginCount) {
273 _graceLoginCount = graceLoginCount;
274 }
275 }
276
277 public String getScreenName() {
278 return GetterUtil.getString(_screenName);
279 }
280
281 public void setScreenName(String screenName) {
282 if (((screenName == null) && (_screenName != null)) ||
283 ((screenName != null) && (_screenName == null)) ||
284 ((screenName != null) && (_screenName != null) &&
285 !screenName.equals(_screenName))) {
286 if (!XSS_ALLOW_SCREENNAME) {
287 screenName = XSSUtil.strip(screenName);
288 }
289
290 _screenName = screenName;
291 }
292 }
293
294 public String getEmailAddress() {
295 return GetterUtil.getString(_emailAddress);
296 }
297
298 public void setEmailAddress(String emailAddress) {
299 if (((emailAddress == null) && (_emailAddress != null)) ||
300 ((emailAddress != null) && (_emailAddress == null)) ||
301 ((emailAddress != null) && (_emailAddress != null) &&
302 !emailAddress.equals(_emailAddress))) {
303 if (!XSS_ALLOW_EMAILADDRESS) {
304 emailAddress = XSSUtil.strip(emailAddress);
305 }
306
307 _emailAddress = emailAddress;
308 }
309 }
310
311 public long getPortraitId() {
312 return _portraitId;
313 }
314
315 public void setPortraitId(long portraitId) {
316 if (portraitId != _portraitId) {
317 _portraitId = portraitId;
318 }
319 }
320
321 public String getLanguageId() {
322 return GetterUtil.getString(_languageId);
323 }
324
325 public void setLanguageId(String languageId) {
326 if (((languageId == null) && (_languageId != null)) ||
327 ((languageId != null) && (_languageId == null)) ||
328 ((languageId != null) && (_languageId != null) &&
329 !languageId.equals(_languageId))) {
330 if (!XSS_ALLOW_LANGUAGEID) {
331 languageId = XSSUtil.strip(languageId);
332 }
333
334 _languageId = languageId;
335 }
336 }
337
338 public String getTimeZoneId() {
339 return GetterUtil.getString(_timeZoneId);
340 }
341
342 public void setTimeZoneId(String timeZoneId) {
343 if (((timeZoneId == null) && (_timeZoneId != null)) ||
344 ((timeZoneId != null) && (_timeZoneId == null)) ||
345 ((timeZoneId != null) && (_timeZoneId != null) &&
346 !timeZoneId.equals(_timeZoneId))) {
347 if (!XSS_ALLOW_TIMEZONEID) {
348 timeZoneId = XSSUtil.strip(timeZoneId);
349 }
350
351 _timeZoneId = timeZoneId;
352 }
353 }
354
355 public String getGreeting() {
356 return GetterUtil.getString(_greeting);
357 }
358
359 public void setGreeting(String greeting) {
360 if (((greeting == null) && (_greeting != null)) ||
361 ((greeting != null) && (_greeting == null)) ||
362 ((greeting != null) && (_greeting != null) &&
363 !greeting.equals(_greeting))) {
364 if (!XSS_ALLOW_GREETING) {
365 greeting = XSSUtil.strip(greeting);
366 }
367
368 _greeting = greeting;
369 }
370 }
371
372 public String getComments() {
373 return GetterUtil.getString(_comments);
374 }
375
376 public void setComments(String comments) {
377 if (((comments == null) && (_comments != null)) ||
378 ((comments != null) && (_comments == null)) ||
379 ((comments != null) && (_comments != null) &&
380 !comments.equals(_comments))) {
381 if (!XSS_ALLOW_COMMENTS) {
382 comments = XSSUtil.strip(comments);
383 }
384
385 _comments = comments;
386 }
387 }
388
389 public Date getLoginDate() {
390 return _loginDate;
391 }
392
393 public void setLoginDate(Date loginDate) {
394 if (((loginDate == null) && (_loginDate != null)) ||
395 ((loginDate != null) && (_loginDate == null)) ||
396 ((loginDate != null) && (_loginDate != null) &&
397 !loginDate.equals(_loginDate))) {
398 _loginDate = loginDate;
399 }
400 }
401
402 public String getLoginIP() {
403 return GetterUtil.getString(_loginIP);
404 }
405
406 public void setLoginIP(String loginIP) {
407 if (((loginIP == null) && (_loginIP != null)) ||
408 ((loginIP != null) && (_loginIP == null)) ||
409 ((loginIP != null) && (_loginIP != null) &&
410 !loginIP.equals(_loginIP))) {
411 if (!XSS_ALLOW_LOGINIP) {
412 loginIP = XSSUtil.strip(loginIP);
413 }
414
415 _loginIP = loginIP;
416 }
417 }
418
419 public Date getLastLoginDate() {
420 return _lastLoginDate;
421 }
422
423 public void setLastLoginDate(Date lastLoginDate) {
424 if (((lastLoginDate == null) && (_lastLoginDate != null)) ||
425 ((lastLoginDate != null) && (_lastLoginDate == null)) ||
426 ((lastLoginDate != null) && (_lastLoginDate != null) &&
427 !lastLoginDate.equals(_lastLoginDate))) {
428 _lastLoginDate = lastLoginDate;
429 }
430 }
431
432 public String getLastLoginIP() {
433 return GetterUtil.getString(_lastLoginIP);
434 }
435
436 public void setLastLoginIP(String lastLoginIP) {
437 if (((lastLoginIP == null) && (_lastLoginIP != null)) ||
438 ((lastLoginIP != null) && (_lastLoginIP == null)) ||
439 ((lastLoginIP != null) && (_lastLoginIP != null) &&
440 !lastLoginIP.equals(_lastLoginIP))) {
441 if (!XSS_ALLOW_LASTLOGINIP) {
442 lastLoginIP = XSSUtil.strip(lastLoginIP);
443 }
444
445 _lastLoginIP = lastLoginIP;
446 }
447 }
448
449 public Date getLastFailedLoginDate() {
450 return _lastFailedLoginDate;
451 }
452
453 public void setLastFailedLoginDate(Date lastFailedLoginDate) {
454 if (((lastFailedLoginDate == null) && (_lastFailedLoginDate != null)) ||
455 ((lastFailedLoginDate != null) &&
456 (_lastFailedLoginDate == null)) ||
457 ((lastFailedLoginDate != null) &&
458 (_lastFailedLoginDate != null) &&
459 !lastFailedLoginDate.equals(_lastFailedLoginDate))) {
460 _lastFailedLoginDate = lastFailedLoginDate;
461 }
462 }
463
464 public int getFailedLoginAttempts() {
465 return _failedLoginAttempts;
466 }
467
468 public void setFailedLoginAttempts(int failedLoginAttempts) {
469 if (failedLoginAttempts != _failedLoginAttempts) {
470 _failedLoginAttempts = failedLoginAttempts;
471 }
472 }
473
474 public boolean getLockout() {
475 return _lockout;
476 }
477
478 public boolean isLockout() {
479 return _lockout;
480 }
481
482 public void setLockout(boolean lockout) {
483 if (lockout != _lockout) {
484 _lockout = lockout;
485 }
486 }
487
488 public Date getLockoutDate() {
489 return _lockoutDate;
490 }
491
492 public void setLockoutDate(Date lockoutDate) {
493 if (((lockoutDate == null) && (_lockoutDate != null)) ||
494 ((lockoutDate != null) && (_lockoutDate == null)) ||
495 ((lockoutDate != null) && (_lockoutDate != null) &&
496 !lockoutDate.equals(_lockoutDate))) {
497 _lockoutDate = lockoutDate;
498 }
499 }
500
501 public boolean getAgreedToTermsOfUse() {
502 return _agreedToTermsOfUse;
503 }
504
505 public boolean isAgreedToTermsOfUse() {
506 return _agreedToTermsOfUse;
507 }
508
509 public void setAgreedToTermsOfUse(boolean agreedToTermsOfUse) {
510 if (agreedToTermsOfUse != _agreedToTermsOfUse) {
511 _agreedToTermsOfUse = agreedToTermsOfUse;
512 }
513 }
514
515 public boolean getActive() {
516 return _active;
517 }
518
519 public boolean isActive() {
520 return _active;
521 }
522
523 public void setActive(boolean active) {
524 if (active != _active) {
525 _active = active;
526 }
527 }
528
529 public Object clone() {
530 UserImpl clone = new UserImpl();
531 clone.setUserId(getUserId());
532 clone.setCompanyId(getCompanyId());
533 clone.setCreateDate(getCreateDate());
534 clone.setModifiedDate(getModifiedDate());
535 clone.setDefaultUser(getDefaultUser());
536 clone.setContactId(getContactId());
537 clone.setPassword(getPassword());
538 clone.setPasswordEncrypted(getPasswordEncrypted());
539 clone.setPasswordReset(getPasswordReset());
540 clone.setPasswordModifiedDate(getPasswordModifiedDate());
541 clone.setGraceLoginCount(getGraceLoginCount());
542 clone.setScreenName(getScreenName());
543 clone.setEmailAddress(getEmailAddress());
544 clone.setPortraitId(getPortraitId());
545 clone.setLanguageId(getLanguageId());
546 clone.setTimeZoneId(getTimeZoneId());
547 clone.setGreeting(getGreeting());
548 clone.setComments(getComments());
549 clone.setLoginDate(getLoginDate());
550 clone.setLoginIP(getLoginIP());
551 clone.setLastLoginDate(getLastLoginDate());
552 clone.setLastLoginIP(getLastLoginIP());
553 clone.setLastFailedLoginDate(getLastFailedLoginDate());
554 clone.setFailedLoginAttempts(getFailedLoginAttempts());
555 clone.setLockout(getLockout());
556 clone.setLockoutDate(getLockoutDate());
557 clone.setAgreedToTermsOfUse(getAgreedToTermsOfUse());
558 clone.setActive(getActive());
559
560 return clone;
561 }
562
563 public int compareTo(Object obj) {
564 if (obj == null) {
565 return -1;
566 }
567
568 UserImpl user = (UserImpl)obj;
569 long pk = user.getPrimaryKey();
570
571 if (getPrimaryKey() < pk) {
572 return -1;
573 }
574 else if (getPrimaryKey() > pk) {
575 return 1;
576 }
577 else {
578 return 0;
579 }
580 }
581
582 public boolean equals(Object obj) {
583 if (obj == null) {
584 return false;
585 }
586
587 UserImpl user = null;
588
589 try {
590 user = (UserImpl)obj;
591 }
592 catch (ClassCastException cce) {
593 return false;
594 }
595
596 long pk = user.getPrimaryKey();
597
598 if (getPrimaryKey() == pk) {
599 return true;
600 }
601 else {
602 return false;
603 }
604 }
605
606 public int hashCode() {
607 return (int)getPrimaryKey();
608 }
609
610 private long _userId;
611 private long _companyId;
612 private Date _createDate;
613 private Date _modifiedDate;
614 private boolean _defaultUser;
615 private long _contactId;
616 private String _password;
617 private boolean _passwordEncrypted;
618 private boolean _passwordReset;
619 private Date _passwordModifiedDate;
620 private int _graceLoginCount;
621 private String _screenName;
622 private String _emailAddress;
623 private long _portraitId;
624 private String _languageId;
625 private String _timeZoneId;
626 private String _greeting;
627 private String _comments;
628 private Date _loginDate;
629 private String _loginIP;
630 private Date _lastLoginDate;
631 private String _lastLoginIP;
632 private Date _lastFailedLoginDate;
633 private int _failedLoginAttempts;
634 private boolean _lockout;
635 private Date _lockoutDate;
636 private boolean _agreedToTermsOfUse;
637 private boolean _active;
638 }