001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.User;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.util.Html;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: import java.util.Date;
037:
038: /**
039: * <a href="UserModelImpl.java.html"><b><i>View Source</i></b></a>
040: *
041: * <p>
042: * ServiceBuilder generated this class. Modifications in this class will be
043: * overwritten the next time is generated.
044: * </p>
045: *
046: * <p>
047: * This class is a model that represents the <code>User</code> table
048: * in the database.
049: * </p>
050: *
051: * @author Brian Wing Shun Chan
052: *
053: * @see com.liferay.portal.service.model.User
054: * @see com.liferay.portal.service.model.UserModel
055: * @see com.liferay.portal.service.model.impl.UserImpl
056: *
057: */
058: public class UserModelImpl extends BaseModelImpl {
059: public static final String TABLE_NAME = "User_";
060: public static final Object[][] TABLE_COLUMNS = {
061: { "uuid_", new Integer(Types.VARCHAR) },
062:
063: { "userId", new Integer(Types.BIGINT) },
064:
065: { "companyId", new Integer(Types.BIGINT) },
066:
067: { "createDate", new Integer(Types.TIMESTAMP) },
068:
069: { "modifiedDate", new Integer(Types.TIMESTAMP) },
070:
071: { "defaultUser", new Integer(Types.BOOLEAN) },
072:
073: { "contactId", new Integer(Types.BIGINT) },
074:
075: { "password_", new Integer(Types.VARCHAR) },
076:
077: { "passwordEncrypted", new Integer(Types.BOOLEAN) },
078:
079: { "passwordReset", new Integer(Types.BOOLEAN) },
080:
081: { "passwordModifiedDate", new Integer(Types.TIMESTAMP) },
082:
083: { "graceLoginCount", new Integer(Types.INTEGER) },
084:
085: { "screenName", new Integer(Types.VARCHAR) },
086:
087: { "emailAddress", new Integer(Types.VARCHAR) },
088:
089: { "portraitId", new Integer(Types.BIGINT) },
090:
091: { "languageId", new Integer(Types.VARCHAR) },
092:
093: { "timeZoneId", new Integer(Types.VARCHAR) },
094:
095: { "greeting", new Integer(Types.VARCHAR) },
096:
097: { "comments", new Integer(Types.VARCHAR) },
098:
099: { "loginDate", new Integer(Types.TIMESTAMP) },
100:
101: { "loginIP", new Integer(Types.VARCHAR) },
102:
103: { "lastLoginDate", new Integer(Types.TIMESTAMP) },
104:
105: { "lastLoginIP", new Integer(Types.VARCHAR) },
106:
107: { "lastFailedLoginDate", new Integer(Types.TIMESTAMP) },
108:
109: { "failedLoginAttempts", new Integer(Types.INTEGER) },
110:
111: { "lockout", new Integer(Types.BOOLEAN) },
112:
113: { "lockoutDate", new Integer(Types.TIMESTAMP) },
114:
115: { "agreedToTermsOfUse", new Integer(Types.BOOLEAN) },
116:
117: { "active_", new Integer(Types.BOOLEAN) } };
118: 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)";
119: public static final String TABLE_SQL_DROP = "drop table User_";
120: public static final boolean CACHE_ENABLED = GetterUtil
121: .getBoolean(
122: PropsUtil
123: .get("value.object.finder.cache.enabled.com.liferay.portal.model.User"),
124: true);
125: public static final boolean CACHE_ENABLED_USERS_GROUPS = GetterUtil
126: .getBoolean(
127: PropsUtil
128: .get("value.object.finder.cache.enabled.Users_Groups"),
129: true);
130: public static final boolean CACHE_ENABLED_USERS_ORGS = GetterUtil
131: .getBoolean(
132: PropsUtil
133: .get("value.object.finder.cache.enabled.Users_Orgs"),
134: true);
135: public static final boolean CACHE_ENABLED_USERS_PERMISSIONS = GetterUtil
136: .getBoolean(
137: PropsUtil
138: .get("value.object.finder.cache.enabled.Users_Permissions"),
139: true);
140: public static final boolean CACHE_ENABLED_USERS_ROLES = GetterUtil
141: .getBoolean(
142: PropsUtil
143: .get("value.object.finder.cache.enabled.Users_Roles"),
144: true);
145: public static final boolean CACHE_ENABLED_USERS_USERGROUPS = GetterUtil
146: .getBoolean(
147: PropsUtil
148: .get("value.object.finder.cache.enabled.Users_UserGroups"),
149: true);
150: public static final long LOCK_EXPIRATION_TIME = GetterUtil
151: .getLong(PropsUtil
152: .get("lock.expiration.time.com.liferay.portal.model.User"));
153:
154: public UserModelImpl() {
155: }
156:
157: public long getPrimaryKey() {
158: return _userId;
159: }
160:
161: public void setPrimaryKey(long pk) {
162: setUserId(pk);
163: }
164:
165: public Serializable getPrimaryKeyObj() {
166: return new Long(_userId);
167: }
168:
169: public String getUuid() {
170: return GetterUtil.getString(_uuid);
171: }
172:
173: public void setUuid(String uuid) {
174: if ((uuid != null) && (uuid != _uuid)) {
175: _uuid = uuid;
176: }
177: }
178:
179: public long getUserId() {
180: return _userId;
181: }
182:
183: public void setUserId(long userId) {
184: if (userId != _userId) {
185: _userId = userId;
186: }
187: }
188:
189: public long getCompanyId() {
190: return _companyId;
191: }
192:
193: public void setCompanyId(long companyId) {
194: if (companyId != _companyId) {
195: _companyId = companyId;
196: }
197: }
198:
199: public Date getCreateDate() {
200: return _createDate;
201: }
202:
203: public void setCreateDate(Date createDate) {
204: if (((createDate == null) && (_createDate != null))
205: || ((createDate != null) && (_createDate == null))
206: || ((createDate != null) && (_createDate != null) && !createDate
207: .equals(_createDate))) {
208: _createDate = createDate;
209: }
210: }
211:
212: public Date getModifiedDate() {
213: return _modifiedDate;
214: }
215:
216: public void setModifiedDate(Date modifiedDate) {
217: if (((modifiedDate == null) && (_modifiedDate != null))
218: || ((modifiedDate != null) && (_modifiedDate == null))
219: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
220: .equals(_modifiedDate))) {
221: _modifiedDate = modifiedDate;
222: }
223: }
224:
225: public boolean getDefaultUser() {
226: return _defaultUser;
227: }
228:
229: public boolean isDefaultUser() {
230: return _defaultUser;
231: }
232:
233: public void setDefaultUser(boolean defaultUser) {
234: if (defaultUser != _defaultUser) {
235: _defaultUser = defaultUser;
236: }
237: }
238:
239: public long getContactId() {
240: return _contactId;
241: }
242:
243: public void setContactId(long contactId) {
244: if (contactId != _contactId) {
245: _contactId = contactId;
246: }
247: }
248:
249: public String getPassword() {
250: return GetterUtil.getString(_password);
251: }
252:
253: public void setPassword(String password) {
254: if (((password == null) && (_password != null))
255: || ((password != null) && (_password == null))
256: || ((password != null) && (_password != null) && !password
257: .equals(_password))) {
258: _password = password;
259: }
260: }
261:
262: public boolean getPasswordEncrypted() {
263: return _passwordEncrypted;
264: }
265:
266: public boolean isPasswordEncrypted() {
267: return _passwordEncrypted;
268: }
269:
270: public void setPasswordEncrypted(boolean passwordEncrypted) {
271: if (passwordEncrypted != _passwordEncrypted) {
272: _passwordEncrypted = passwordEncrypted;
273: }
274: }
275:
276: public boolean getPasswordReset() {
277: return _passwordReset;
278: }
279:
280: public boolean isPasswordReset() {
281: return _passwordReset;
282: }
283:
284: public void setPasswordReset(boolean passwordReset) {
285: if (passwordReset != _passwordReset) {
286: _passwordReset = passwordReset;
287: }
288: }
289:
290: public Date getPasswordModifiedDate() {
291: return _passwordModifiedDate;
292: }
293:
294: public void setPasswordModifiedDate(Date passwordModifiedDate) {
295: if (((passwordModifiedDate == null) && (_passwordModifiedDate != null))
296: || ((passwordModifiedDate != null) && (_passwordModifiedDate == null))
297: || ((passwordModifiedDate != null)
298: && (_passwordModifiedDate != null) && !passwordModifiedDate
299: .equals(_passwordModifiedDate))) {
300: _passwordModifiedDate = passwordModifiedDate;
301: }
302: }
303:
304: public int getGraceLoginCount() {
305: return _graceLoginCount;
306: }
307:
308: public void setGraceLoginCount(int graceLoginCount) {
309: if (graceLoginCount != _graceLoginCount) {
310: _graceLoginCount = graceLoginCount;
311: }
312: }
313:
314: public String getScreenName() {
315: return GetterUtil.getString(_screenName);
316: }
317:
318: public void setScreenName(String screenName) {
319: if (((screenName == null) && (_screenName != null))
320: || ((screenName != null) && (_screenName == null))
321: || ((screenName != null) && (_screenName != null) && !screenName
322: .equals(_screenName))) {
323: _screenName = screenName;
324: }
325: }
326:
327: public String getEmailAddress() {
328: return GetterUtil.getString(_emailAddress);
329: }
330:
331: public void setEmailAddress(String emailAddress) {
332: if (((emailAddress == null) && (_emailAddress != null))
333: || ((emailAddress != null) && (_emailAddress == null))
334: || ((emailAddress != null) && (_emailAddress != null) && !emailAddress
335: .equals(_emailAddress))) {
336: _emailAddress = emailAddress;
337: }
338: }
339:
340: public long getPortraitId() {
341: return _portraitId;
342: }
343:
344: public void setPortraitId(long portraitId) {
345: if (portraitId != _portraitId) {
346: _portraitId = portraitId;
347: }
348: }
349:
350: public String getLanguageId() {
351: return GetterUtil.getString(_languageId);
352: }
353:
354: public void setLanguageId(String languageId) {
355: if (((languageId == null) && (_languageId != null))
356: || ((languageId != null) && (_languageId == null))
357: || ((languageId != null) && (_languageId != null) && !languageId
358: .equals(_languageId))) {
359: _languageId = languageId;
360: }
361: }
362:
363: public String getTimeZoneId() {
364: return GetterUtil.getString(_timeZoneId);
365: }
366:
367: public void setTimeZoneId(String timeZoneId) {
368: if (((timeZoneId == null) && (_timeZoneId != null))
369: || ((timeZoneId != null) && (_timeZoneId == null))
370: || ((timeZoneId != null) && (_timeZoneId != null) && !timeZoneId
371: .equals(_timeZoneId))) {
372: _timeZoneId = timeZoneId;
373: }
374: }
375:
376: public String getGreeting() {
377: return GetterUtil.getString(_greeting);
378: }
379:
380: public void setGreeting(String greeting) {
381: if (((greeting == null) && (_greeting != null))
382: || ((greeting != null) && (_greeting == null))
383: || ((greeting != null) && (_greeting != null) && !greeting
384: .equals(_greeting))) {
385: _greeting = greeting;
386: }
387: }
388:
389: public String getComments() {
390: return GetterUtil.getString(_comments);
391: }
392:
393: public void setComments(String comments) {
394: if (((comments == null) && (_comments != null))
395: || ((comments != null) && (_comments == null))
396: || ((comments != null) && (_comments != null) && !comments
397: .equals(_comments))) {
398: _comments = comments;
399: }
400: }
401:
402: public Date getLoginDate() {
403: return _loginDate;
404: }
405:
406: public void setLoginDate(Date loginDate) {
407: if (((loginDate == null) && (_loginDate != null))
408: || ((loginDate != null) && (_loginDate == null))
409: || ((loginDate != null) && (_loginDate != null) && !loginDate
410: .equals(_loginDate))) {
411: _loginDate = loginDate;
412: }
413: }
414:
415: public String getLoginIP() {
416: return GetterUtil.getString(_loginIP);
417: }
418:
419: public void setLoginIP(String loginIP) {
420: if (((loginIP == null) && (_loginIP != null))
421: || ((loginIP != null) && (_loginIP == null))
422: || ((loginIP != null) && (_loginIP != null) && !loginIP
423: .equals(_loginIP))) {
424: _loginIP = loginIP;
425: }
426: }
427:
428: public Date getLastLoginDate() {
429: return _lastLoginDate;
430: }
431:
432: public void setLastLoginDate(Date lastLoginDate) {
433: if (((lastLoginDate == null) && (_lastLoginDate != null))
434: || ((lastLoginDate != null) && (_lastLoginDate == null))
435: || ((lastLoginDate != null) && (_lastLoginDate != null) && !lastLoginDate
436: .equals(_lastLoginDate))) {
437: _lastLoginDate = lastLoginDate;
438: }
439: }
440:
441: public String getLastLoginIP() {
442: return GetterUtil.getString(_lastLoginIP);
443: }
444:
445: public void setLastLoginIP(String lastLoginIP) {
446: if (((lastLoginIP == null) && (_lastLoginIP != null))
447: || ((lastLoginIP != null) && (_lastLoginIP == null))
448: || ((lastLoginIP != null) && (_lastLoginIP != null) && !lastLoginIP
449: .equals(_lastLoginIP))) {
450: _lastLoginIP = lastLoginIP;
451: }
452: }
453:
454: public Date getLastFailedLoginDate() {
455: return _lastFailedLoginDate;
456: }
457:
458: public void setLastFailedLoginDate(Date lastFailedLoginDate) {
459: if (((lastFailedLoginDate == null) && (_lastFailedLoginDate != null))
460: || ((lastFailedLoginDate != null) && (_lastFailedLoginDate == null))
461: || ((lastFailedLoginDate != null)
462: && (_lastFailedLoginDate != null) && !lastFailedLoginDate
463: .equals(_lastFailedLoginDate))) {
464: _lastFailedLoginDate = lastFailedLoginDate;
465: }
466: }
467:
468: public int getFailedLoginAttempts() {
469: return _failedLoginAttempts;
470: }
471:
472: public void setFailedLoginAttempts(int failedLoginAttempts) {
473: if (failedLoginAttempts != _failedLoginAttempts) {
474: _failedLoginAttempts = failedLoginAttempts;
475: }
476: }
477:
478: public boolean getLockout() {
479: return _lockout;
480: }
481:
482: public boolean isLockout() {
483: return _lockout;
484: }
485:
486: public void setLockout(boolean lockout) {
487: if (lockout != _lockout) {
488: _lockout = lockout;
489: }
490: }
491:
492: public Date getLockoutDate() {
493: return _lockoutDate;
494: }
495:
496: public void setLockoutDate(Date lockoutDate) {
497: if (((lockoutDate == null) && (_lockoutDate != null))
498: || ((lockoutDate != null) && (_lockoutDate == null))
499: || ((lockoutDate != null) && (_lockoutDate != null) && !lockoutDate
500: .equals(_lockoutDate))) {
501: _lockoutDate = lockoutDate;
502: }
503: }
504:
505: public boolean getAgreedToTermsOfUse() {
506: return _agreedToTermsOfUse;
507: }
508:
509: public boolean isAgreedToTermsOfUse() {
510: return _agreedToTermsOfUse;
511: }
512:
513: public void setAgreedToTermsOfUse(boolean agreedToTermsOfUse) {
514: if (agreedToTermsOfUse != _agreedToTermsOfUse) {
515: _agreedToTermsOfUse = agreedToTermsOfUse;
516: }
517: }
518:
519: public boolean getActive() {
520: return _active;
521: }
522:
523: public boolean isActive() {
524: return _active;
525: }
526:
527: public void setActive(boolean active) {
528: if (active != _active) {
529: _active = active;
530: }
531: }
532:
533: public User toEscapedModel() {
534: if (isEscapedModel()) {
535: return (User) this ;
536: } else {
537: User model = new UserImpl();
538:
539: model.setEscapedModel(true);
540:
541: model.setUuid(Html.escape(getUuid()));
542: model.setUserId(getUserId());
543: model.setCompanyId(getCompanyId());
544: model.setCreateDate(getCreateDate());
545: model.setModifiedDate(getModifiedDate());
546: model.setDefaultUser(getDefaultUser());
547: model.setContactId(getContactId());
548: model.setPassword(Html.escape(getPassword()));
549: model.setPasswordEncrypted(getPasswordEncrypted());
550: model.setPasswordReset(getPasswordReset());
551: model.setPasswordModifiedDate(getPasswordModifiedDate());
552: model.setGraceLoginCount(getGraceLoginCount());
553: model.setScreenName(Html.escape(getScreenName()));
554: model.setEmailAddress(Html.escape(getEmailAddress()));
555: model.setPortraitId(getPortraitId());
556: model.setLanguageId(Html.escape(getLanguageId()));
557: model.setTimeZoneId(Html.escape(getTimeZoneId()));
558: model.setGreeting(Html.escape(getGreeting()));
559: model.setComments(Html.escape(getComments()));
560: model.setLoginDate(getLoginDate());
561: model.setLoginIP(Html.escape(getLoginIP()));
562: model.setLastLoginDate(getLastLoginDate());
563: model.setLastLoginIP(Html.escape(getLastLoginIP()));
564: model.setLastFailedLoginDate(getLastFailedLoginDate());
565: model.setFailedLoginAttempts(getFailedLoginAttempts());
566: model.setLockout(getLockout());
567: model.setLockoutDate(getLockoutDate());
568: model.setAgreedToTermsOfUse(getAgreedToTermsOfUse());
569: model.setActive(getActive());
570:
571: model = (User) Proxy.newProxyInstance(User.class
572: .getClassLoader(), new Class[] { User.class },
573: new ReadOnlyBeanHandler(model));
574:
575: return model;
576: }
577: }
578:
579: public Object clone() {
580: UserImpl clone = new UserImpl();
581:
582: clone.setUuid(getUuid());
583: clone.setUserId(getUserId());
584: clone.setCompanyId(getCompanyId());
585: clone.setCreateDate(getCreateDate());
586: clone.setModifiedDate(getModifiedDate());
587: clone.setDefaultUser(getDefaultUser());
588: clone.setContactId(getContactId());
589: clone.setPassword(getPassword());
590: clone.setPasswordEncrypted(getPasswordEncrypted());
591: clone.setPasswordReset(getPasswordReset());
592: clone.setPasswordModifiedDate(getPasswordModifiedDate());
593: clone.setGraceLoginCount(getGraceLoginCount());
594: clone.setScreenName(getScreenName());
595: clone.setEmailAddress(getEmailAddress());
596: clone.setPortraitId(getPortraitId());
597: clone.setLanguageId(getLanguageId());
598: clone.setTimeZoneId(getTimeZoneId());
599: clone.setGreeting(getGreeting());
600: clone.setComments(getComments());
601: clone.setLoginDate(getLoginDate());
602: clone.setLoginIP(getLoginIP());
603: clone.setLastLoginDate(getLastLoginDate());
604: clone.setLastLoginIP(getLastLoginIP());
605: clone.setLastFailedLoginDate(getLastFailedLoginDate());
606: clone.setFailedLoginAttempts(getFailedLoginAttempts());
607: clone.setLockout(getLockout());
608: clone.setLockoutDate(getLockoutDate());
609: clone.setAgreedToTermsOfUse(getAgreedToTermsOfUse());
610: clone.setActive(getActive());
611:
612: return clone;
613: }
614:
615: public int compareTo(Object obj) {
616: if (obj == null) {
617: return -1;
618: }
619:
620: UserImpl user = (UserImpl) obj;
621:
622: long pk = user.getPrimaryKey();
623:
624: if (getPrimaryKey() < pk) {
625: return -1;
626: } else if (getPrimaryKey() > pk) {
627: return 1;
628: } else {
629: return 0;
630: }
631: }
632:
633: public boolean equals(Object obj) {
634: if (obj == null) {
635: return false;
636: }
637:
638: UserImpl user = null;
639:
640: try {
641: user = (UserImpl) obj;
642: } catch (ClassCastException cce) {
643: return false;
644: }
645:
646: long pk = user.getPrimaryKey();
647:
648: if (getPrimaryKey() == pk) {
649: return true;
650: } else {
651: return false;
652: }
653: }
654:
655: public int hashCode() {
656: return (int) getPrimaryKey();
657: }
658:
659: private String _uuid;
660: private long _userId;
661: private long _companyId;
662: private Date _createDate;
663: private Date _modifiedDate;
664: private boolean _defaultUser;
665: private long _contactId;
666: private String _password;
667: private boolean _passwordEncrypted;
668: private boolean _passwordReset;
669: private Date _passwordModifiedDate;
670: private int _graceLoginCount;
671: private String _screenName;
672: private String _emailAddress;
673: private long _portraitId;
674: private String _languageId;
675: private String _timeZoneId;
676: private String _greeting;
677: private String _comments;
678: private Date _loginDate;
679: private String _loginIP;
680: private Date _lastLoginDate;
681: private String _lastLoginIP;
682: private Date _lastFailedLoginDate;
683: private int _failedLoginAttempts;
684: private boolean _lockout;
685: private Date _lockoutDate;
686: private boolean _agreedToTermsOfUse;
687: private boolean _active;
688: }
|