Rev 4544 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.serving.controllers;import java.util.List;import java.util.ArrayList;import org.apache.struts2.interceptor.ServletRequestAware;import org.apache.struts2.interceptor.ServletResponseAware;import org.apache.thrift.TException;import org.apache.thrift.transport.TTransportException;import in.shop2020.thrift.clients.HelperClient;import in.shop2020.utils.HelperService;import in.shop2020.utils.HelperServiceException;/*** @author Varun Gupta**/@SuppressWarnings("serial")public class ShareProducts extends BaseController implements ServletRequestAware, ServletResponseAware {public ShareProducts() {super();}public String index() {return "success";}public String create() {String emailAddress = request.getParameter("email");String[] productIds = request.getParameterValues("e");List<Long> entityIds = new ArrayList<Long>();for (String entityId: productIds) {try {entityIds.add(Long.parseLong(entityId));} catch (NumberFormatException e) {// TODO: handle exception}}HelperClient helperServiceClient;try {helperServiceClient = new HelperClient();HelperService.Client helperClient = helperServiceClient.getClient();helperClient.shareEntities(entityIds, emailAddress);} catch (TTransportException e) {e.printStackTrace();} catch (HelperServiceException e) {e.printStackTrace();} catch (TException e) {e.printStackTrace();}return "success";}}