1 45 package net.jforum.entities; 46 47 import java.io.Serializable ; 48 import java.text.SimpleDateFormat ; 49 import java.util.ArrayList ; 50 import java.util.Date ; 51 import java.util.HashMap ; 52 import java.util.List ; 53 import java.util.Map ; 54 55 import net.jforum.SessionFacade; 56 import net.jforum.util.preferences.ConfigKeys; 57 import net.jforum.util.preferences.SystemGlobals; 58 59 68 public class User implements Serializable 69 { 70 private int id; 71 private int themeId; 72 private int level; 73 private int totalPosts; 74 private boolean attachSignatureEnabled = true; 75 private int rankId = 1; 76 private boolean htmlEnabled = true; 77 private boolean bbCodeEnabled = true; 78 private boolean smiliesEnabled = true; 79 private boolean avatarEnabled = true; 80 private boolean privateMessagesEnabled = true; 81 private boolean viewOnlineEnabled = true; 82 private boolean notifyPrivateMessagesEnabled = true; 83 private boolean notifyOnMessagesEnabled = true; 84 private String username; 85 private String password; 86 private Date lastVisit; 87 private Date registrationDate; 88 private String avatar; 89 private boolean isExternalAvatar; 90 private String email; 91 private String icq; 92 private String webSite; 93 private String from; 94 private String signature; 95 private String aim; 96 private String yim; 97 private String msnm; 98 private String occupation; 99 private String interests; 100 private String biography; 101 private String gender; 102 private String timeZone; 103 private String lang; 104 private String dateFormat; 105 private boolean viewEmailEnabled = true; 106 private List groupsList; 107 private int privateMessagesCount; 108 private KarmaStatus karma; 109 private int active; 110 private String activationKey; 111 private int deleted; 112 private String firstName; 113 private String lastName; 114 private Map extra = new HashMap (); 115 116 119 public User() 120 { 121 this.groupsList = new ArrayList (); 122 } 123 124 public void addExtra(String name, Object value) 125 { 126 this.extra.put(name, value); 127 } 128 129 public Object getExtra(String name) 130 { 131 return this.extra.get(name); 132 } 133 134 public void setFirstName(String name) 135 { 136 this.firstName = name; 137 } 138 139 public String getFirstName() 140 { 141 return this.firstName; 142 } 143 144 public void setLastName(String name) 145 { 146 this.lastName = name; 147 } 148 149 public String getLastNmame() 150 { 151 return this.lastName; 152 } 153 154 public String getName() 155 { 156 return this.firstName + " " + this.lastName; 157 } 158 159 public boolean isDeleted() { 160 return this.deleted == 1; 161 } 162 163 public void setDeleted(int deleted){ 164 this.deleted = deleted; 165 } 166 167 172 public String getAim() { 173 return this.aim; 174 } 175 176 181 public String getAvatar() { 182 return this.avatar; 183 } 184 185 190 public boolean isAvatarEnabled() { 191 return this.avatarEnabled; 192 } 193 194 199 public boolean isBbCodeEnabled() { 200 return this.bbCodeEnabled; 201 } 202 203 208 public String getDateFormat() { 209 return this.dateFormat; 210 } 211 212 217 public String getEmail() { 218 return this.email; 219 } 220 221 226 public String getFrom() { 227 return this.from; 228 } 229 230 235 public String getGender() { 236 return this.gender; 237 } 238 239 244 public boolean isHtmlEnabled() { 245 return this.htmlEnabled; 246 } 247 248 253 public String getIcq() { 254 return this.icq; 255 } 256 257 262 public int getId() { 263 return this.id; 264 } 265 266 271 public String getInterests() { 272 return this.interests; 273 } 274 275 280 public String getLang() { 281 return this.lang; 282 } 283 284 289 public Date getLastVisit() { 290 return this.lastVisit; 291 } 292 293 298 public int getLevel() { 299 return this.level; 300 } 301 302 307 public boolean isNotifyPrivateMessagesEnabled() { 308 return this.notifyPrivateMessagesEnabled; 309 } 310 311 316 public String getOccupation() { 317 return this.occupation; 318 } 319 320 325 public String getPassword() { 326 return this.password; 327 } 328 329 334 public boolean isPrivateMessagesEnabled() { 335 return this.privateMessagesEnabled; 336 } 337 338 343 public int getRankId() { 344 return this.rankId; 345 } 346 347 352 public String getRegistrationDate() 353 { 354 SimpleDateFormat df = new SimpleDateFormat (SystemGlobals.getValue(ConfigKeys.DATE_TIME_FORMAT)); 355 356 return df.format(this.registrationDate); 357 } 358 359 364 public String getSignature() { 365 return this.signature; 366 } 367 368 373 public boolean isSmiliesEnabled() { 374 return this.smiliesEnabled; 375 } 376 377 382 public int getThemeId() { 383 return this.themeId; 384 } 385 386 391 public String getTimeZone() { 392 return this.timeZone; 393 } 394 395 400 public int getTotalPosts() { 401 return this.totalPosts; 402 } 403 404 409 public String getUsername() { 410 return this.username; 411 } 412 413 418 public boolean isViewOnlineEnabled() { 419 return this.viewOnlineEnabled; 420 } 421 422 427 public String getWebSite() { 428 return this.webSite; 429 } 430 431 436 public String getYim() { 437 return this.yim; 438 } 439 440 445 public boolean isActive(){ 446 return this.active == 1; 447 } 448 449 454 public String getActivationKey(){ 455 return this.activationKey; 456 } 457 458 463 public void setAim(String aim) { 464 this.aim = aim; 465 } 466 467 472 public void setAvatar(String avatar) { 473 this.avatar = avatar; 474 475 if (avatar != null && avatar.toLowerCase().startsWith("http://")) { 476 this.isExternalAvatar = true; 477 } 478 } 479 480 484 public boolean isExternalAvatar() { 485 return this.isExternalAvatar; 486 } 487 488 493 public void setAvatarEnabled(boolean avatarEnabled) { 494 this.avatarEnabled = avatarEnabled; 495 } 496 497 502 public void setBbCodeEnabled(boolean bbCodeEnabled) { 503 this.bbCodeEnabled = bbCodeEnabled; 504 } 505 506 511 public void setDateFormat(String dateFormat) { 512 this.dateFormat = dateFormat; 513 } 514 515 520 public void setEmail(String email) { 521 this.email = email; 522 } 523 524 529 public void setFrom(String from) { 530 this.from = from; 531 } 532 533 538 public void setGender(String gender) { 539 this.gender = gender; 540 } 541 542 547 public void setHtmlEnabled(boolean htmlEnabled) { 548 this.htmlEnabled = htmlEnabled; 549 } 550 551 556 public void setIcq(String icq) { 557 this.icq = icq; 558 } 559 560 565 public void setId(int id) { 566 this.id = id; 567 } 568 569 574 public void setInterests(String interests) { 575 this.interests = interests; 576 } 577 578 583 public void setLang(String lang) { 584 this.lang = lang; 585 } 586 587 592 public void setLastVisit(Date lastVisit) { 593 this.lastVisit = lastVisit; 594 } 595 596 601 public void setLevel(int level) { 602 this.level = level; 603 } 604 605 610 public void setNotifyPrivateMessagesEnabled(boolean notifyPrivateMessagesEnabled) { 611 this.notifyPrivateMessagesEnabled = notifyPrivateMessagesEnabled; 612 } 613 614 619 public void setOccupation(String occupation) { 620 this.occupation = occupation; 621 } 622 623 628 public void setPassword(String password) { 629 this.password = password; 630 } 631 632 637 public void setPrivateMessagesEnabled(boolean privateMessagesEnabled) { 638 this.privateMessagesEnabled = privateMessagesEnabled; 639 } 640 641 646 public void setRankId(int rankId) { 647 this.rankId = rankId; 648 } 649 650 655 public void setRegistrationDate(Date registrationDate) { 656 this.registrationDate = registrationDate; 657 } 658 659 664 public void setSignature(String signature) { 665 this.signature = signature; 666 } 667 668 673 public void setSmiliesEnabled(boolean smilesEnabled) { 674 this.smiliesEnabled = smilesEnabled; 675 } 676 677 682 public void setThemeId(int themeId) { 683 this.themeId = themeId; 684 } 685 686 691 public void setTimeZone(String timeZone) { 692 this.timeZone = timeZone; 693 } 694 695 700 public void setTotalPosts(int totalPosts) { 701 this.totalPosts = totalPosts; 702 } 703 704 709 public void setUsername(String username) { 710 this.username = username; 711 } 712 713 717 public void setViewOnlineEnabled(boolean viewOnlineEnabled) { 718 this.viewOnlineEnabled = viewOnlineEnabled; 719 } 720 721 726 public void setWebSite(String webSite) { 727 this.webSite = webSite; 728 } 729 730 735 public void setYim(String yim) { 736 this.yim = yim; 737 } 738 739 742 public String getMsnm() { 743 return this.msnm; 744 } 745 746 749 public void setMsnm(String string) { 750 this.msnm = string; 751 } 752 753 756 public boolean isNotifyOnMessagesEnabled() { 757 return this.notifyOnMessagesEnabled; 758 } 759 760 763 public void setNotifyOnMessagesEnabled(boolean b) { 764 this.notifyOnMessagesEnabled = b; 765 } 766 767 770 public boolean isViewEmailEnabled() { 771 return this.viewEmailEnabled; 772 } 773 774 777 public void setViewEmailEnabled(boolean b) { 778 this.viewEmailEnabled = b; 779 } 780 781 784 public boolean getAttachSignatureEnabled() { 785 return this.attachSignatureEnabled; 786 } 787 788 791 public void setAttachSignatureEnabled(boolean b) { 792 this.attachSignatureEnabled = b; 793 } 794 795 798 public List getGroupsList() { 799 return this.groupsList; 800 } 801 802 805 public int getPrivateMessagesCount() 806 { 807 return this.privateMessagesCount; 808 } 809 812 public void setPrivateMessagesCount(int privateMessagesCount) 813 { 814 this.privateMessagesCount = privateMessagesCount; 815 } 816 819 public boolean hasPrivateMessages() 820 { 821 return this.privateMessagesCount > 0; 822 } 823 824 827 public void setActive(int active){ 828 this.active = active; 829 } 830 831 public void setActivationKey(String activationKey){ 832 this.activationKey = activationKey; 833 } 834 835 public void setKarma(KarmaStatus karma) 836 { 837 this.karma = karma; 838 } 839 840 public KarmaStatus getKarma() 841 { 842 return this.karma; 843 } 844 845 850 public boolean isOnline() 851 { 852 return (SessionFacade.isUserInSession(this.id) != null); 853 } 854 855 859 public String getBiography() { 860 return biography; 861 } 862 863 867 public void setBiography(String biography) { 868 this.biography = biography; 869 } 870 } 871 | Popular Tags |