| 584 |
chandransh |
1 |
package in.shop2020.hotspot.dashbaord.server;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.hotspot.dashbaord.shared.actions.Item;
|
|
|
4 |
import in.shop2020.model.v1.catalog.InventoryService;
|
|
|
5 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
|
|
6 |
|
|
|
7 |
import java.util.ArrayList;
|
|
|
8 |
import java.util.List;
|
|
|
9 |
|
|
|
10 |
public class CatalogUtils {
|
|
|
11 |
public static List<Item> getAllItems(){
|
|
|
12 |
List<Item> itemList = new ArrayList<Item>();
|
|
|
13 |
|
|
|
14 |
try {
|
|
|
15 |
CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
|
|
|
16 |
InventoryService.Client catalogClient = catalogServiceClient.getClient();
|
|
|
17 |
|
|
|
18 |
List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getAllItems(true);
|
|
|
19 |
for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems){
|
|
|
20 |
Item item = new Item(thriftItem.getId(), thriftItem.getManufacturerName(), thriftItem.getModelNumber(),
|
|
|
21 |
thriftItem.getModelName(), thriftItem.getCategory(), thriftItem.getComments(),
|
|
|
22 |
thriftItem.getCatalogItemId(), thriftItem.getVendorItemId(), thriftItem.getFeatureId(),
|
|
|
23 |
thriftItem.getFeatureDescription(),
|
|
|
24 |
//thriftItem.getItemInventory(),
|
|
|
25 |
thriftItem.getMrp(),
|
|
|
26 |
thriftItem.getMop(), thriftItem.getSellingPrice(), thriftItem.getWeight(), thriftItem.getAddedOn(),
|
|
|
27 |
thriftItem.getStartDate(), thriftItem.getRetireDate(),
|
|
|
28 |
//thriftItem.getItemStatus(),
|
|
|
29 |
thriftItem.getOtherInfo());
|
|
|
30 |
itemList.add(item);
|
|
|
31 |
}
|
|
|
32 |
} catch (Exception e) {
|
|
|
33 |
// TODO Auto-generated catch block
|
|
|
34 |
e.printStackTrace();
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
return itemList;
|
|
|
38 |
}
|
|
|
39 |
}
|