List of usage examples for org.springframework.web.bind.support SessionStatus setComplete
void setComplete();
From source file:egovframework.example.sample.web.EgovSampleController.java
@RequestMapping("/fileUploadX.do") public void fileUploadX(HttpServletRequest request, HttpServletResponse response, SessionStatus status) throws Exception { //System.out.println(" ? uuid--"+request.getParameter("uuid")); String chkType = request.getHeader("Content-Type"); if (chkType == null) { return;//from ww w . j a v a 2s . c o m } request.setCharacterEncoding("utf-8"); String contextRealPath = request.getSession().getServletContext().getRealPath("/"); String PATH = request.getParameter("PATH"); String savePath = contextRealPath + PATH; // System.out.println("savePath------@@-----"+savePath); // int maxSize = 500 * 1024 * 1024; // ? ? 500MB() PlatformData resData = new PlatformData(); VariableList resVarList = resData.getVariableList(); String sMsg = " A "; try { MultipartHttpServletRequest msReq = (MultipartHttpServletRequest) request; Iterator<String> filesd = msReq.getFileNames(); String dir = request.getRealPath("images/egovframework/board_img"); while (filesd.hasNext()) { sMsg += "D "; //String name = (String)files.nextElement(); String name = filesd.next(); // System.out.println("? ^^-----"+name); MultipartFile mfile = msReq.getFile(name); //? String genId = UUID.randomUUID().toString(); //? String originalFileName = mfile.getOriginalFilename(); //? String saveFileName = genId; // System.out.println("???="+ originalFileName); System.out.println("??=" + saveFileName); String savePathh = dir + "/" + saveFileName; mfile.transferTo(new File(savePathh)); System.out.println(name + "??"); System.out.println("? ?-" + genId); //?? SampleVO vo = new SampleVO(); vo.setiOriName(originalFileName); vo.setiFileName(saveFileName); vo.setiSize((int) mfile.getSize()); vo.setiUrl(savePathh); vo.setiUuid(request.getParameter("uuid")); sampleService.uploadImg(vo); status.setComplete(); } resVarList.add("ErrorCode", 200); resVarList.add("ErrorMsg", "SUCC"); } catch (Exception e) { resVarList.add("ErrorCode", 500); resVarList.add("ErrorMsg", sMsg + " " + e); } HttpPlatformResponse res = new HttpPlatformResponse(response); res.setData(resData); res.sendData(); }
From source file:egovframework.example.sample.web.EgovSampleController.java
@RequestMapping(value = "/deleteQnaOriX.do", method = RequestMethod.POST) public void deleteQnaOriX(HttpServletRequest request, HttpServletResponse response, SessionStatus status) throws Exception { System.out.println("-----------------------------------------"); //PlatformData oData = new PlatformData(); int nErrorCode = 0; String strErrorMsg = "START"; HttpPlatformRequest pReq = new HttpPlatformRequest(request); pReq.receiveData();//???? ?? PlatformData iData = pReq.getData(); VariableList in_vl = iData.getVariableList(); int in_var2 = in_vl.getInt("sVal1"); System.out.println("? --" + in_var2); try {/*from ww w . java 2 s. c o m*/ QnaVO qVO = new QnaVO(); qVO.setQ_num(in_var2); // SampleVO sampleVO = new SampleVO(); //sampleVO.setbNum(in_var2); /////////////?(? ? ? )/// // List<SampleVO> uuidList = (List<SampleVO>) sampleService.getUuid(sampleVO); //? ? uuid List<QnaVO> uuidList = (List<QnaVO>) sampleService.getQnaUuid(qVO); //? ? uuid // for (int i = 0; i < uuidList.size(); i++) { // // // System.out.println("uuid====="+uuidList.get(i).getbUuid()); // // } SampleVO iVo = new SampleVO(); SampleVO iVo2 = new SampleVO(); for (int i = 0; i < uuidList.size(); i++) { String qUuid = uuidList.get(i).getQ_uuid().toString(); // iVo.setiUuid(bUuid); iVo.setbUuid(qUuid); //? ? ? //iVo2 = sampleService.selectImgUuid(iVo); //b List<SampleVO> ivoList = (List<SampleVO>) sampleService.selectImgUuid(iVo); //uuid? ?? // System.out.println(ivoList.get(0).getiUrl()); for (int j = 0; j < ivoList.size(); j++) { // ?? for // System.out.println(" +? ===="+ivoList.get(j).getiUrl()); File f = new File(ivoList.get(j).getiUrl().toString()); //? f.delete(); //? sampleService.deleteImgUuid(iVo); status.setComplete(); } } ///////////////////////// sampleService.deleteQnaOri(qVO); status.setComplete(); nErrorCode = 0; strErrorMsg = "SUCC"; } catch (Exception e) { // VariableList? ? ? nErrorCode = -1; strErrorMsg = e.getMessage(); e.printStackTrace(); } nErrorCode = 0; strErrorMsg = "SUCC"; PlatformData oData = new PlatformData(); // VariableList VariableList varList = oData.getVariableList(); // VariableList? ? ? varList.add("ErrorCode", nErrorCode); varList.add("ErrorMsg", strErrorMsg); // return "forward:/egovSampleList.do"; // HttpServletResponse ? HttpPlatformResponse ? HttpPlatformResponse pRes = new HttpPlatformResponse(response, PlatformType.CONTENT_TYPE_XML, "UTF-8"); pRes.setData(oData); // ?? pRes.sendData(); }
From source file:com.citrix.cpbm.portal.fragment.controllers.AbstractTenantController.java
/** * Post method for creating Tenant.//from w w w .ja va 2 s .c om * * @param form the Tenant form. {@link TenantForm} * @param result {@link BindingResult} * @param map {@link ModelMap} * @param sessionStatus * @param request the {@link HttpServletRequest} * @return View. * @throws Exception */ @RequestMapping(value = { "", "/" }, method = RequestMethod.POST) public String create(@ModelAttribute("account") final TenantForm form, BindingResult result, ModelMap map, SessionStatus sessionStatus, HttpServletRequest request) throws Exception { logger.debug("###Entering in create(form,map,status) method @POST"); String promocode = form.getTrialCode(); if (promocode != null) { CampaignPromotion campaignPromotion = promotionService.locatePromotionByToken(promocode); if (campaignPromotion == null) { logger.debug("Campaign is not valid"); result.reject("trialCode", messageSource.getMessage("errors.registration.invalid_trial_code", null, getSessionLocale(request))); return "tenants.new"; } } String email = form.getUser().getEmail(); if (isEmailBlacklisted(email.toLowerCase())) { map.addAttribute("supportedLocaleList", this.getLocaleDisplayName(listSupportedLocales())); map.addAttribute("defaultLocale", getDefaultLocale()); map.addAttribute("ipToCountryCode", form.getUser().getAddress().getCountry()); form.setAccountTypes(tenantService.getManualRegistrationAccountTypes()); map.addAttribute("tenant", CustomProxy.newInstance(getCurrentUser().getTenant())); map.addAttribute("account", form); map.addAttribute("channels", channelService.getChannels(null, null, null)); List<Country> filteredCountryList = getFilteredCountryList(form.getCountryList()); map.addAttribute("filteredCountryList", filteredCountryList); map.addAttribute("signuperror", "emaildomainblacklisted"); return "tenants.new"; } if (result.hasErrors()) { displayErrors(result); parseResult(result, map); return "tenants.new"; } // set currency for (CurrencyValue cv : form.getCurrencyValueList()) { if (cv.getCurrencyCode().equals(form.getCurrency())) { form.getTenant().setCurrency(cv); break; } } form.getTenant().setAddress(form.getUser().getAddress()); if (form.isAllowSecondary()) { form.getTenant().setSecondaryAddress(form.getSecondaryAddress()); } AccountType at = tenantService.getAccountTypeById(form.getAccountTypeId()); List<PaymentMode> paymentModes = at.getSupportedPaymentModes(); if (paymentModes != null && paymentModes.size() > 0) { form.getTenant().getObject().getTenantExtraInformation().setPaymentMode(paymentModes.get(0)); } List<String> errorMsgList = new ArrayList<String>(); try { final com.citrix.cpbm.access.User owner = form.getUser(); String phoneNo = owner.getObject().getCountryCode().replaceAll(PHONE_NUMBER_REGEX, "") + COUNTRY_CODE_TO_PHONE_NUMBER_SEPERATOR + owner.getPhone().replaceAll(PHONE_NUMBER_REGEX, ""); owner.setPhone(phoneNo); owner.setLocale(form.getUser().getLocale()); form.getTenant().setRemoteAddress(getRemoteUserIp(request)); String channelParam = form.getChannelParam(); if (at.equals(tenantService.getTrialAccountType())) { com.citrix.cpbm.access.Tenant trialTenant = form.getTenant(); trialTenant.setAccountType(at); registrationService.registerTrialAccount(form.getTrialCode(), trialTenant, owner, channelParam); } else { tenantService.createAccount(form.getTenant(), owner, channelParam, form.getAccountTypeId(), result); com.citrix.cpbm.access.Tenant tenant = form.getTenant(); if (promocode != null && !promocode.isEmpty()) { promotionService.createTenantPromotion(promocode, tenant.getObject()); } } map.addAttribute("tenant", form.getTenant()); String homeUrl = config.getValue(Names.com_citrix_cpbm_portal_marketing_home_url); String cloudmktgUrl = config.getValue(Names.com_citrix_cpbm_portal_marketing_marketing_url); if (homeUrl != null) { map.addAttribute("homeUrl", homeUrl); } if (cloudmktgUrl != null) { map.addAttribute("cloudmktgUrl", cloudmktgUrl); } sessionStatus.setComplete(); // clean up parameters in session. } catch (DataAccessException ex) { logger.error(ex); result.reject("errors.registration", new Object[] { ex.getMessage() }, null); errorMsgList.add("You must accept the terms and conditions to use this service"); } catch (LDAPException le) { logger.error(le); result.reject("errors.registration", new Object[] { le.getMessage() }, null); } catch (Exception ex) { logger.error("###handleTenantCreationError:" + ex.getMessage()); throw ex; } if (result.hasErrors()) { displayErrors(result); form.reset(); if (errorMsgList.size() > 0) { map.addAttribute("errorMsgList", errorMsgList); map.addAttribute("errormsg", true); } logger.debug("###Exiting register(registration,result,captchaChallenge,captchaResponse," + "map,sessionStatus,request) method @POST"); throw new AjaxFormValidationException(result); // return "tenants.new"; } else { String tenantParam = form.getTenant().getUuid(); map.clear(); map.addAttribute("tenantParam", tenantParam); map.addAttribute("tenantName", form.getTenant().getName()); map.addAttribute("tenantAccountTypeName", form.getTenant().getAccountType().getName()); map.addAttribute("tenantAccountId", form.getTenant().getObject().getAccountId()); map.addAttribute("tenantOwnerUserName", form.getTenant().getOwner().getUsername()); map.addAttribute("tenantId", form.getTenant().getObject().getId()); logger.debug("###Exiting create(registration,result,map,sessionStatus,request) method @POST"); return result.toString(); } }
From source file:egovframework.example.sample.web.EgovSampleController.java
@RequestMapping("/deleteProduct.do") public void deleteProduct(@ModelAttribute("searchVO") SampleDefaultVO searchVO, @RequestParam("seq") int seq, SessionStatus status, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { int nErrorCode = 0; String strErrorMsg = "START"; HttpPlatformRequest pReq = new HttpPlatformRequest(request); pReq.receiveData();//???? ?? PlatformData iData = pReq.getData(); System.out.println("x? ? : seq -" + seq); Product productVO = new Product(); productVO.setP_seq(seq);//from w w w . ja v a 2 s .co m // // SampleVO sampleVO = new SampleVO(); // sampleVO.setbSeq(id); // //?/////////////////////////////////////////////////////////////////////////////////////////////// Product productVO2 = new Product(); productVO2 = sampleService.selectProduct(productVO); String uuid = productVO2.getP_uuid(); String thumbnail = productVO2.getP_thumbnail(); SampleVO sam2 = new SampleVO(); sam2.setbUuid(uuid); //? ? if (thumbnail.equals( "http://localhost:8778/sample/images/egovframework/example/48d896f7-9ec8-456e-a0bc-06c1ff5f854c")) {//? System.out.println(" ? ?."); } else {//?? ? String dir = request.getRealPath("images/egovframework/board_img"); String deleteThumb = thumbnail.substring(thumbnail.length() - 36); System.out.println(" ?? uuid :" + deleteThumb); String deleteThumbDir = dir + "/" + deleteThumb; System.out.println(" ? url" + deleteThumbDir); File f = new File(deleteThumbDir); //? f.delete(); //? System.out.println("? ?? ?."); } SampleVO iVo = new SampleVO(); SampleVO iVo2 = new SampleVO(); List<SampleVO> imgList = (List<SampleVO>) sampleService.selectImgList(sam2); for (int i = 0; i < imgList.size(); i++) { int imgSeq = imgList.get(i).getiSeq(); System.out.println("imgseq======" + imgSeq); iVo.setiSeq(imgSeq); System.out.println(" ?? ===" + imgList.get(i).getiSeq()); //? ? ?? iVo2 = sampleService.selectImg(iVo); //? System.out.println(" +? ====" + iVo2.getiUrl()); File f = new File(iVo2.getiUrl().toString()); //? f.delete(); //? sampleService.deleteImg(iVo); status.setComplete(); } ////////////////////////////////////////////////////////////////////////////////////////////////// sampleService.deleteProduct(productVO); status.setComplete(); nErrorCode = 0; strErrorMsg = "SUCC"; PlatformData oData = new PlatformData(); VariableList varList = oData.getVariableList(); varList.add("ErrorCode", nErrorCode); varList.add("ErrorMsg", strErrorMsg); HttpPlatformResponse pRes = new HttpPlatformResponse(response, PlatformType.CONTENT_TYPE_XML, "UTF-8"); pRes.setData(oData); //send data pRes.sendData(); }
From source file:egovframework.example.sample.web.EgovSampleController.java
@RequestMapping("/fileUploadX2.do") public void fileUploadX2(HttpServletRequest request, HttpServletResponse response, SessionStatus status) throws Exception { //System.out.println(" ? uuid--"+request.getParameter("uuid")); String chkType = request.getHeader("Content-Type"); if (chkType == null) { return;//from w w w .ja v a 2 s. com } request.setCharacterEncoding("utf-8"); String contextRealPath = request.getSession().getServletContext().getRealPath("/"); String PATH = request.getParameter("PATH"); String savePath = contextRealPath + PATH; // System.out.println("savePath------@@-----"+savePath); // int maxSize = 500 * 1024 * 1024; // ? ? 500MB() PlatformData resData = new PlatformData(); VariableList resVarList = resData.getVariableList(); String sMsg = " A "; try { MultipartHttpServletRequest msReq = (MultipartHttpServletRequest) request; Iterator<String> filesd = msReq.getFileNames(); String dir = request.getRealPath("images/egovframework/board_img"); while (filesd.hasNext()) { sMsg += "D "; //String name = (String)files.nextElement(); String name = filesd.next(); // System.out.println("? ^^-----"+name); MultipartFile mfile = msReq.getFile(name); //? String genId = UUID.randomUUID().toString(); //? String originalFileName = mfile.getOriginalFilename(); //? String saveFileName = genId; // System.out.println("???="+ originalFileName); System.out.println("??=" + saveFileName); String savePathh = dir + "/" + saveFileName; mfile.transferTo(new File(savePathh)); System.out.println(name + "??"); System.out.println("? ?-" + genId); //?? SampleVO vo = new SampleVO(); vo.setiOriName(originalFileName); vo.setiFileName(saveFileName); vo.setiSize((int) mfile.getSize()); vo.setiUrl(savePathh); vo.setiUuid("thumbnail"); sampleService.uploadImg(vo); //? ? //updateThumbnail Product pVO = new Product(); pVO.setP_uuid(request.getParameter("uuid")); System.out.println(" uuid-" + request.getParameter("uuid")); String thumbnail = "http://localhost:8778/sample/images/egovframework/board_img/" + saveFileName; pVO.setP_thumbnail(thumbnail); sampleService.updateThumbnail(pVO); status.setComplete(); } resVarList.add("ErrorCode", 200); resVarList.add("ErrorMsg", "SUCC"); } catch (Exception e) { resVarList.add("ErrorCode", 500); resVarList.add("ErrorMsg", sMsg + " " + e); } HttpPlatformResponse res = new HttpPlatformResponse(response); res.setData(resData); res.sendData(); }
From source file:com.citrix.cpbm.portal.fragment.controllers.AbstractRegistrationController.java
/** * This method is used for Register./* w w w. j a v a2 s. co m*/ * * @param registration * @param result * @param captchaChallenge * @param captchaResponse * @param map * @param channelParam * @param sessionStatus * @param request * @return String */ @RequestMapping(value = "/register", method = RequestMethod.POST) public String register(@Valid @ModelAttribute("registration") final UserRegistration registration, final BindingResult result, @RequestParam(value = "recaptcha_challenge_field", required = false) String captchaChallenge, @RequestParam(value = "recaptcha_response_field", required = false) String captchaResponse, final ModelMap map, @ModelAttribute("channelParam") final String channelParam, SessionStatus sessionStatus, HttpServletRequest request) { logger.debug("###Entering in register( method @POST"); map.addAttribute("page", Page.HOME); map.addAttribute("registration", registration); addFraudProfilingHostToSession(map); IPtoCountry iPtoCountry = super.getGeoIpToCountry(request); List<Country> filteredCountryList = getFilteredCountryList(registration.getCountryList()); map.addAttribute("filteredCountryList", filteredCountryList); if (registration.getUser().getAddress().getCountry().length() > 0) { map.addAttribute("ipToCountryCode", registration.getUser().getAddress().getCountry()); } else { map.addAttribute("ipToCountryCode", iPtoCountry.getCountryCode()); } map.addAttribute(Page.HOME.getLevel1().name(), "on"); map.addAttribute("allowSecondaryCheckBox", registration.getTenant().getAccountType().isEnableSecondaryAddress()); if (!registration.getPhoneVerificationEnabled() && !Boolean.valueOf(config.getValue(Names.com_citrix_cpbm_use_intranet_only))) { try { verifyCaptcha(captchaChallenge, captchaResponse, getRemoteUserIp(request), captchaService); } catch (CaptchaFailureException ex) { map.addAttribute("registrationError", "captcha.error"); map.addAttribute("recaptchaPublicKey", config.getRecaptchaPublicKey()); map.addAttribute("showCaptcha", true); result.reject("errors.registration.captcha", null, null); map.addAttribute("allowSecondaryCheckBox", registration.getTenant().getAccountType().isEnableSecondaryAddress()); return "register.moreuserinfo"; } } registration.getUser().setPhone(registration.getUser().getPhone().replaceAll(PHONE_NUMBER_REGEX, "")); TelephoneVerificationService telephoneVerificationService = (TelephoneVerificationService) connectorManagementService .getOssServiceInstancebycategory(ConnectorType.PHONE_VERIFICATION); if (telephoneVerificationService != null && telephoneVerificationService.isEnabled()) { String generatedPhoneVerificationPin = request.getSession().getAttribute("phoneVerificationPin") .toString(); String actualPhoneNumber = request.getSession().getAttribute("phoneNumber").toString(); if (!registration.getUserEnteredPhoneVerificationPin().equals(generatedPhoneVerificationPin) || !areDigitsInPhoneNosEqual(registration.getUser().getPhone(), actualPhoneNumber)) { map.addAttribute("registrationError", "phoneVerfication.error"); result.reject("errors.registration.user.phone", null, null); return "register.phoneverification"; } } if (result.hasErrors()) { displayErrors(result); parseResult(result, map); return "register.userinfo"; } // Device intelligence and fraud detection ReviewStatus fraudStatus = null; DeviceFraudDetectionAudit log = null; DeviceFraudDetectionService deviceFraudDetectionService = (DeviceFraudDetectionService) connectorManagementService .getOssServiceInstancebycategory(ConnectorType.DEVICE_FRAUD_CONTROL); if (deviceFraudDetectionService != null && deviceFraudDetectionService.isEnabled()) { fraudStatus = assessAccountCreationRisk(registration, request); if (fraudStatus == ReviewStatus.FAIL) { return "register.fail"; } log = ((DeviceFraudDetectionService) connectorManagementService .getOssServiceInstancebycategory(ConnectorType.DEVICE_FRAUD_CONTROL)) .getLastLog(request.getSession().getId(), registration.getUser().getUsername()); String message = "device.fraud"; Tenant tenant = tenantService.getSystemTenant(); String messageArguments = registration.getUser().getUsername(); Event event = null; switch (fraudStatus) { case REJECT: context.publishEvent(new PortalEvent("Device Fraud Detection Event", actorService.getActor(), new DeviceFraudDetectionEvent(log, registration.getUser().getUsername(), registration.getUser().getEmail(), registration.getUser().getPhone(), registration.getUser().getFirstName(), registration.getUser().getLastName()))); event = new Event(new Date(), message, messageArguments, tenant, Source.PORTAL, Scope.ACCOUNT, Category.ACCOUNT, Severity.CRITICAL, true); eventService.createEvent(event, false); return "register.fail"; case REVIEW: // account to be manual activated registration.getTenant().setIsManualActivation(true); context.publishEvent(new PortalEvent("Device Fraud Detection Event", actorService.getActor(), new DeviceFraudDetectionEvent(log, registration.getUser().getUsername(), registration.getUser().getEmail(), registration.getUser().getPhone(), registration.getUser().getFirstName(), registration.getUser().getLastName()))); event = new Event(new Date(), message, messageArguments, tenant, Source.PORTAL, Scope.ACCOUNT, Category.ACCOUNT, Severity.ALERT, true); eventService.createEvent(event, false); // Model should know fraud has been detected map.put("deviceFraudDetected", true); default: break; } } // This checks whether the trial code is valid or not map.addAttribute("supportEmail", config.getValue(Names.com_citrix_cpbm_portal_addressbook_helpDeskEmail)); map.addAttribute("supportPhone", config.getValue(Names.com_citrix_cpbm_portal_settings_helpdesk_phone)); // post processing for trial code if (!StringUtils.isEmpty(registration.getTrialCode())) { String promoCode = registration.getTrialCode(); String channelCode = channelService.getChannel(channelParam).getCode(); if (!promotionService.isValidPromotion(promoCode, channelCode)) { logger.debug("Invalid promo code " + promoCode + " for channel code " + channelCode); return "register.fail"; } // preempt trial account type creation if NOT supported [TA10428] CampaignPromotion cp = promotionService.locatePromotionByToken(promoCode); AccountType requestedAccountType = registrationService .getAccountTypeById(registration.getAccountTypeId()); if (requestedAccountType.equals(registrationService.getTrialAccountType()) && !cp.isTrial()) { logger.debug("Invalid promo code " + promoCode + " for account type " + requestedAccountType); return "register.fail"; } } registration.getTenant().setAddress(registration.getUser().getAddress()); if (!registration.isAllowSecondary()) { registration.getTenant().setSecondaryAddress(null); } else { registration.getTenant().setSecondaryAddress(registration.getSecondaryAddress()); } registration.getTenant().setSyncBillingAddress(true); // to store error messages List<String> errorMsgList = new ArrayList<String>(); try { final com.citrix.cpbm.access.User owner = registration.getUser(); if (registration.getCountryCode() == null || registration.getCountryCode().equals("")) { Country country = countryService .locateCountryByCode(registration.getUser().getAddress().getCountry()); registration.setCountryName(country.getName()); registration.setCountryCode(country.getIsdCode()); } String phoneNo = registration.getCountryCode().replaceAll(PHONE_NUMBER_REGEX, "") + COUNTRY_CODE_TO_PHONE_NUMBER_SEPERATOR + owner.getPhone().replaceAll(PHONE_NUMBER_REGEX, ""); // Set the phone number owner.setPhone(phoneNo); owner.setLocale(registration.getUser().getLocale()); registration.getTenant().setRemoteAddress(getRemoteUserIp(request)); // set currency for (CurrencyValue cv : registration.getCurrencyValueList()) { if (cv.getCurrencyCode().equals(registration.getCurrency())) { registration.getTenant().setCurrency(cv); break; } } privilegeService.runAsPortal(new PrivilegedAction<Void>() { @Override public Void run() { AccountType requestedAccountType = registrationService .getAccountTypeById(registration.getAccountTypeId()); if (requestedAccountType.equals(registrationService.getTrialAccountType())) { TrialAccount account = null; try { account = registrationService.registerTrialAccount(registration.getTrialCode(), registration.getTenant(), owner, channelParam); } catch (TrialCodeInvalidException e) { logger.debug("Invalid Trial Code", e); } catch (ConnectorManagementServiceException e) { logger.debug("Cannot find service instance", e); } map.addAttribute("trial", account); return null; } else { try { registrationService.registerTenant(registration.getTenant(), owner, channelParam, registration.getTrialCode(), result); } catch (ConnectorManagementServiceException e) { logger.debug("Cannot find service instance", e); } } if (!result.hasErrors()) { Tenant t = tenantService.get(registration.getTenant().getUuid()); t.setAccountType(registrationService.getAccountTypeById(registration.getAccountTypeId())); t.getTenantExtraInformation() .setPaymentMode(requestedAccountType.getSupportedPaymentModes().get(0)); tenantService.save(t); registration.setTenant((com.citrix.cpbm.access.Tenant) CustomProxy.newInstance(t)); } return null; } }); if (deviceFraudDetectionService != null && deviceFraudDetectionService.isEnabled()) { log.setUserId(registration.getTenant().getOwner().getId()); } map.addAttribute("tenant", registration.getTenant()); String homeUrl = config.getValue(Names.com_citrix_cpbm_portal_marketing_home_url); String cloudmktgUrl = config.getValue(Names.com_citrix_cpbm_portal_marketing_marketing_url); if (homeUrl != null) { map.addAttribute("homeUrl", homeUrl); } if (cloudmktgUrl != null) { map.addAttribute("cloudmktgUrl", cloudmktgUrl); } } catch (DataAccessException ex) { logger.error(ex); result.reject("errors.registration", new Object[] { ex.getMessage() }, null); errorMsgList.add("You must accept the terms and conditions to use this service"); } catch (TrialCodeInvalidException ex) { result.rejectValue("trialCode", "errors.registration.invalid_trial_code", null); map.addAttribute("trialCode", "errors.registration.invalid_trial_code"); logger.debug("registrationError " + ex.getMessage()); } catch (TrialMaxAccountReachedException ex) { result.rejectValue("trialCode", "errors.registration.max_trial_reached", null); map.addAttribute("trialCode", "errors.registration.max_trial_reached"); logger.debug("registrationError " + ex.getMessage()); } catch (Exception ex) { logger.error("registrationError ", ex); return "redirect:/portal/errors/error"; } if (result.hasErrors()) { displayErrors(result); parseResult(result, map); registration.reset(); registration.setCurrency(config.getValue(Names.com_citrix_cpbm_portal_settings_default_currency)); if (errorMsgList.size() > 0) { map.addAttribute("errorMsgList", errorMsgList); map.addAttribute("errormsg", true); } logger.debug("###Exiting register(registration,result,captchaChallenge,,captchaResponse," + "map,sessionStatus,request) method @POST"); map.addAttribute("allowSecondaryCheckBox", registration.getTenant().getAccountType().isEnableSecondaryAddress()); if (!Boolean.valueOf(config.getValue(Names.com_citrix_cpbm_use_intranet_only))) { map.addAttribute("recaptchaPublicKey", config.getRecaptchaPublicKey()); map.addAttribute("showCaptcha", true); } return "register.moreuserinfo"; } else { sessionStatus.setComplete(); // clean up parameters in session. logger.debug("###Exiting register(registration,result,captchaChallenge,,captchaResponse," + "map,sessionStatus,request) method @POST"); map.addAttribute("user", registration.getUser()); return "register.registration_success"; } }