1 37 38 package com.sun.j2ee.blueprints.catalog; 39 40 import java.util.Locale ; 41 import java.util.ArrayList ; 42 import com.sun.j2ee.blueprints.catalog.dao.CatalogDAO; 43 import com.sun.j2ee.blueprints.catalog.dao.JNDINames; 44 import com.sun.j2ee.blueprints.catalog.dao.CatalogDAOException; 45 import com.sun.j2ee.blueprints.util.dao.DAOFactory; 46 import com.sun.j2ee.blueprints.util.dao.DAOSystemException; 47 48 51 public class CatalogFacade { 52 53 private CatalogDAO catalogDao = null; 54 55 public CatalogFacade() { 56 catalogDao = (CatalogDAO) DAOFactory.getDAO(JNDINames.CATALOG_DAO_CLASS); 57 } 58 59 public ArrayList getLodgings(String location, Locale locale) 60 throws CatalogException { 61 try { 62 return catalogDao.getLodgings(location,locale); 63 } catch (CatalogDAOException cdos) { 64 throw new CatalogException("Catalog Exception", cdos); 65 } 66 } 67 68 public Lodging getLodging(String id, Locale locale) 69 throws CatalogException { 70 try { 71 return catalogDao.getLodging(id,locale); 72 } catch (CatalogDAOException cdos) { 73 throw new CatalogException("Catalog Exception", cdos); 74 } 75 } 76 77 78 public AdventurePackage getAdventurePackage(String packageId, Locale locale) 79 throws CatalogException { 80 try { 81 return catalogDao.getAdventurePackage(packageId,locale); 82 } catch (CatalogDAOException cdos) { 83 throw new CatalogException("Catalog Exception", cdos); 84 } 85 } 86 87 public ArrayList getTransportations(String origin, String destination, Locale locale) 88 throws CatalogException { 89 try { 90 return catalogDao.getTransportations(origin, destination, locale); 91 } catch (CatalogDAOException cdos) { 92 throw new CatalogException("Catalog Exception", cdos); 93 } 94 } 95 96 public Transportation getTransportation(String id, Locale locale) 97 throws CatalogException { 98 try { 99 return catalogDao.getTransportation(id,locale); 100 } catch (CatalogDAOException cdos) { 101 throw new CatalogException("Catalog Exception", cdos); 102 } 103 } 104 105 public ArrayList getActivities(String location, Locale locale) 106 throws CatalogException { 107 try { 108 return catalogDao.getActivities(location,locale); 109 } catch (CatalogDAOException cdos) { 110 throw new CatalogException("Catalog Exception", cdos); 111 } 112 } 113 114 public Activity getActivity(String id, Locale locale) 115 throws CatalogException { 116 try { 117 return catalogDao.getActivity(id,locale); 118 } catch (CatalogDAOException cdos) { 119 throw new CatalogException("Catalog Exception", cdos); 120 } 121 } 122 123 } 124 | Popular Tags |