1 16 package johnmammen.betterpetshop.service.spring; 17 18 import java.sql.SQLException ; 19 import java.util.Map ; 20 21 import johnmammen.betterpetshop.service.PetshopManager; 22 import johnmammen.betterpetshop.service.dao.IBannerdataDAO; 23 import johnmammen.betterpetshop.service.dao.ICustomerDAO; 24 import johnmammen.betterpetshop.service.dao.IOrderDAO; 25 import johnmammen.betterpetshop.service.dao.IProductDAO; 26 27 import org.apache.tapestry.pets.domain.model.ICustomer; 28 import org.apache.tapestry.pets.domain.model.IInventory; 29 import org.apache.tapestry.pets.domain.model.IItem; 30 import org.apache.tapestry.pets.domain.model.IProduct; 31 import org.apache.tapestry.pets.domain.model.IShoppingCart; 32 import org.apache.tapestry.pets.domain.model.IUserLogin; 33 import org.apache.tapestry.pets.domain.model.pojo.Inventory; 34 35 import org.springframework.dao.DataAccessException; 36 37 public class PetshopManagerImpl implements PetshopManager { 38 39 private IBannerdataDAO bannerdata; 40 41 private ICustomerDAO customer; 42 43 private IOrderDAO order; 44 45 private IProductDAO product; 46 47 private static int count = 0; 48 49 public String getBannerPath(String favCategory) { 51 return getBannerdata().getBannerPath(favCategory); 56 57 } 58 59 61 public ICustomer authenticate(IUserLogin signOn) { 62 63 71 return getCustomer().login(signOn.getUserID(), signOn.getPassword()); 72 73 } 74 75 public ICustomer accountInfo(String userID) { 76 ICustomer c = null; 77 80 c = getCustomer().accountInfo(userID); 81 82 return c; 83 } 84 85 public boolean add(ICustomer newcustomer, IUserLogin userLogin) { 86 return getCustomer().add(newcustomer, userLogin); 88 89 } 90 91 94 public void updateAccount(ICustomer customer) { 95 getCustomer().updateAccount(customer); 96 } 97 98 public IProduct[] getProducts() throws SQLException { 100 return getProduct().getProducts(); 101 102 } 103 104 public IItem[] getItemsByProduct(String prodid) { 106 107 123 return getProduct().getItemsByProduct(prodid); 124 } 125 126 public IItem getItem(String itemID) { 127 return getProduct().getItem(itemID); 140 } 141 142 public String addOrder(Map orderInfo, IShoppingCart cart) { 144 return getOrder().addOrder(orderInfo, cart); 145 } 146 147 public IProduct[] findByCategory(String catid) throws DataAccessException { 149 return getProduct().findByCategory(catid); 163 } 164 165 public IProduct[] findBySearchCriteria(String searchText) { 166 167 return getProduct().findBySearchCriteria(searchText); 186 } 187 188 190 public IInventory[] getInventory(String csvItemList) { 191 195 IInventory[] inventory = new Inventory[1]; 196 IInventory inv = new Inventory(); 197 inv.setItemID("TEST"); 198 inv.setQty(100); 199 inventory[0] = inv; 200 201 return inventory; 202 } 204 205 208 public IBannerdataDAO getBannerdata() { 209 return bannerdata; 210 } 211 212 216 public void setBannerdata(IBannerdataDAO bannerdata) { 217 this.bannerdata = bannerdata; 218 } 219 220 223 public ICustomerDAO getCustomer() { 224 return customer; 225 } 226 227 231 public void setCustomer(ICustomerDAO customer) { 232 this.customer = customer; 233 } 234 235 238 public IOrderDAO getOrder() { 239 return order; 240 } 241 242 246 public void setOrder(IOrderDAO order) { 247 this.order = order; 248 } 249 250 253 public IProductDAO getProduct() { 254 return product; 255 } 256 257 261 public void setProduct(IProductDAO product) { 262 this.product = product; 263 } 264 265 268 public PetshopManagerImpl() { 269 count++; 270 System.out 271 .println("<<<<<<<<<<<<<<<>>>>>>>>>>>Incrementing PETSHOPMANGER " 272 + count); 273 } 274 } | Popular Tags |