亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? requesttoeventtranslator.java

?? 一個優秀的供應商管理系統
?? JAVA
字號:
package apusic.myshop.control.web;import java.util.HashMap;import java.util.ArrayList;import java.util.Iterator;import java.util.Enumeration;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpSession;import apusic.myshop.control.EventException;import apusic.myshop.control.event.BaseEvent;import apusic.myshop.control.event.LoginEvent;import apusic.myshop.control.event.LogoutEvent;import apusic.myshop.control.event.CartEvent;import apusic.myshop.control.event.CustomerEvent;import apusic.myshop.control.event.DBLoginEvent;import apusic.myshop.control.event.OrderEvent;import apusic.myshop.util.Debug;import apusic.myshop.control.web.PathNames;import apusic.myshop.util.Calendar;import apusic.myshop.util.CreditCard;import apusic.myshop.util.ContactInfo;import apusic.myshop.util.WebKeys;import apusic.myshop.customer.model.CustomerModel;import apusic.myshop.util.JSPUtil;import apusic.myshop.cart.model.CartModel;//將客戶端的請求轉換成事件REQUEST————》EVENTpublic class RequestToEventTranslator {  private RequestProcessor sessionClientController;  private ModelManager mm;  public RequestToEventTranslator(RequestProcessor sessionClientController,    ModelManager mm) {    this.sessionClientController = sessionClientController;    this.mm = mm;  }  public BaseEvent processRequest(HttpServletRequest req) throws EventException,  MissingFormDataException  {    // Process the request and get the necessary event depending on the URL    String selectedUrl = req.getPathInfo();    BaseEvent event = null;    if (selectedUrl == null) {      // do nothing. show the default screen.      return null;    } else if (selectedUrl.equals(PathNames.CATALOG_URL)) {      //event = createCatalogEvent(req);    } else if (selectedUrl.equals(PathNames.CART_URL)) {      mm.getCartModel();      event = createCartEvent(req);    } else if (selectedUrl.equals(PathNames.LOGOUT_URL)) {      event = new LogoutEvent();    } else if (selectedUrl.equals(PathNames.VERIFY_LOGIN_URL)) {      event = createDBLoginEvent(req);    } else if (selectedUrl.equals(PathNames.VALIDATE_NEW_CUSTOMER_URL)) {      event = createCustomerEvent(req);    } else if (selectedUrl.equals(PathNames.COMMIT_ORDER_URL)) {      event = createOrderEvent(req);    } else if (selectedUrl.equals(PathNames.VALIDATE_BILLING_INFORMATION_URL)) {      getBillingInformation(req);    } else if (selectedUrl.equals(PathNames.VALIDATE_SHIPPING_INFORMATION_URL)) {      extractShippingInformation(req);    }    return event;  }//事件1  public BaseEvent createLoginEvent(HttpServletRequest request) {    return new LoginEvent();  }//事件2  public DBLoginEvent createDBLoginEvent(HttpServletRequest request)    throws MissingFormDataException{    Debug.println("login through db ");    ArrayList missingFields = null;    DBLoginEvent event = new DBLoginEvent();    String userId = request.getParameter("userId").trim();    if (userId.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();      }      missingFields.add("用戶賬號");    }    String password = request.getParameter("password").trim();    if (password.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();	    }      missingFields.add("密碼");    }    if (missingFields != null) {      throw new MissingFormDataException("漏輸賬號信息", missingFields);	  }    event.setInfo(userId, password);    return event;  }    //事件3  public CustomerEvent createCustomerEvent(HttpServletRequest request)    throws MissingFormDataException {    Debug.println("Creating new Customer");    ArrayList missingFields = null;    CustomerEvent event = new CustomerEvent();	  String userId = request.getParameter("userId").trim();    if (userId.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();      }      missingFields.add("用戶賬號");    }    String password = request.getParameter("password").trim();    if (password.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();	    }      missingFields.add("密碼");    }    String name = request.getParameter("name").trim();    if (name.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();      }      missingFields.add("姓名");    }    String sex = request.getParameter("sex").trim();    String company = request.getParameter("company").trim();    if (company.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();      }      missingFields.add("單位");    }    String cid = request.getParameter("cid").trim();    if (cid.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();      }      missingFields.add("身份證號碼");    }    String address = request.getParameter("address").trim();    if (address.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();      }      missingFields.add("詳細地址");    }    String province = request.getParameter("province").trim();    if (province.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();      }      missingFields.add("省份");    }    String city = request.getParameter("city").trim();    if (city.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();      }      missingFields.add("城市");    }    String zip = request.getParameter("zip").trim();    if (zip.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();      }      missingFields.add("郵政編碼");    }    String phone = request.getParameter("phone").trim();    if (phone.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();      }      missingFields.add("聯系電話");    }	  String email = request.getParameter("email").trim();	  if (email.equals("")) {      if (missingFields == null) {        missingFields = new ArrayList();      }      missingFields.add("E-Mail 地址");    }    java.sql.Date regDate = new java.sql.Date((new java.util.Date()).getTime());	  if (missingFields != null) {      throw new MissingFormDataException("漏輸客戶信息", missingFields);	  }	  event.setInfo(userId, password, name, sex,      company, cid, address, province,      city, zip, phone, email, regDate    );	  return event;  }//事件4  private CartEvent createCartEvent(HttpServletRequest request) {    Debug.println("Started Create Cart Event");    String action = request.getParameter("action");    if (action == null) {      return null;    } else if (action.equals("purchaseItem")) {      return createPurchaseItemEvent(request);    } else if (action.equals("removeItem")) {      return createRemoveItemEvent(request);    } else if (action.equals("updateCart")) {      return createUpdateCartEvent(request);    }    return null;  }//事件5  private CartEvent createPurchaseItemEvent(HttpServletRequest request) {    Debug.println("Started Purchase Action");    CartEvent event = null;    try {      // get the id number from the parameter      String id = request.getParameter("itemId").trim();      ArrayList itemIds = new ArrayList();      itemIds.add(id);      event = new CartEvent(CartEvent.ADD_ITEM, itemIds);    } catch(Exception e) {      Debug.print(e);    }    return event;  }//事件6  private CartEvent createRemoveItemEvent(HttpServletRequest request) {    Debug.println("Started Remove Action");    CartEvent event = null;    try {      // get the id number from the parameter      String id = request.getParameter("itemId").trim();      ArrayList itemIds = new ArrayList();      itemIds.add(id);      event = new CartEvent(CartEvent.DELETE_ITEM, itemIds);    } catch(Exception e) {      Debug.print(e);    }    return event;  }//事件7  private CartEvent createUpdateCartEvent(HttpServletRequest request) {    CartEvent event = null;    HashMap quantities = new HashMap();    ArrayList itemIds = new ArrayList();    Debug.println("RequestToEventTranslator: Updating Cart Item quantities");    Enumeration enum = request.getParameterNames();    while ((enum != null) && enum.hasMoreElements()) {      String param = ((String)enum.nextElement()).trim();      if ((param != null) && param.startsWith("itemQuantity_")) {        try{          // get the item id number from the parameter          String id = param.substring("itemQuantity_".length(),          param.length());          Integer quantity = new Integer(0);          if (id != null) {            // remove image map info from the parameter            if (id.lastIndexOf(".") != -1) {              id = id.substring(0, id.lastIndexOf("."));            }            try {              quantity= Integer.valueOf(request.getParameter(param));              itemIds.add(id);              quantities.put(id, quantity);            } catch (NumberFormatException ex) {              // if the user uses something other than numbers leave as is            }            event = new CartEvent(CartEvent.UPDATE_ITEM,  itemIds, quantities);          }        } catch(Exception e) {          Debug.print(e);        }      }    }    return event;  }  private void getBillingInformation(HttpServletRequest request)  	throws MissingFormDataException {    Debug.println("Getting Billing Information");	  ArrayList missingFields = null;    String monthString = request.getParameter("expiration_month");	  if (monthString.equals("")) {	    if (missingFields == null) {		    missingFields = new ArrayList();	    }	    missingFields.add("Credit Card Month");	  }	  int month = Integer.parseInt(monthString);  	String yearString = request.getParameter("expiration_year");	  if (yearString.equals("")){      if (missingFields == null) {		    missingFields = new ArrayList();	    }	    missingFields.add("Credit Card Year");	  }	  int year = Integer.parseInt(yearString);	  Calendar expiryDate = Calendar.getInstance();	 // months in Calendar start at 0 and not one  	expiryDate.set(Calendar.MONTH, month-1);	  expiryDate.set(Calendar.YEAR, year);  	String cardType = request.getParameter("credit_card_type").trim();	  if (cardType.equals("")) {	    if (missingFields == null) {		    missingFields = new ArrayList();	    }	    missingFields.add("信用卡類別");	  }  	String cardNo = request.getParameter("credit_card_number").trim();	  if (cardNo.equals("")) {	    if (missingFields == null) {		    missingFields = new ArrayList();	    }	    missingFields.add("卡號");	  }  	if (missingFields != null) {	    throw new MissingFormDataException("漏輸信用卡信息", missingFields);	  }    HttpSession session = request.getSession();	  CreditCard card = new CreditCard(cardNo, cardType, expiryDate);	  session.setAttribute(WebKeys.CreditCardKey, card);    // get billing address    ContactInfo billingContactInfo = extractContactInfo(request);	  session.setAttribute(WebKeys.BillingContactInfoKey, billingContactInfo);    // copy shipping address if the same as billing address    if (request.getParameter("ship_to_billing_address") != null) {	    session.setAttribute(WebKeys.ShippingContactInfoKey,				 billingContactInfo);	    session.setAttribute(WebKeys.ShippingAddressRequiredKey, "false");	  } else {	    session.setAttribute(WebKeys.ShippingAddressRequiredKey, "true");	  }    Debug.println("<<<get bill info end.");  }  private void extractShippingInformation(HttpServletRequest request)    throws MissingFormDataException {	  Debug.println("Extracting Shipping Information");	  request.getSession().setAttribute(WebKeys.ShippingContactInfoKey,      extractContactInfo(request));  }  // parse address form and generate a ContactInformation object  private ContactInfo extractContactInfo(HttpServletRequest request)	  throws MissingFormDataException {	  ArrayList missingFields = null;	  String name =  request.getParameter("name").trim();	  if (name.equals("")) {	    if (missingFields == null) {		    missingFields = new ArrayList();	    }	    missingFields.add("姓名");	  }    String phone = request.getParameter("phone").trim();	  if (phone.equals("")){	    if (missingFields == null) {		    missingFields = new ArrayList();	    }	    missingFields.add("電話號碼");	  }    String email = request.getParameter("email");    String address = request.getParameter("address").trim();	  if (address.equals("")){	    if (missingFields == null) {		    missingFields = new ArrayList();	    }	    missingFields.add("詳細地址");	  }    String province = request.getParameter("province").trim();	  if (province.equals("")) {	    if (missingFields == null) {		    missingFields = new ArrayList();	    }	    missingFields.add("省份");	  }	  String city = 	request.getParameter("city").trim();	  if (city.equals("")){	    if (missingFields == null) {		    missingFields = new ArrayList();      }	    missingFields.add("所在城市");	  }    String zip = request.getParameter("zip").trim();	  if (zip.equals("")){	    if (missingFields == null) {		    missingFields = new ArrayList();      }	    missingFields.add("郵政編碼");	  }	  String country = request.getParameter("country");	  if (missingFields != null) {	    throw new MissingFormDataException("漏輸地址信息", missingFields);	  }	  return new ContactInfo(name, phone, email, address,      province, city, zip, country);  }//事件8  private OrderEvent createOrderEvent(HttpServletRequest request) {	  Debug.println("Creating Order Event");	  CustomerModel customer = mm.getCustomerModel();	  int requestId = JSPUtil.getEventId();	  CartModel cart = mm.getCartModel();	  OrderEvent oe = new OrderEvent();	  HttpSession session = request.getSession();	  ContactInfo shippingInfo = (ContactInfo)	    session.getAttribute(WebKeys.ShippingContactInfoKey);	  ContactInfo billingInfo = (ContactInfo)	    session.getAttribute(WebKeys.BillingContactInfoKey);    //String carrier = (String) session.getAttribute(WebKeys.CarrierKey);    String userId = (String) session.getAttribute(WebKeys.UserIdKey);	  CreditCard creditCard = (CreditCard)      session.getAttribute(WebKeys.CreditCardKey);	  oe.setInfo(requestId, userId, shippingInfo.getName(),      shippingInfo.getAddress(), shippingInfo.getProvince(),      shippingInfo.getCity(), shippingInfo.getZip(),      shippingInfo.getCountry(), billingInfo.getName(),      billingInfo.getAddress(), billingInfo.getProvince(),      billingInfo.getCity(), billingInfo.getZip(),      billingInfo.getCountry(), creditCard);	  // set up the request id attribute so that the pages can	  // create orderwebimpl correctly.	  request.setAttribute(WebKeys.RequestIdKey, new Integer(requestId));	  return oe;  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久机这里只有精品| 欧美色图天堂网| 在线视频国产一区| 国产日本欧美一区二区| 首页国产欧美日韩丝袜| 成人av网站免费观看| 日韩午夜电影av| 一区二区三区四区中文字幕| 国产一区二区中文字幕| 欧美久久久久久久久中文字幕| 日韩一区欧美小说| 国产成人综合在线观看| 日韩一区二区电影在线| 亚洲成人先锋电影| 欧美又粗又大又爽| 自拍偷自拍亚洲精品播放| 丁香五精品蜜臀久久久久99网站| 欧美日韩一二三| 亚洲成人第一页| 欧美无乱码久久久免费午夜一区| 欧美高清在线一区二区| 国产一区欧美日韩| 欧美精品一区二区在线播放| 麻豆国产精品视频| 欧美一区二区三区四区高清| 亚洲电影一级黄| 欧美人狂配大交3d怪物一区 | 成人激情午夜影院| 久久久久亚洲综合| 国产成人在线观看免费网站| 久久嫩草精品久久久久| 色综合久久六月婷婷中文字幕| 国产亲近乱来精品视频| 国产xxx精品视频大全| 国产日韩欧美精品一区| 国产成人精品免费视频网站| 国产精品私房写真福利视频| 粉嫩蜜臀av国产精品网站| 中文字幕av一区二区三区免费看| 粉嫩av一区二区三区| 国产精品久久免费看| 91小宝寻花一区二区三区| 日韩一区欧美小说| 欧美日韩国产综合视频在线观看| 亚洲午夜久久久久久久久电影院| 欧美另类高清zo欧美| 麻豆91在线看| 国产精品丝袜一区| 欧美在线你懂得| 久久aⅴ国产欧美74aaa| 国产色婷婷亚洲99精品小说| 色婷婷综合久久久中文字幕| 亚洲6080在线| 久久女同精品一区二区| 成人aaaa免费全部观看| 亚洲一区影音先锋| 欧美成人综合网站| voyeur盗摄精品| 日本亚洲一区二区| 国产女人水真多18毛片18精品视频| 成人黄色小视频| 亚洲电影激情视频网站| 精品久久一二三区| 99国产精品久久久久久久久久| 亚洲国产成人高清精品| 国产日韩精品一区二区浪潮av| 日本电影欧美片| 国产福利一区在线| 亚洲一区二区三区美女| 国产日韩欧美综合一区| 欧美狂野另类xxxxoooo| 国产xxx精品视频大全| 香蕉影视欧美成人| 国产精品久久久久久久裸模| 6080国产精品一区二区| 成人免费视频网站在线观看| 丝袜美腿亚洲一区| 中文字幕制服丝袜一区二区三区| 日韩一区和二区| 色综合久久中文综合久久牛| 精品一区二区三区免费毛片爱| 亚洲品质自拍视频网站| 久久亚洲一级片| 91麻豆精品国产自产在线| 一区二区三区电影在线播| 最近日韩中文字幕| 日韩视频中午一区| 亚洲最新在线观看| 色婷婷综合久久久久中文一区二区 | 蜜臀av一区二区三区| 综合激情网...| 国产欧美一区二区精品性| 欧美日韩激情一区二区| 91免费在线视频观看| 成人网男人的天堂| 国产一区二区三区免费看| 日韩福利电影在线| 亚洲v中文字幕| 一区二区欧美视频| **网站欧美大片在线观看| 精品国产乱子伦一区| 日韩欧美一二三| 正在播放一区二区| 欧美日韩国产小视频| 欧美在线观看你懂的| av一区二区三区在线| 99久久精品国产一区| www.亚洲激情.com| www.亚洲色图.com| 91免费版在线| 一本色道**综合亚洲精品蜜桃冫| jlzzjlzz欧美大全| 91丨九色porny丨蝌蚪| 99久久精品国产观看| 91麻豆蜜桃一区二区三区| 成人高清伦理免费影院在线观看| 亚洲精品免费在线| 亚洲午夜三级在线| 欧美激情综合五月色丁香小说| 欧美熟乱第一页| 99re视频精品| 欧美大度的电影原声| 精品视频资源站| 99久久精品费精品国产一区二区| 蜜芽一区二区三区| 麻豆精品在线播放| 国产精品一区二区视频| 国产成人免费在线视频| 国产91精品欧美| av动漫一区二区| 欧洲精品一区二区| 欧美成人国产一区二区| 欧美激情一二三区| 亚洲一区在线观看视频| 免费的国产精品| 成人精品免费网站| 国产精品久久看| 亚洲午夜久久久久中文字幕久| 亚洲另类一区二区| 亚洲一级不卡视频| 亚洲永久精品大片| 午夜精品一区在线观看| 久久不见久久见免费视频1| 高清不卡在线观看| 欧美剧在线免费观看网站| 精品少妇一区二区三区免费观看| 中文字幕精品三区| 亚洲最大成人网4388xx| 狠狠色丁香久久婷婷综| 99久久婷婷国产综合精品 | 国产毛片精品国产一区二区三区| 成人手机电影网| 欧美日韩成人在线| 久久精品水蜜桃av综合天堂| 亚洲精品老司机| 国产一区二区不卡在线| 91国产丝袜在线播放| 欧美精品一区二区三区高清aⅴ| 亚洲欧美另类综合偷拍| 国产综合色在线| 欧美日韩精品电影| 亚洲三级电影全部在线观看高清| 天堂va蜜桃一区二区三区漫画版| 成人免费毛片片v| 555www色欧美视频| 中文字幕日韩欧美一区二区三区| 天堂成人国产精品一区| 99久久久久久99| 久久久久久电影| 日本不卡免费在线视频| 日本精品免费观看高清观看| 久久久九九九九| 美女一区二区视频| 欧美日韩国产在线播放网站| 国产精品久久久久久福利一牛影视 | 亚洲一区二区视频在线观看| 国产jizzjizz一区二区| 日韩一区二区精品在线观看| 一区二区三区在线观看网站| 99热99精品| 中文字幕欧美国产| 国产成人一区在线| 国产午夜亚洲精品不卡| 狠狠色丁香婷婷综合久久片| 91精品国产综合久久精品性色| 亚洲精品欧美激情| 91啪亚洲精品| 中文字幕一区二区日韩精品绯色| 国产.精品.日韩.另类.中文.在线.播放 | 久久香蕉国产线看观看99| 蜜臀久久99精品久久久久久9 | 久久久久久久久久久久久女国产乱| 天堂影院一区二区| 欧美日韩一区久久| 亚洲第四色夜色| 欧美三级视频在线观看| 午夜伦理一区二区| 91麻豆精品国产91久久久久久久久| 午夜精品在线看| 91精品国产91久久久久久一区二区|