コード例 #1
0
  @RequestMapping(method = RequestMethod.GET)
  public String showForm(
      @RequestParam(value = ACTIVE_CATEGORY, required = true) final String activeCategory,
      @RequestParam(value = "agent", required = true) final String agentId,
      @RequestParam(value = SEND_STATUS, required = false) final String viewStatus,
      final Model model)
      throws CMSItemNotFoundException, YFormServiceException, InvalidAttributeValueException {
    storeCmsPageInModel(model, getContentPageForLabelOrId(CONTACT_AGENT_FORM_CMS_PAGE));

    if (SEND.equals(viewStatus)) {
      final String dataId =
          sessionService.getAttribute(
              FinancialacceleratorstorefrontConstants.FINANCIAL_FIND_AGENT_FORM_ID);
      if (StringUtils.isNotEmpty(dataId)) {
        final YFormDataData yfdd = getYformFacade().getYFormData(dataId, YFormDataTypeEnum.DATA);
        agentFacade.sendMail(yfdd.getContent());

        sessionService.removeAttribute(
            FinancialacceleratorstorefrontConstants.FINANCIAL_FIND_AGENT_FORM_ID);
        model.addAttribute(THANK_YOU, Boolean.TRUE);
      } else {
        throw new InvalidAttributeValueException(
            "Can't upload yFormData. Attribute 'financialFindAgentForm' doesn't exist in session.");
      }
    }

    if (StringUtils.isNotBlank(agentId)) {
      final AgentData agent = getAgentFacade().getAgentByUid(agentId);
      model.addAttribute(AGENT_DATA, agent);
      model.addAttribute(ACTIVE_CATEGORY, activeCategory);
    }

    return ControllerConstants.Views.Pages.Agent.ContactAgentForm;
  }
 public static void resetSessionOverrides() {
   final SessionService sessionService = getStaticSessionService();
   sessionService.removeAttribute(B2B_SESSION_KEY_CHECKOUT_FLOW);
   sessionService.removeAttribute(B2B_SESSION_KEY_SUBSCRIPTION_PCI_OPTION);
 }