| Line 18... |
Line 18... |
| 18 |
/**
|
18 |
/**
|
| 19 |
* get latest arrivals items from the catalog service
|
19 |
* get latest arrivals items from the catalog service
|
| 20 |
* @author rajveer
|
20 |
* @author rajveer
|
| 21 |
*
|
21 |
*
|
| 22 |
*/
|
22 |
*/
|
| - |
|
23 |
@SuppressWarnings("serial")
|
| 23 |
public class LatestArrivalsController extends BaseController {
|
24 |
public class LatestArrivalsController extends BaseController {
|
| 24 |
|
25 |
|
| 25 |
private static final long serialVersionUID = -2720118892178057878L;
|
- |
|
| 26 |
private static Logger log = Logger.getLogger(Class.class);
|
26 |
private static Logger log = Logger.getLogger(Class.class);
|
| 27 |
|
27 |
|
| 28 |
private static final int windowSize = 20;
|
28 |
private static final int windowSize = 20;
|
| 29 |
|
29 |
|
| 30 |
private long beginIndex = 0;
|
30 |
private long beginIndex = 0;
|
| Line 55... |
Line 55... |
| 55 |
//Right now if we have brand name, we can just send back for all categories
|
55 |
//Right now if we have brand name, we can just send back for all categories
|
| 56 |
if(brandName!=null){
|
56 |
if(brandName!=null){
|
| 57 |
categoryId = -1;
|
57 |
categoryId = -1;
|
| 58 |
}
|
58 |
}
|
| 59 |
in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
|
59 |
in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
|
| - |
|
60 |
List<Long> latestArrivalCategories = new ArrayList<Long>();
|
| - |
|
61 |
latestArrivalCategories.add(categoryId);
|
| 60 |
this.items = client.getLatestArrivalsCatalogIds(beginIndex, windowSize, brandName, categoryId);
|
62 |
this.items = client.getLatestArrivalsCatalogIds(beginIndex, windowSize, brandName, latestArrivalCategories);
|
| 61 |
return new DefaultHttpHeaders("index");
|
63 |
return new DefaultHttpHeaders("index");
|
| 62 |
}
|
64 |
}
|
| 63 |
|
65 |
|
| 64 |
// GET /show
|
66 |
// GET /show
|
| 65 |
public HttpHeaders show() {
|
67 |
public HttpHeaders show() {
|
| 66 |
in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
|
68 |
in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
|
| 67 |
try {
|
69 |
try {
|
| 68 |
this.setTotalItems(client.getLatestArrivalsCount());
|
70 |
this.setTotalItems(client.getLatestArrivalsCount());
|
| 69 |
this.items = client.getLatestArrivalsCatalogIds(beginIndex, windowSize, null, -1);
|
71 |
this.items = client.getLatestArrivalsCatalogIds(beginIndex, windowSize, null, new ArrayList<Long>());
|
| 70 |
} catch (InventoryServiceException e) {
|
72 |
} catch (InventoryServiceException e) {
|
| 71 |
log.error("Unable to get latest arrivals from inventory service.", e);
|
73 |
log.error("Unable to get latest arrivals from inventory service.", e);
|
| 72 |
} catch (TException e) {
|
74 |
} catch (TException e) {
|
| 73 |
log.error("Unable to get latest arrivals from inventory service.", e);
|
75 |
log.error("Unable to get latest arrivals from inventory service.", e);
|
| 74 |
}
|
76 |
}
|