Subversion Repositories SmartDukaan

Rev

Rev 1498 | Rev 1738 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package in.shop2020.support.controllers;

import in.shop2020.model.v1.order.LineItem;
import in.shop2020.model.v1.order.Order;
import in.shop2020.model.v1.order.Transaction;
import in.shop2020.model.v1.order.TransactionServiceException;
import in.shop2020.model.v1.user.Address;
import in.shop2020.model.v1.user.User;
import in.shop2020.model.v1.user.UserContextService.Client;
import in.shop2020.payments.Payment;
import in.shop2020.thrift.clients.PaymentServiceClient;
import in.shop2020.thrift.clients.TransactionServiceClient;
import in.shop2020.thrift.clients.UserContextServiceClient;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.Principal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;

public class UserOrdersController implements ServletResponseAware, ServletRequestAware{

        private HttpServletRequest request;
        private HttpServletResponse response;
        
        private String errorMsg = "";
        
        public UserOrdersController(){
                
        }
        
        @Override
        public void setServletRequest(HttpServletRequest req) {
                this.request = req;
        }

        @Override
        public void setServletResponse(HttpServletResponse res) {
                this.response = res;
        }
        
        public String index()   {
                return "report";
        }
        
        public String show(){
                return "report";
        }
        
        // Handles the POST request (Form Submission)
        public String create(){
                try     {
                        //Formatting Form input parameters
                        String email = request.getParameter("email");
                        String orderid = request.getParameter("orderid");

                        TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
                        in.shop2020.model.v1.order.TransactionService.Client transactionClient = transactionServiceClient.getClient();
                        
                        UserContextServiceClient userContextServiceClient = new UserContextServiceClient();
                        Client userClient = userContextServiceClient.getClient();
                        
                        PaymentServiceClient paymentServiceClient = new PaymentServiceClient();
                        in.shop2020.payments.PaymentService.Client paymentClient = paymentServiceClient.getClient();
                        
                        User user = null;
                        if (email != null && !email.isEmpty()) {
                                user = userClient.getUserByEmail(email);
                                if(user.getUserId() == -1){
                                    errorMsg = "No user for this id.";
                                        return "report";
                                }
                        }
                        else {
                                try {
                                    user = userClient.getUserById(transactionClient.getOrder(Long.parseLong(orderid)).getCustomer_id());
                                } catch (NumberFormatException e)       {
                                        errorMsg = "Order Id should be a number.";
                                        return "report";
                                }
                        }
                        
                        if (user == null) {
                                errorMsg = "Could not find user.";
                                return "report";
                        }

                        List <Transaction> transactions = new ArrayList<Transaction>();

                        //Retrieving all the transactions
                        transactions.addAll(transactionClient.getTransactionsForCustomer(user.getUserId(), 0, (new Date()).getTime(), null));
                        System.out.println("Total number of Transaction: " + transactions.size());
                        
                        List <Payment> payments = new ArrayList<Payment>();
                        //Retrieving all the payments 
                        payments.addAll(paymentClient.getPaymentsForUser(user.getUserId(), 0,
                                                (new Date()).getTime(), null, 0));
                        // Preparing XLS file for output
                        response.setContentType("application/vnd.ms-excel");
                        
                        response.setHeader("Content-disposition", "inline; filename=user-orders" + ".xls");
                        
                        ServletOutputStream sos;
                        try {
                                ByteArrayOutputStream baos = getSpreadSheetData(user, transactions, payments);
                                sos = response.getOutputStream();
                                baos.writeTo(sos);
                                sos.flush();
                        } catch (IOException e) {
                                errorMsg = "Failed to write to response.";
                                e.printStackTrace();
                        }

                } catch (ParseException e)      {
                        errorMsg = e.getMessage();
                        e.printStackTrace();
                } catch (TransactionServiceException e) {
                        errorMsg = e.getMessage();
                        e.printStackTrace();
                } catch (Exception e)   {
                        errorMsg = e.getMessage();
                        e.printStackTrace();
                }
                return "report";
        }
        
