Subversion Repositories SmartDukaan

Rev

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

Rev 3132 Rev 4363
Line 1... Line 1...
1
package in.shop2020.hotspot.dashbaord.server;
1
package in.shop2020.hotspot.dashbaord.server;
2
 
2
 
3
import in.shop2020.hotspot.dashbaord.shared.actions.Item;
3
import in.shop2020.hotspot.dashbaord.shared.actions.Item;
4
import in.shop2020.model.v1.catalog.InventoryService;
4
import in.shop2020.model.v1.catalog.InventoryService;
-
 
5
import in.shop2020.model.v1.catalog.Vendor;
5
import in.shop2020.thrift.clients.CatalogClient;
6
import in.shop2020.thrift.clients.CatalogClient;
6
 
7
 
7
import java.util.ArrayList;
8
import java.util.ArrayList;
-
 
9
import java.util.HashMap;
8
import java.util.List;
10
import java.util.List;
-
 
11
import java.util.Map;
9
 
12
 
10
import com.google.gwt.core.client.GWT;
13
import com.google.gwt.core.client.GWT;
11
 
14
 
12
public class CatalogUtils {
15
public class CatalogUtils {
13
	public static List<Item> getAllItems(){
16
	public static List<Item> getAllItems(){
Line 106... Line 109...
106
			// periodically.
109
			// periodically.
107
			e.printStackTrace();
110
			e.printStackTrace();
108
		}
111
		}
109
	}
112
	}
110
	
113
	
-
 
114
	
-
 
115
	public static Map<Long, String> getVendorsForWarehouse(long warehouseId){
-
 
116
		try{
-
 
117
			CatalogClient catalogServiceClient = new CatalogClient();
-
 
118
			InventoryService.Client catalogClient = catalogServiceClient.getClient();
-
 
119
			List<Vendor> vendors = catalogClient.getVendorsForWarehouse(warehouseId);
-
 
120
			Map<Long, String> vendorMapping = new HashMap<Long, String>();
-
 
121
			for(Vendor vendor: vendors){
-
 
122
				vendorMapping.put(vendor.getId(), vendor.getName());
-
 
123
			}
-
 
124
			return vendorMapping;
-
 
125
		}catch(Exception e){
-
 
126
			// TODO: Oops! We couldn't reduce the item reservation count. This will
-
 
127
			// result in underestimation of inventory stock. Should be corrected
-
 
128
			// periodically.
-
 
129
			e.printStackTrace();
-
 
130
		}
-
 
131
		return null;
-
 
132
	}
-
 
133
 
111
	private static Item getItemFromThriftItem(in.shop2020.model.v1.catalog.Item thriftItem){
134
	private static Item getItemFromThriftItem(in.shop2020.model.v1.catalog.Item thriftItem){
112
		Item item = new Item(thriftItem.getId(),
135
		Item item = new Item(thriftItem.getId(),
113
				thriftItem.getProductGroup(),
136
				thriftItem.getProductGroup(),
114
				thriftItem.getBrand(),
137
				thriftItem.getBrand(),
115
				thriftItem.getModelNumber(),
138
				thriftItem.getModelNumber(),