Rev 306 | Blame | Last modification | View Log | RSS feed
package in.shop2020.hotspot.dashbaord.server.handler;import in.shop2020.hotspot.dashbaord.shared.actions.AddressRequest;import in.shop2020.hotspot.dashbaord.shared.actions.AddressResponse;import in.shop2020.hotspot.dashbaord.shared.data.Address;import in.shop2020.model.v1.order.Order;import in.shop2020.model.v1.order.ShipmentInfo;import in.shop2020.model.v1.order.Transaction;import in.shop2020.model.v1.order.TransactionService.Client;import in.shop2020.thrift.clients.TransactionServiceClient;import net.customware.gwt.dispatch.server.ActionHandler;import net.customware.gwt.dispatch.server.ExecutionContext;import net.customware.gwt.dispatch.shared.ActionException;public class AddressHandler implements ActionHandler<AddressRequest, AddressResponse>{@Overridepublic AddressResponse execute(AddressRequest request, ExecutionContext context)throws ActionException {try{TransactionServiceClient client = new TransactionServiceClient();Client c = client.getClient();Order t_order = c.getOrder(request.getOrder().getOrderId());if (t_order == null ){Address a = new Address("Ashish", "D-15/15, GF,", "Ardee City", "Sector-52", "Gold Souk", "Gurgaon", "Haryana", "India", "122003", "9811384697");return new AddressResponse(a);}else{String address = t_order.getCustomer_address();Address a = new Address(address);return new AddressResponse(a);//TODO remove hardcoding}}catch(Exception e){Address a = new Address("Ashish", "D-15/15, GF,", "Ardee City", "Sector-52", "Gold Souk", "Gurgaon", "Haryana", "India", "122003", "9811384697");return new AddressResponse(a);}}@Overridepublic Class<AddressRequest> getActionType() {// TODO Auto-generated method stubreturn AddressRequest.class;}@Overridepublic void rollback(AddressRequest arg0, AddressResponse arg1,ExecutionContext arg2) throws ActionException {// TODO Auto-generated method stub}}