package com.swfarm.biz.ebay.web;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.swfarm.biz.ebay.bo.EbayAccount;
import com.swfarm.biz.ebay.srv.EbayService;

public class ShowEbayAccountsController extends AbstractController {
	private EbayService ebayService;

	public void setEbayService(EbayService ebayService) {
		this.ebayService = ebayService;
	}

	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest req,
			HttpServletResponse res) throws Exception {
		Map dataMap = new HashMap();
		List<EbayAccount> ebayAccounts = ebayService.findEbayAccounts();
		dataMap.put("ebayAccounts", ebayAccounts);
		return new ModelAndView("ebay/ebayaccounts", dataMap);
	}

}
