KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > snapper > business > SiteListImpl


1 /*
2  * snapper
3  *
4  * Enhydra super-servlet business object
5  *
6  */

7
8 package org.enhydra.snapper.business;
9
10 // Enhydra SuperServlet specification imports
11
import org.enhydra.snapper.spec.*;
12 import org.enhydra.snapper.data.*;
13
14 import com.lutris.appserver.server.sql.DBTransaction;
15 import com.lutris.appserver.server.sql.ObjectId;
16
17 // Standard imports
18
//import java.text.DateFormat;
19

20 public class SiteListImpl implements SiteList {
21     
22     
23     public Site[] getList(DBTransaction dbt) throws Exception JavaDoc{
24         SiteImpl[] sitesArray = null;
25         try {
26             SitesQuery query = new SitesQuery(dbt);
27             //set query
28
//query.setQueryOwner(PersonDO.createExisting(owner.getHandle()));
29
// Order discs alphabetically by artist
30
query.addOrderByNAME();
31             SitesDO[] DOarray = query.getDOArray();
32             sitesArray = new SiteImpl[ DOarray.length ];
33             for ( int i = 0; i < DOarray.length; i++ )
34             sitesArray[i] = new SiteImpl(DOarray[i], dbt);
35         }catch(Exception JavaDoc ex) {
36             throw new Exception JavaDoc("Exception in getList()", ex);
37         }
38         
39         return sitesArray;
40     }
41     
42     public Site findSiteByID(String JavaDoc id, DBTransaction dbt) throws Exception JavaDoc
43     {
44         SiteImpl site = null;
45         try {
46             SitesQuery query = new SitesQuery(dbt);
47             //set query
48
query.setQueryOId(new ObjectId(id));
49             // Throw an exception if more than one user by this name is found
50
query.requireUniqueInstance();
51             SitesDO sitesDO = query.getNextDO();
52             site = new SiteImpl(sitesDO, dbt);
53             return site;
54         }catch(Exception JavaDoc ex) {
55             throw new Exception JavaDoc("Exception in findDiscsByID()", ex);
56         }
57     }
58     
59 }
60
Popular Tags