        // Prepares the XLS worksheet object and fills in the data with proper formatting
        private ByteArrayOutputStream getSpreadSheetData(User user, List<Transaction> transactions, List<Payment> payments)     {
                ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();

                DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
                
            Workbook wb = new HSSFWorkbook();
            
            Font font = wb.createFont();
            font.setBoldweight(Font.BOLDWEIGHT_BOLD);
            CellStyle style = wb.createCellStyle();
            style.setFont(font);
            
            createUserSheet(user, wb, style);
            createTransactionSheet(transactions, wb, style, dateFormat);
            createPaymentSheet(payments, wb, style, dateFormat);
                        
                // Write the workbook to the output stream
                try {
                        wb.write(baosXLS);
                        baosXLS.close();
                } catch (IOException e) {
                        e.printStackTrace();
                }               
                return baosXLS;
        }
        
        private void createPaymentSheet(List<Payment> payments, Workbook wb,
                        CellStyle style, DateFormat dateFormat) 
        {
                // PAYMENT SHEET
            Sheet paymentSheet = wb.createSheet("Payment");
            short paymentSerialNo = 0;

            Row orderTitleRow = paymentSheet.createRow(paymentSerialNo ++);
            Cell orderTitleCell = orderTitleRow.createCell(0);
            orderTitleCell.setCellValue("User Payments");
            orderTitleCell.setCellStyle(style);
            
            paymentSheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
            
            paymentSheet.createRow(paymentSerialNo ++);
            
            Row orderHeaderRow = paymentSheet.createRow(paymentSerialNo ++);
            orderHeaderRow.createCell(0).setCellValue("Transaction Id");
            orderHeaderRow.createCell(1).setCellValue("Payment Id");
            orderHeaderRow.createCell(2).setCellValue("Payment Status");
            orderHeaderRow.createCell(3).setCellValue("Gateway Payment Id");
            orderHeaderRow.createCell(4).setCellValue("Gateway Transaction Date");
            orderHeaderRow.createCell(5).setCellValue("Gateway Txn Id");
            orderHeaderRow.createCell(6).setCellValue("Gateway Txn Status");
            orderHeaderRow.createCell(7).setCellValue("Reference Code");
            orderHeaderRow.createCell(8).setCellValue("Gateway Id");
            orderHeaderRow.createCell(9).setCellValue("Amount");
            orderHeaderRow.createCell(10).setCellValue("Description");
            orderHeaderRow.createCell(11).setCellValue("Auth Code");
            orderHeaderRow.createCell(12).setCellValue("Error Code");

                for (Payment payment : payments) {
                        paymentSerialNo++;
                        Row contentRow = paymentSheet.createRow(paymentSerialNo);

                        contentRow.createCell(0).setCellValue(payment.getMerchantTxnId());
                        contentRow.createCell(1).setCellValue(payment.getPaymentId());
                        contentRow.createCell(2).setCellValue(payment.getStatus().name());
                        contentRow.createCell(3)
                                        .setCellValue(payment.getGatewayPaymentId());
                        contentRow.createCell(4).setCellValue(payment.getGatewayTxnDate());
                        contentRow.createCell(5).setCellValue(payment.getGatewayTxnId());
                        contentRow.createCell(6)
                                        .setCellValue(payment.getGatewayTxnStatus());
                        contentRow.createCell(7).setCellValue(payment.getReferenceCode());
                        contentRow.createCell(8).setCellValue(payment.getGatewayId());
                        contentRow.createCell(9).setCellValue(payment.getAmount());
                        contentRow.createCell(10).setCellValue(payment.getDescription());
                        contentRow.createCell(11).setCellValue(payment.getAuthCode());
                        contentRow.createCell(12).setCellValue(payment.getErrorCode());
                }
        }

