Subversion Repositories SmartDukaan

Rev

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

Rev 2975 Rev 3017
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
3
import java.io.File;
-
 
4
import java.io.IOException;
-
 
5
import java.util.ArrayList;
-
 
6
import java.util.List;
-
 
7
 
-
 
8
import in.shop2020.model.v1.catalog.InventoryServiceException;
3
import in.shop2020.model.v1.catalog.InventoryServiceException;
9
import in.shop2020.serving.utils.FileUtils;
4
import in.shop2020.serving.utils.FileUtils;
10
import in.shop2020.serving.utils.Utils;
5
import in.shop2020.serving.utils.Utils;
11
import in.shop2020.thrift.clients.CatalogServiceClient;
6
import in.shop2020.thrift.clients.CatalogServiceClient;
12
 
7
 
-
 
8
import java.io.File;
-
 
9
import java.io.IOException;
-
 
10
import java.util.ArrayList;
-
 
11
import java.util.List;
-
 
12
 
13
import org.apache.log4j.Logger;
13
import org.apache.log4j.Logger;
14
import org.apache.struts2.rest.DefaultHttpHeaders;
14
import org.apache.struts2.rest.DefaultHttpHeaders;
15
import org.apache.struts2.rest.HttpHeaders;
15
import org.apache.struts2.rest.HttpHeaders;
16
import org.apache.thrift.TException;
16
import org.apache.thrift.TException;
17
 
17
 
Line 50... Line 50...
50
    
50
    
51
    // GET /index
51
    // GET /index
52
    public HttpHeaders index() throws Exception {
52
    public HttpHeaders index() throws Exception {
53
    	long categoryId = Long.parseLong(request.getParameter("categoryid"));
53
    	long categoryId = Long.parseLong(request.getParameter("categoryid"));
54
    	String brandName = request.getParameter("brand");
54
    	String brandName = request.getParameter("brand");
-
 
55
    	List<Long> latestArrivalCategories = new ArrayList<Long>();
55
    	//Right now if we have brand name, we can just send back for all categories
56
    	//Right now if we have brand name, we can just send back for all categories
56
    	if(brandName!=null){
57
    	if(brandName==null){
57
    	    categoryId = -1;
58
    	    latestArrivalCategories.add(categoryId);
58
    	}
59
    	}
59
    	in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
60
    	in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
60
    	List<Long> latestArrivalCategories = new ArrayList<Long>();
-
 
-
 
61
    	
61
        latestArrivalCategories.add(categoryId);
62
        
62
    	this.items = client.getLatestArrivalsCatalogIds(beginIndex, windowSize, brandName, latestArrivalCategories);
63
    	this.items = client.getLatestArrivalsCatalogIds(beginIndex, windowSize, brandName, latestArrivalCategories);
63
    	return new DefaultHttpHeaders("index");
64
    	return new DefaultHttpHeaders("index");
64
    }
65
    }
65
 
66
 
66
    // GET /show
67
    // GET /show