1 23 24 package discRack.business.person; 25 26 import discRack.business.DiscRackBusinessException; 27 import discRack.data.person.*; 28 import discRack.data.disc.DiscDO; 29 import discRack.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 import org.enhydra.dods.exceptions.AssertionDataObjectException; 34 35 38 public class Person { 39 42 protected PersonDO myDO = null; 43 44 47 public Person() throws DiscRackBusinessException { 48 try { 49 this.myDO = PersonDO.createVirgin(); 50 } catch(DatabaseManagerException ex) { 51 throw new DiscRackBusinessException("Error creating empty person", ex); 52 } catch(ObjectIdException ex) { 53 throw new DiscRackBusinessException("Error creating object ID for person", ex); 54 } 55 } 56 57 61 public Person(PersonDO thePerson) { 62 this.myDO = thePerson; 63 } 64 65 73 public String getHandle() 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() throws DiscRackBusinessException { 90 try { 91 return myDO.getLogin(); 92 } catch(DataObjectException ex) { 93 throw new DiscRackBusinessException("Error getting user's login name", ex); 94 } 95 } 96 97 105 public String getPassword() throws DiscRackBusinessException { 106 try { 107 return myDO.getPassword(); 108 } catch(DataObjectException ex) { 109 throw new DiscRackBusinessException("Error getting user's password", ex); 110 } 111 } 112 113 121 public String getFirstname() throws DiscRackBusinessException { 122 try { 123 return myDO.getFirstname(); 124 } catch(DataObjectException ex) { 125 throw new DiscRackBusinessException("Error getting user's first name", ex); 126 } 127 } 128 129 137 public String getLastname() throws DiscRackBusinessException { 138 try { 139 return myDO.getLastname(); 140 } catch(DataObjectException ex) { 141 throw new DiscRackBusinessException("Error getting user's last name", ex); 142 } 143 } 144 145 153 public void setLogin(String login) throws DiscRackBusinessException { 154 try { 155 myDO.setLogin(login); 156 } catch(DataObjectException ex) { 157 throw new DiscRackBusinessException("Error setting user's login name", ex); 158 } 159 } 160 161 169 public void setPassword(String password) throws DiscRackBusinessException { 170 try { 171 myDO.setPassword(password); 172 } catch(DataObjectException ex) { 173 throw new DiscRackBusinessException("Error setting user's password", ex); 174 } 175 } 176 177 185 public void setFirstname(String firstname) throws DiscRackBusinessException { 186 try { 187 myDO.setFirstname(firstname); 188 } catch(DataObjectException ex) { 189 throw new DiscRackBusinessException("Error setting user's first name", ex); 190 } 191 } 192 193 201 public void setLastname(String lastname) throws DiscRackBusinessException { 202 try { 203 myDO.setLastname(lastname); 204 } catch(DataObjectException ex) { 205 throw new DiscRackBusinessException("Error setting user's last name", ex); 206 } 207 } 208 209 216 public void save() throws DiscRackBusinessException, AssertionDataObjectException { 217 try { 218 this.myDO.save(); 220 } catch(AssertionDataObjectException ex) { 221 throw new AssertionDataObjectException("DML opertions not allowed.", ex); 222 } catch(Exception ex) { 223 throw new DiscRackBusinessException("Error saving person", ex); 224 } 225 } 226 } 227 | Popular Tags |