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