1 23 24 package barracudaDiscRack.business.person; 25 26 import barracudaDiscRack.business.DiscRackBusinessException; 27 import barracudaDiscRack.data.person.*; 28 import barracudaDiscRack.data.disc.DiscDO; 29 import barracudaDiscRack.business.disc.Disc; 30 import com.lutris.appserver.server.sql.DatabaseManagerException; 31 import com.lutris.appserver.server.sql.ObjectIdException; 32 import com.lutris.dods.builder.generator.query.DataObjectException; 33 34 37 public class Person { 38 41 protected PersonDO myDO = null; 42 43 46 public Person() throws DiscRackBusinessException { 47 try { 48 this.myDO = PersonDO.createVirgin(); 49 } catch(DatabaseManagerException ex) { 50 throw new DiscRackBusinessException("Error creating empty person", ex); 51 } catch(ObjectIdException ex) { 52 throw new DiscRackBusinessException("Error creating object ID for person", ex); 53 } 54 } 55 56 60 public Person(PersonDO thePerson) { 61 this.myDO = thePerson; 62 } 63 64 72 public String getHandle() 73 throws DiscRackBusinessException { 74 try { 75 return this.myDO.getHandle(); 76 } catch(DatabaseManagerException ex) { 77 throw new DiscRackBusinessException("Error getting handle for person", ex); 78 } 79 } 80 81 89 public String getLogin() 90 throws DiscRackBusinessException { 91 try { 92 return myDO.getLogin(); 93 } catch(DataObjectException ex) { 94 throw new DiscRackBusinessException("Error getting user's login name", ex); 95 } 96 } 97 98 106 public String getPassword() 107 throws DiscRackBusinessException { 108 try { 109 return myDO.getPassword(); 110 } catch(DataObjectException ex) { 111 throw new DiscRackBusinessException("Error getting user's password", ex); 112 } 113 } 114 115 123 public String getFirstname() 124 throws DiscRackBusinessException { 125 try { 126 return myDO.getFirstname(); 127 } catch(DataObjectException ex) { 128 throw new DiscRackBusinessException("Error getting user's first name", ex); 129 } 130 } 131 132 140 public String getLastname() 141 throws DiscRackBusinessException { 142 try { 143 return myDO.getLastname(); 144 } catch(DataObjectException ex) { 145 throw new DiscRackBusinessException("Error getting user's last name", ex); 146 } 147 } 148 149 157 public void setLogin(String login) 158 throws DiscRackBusinessException { 159 try { 160 myDO.setLogin(login); 161 } catch(DataObjectException ex) { 162 throw new DiscRackBusinessException("Error setting user's login name", ex); 163 } 164 } 165 166 174 public void setPassword(String password) 175 throws DiscRackBusinessException { 176 try { 177 myDO.setPassword(password); 178 } catch(DataObjectException ex) { 179 throw new DiscRackBusinessException("Error setting user's password", ex); 180 } 181 } 182 183 191 public void setFirstname(String firstname) 192 throws DiscRackBusinessException { 193 try { 194 myDO.setFirstname(firstname); 195 } catch(DataObjectException ex) { 196 throw new DiscRackBusinessException("Error setting user's first name", ex); 197 } 198 } 199 200 208 public void setLastname(String lastname) 209 throws DiscRackBusinessException { 210 try { 211 myDO.setLastname(lastname); 212 } catch(DataObjectException ex) { 213 throw new DiscRackBusinessException("Error setting user's last name", ex); 214 } 215 } 216 217 224 public void save() throws DiscRackBusinessException { 225 try { 226 this.myDO.commit(); 227 } catch(Exception ex) { 228 throw new DiscRackBusinessException("Error saving person", ex); 229 } 230 } 231 } 232 | Popular Tags |