1 37 package com.sun.j2ee.blueprints.customer; 38 39 import com.sun.j2ee.blueprints.customer.dao.*; 40 import com.sun.j2ee.blueprints.util.dao.DAOFactory; 41 42 45 public class CustomerFacade { 46 47 private AccountDAO accountDao = null; 48 49 public CustomerFacade() { 50 accountDao = (AccountDAO) DAOFactory.getDAO(JNDINames.ACCOUNT_DAO_CLASS); 51 } 52 53 54 public void createAccount(Account accountDetails)throws CustomerException { 55 try { 56 accountDao.create(accountDetails); 57 } catch (Exception e) { 58 throw new CustomerException("Exception in CustomerFacade while creating account.", e); 59 } 60 } 61 62 public Account getAccount(String userId) throws CustomerException { 63 Account account = null; 64 try { 65 account = accountDao.getAccount(userId); 66 } catch(AccountDAOFinderException fe) { 67 throw new CustomerException("Exception in CustomerFacade while creating account.", fe); 68 } 69 return account; 70 } 71 } 72 | Popular Tags |