1 23 24 package barracudaDiscRack.business.disc; 25 26 import barracudaDiscRack.business.DiscRackBusinessException; 27 import barracudaDiscRack.data.disc.*; 28 import barracudaDiscRack.business.person.Person; 29 import com.lutris.dods.builder.generator.query.*; 30 import barracudaDiscRack.business.person.Person; 31 import barracudaDiscRack.data.person.PersonDO; 32 import com.lutris.appserver.server.sql.ObjectId; 33 34 37 public class DiscFactory { 38 39 51 public static Disc[] findDiscsForPerson(Person owner) 52 throws DiscRackBusinessException { 53 Disc[] theDiscArray = null; 54 55 try { 56 DiscQuery query = new DiscQuery(); 57 query.setQueryOwner(PersonDO.createExisting(owner.getHandle())); 59 query.addOrderByArtist(); 61 DiscDO[] DOarray = query.getDOArray(); 62 theDiscArray = new Disc[ DOarray.length ]; 63 for ( int i = 0; i < DOarray.length; i++ ) 64 theDiscArray[i] = new Disc(DOarray[i]); 65 }catch(Exception ex) { 66 throw new DiscRackBusinessException("Exception in findDiscsForPerson()", ex); 67 } 68 69 return theDiscArray; 70 } 71 72 85 public static Disc findDiscByID(String id) 86 throws DiscRackBusinessException { 87 Disc theDisc = null; 88 89 try { 90 DiscQuery query = new DiscQuery(); 91 query.setQueryOId(new ObjectId(id)); 93 query.requireUniqueInstance(); 95 DiscDO theDiscDO = query.getNextDO(); 96 theDisc = new Disc(theDiscDO); 97 return theDisc; 98 }catch(Exception ex) { 99 throw new DiscRackBusinessException("Exception in findDiscsForPerson()", ex); 100 } 101 } 102 } 103 104 | Popular Tags |