| 3080 |
rajveer |
1 |
package in.shop2020.serving.controllers;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.serving.controllers.BaseController;
|
|
|
4 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
|
|
5 |
|
|
|
6 |
import org.apache.log4j.Logger;
|
|
|
7 |
|
|
|
8 |
@SuppressWarnings("serial")
|
|
|
9 |
public class ProductNotificationController extends BaseController{
|
|
|
10 |
|
|
|
11 |
private static Logger log = Logger.getLogger(ProductNotificationController.class);
|
|
|
12 |
private String emailId = null;
|
|
|
13 |
private long itemId = 0;
|
|
|
14 |
public ProductNotificationController(){
|
|
|
15 |
super();
|
|
|
16 |
}
|
|
|
17 |
|
|
|
18 |
public String create() {
|
|
|
19 |
emailId = this.request.getParameter("emailId");
|
|
|
20 |
itemId = Long.parseLong(this.request.getParameter("itemId"));
|
|
|
21 |
|
|
|
22 |
CatalogServiceClient catalogClientService;
|
|
|
23 |
try {
|
|
|
24 |
catalogClientService = new CatalogServiceClient();
|
|
|
25 |
in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
|
|
|
26 |
client.addProductNotification(itemId, emailId);
|
|
|
27 |
} catch (Exception e) {
|
|
|
28 |
log.error("Exception while adding product notification for item: " + itemId + " and email: " + emailId, e);
|
|
|
29 |
}
|
|
|
30 |
log.debug("Got product notification for product: " + itemId + " from user: " + emailId );
|
|
|
31 |
return "show";
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
}
|