protected ActionForward doAction(
      ActionMapping mapping, HttpServletRequest request, HttpServletResponse response) {
    try {
      DataHandler handler =
          (DataHandler) request.getAttribute(BrowserFrameworkConstants.CLIENT_INFO);
      Long userId = PoiUtil.getUserId(handler);
      TnContext tc = PoiUtil.getTnContext(handler);
      TxNode body = handler.getAJAXBody();
      String joString = body.msgAt(0);
      JSONObject jo = new JSONObject(joString);
      String firstName = jo.getString("firstName");
      String lastName = jo.getString("lastName");
      String email = jo.getString("email");
      if (null != email) {
        email = email.toLowerCase();
      }

      TxNode node = new TxNode();
      node.addMsg(firstName);
      node.addMsg(lastName);
      node.addMsg(email);

      if (email.equals("")) {
        email = null;
      }

      TelepersonalizationFacade.updateUserProfile(
          userId.toString(), firstName, lastName, email, -1, -1, true, tc);

      /*
      TelePersonalize telePersonalize = new TelePersonalize();
      telePersonalize.updateUserInfo(userId.toString(), firstName, lastName, email,
              -1, -1, false, tc.toContextString());*/

      request.setAttribute("node", node);
      return mapping.findForward("success");
    } catch (Exception e) {
      ActionMessages msgs = new ActionMessages();
      msgs.add("UpdateUserInfofailed", new ActionMessage("errors.UpdateUserInfo.failed"));
      addErrors(request, msgs);
      return mapping.findForward("failure");
    }
  }
  /* used in ShareAddressExecutor */
  @Monitor(
      server = SHAREADDRESS_SERVER,
      parserClass = ServiceUrlParserFactory.CLASS_XML_WEBSERVICE,
      serviceUrlKeys = "ADDRESSSHARING")
  private DetectResult monitorShareAddressServer() {
    DetectResult result = new DetectResult();

    try {
      UserProfile userProfile = BackendServerMonitorUtil.createUserProfile();
      TnContext tc = BackendServerMonitorUtil.createTnContext();

      AddressSharingRequest addressSharingRequest = new AddressSharingRequest();
      addressSharingRequest.setUserId(PoiUtil.getLongFrom(userProfile.getUserId()));
      addressSharingRequest.setPtn(userProfile.getMin());
      addressSharingRequest.setContextString(tc.toContextString());
      addressSharingRequest.setAddress(BackendServerMonitorUtil.createStop());

      ContactInfo contact = new ContactInfo();
      contact.setName("test");
      contact.setPtn(userProfile.getMin());
      List<ContactInfo> contactlist = new ArrayList<ContactInfo>();
      contactlist.add(contact);
      addressSharingRequest.setContactList(contactlist);

      AddressSharingResponse addressSharingResponse =
          AddressSharingServiceProxy.getInstance().shareAddress(addressSharingRequest, tc);
      String statusCode = addressSharingResponse.getStatusCode();
      String statusMessage = addressSharingResponse.getStatusMessage();

      if ("OK".equalsIgnoreCase(statusCode)) {
        result.isSuccess = true;
      } else {
        result.isSuccess = false;
        result.msg = "statusCode = " + statusCode + ", statusMessage = " + statusMessage;
      }
    } catch (Exception ex) {
      logger.fatal("#monitorShareAddressServer", ex);
      result.isSuccess = false;
      result.msg =
          "Exception occurs when share address"
              + ". Exception msg->"
              + ExceptionUtil.collectExceptionMsg(ex);
    }

    return result;
  }
  /*
   * (non-Javadoc)
   *
   * @seecom.telenav.cserver.poi.protocol.BrowserProtocolRequestParser#
   * parseBrowserRequest(javax.servlet.http.HttpServletRequest)
   */
  @Override
  public ExecutorRequest parseBrowserRequest(HttpServletRequest httpRequest) {

    DataHandler handler = new DataHandler(httpRequest);
    SentAddressRequest request = new SentAddressRequest();
    request.setUserId(PoiUtil.getUserId(handler));

    String action = TnUtil.filterLastPara(httpRequest.getParameter("action"));
    request.setAction(action);
    log.info("SentAddressRequestParser.parseBrowserRequest(). action is:" + action);
    // delete action
    if ("delete".equals(action)) {
      // get address id
      String id = TnUtil.filterLastPara((String) httpRequest.getParameter("id"));
      log.info("SentAddressRequestParser.delete(). id is:" + id);
      // invokde delete service to delete
      request.setId(id);
    }

    return request;
  }
Exemplo n.º 4
0
  public ActionForward doAction(
      ActionMapping mapping, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    String value = request.getParameter("jsp").split(";")[0];

    DataHandler handler = (DataHandler) request.getAttribute(BrowserFrameworkConstants.CLIENT_INFO);

    if ("SearchPoi".equalsIgnoreCase(value)) {
      if (!PoiUtil.needsBrandListWhenStartUp(handler)) {
        PoiUtil.loadHotBrand(request);
      } else {
        // get hot poi category data
        PoiCategoryCollection poiCollection = new PoiCategoryCollection();
        List<PoiCategoryItem> hotList;
        UserProfile userProfile = TnUtil.getUserProfile(handler);
        hotList = poiCollection.getPoiHotList(userProfile);
        //				if(TnUtil.isMMICarrier(handler))
        //				{
        //					hotList = poiCollection.getPoiHotListForMMI();
        //				}
        //				else
        //				{
        //					hotList = poiCollection.getPoiHotList();
        //				}

        /*
        List<PoiCategoryItem> hotList = PoiCategoryManager.getInstance().getPoiHotList(tncontext, handler);*/
        request.setAttribute("hotCategoryData", hotList);
      }
    }

    // do some hardcode logic here
    if ("PoiList".equalsIgnoreCase(value)) {
      if (PoiUtil.isAndroid61(handler)) {
        value = "PoiListAndroid";
      }
      if (PoiUtil.isRimTouch(handler)) {
        value = "PoiListAndroid";
      }
    } else if ("ShowDetail".equalsIgnoreCase(value)) {
      if (PoiUtil.isAndroid61(handler)) {
        value = "ShowDetailAndroid";
      }
      if (PoiUtil.isRimTouch(handler)) {
        value = "ShowDetailAndroid";
      }
    } else if ("AboutSupport".equalsIgnoreCase(value)) {
      if (TnUtil.isBell_VMC(handler)) {
        value = "AboutSupportForBell_VMC";
      } else if (TnUtil.isTelcelRIM64(handler)) {
        value = "AboutSupportForTelcel";
      }

    } else if ("ToolsMain".equalsIgnoreCase(value)) {
      if (TnUtil.isSprintRim62(handler) || TnUtil.isVNRIM62(handler)) {
        value = "NewToolsMain";
      }
    }

    return mapping.findForward(value);
  }