        private void createTransactionSheet(List<Transaction> transactions, Workbook wb, CellStyle style, DateFormat dateFormat) {
                // TRANSACTION SHEET
            Sheet transactionSheet = wb.createSheet("Transaction");
            short transactionSerialNo = 0;

            Row orderTitleRow = transactionSheet.createRow(transactionSerialNo ++);
            Cell orderTitleCell = orderTitleRow.createCell(0);
            orderTitleCell.setCellValue("User Transactions");
            orderTitleCell.setCellStyle(style);
            
            transactionSheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
            
            transactionSheet.createRow(transactionSerialNo ++);
            
            Row orderHeaderRow = transactionSheet.createRow(transactionSerialNo ++);
            orderHeaderRow.createCell(0).setCellValue("Transaction Id");
            orderHeaderRow.createCell(1).setCellValue("Transaction Date");
            orderHeaderRow.createCell(2).setCellValue("Transaction Status");
            orderHeaderRow.createCell(3).setCellValue("Order Id");
            orderHeaderRow.createCell(4).setCellValue("Billing Number");
            orderHeaderRow.createCell(5).setCellValue("Billing Date");
            orderHeaderRow.createCell(6).setCellValue("Order Status");
            orderHeaderRow.createCell(7).setCellValue("Brand");
            orderHeaderRow.createCell(8).setCellValue("Model Name");
            orderHeaderRow.createCell(9).setCellValue("Model Number");
            orderHeaderRow.createCell(10).setCellValue("Color");
            orderHeaderRow.createCell(11).setCellValue("Quantity");
            orderHeaderRow.createCell(12).setCellValue("Unit Price");
            orderHeaderRow.createCell(13).setCellValue("Total Price");
            orderHeaderRow.createCell(14).setCellValue("User Id");
            orderHeaderRow.createCell(15).setCellValue("Name");
            orderHeaderRow.createCell(16).setCellValue("Address1");
            orderHeaderRow.createCell(17).setCellValue("Address2");
            orderHeaderRow.createCell(17).setCellValue("City");
            orderHeaderRow.createCell(19).setCellValue("State");
            orderHeaderRow.createCell(20).setCellValue("Pin Code");
            orderHeaderRow.createCell(21).setCellValue("Mobile Number");
            orderHeaderRow.createCell(22).setCellValue("email");
            orderHeaderRow.createCell(23).setCellValue("Airway Bill No.");
            orderHeaderRow.createCell(24).setCellValue("Billed By");
            orderHeaderRow.createCell(25).setCellValue("Receiver");
            orderHeaderRow.createCell(26).setCellValue("Tracking Id");
            orderHeaderRow.createCell(27).setCellValue("Accepted Timestamp");
            orderHeaderRow.createCell(28).setCellValue("Delivery Timestamp");
            orderHeaderRow.createCell(29).setCellValue("Expected Delivery Time");

            for(Transaction transaction : transactions) {
                List<Order> orders = transaction.getOrders();
                Date transactionDate = new Date(transaction.getCreatedOn());
                long transactionId = transaction.getId();
                String transactionStatus = transaction.getStatusDescription();
                for(Order order : orders)       {
                        transactionSerialNo ++;
                        Row contentRow = transactionSheet.createRow(transactionSerialNo);
                            LineItem lineItem = order.getLineitems().get(0);
                            
                            contentRow.createCell(0).setCellValue(transactionId);
                            contentRow.createCell(1).setCellValue(dateFormat.format(transactionDate));
                            contentRow.createCell(2).setCellValue(transactionStatus);
                            contentRow.createCell(3).setCellValue(order.getId());
                            contentRow.createCell(4).setCellValue(order.getInvoice_number());
                            contentRow.createCell(5).setCellValue(dateFormat.format(new Date(order.getBilling_timestamp())));
                            contentRow.createCell(6).setCellValue(order.getStatusDescription());
                            contentRow.createCell(7).setCellValue(getValueForEmptyString(lineItem.getBrand()));
                            contentRow.createCell(8).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
                            contentRow.createCell(9).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
                            contentRow.createCell(10).setCellValue(getValueForEmptyString(lineItem.getColor()));
                            contentRow.createCell(11).setCellValue(lineItem.getQuantity());
                            contentRow.createCell(12).setCellValue(lineItem.getUnit_price());
                            contentRow.createCell(13).setCellValue(lineItem.getTotal_price());
                            contentRow.createCell(14).setCellValue(order.getCustomer_id());
                            contentRow.createCell(15).setCellValue(order.getCustomer_name());
                            contentRow.createCell(16).setCellValue(order.getCustomer_address1());
                            contentRow.createCell(17).setCellValue(order.getCustomer_address2());
                            contentRow.createCell(18).setCellValue(order.getCustomer_city());
                            contentRow.createCell(19).setCellValue(order.getCustomer_state());
                            contentRow.createCell(20).setCellValue(order.getCustomer_pincode());
                            contentRow.createCell(21).setCellValue(order.getCustomer_mobilenumber());
                            contentRow.createCell(22).setCellValue(order.getCustomer_email());
                            contentRow.createCell(23).setCellValue(order.getAirwaybill_no());
                            contentRow.createCell(24).setCellValue(order.getBilled_by());
                            contentRow.createCell(25).setCellValue(order.getReceiver());
                            contentRow.createCell(26).setCellValue(order.getTracking_id());
                            contentRow.createCell(27).setCellValue(dateFormat.format(new Date(order.getAccepted_timestamp())));
                            contentRow.createCell(28).setCellValue(dateFormat.format(new Date(order.getDelivery_timestamp())));
                            contentRow.createCell(29).setCellValue(dateFormat.format(new Date(order.getExpected_delivery_time())));
                    }
            }
        }

