1 25 26 29 package net.killingar.forum.internal; 30 31 import net.killingar.forum.internal.managers.ForumManager; 32 33 import java.sql.Date ; 34 35 public class User extends NamedItemImpl 36 { 37 public String 38 email, icq, 40 telephone, 41 mobilephone, 42 address, 43 other, 44 realName, 45 46 publicEmail, 48 restrictedEmail, 49 secretEmail; 50 51 public Date birthdate; 52 53 public User() 54 { 55 super(-1, ""); 56 } 57 58 public User( 59 long _ID, 60 String _name, 61 String _publicEmail) 62 { 63 super(_ID, _name); 64 65 publicEmail = _publicEmail != null && _publicEmail.length() == 0? null: _publicEmail; 66 } 67 68 public User( 69 long _ID, 70 String _name, 71 String _publicEmail, 72 String _restrictedEmail, 73 String _secretEmail, 74 String _icq, 75 String _telephone, 76 String _mobilephone, 77 String _address, 78 String _other, 79 String _realName, 80 Date _birthdate) 81 { 82 super(_ID, _name); 83 84 publicEmail = _publicEmail != null && _publicEmail.length() == 0? null: _publicEmail; 85 restrictedEmail = _restrictedEmail != null && _restrictedEmail.length() == 0? null: _restrictedEmail; 86 secretEmail = _secretEmail != null && _secretEmail.length() == 0? null: _secretEmail; 87 icq = _icq != null && _icq.length() == 0? null: _icq; 88 telephone = _telephone != null && _telephone.length() == 0? null: _telephone; 89 mobilephone = _mobilephone != null && _mobilephone.length() == 0? null: _mobilephone; 90 address = _address != null && _address.length() == 0? null: _address; 91 other = _other != null && _other.length() == 0? null: _other; 92 realName = _realName != null && _realName.length() == 0? null: _realName; 93 birthdate = _birthdate == null || _birthdate.getTime() == 0 || _birthdate.getTime() == -2208992400000L? null: _birthdate; 94 95 email = publicEmail; 96 if (restrictedEmail != null) 97 email = restrictedEmail; 98 99 if (email != null && email.length() == 0) 100 email = null; 101 102 } 103 104 public User(User user) 105 { 106 this( 107 user.ID, 108 user.name, 109 user.publicEmail, 110 user.restrictedEmail, 111 user.secretEmail, 112 user.icq, 113 user.telephone, 114 user.mobilephone, 115 user.address, 116 user.other, 117 user.realName, 118 user.birthdate); 119 } 120 121 public String getEmail() { return email; } 122 public String getIcq() { return icq; } 123 public String getTelephone() { return telephone; } 124 public String getMobilephone() { return mobilephone; } 125 public String getAddress() { return address; } 126 public String getOther() { return other; } 127 public String getRealName() { return realName; } 128 public String getPublicEmail() { return publicEmail; } 129 public String getRestrictedEmail() { return restrictedEmail; } 130 public String getSecretEmail(ForumManager mgr) { return mgr.getUserID() == getId()? secretEmail : null; } 131 public Date getBirthdate() { return birthdate; } 132 133 public String toString() { return getName(); } 134 } | Popular Tags |