1 package de.webman.acl.db; 2 3 import java.sql.ResultSet ; 4 import java.sql.SQLException ; 5 import com.teamkonzept.db.TKQuery; 6 import com.teamkonzept.lib.TKVector; 7 import de.webman.acl.Login; 8 9 18 public class LoginDBData 19 extends ObjectDBData 20 { 21 22 24 27 private String login = null; 28 29 32 private String name = null; 33 34 37 private String type = null; 38 39 40 42 50 public LoginDBData (Integer id, 51 String login, 52 String name, 53 String type) 54 { 55 super(id); 56 57 this.name = name; 58 this.login = login; 59 this.type = type; 60 } 61 62 67 public LoginDBData (Login login) 68 { 69 super(login); 70 71 this.login = login.getLogin(); 72 this.name = login.getName(); 73 this.type = login.isUser() 74 ? LoginDBInterface.TYPE_USER 75 : LoginDBInterface.TYPE_PROFILE; 76 } 77 78 79 81 86 public final ObjectDBInterface getDBInterface () 87 { 88 return LoginDBInterface.getInstance(); 89 } 90 91 99 public void insertInitialIntoQuery (TKQuery query) 100 throws SQLException 101 { 102 super.insertInitialIntoQuery(query); 103 104 query.setQueryParams(LoginDBInterface.LOGIN_COLUMN, this.login); 105 query.setQueryParams(LoginDBInterface.NAME_COLUMN, this.name); 106 query.setQueryParams(LoginDBInterface.TYPE_COLUMN, this.type); 107 } 108 109 118 public void fill (ResultSet result) 119 throws SQLException 120 { 121 this.login = result.getString(LoginDBInterface.LOGIN_COLUMN); 122 this.name = result.getString(LoginDBInterface.NAME_COLUMN); 123 this.type = result.getString(LoginDBInterface.TYPE_COLUMN); 124 125 super.fill(result); 126 } 127 128 133 public final String getName () 134 { 135 return this.name; 136 } 137 138 143 public final String getLogin () 144 { 145 return this.login; 146 } 147 148 154 public final boolean isUser () 155 { 156 return type != null && type.equals(LoginDBInterface.TYPE_USER); 157 } 158 159 165 public final boolean isProfile () 166 { 167 return type != null && type.equals(LoginDBInterface.TYPE_PROFILE); 168 } 169 170 } 171 | Popular Tags |