1 23 24 package discRack.business.disc; 25 26 27 import discRack.data.disc.*; 28 import discRack.spec.*; 29 import discRack.business.DiscRackBusinessException; 30 import discRack.data.person.PersonDO; 31 32 import com.lutris.dods.builder.generator.query.*; 33 import com.lutris.appserver.server.sql.ObjectId; 34 import org.enhydra.dods.exceptions.AssertionDataObjectException; 35 38 public class DiscGeneratorImpl implements DiscGenerator { 39 40 52 public Disc[] findDiscsForPerson(Person owner) 53 throws DiscRackBusinessException { 54 DiscImpl[] theDiscArray = null; 55 56 try { 57 DiscQuery query = new DiscQuery(); 58 query.setQueryOwner(PersonDO.createExisting(owner.getHandle())); 60 query.addOrderByArtist(); 62 DiscDO[] DOarray = query.getDOArray(); 63 theDiscArray = new DiscImpl[ DOarray.length ]; 64 for ( int i = 0; i < DOarray.length; i++ ) 65 theDiscArray[i] = new DiscImpl(DOarray[i]); 66 }catch(Exception ex) { 67 throw new DiscRackBusinessException("Exception in findDiscsForPerson()", ex); 68 } 69 70 return theDiscArray; 71 } 72 73 86 public Disc findDiscByID(String id) 87 throws DiscRackBusinessException { 88 DiscImpl theDisc = null; 89 90 try { 91 DiscQuery query = new DiscQuery(); 92 query.setQueryOId(new ObjectId(id)); 94 query.requireUniqueInstance(); 96 DiscDO theDiscDO = query.getNextDO(); 97 theDisc = new DiscImpl(theDiscDO); 98 return theDisc; 99 }catch(Exception ex) { 100 throw new DiscRackBusinessException("Exception in findDiscsByID()", ex); 101 } 102 } 103 104 105 106 } 107 108 | Popular Tags |