Rev 167 | 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.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();ShipmentInfo sionfo = c.getShippingInfo(request.getOrder().getTransactionId());if (sionfo == null || sionfo.getShipments() == null || sionfo.getShipments().size() == 0){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 = sionfo.getShipments().iterator().next().getAddress();Address a = new Address(address);return new AddressResponse(a);}}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}}