        private String getValueForEmptyString(String s){
                if(s==null || s.equals(""))
                        return "-";
                else
                        return s; 
        }
        
        private void createUserSheet(User user, Workbook wb, CellStyle style) {
            Sheet userSheet = wb.createSheet("User");
            short userSerialNo = 0;
        // Create the header row and put all the titles in it. Rows are 0 based.
            
            Row titleRow = userSheet.createRow(userSerialNo++);
            Cell titleCell = titleRow.createCell(0);
            titleCell.setCellValue("User Details");
            titleCell.setCellStyle(style);
            
            userSheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
            
            Row userHeaderRow = userSheet.createRow(userSerialNo++);
            userHeaderRow.createCell(0).setCellValue("Name");
            userHeaderRow.createCell(1).setCellValue("Email");
            userHeaderRow.createCell(2).setCellValue("Communication Email");
            userHeaderRow.createCell(3).setCellValue("Date Of Birth");
            userHeaderRow.createCell(4).setCellValue("Mobile Number");
            userHeaderRow.createCell(5).setCellValue("Sex");
            userHeaderRow.createCell(6).setCellValue("User Id");

            Row userContentRow = userSheet.createRow(userSerialNo++);
            
        userContentRow.createCell(0).setCellValue(user.getName());
        userContentRow.createCell(1).setCellValue(user.getEmail());
        userContentRow.createCell(2).setCellValue(user.getCommunicationEmail());
        userContentRow.createCell(3).setCellValue(user.getDateOfBirth());
        userContentRow.createCell(4).setCellValue(user.getMobileNumber());
        userContentRow.createCell(5).setCellValue(user.getSex().name());
        userContentRow.createCell(6).setCellValue(user.getUserId());
        
        userSerialNo+=2;
                Row addressHeaderRow = userSheet.createRow(userSerialNo++);
            addressHeaderRow.createCell(0).setCellValue("Name");
            addressHeaderRow.createCell(1).setCellValue("Line1");
            addressHeaderRow.createCell(2).setCellValue("Line2");
            addressHeaderRow.createCell(3).setCellValue("City");
            addressHeaderRow.createCell(4).setCellValue("State");
            addressHeaderRow.createCell(5).setCellValue("Pincode");
            addressHeaderRow.createCell(6).setCellValue("Phone");

                List<Address> user_addresses = user.getAddresses();
                if (user_addresses != null && !user_addresses.isEmpty()) {
                        for (Address address : user.getAddresses()) {
                                if (user.getDefaultAddressId() == address.getId()) {
                                        userContentRow = userSheet.createRow(userSerialNo);
                                        userSheet.addMergedRegion(new CellRangeAddress(
                                                        userSerialNo, userSerialNo, 0, 6));
                                        userContentRow.createCell(0)
                                                        .setCellValue("Primary Address");

                                        userSerialNo++;
                                        userContentRow = userSheet.createRow(userSerialNo);
                                        userContentRow.createCell(0)
                                                        .setCellValue(address.getName());
                                        userContentRow.createCell(1).setCellValue(
                                                        address.getLine1());
                                        userContentRow.createCell(2).setCellValue(
                                                        address.getLine2());
                                        userContentRow.createCell(3)
                                                        .setCellValue(address.getCity());
                                        userContentRow.createCell(4).setCellValue(
                                                        address.getState());
                                        userContentRow.createCell(5).setCellValue(address.getPin());
                                        userContentRow.createCell(6).setCellValue(
                                                        address.getPhone());
                                        userSerialNo += 3;
                                }
                        }

                        userContentRow = userSheet.createRow(userSerialNo);
                        userSheet.addMergedRegion(new CellRangeAddress(userSerialNo,
                                        userSerialNo, 0, 6));
                        userContentRow.createCell(0).setCellValue("Other Addresses");

                        for (Address address : user.getAddresses()) {
                                if (user.getDefaultAddressId() != address.getId()) {

                                        userSerialNo++;
                                        userContentRow = userSheet.createRow(userSerialNo);
                                        userContentRow.createCell(0)
                                                        .setCellValue(address.getName());
                                        userContentRow.createCell(1).setCellValue(
                                                        address.getLine1());
                                        userContentRow.createCell(2).setCellValue(
                                                        address.getLine2());
                                        userContentRow.createCell(3)
                                                        .setCellValue(address.getCity());
                                        userContentRow.createCell(4).setCellValue(
                                                        address.getState());
                                        userContentRow.createCell(5).setCellValue(address.getPin());
                                        userContentRow.createCell(6).setCellValue(
                                                        address.getPhone());
                                }
                        }
                }
        }
        
