Subversion Repositories SmartDukaan

Rev

Rev 1044 | Rev 2453 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1044 Rev 1928
Line 52... Line 52...
52
	}
52
	}
53
    
53
    
54
    // GET /index
54
    // GET /index
55
    public HttpHeaders index() throws Exception {
55
    public HttpHeaders index() throws Exception {
56
    	long categoryId = Long.parseLong(request.getParameter("categoryid"));
56
    	long categoryId = Long.parseLong(request.getParameter("categoryid"));
-
 
57
        String brandName = request.getParameter("brand");
-
 
58
        //Right now if we have brand name, we can just send back data for all categories
-
 
59
        if(brandName!=null){
-
 
60
            categoryId = -1;
-
 
61
        }
57
    	in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
62
    	in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
58
    	this.items = client.getBestDealsCatalogIds(beginIndex, windowSize, categoryId);
63
    	this.items = client.getBestDealsCatalogIds(beginIndex, windowSize, brandName, categoryId);
59
    	return new DefaultHttpHeaders("index");
64
    	return new DefaultHttpHeaders("index");
60
    }
65
    }
61
 
66
 
62
    // GET /show
67
    // GET /show
63
    public HttpHeaders show() {
68
    public HttpHeaders show() {
64
    	in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
69
    	in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
65
    	try {
70
    	try {
66
			this.setTotalItems(client.getBestDealsCount());
71
			this.setTotalItems(client.getBestDealsCount());
67
			this.items = client.getBestDealsCatalogIds(beginIndex, windowSize, -1);
72
			this.items = client.getBestDealsCatalogIds(beginIndex, windowSize, null, -1);
68
		} catch (InventoryServiceException e) {
73
		} catch (InventoryServiceException e) {
69
			log.error("Unable to get best deals from inventory service.");
74
			log.error("Unable to get best deals from inventory service.");
70
			log.error("Exception id is:"  + e.getId() + " Exception message is:" + e.getMessage());
75
			log.error("Exception id is:"  + e.getId() + " Exception message is:" + e.getMessage());
71
			e.printStackTrace();
76
			e.printStackTrace();
72
		} catch (TException e) {
77
		} catch (TException e) {