1 23 24 package discRack.business.disc; 25 26 import discRack.business.DiscRackBusinessException; 27 import discRack.data.disc.*; 28 import com.lutris.dods.builder.generator.query.*; 29 import discRack.business.person.*; 30 import discRack.data.person.PersonDO; 31 import com.lutris.appserver.server.sql.ObjectId; 32 33 import java.util.*; 34 35 38 public class DiscFactory { 39 40 41 53 public static Disc[] findDiscsForPerson(Person owner) 54 throws DiscRackBusinessException { 55 Disc[] theDiscArray = null; 56 57 try { 58 DiscQuery query = new DiscQuery(); 59 query.setQueryOwner(PersonDO.createExisting(owner.getHandle())); 61 query.addOrderByArtist(); 63 DiscDO[] DOarray = query.getDOArray(); 64 theDiscArray = new Disc[ DOarray.length ]; 65 for ( int i = 0; i < DOarray.length; i++ ) 66 theDiscArray[i] = new Disc(DOarray[i]); 67 }catch(Exception ex) { 68 throw new DiscRackBusinessException("Exception in findDiscsForPerson()", ex); 69 } 70 return theDiscArray; 71 } 72 73 86 public static Disc findDiscByID(String id) 87 throws DiscRackBusinessException { 88 Disc 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 Disc(theDiscDO); 98 return theDisc; 99 }catch(Exception ex) { 100 throw new DiscRackBusinessException("Exception in findDiscsForPerson()", ex); 101 } 102 } 103 } 104 105 | Popular Tags |