1 23 24 package discRack.business.person; 25 26 27 import discRack.data.person.PersonDO; 28 import discRack.data.disc.DiscDO; 29 import discRack.spec.Person; 30 import discRack.business.DiscRackBusinessException; 31 32 import com.lutris.appserver.server.sql.DatabaseManagerException; 33 import com.lutris.appserver.server.sql.ObjectIdException; 34 import com.lutris.dods.builder.generator.query.DataObjectException; 35 import org.enhydra.dods.exceptions.AssertionDataObjectException; 36 37 40 public class PersonImpl implements Person,java.io.Serializable { 41 44 protected PersonDO myDO = null; 45 46 49 public PersonImpl() throws DiscRackBusinessException { 50 try { 51 this.myDO = PersonDO.createVirgin(); 52 } catch(DatabaseManagerException ex) { 53 throw new DiscRackBusinessException("Error creating empty person", ex); 54 } catch(ObjectIdException ex) { 55 throw new DiscRackBusinessException("Error creating object ID for person", ex); 56 } 57 } 58 59 63 public PersonImpl(PersonDO thePerson) { 64 this.myDO = thePerson; 65 } 66 67 75 public String getHandle() 76 throws DiscRackBusinessException { 77 try { 78 return this.myDO.getHandle(); 79 } catch(DatabaseManagerException ex) { 80 throw new DiscRackBusinessException("Error getting handle for person", ex); 81 } 82 } 83 84 92 public String getLogin() 93 throws DiscRackBusinessException { 94 try { 95 return myDO.getLogin(); 96 } catch(DataObjectException ex) { 97 throw new DiscRackBusinessException("Error getting user's login name", ex); 98 } 99 } 100 101 109 public String getPassword() 110 throws DiscRackBusinessException { 111 try { 112 return myDO.getPassword(); 113 } catch(DataObjectException ex) { 114 throw new DiscRackBusinessException("Error getting user's password", ex); 115 } 116 } 117 118 126 public String getFirstname() 127 throws DiscRackBusinessException { 128 try { 129 return myDO.getFirstname(); 130 } catch(DataObjectException ex) { 131 throw new DiscRackBusinessException("Error getting user's first name", ex); 132 } 133 } 134 135 143 public String getLastname() 144 throws DiscRackBusinessException { 145 try { 146 return myDO.getLastname(); 147 } catch(DataObjectException ex) { 148 throw new DiscRackBusinessException("Error getting user's last name", ex); 149 } 150 } 151 152 160 public void setLogin(String login) 161 throws DiscRackBusinessException { 162 try { 163 myDO.setLogin(login); 164 } catch(DataObjectException ex) { 165 throw new DiscRackBusinessException("Error setting user's login name", ex); 166 } 167 } 168 169 177 public void setPassword(String password) 178 throws DiscRackBusinessException { 179 try { 180 myDO.setPassword(password); 181 } catch(DataObjectException ex) { 182 throw new DiscRackBusinessException("Error setting user's password", ex); 183 } 184 } 185 186 194 public void setFirstname(String firstname) 195 throws DiscRackBusinessException { 196 try { 197 myDO.setFirstname(firstname); 198 } catch(DataObjectException ex) { 199 throw new DiscRackBusinessException("Error setting user's first name", ex); 200 } 201 } 202 203 211 public void setLastname(String lastname) 212 throws DiscRackBusinessException { 213 try { 214 myDO.setLastname(lastname); 215 } catch(DataObjectException ex) { 216 throw new DiscRackBusinessException("Error setting user's last name", ex); 217 } 218 } 219 220 227 public void save() throws DiscRackBusinessException, AssertionDataObjectException { 228 try { 229 this.myDO.commit(); 230 } 231 catch (AssertionDataObjectException ex) { 232 throw new AssertionDataObjectException("Read-only table: DML operations not allowed", ex); 233 } 234 catch(Exception ex) { 235 throw new DiscRackBusinessException("Error saving person", ex); 236 } 237 } 238 } 239 | Popular Tags |