        public static void main(String[] args){
                UserOrdersController usc = new UserOrdersController();
                usc.request = new HttpServletRequest() {
                        
                        @Override
                        public void setCharacterEncoding(String arg0)
                                        throws UnsupportedEncodingException {
                                // TODO Auto-generated method stub
                                
                        }
                        
                        @Override
                        public void setAttribute(String arg0, Object arg1) {
                                // TODO Auto-generated method stub
                                
                        }
                        
                        @Override
                        public void removeAttribute(String arg0) {
                                // TODO Auto-generated method stub
                                
                        }
                        
                        @Override
                        public boolean isSecure() {
                                // TODO Auto-generated method stub
                                return false;
                        }
                        
                        @Override
                        public int getServerPort() {
                                // TODO Auto-generated method stub
                                return 0;
                        }
                        
                        @Override
                        public String getServerName() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getScheme() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public RequestDispatcher getRequestDispatcher(String arg0) {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public int getRemotePort() {
                                // TODO Auto-generated method stub
                                return 0;
                        }
                        
                        @Override
                        public String getRemoteHost() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getRemoteAddr() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getRealPath(String arg0) {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public BufferedReader getReader() throws IOException {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getProtocol() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String[] getParameterValues(String arg0) {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public Enumeration getParameterNames() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public Map getParameterMap() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getParameter(String arg0) {
                                return "test@test.com";
                        }
                        
                        @Override
                        public Enumeration getLocales() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public Locale getLocale() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public int getLocalPort() {
                                // TODO Auto-generated method stub
                                return 0;
                        }
                        
                        @Override
                        public String getLocalName() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getLocalAddr() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public ServletInputStream getInputStream() throws IOException {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getContentType() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public int getContentLength() {
                                // TODO Auto-generated method stub
                                return 0;
                        }
                        
                        @Override
                        public String getCharacterEncoding() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public Enumeration getAttributeNames() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public Object getAttribute(String arg0) {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public boolean isUserInRole(String arg0) {
                                // TODO Auto-generated method stub
                                return false;
                        }
                        
                        @Override
                        public boolean isRequestedSessionIdValid() {
                                // TODO Auto-generated method stub
                                return false;
                        }
                        
                        @Override
                        public boolean isRequestedSessionIdFromUrl() {
                                // TODO Auto-generated method stub
                                return false;
                        }
                        
                        @Override
                        public boolean isRequestedSessionIdFromURL() {
                                // TODO Auto-generated method stub
                                return false;
                        }
                        
                        @Override
                        public boolean isRequestedSessionIdFromCookie() {
                                // TODO Auto-generated method stub
                                return false;
                        }
                        
                        @Override
                        public Principal getUserPrincipal() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public HttpSession getSession(boolean arg0) {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public HttpSession getSession() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getServletPath() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getRequestedSessionId() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public StringBuffer getRequestURL() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getRequestURI() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getRemoteUser() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getQueryString() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getPathTranslated() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getPathInfo() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getMethod() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public int getIntHeader(String arg0) {
                                // TODO Auto-generated method stub
                                return 0;
                        }
                        
                        @Override
                        public Enumeration getHeaders(String arg0) {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public Enumeration getHeaderNames() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getHeader(String arg0) {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public long getDateHeader(String arg0) {
                                // TODO Auto-generated method stub
                                return 0;
                        }
                        
                        @Override
                        public Cookie[] getCookies() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getContextPath() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                        
                        @Override
                        public String getAuthType() {
                                // TODO Auto-generated method stub
                                return null;
                        }
                };
                usc.create();
        }

        public String getErrorMsg() {
                return errorMsg;
        }
}