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