| Line 6... |
Line 6... |
| 6 |
|
6 |
|
| 7 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
7 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
| 8 |
import in.shop2020.model.v1.catalog.Warehouse;
|
8 |
import in.shop2020.model.v1.catalog.Warehouse;
|
| 9 |
import in.shop2020.support.models.InventoryUpdate;
|
9 |
import in.shop2020.support.models.InventoryUpdate;
|
| 10 |
import in.shop2020.support.models.Update;
|
10 |
import in.shop2020.support.models.Update;
|
| 11 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
11 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 12 |
|
12 |
|
| 13 |
import org.apache.struts2.rest.DefaultHttpHeaders;
|
13 |
import org.apache.struts2.rest.DefaultHttpHeaders;
|
| 14 |
import org.apache.struts2.rest.HttpHeaders;
|
14 |
import org.apache.struts2.rest.HttpHeaders;
|
| 15 |
import org.slf4j.Logger;
|
15 |
import org.slf4j.Logger;
|
| 16 |
import org.slf4j.LoggerFactory;
|
16 |
import org.slf4j.LoggerFactory;
|
| Line 39... |
Line 39... |
| 39 |
return this.inventoryUpdate;
|
39 |
return this.inventoryUpdate;
|
| 40 |
}
|
40 |
}
|
| 41 |
|
41 |
|
| 42 |
public HttpHeaders show(){
|
42 |
public HttpHeaders show(){
|
| 43 |
logger.info("Status requested for warehouse id: " + getId());
|
43 |
logger.info("Status requested for warehouse id: " + getId());
|
| 44 |
CatalogServiceClient catalogServiceClient;
|
44 |
CatalogClient catalogServiceClient;
|
| 45 |
Client client;
|
45 |
Client client;
|
| 46 |
|
46 |
|
| 47 |
try {
|
47 |
try {
|
| 48 |
catalogServiceClient = new CatalogServiceClient();
|
48 |
catalogServiceClient = new CatalogClient();
|
| 49 |
client = catalogServiceClient.getClient();
|
49 |
client = catalogServiceClient.getClient();
|
| 50 |
long warehouseId = Long.parseLong(getId());
|
50 |
long warehouseId = Long.parseLong(getId());
|
| 51 |
Warehouse warehouse = client.getWarehouse(warehouseId);
|
51 |
Warehouse warehouse = client.getWarehouse(warehouseId);
|
| 52 |
setTimestamp(warehouse.getVendorString());
|
52 |
setTimestamp(warehouse.getVendorString());
|
| 53 |
} catch (Exception e) {
|
53 |
} catch (Exception e) {
|
| Line 58... |
Line 58... |
| 58 |
|
58 |
|
| 59 |
|
59 |
|
| 60 |
public HttpHeaders create(){
|
60 |
public HttpHeaders create(){
|
| 61 |
logger.info(inventoryUpdate.toString());
|
61 |
logger.info(inventoryUpdate.toString());
|
| 62 |
// need to store all data from object to service
|
62 |
// need to store all data from object to service
|
| 63 |
CatalogServiceClient catalogServiceClient;
|
63 |
CatalogClient catalogServiceClient;
|
| 64 |
Client client;
|
64 |
Client client;
|
| 65 |
try {
|
65 |
try {
|
| 66 |
catalogServiceClient = new CatalogServiceClient();
|
66 |
catalogServiceClient = new CatalogClient();
|
| 67 |
client = catalogServiceClient.getClient();
|
67 |
client = catalogServiceClient.getClient();
|
| 68 |
Long warehouseId = Long.parseLong(inventoryUpdate.getwarehouseId());
|
68 |
Long warehouseId = Long.parseLong(inventoryUpdate.getwarehouseId());
|
| 69 |
String timestamp = inventoryUpdate.getCurrentTimestamp();
|
69 |
String timestamp = inventoryUpdate.getCurrentTimestamp();
|
| 70 |
Map<String, Long> availability = new HashMap<String, Long>();
|
70 |
Map<String, Long> availability = new HashMap<String, Long>();
|
| 71 |
List<Update> updates = inventoryUpdate.getUpdates();
|
71 |
List<Update> updates = inventoryUpdate.getUpdates();
|