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