List of usage examples for com.liferay.portal.kernel.util StringPool QUESTION
String QUESTION
To view the source code for com.liferay.portal.kernel.util StringPool QUESTION.
Click Source Link
From source file:com.liferay.taglib.security.EncryptTag.java
License:Open Source License
@Override public int doStartTag() throws JspException { try {//from w ww . j av a 2 s .c o m StringBundler sb = new StringBundler(); // Open anchor sb.append("<a "); // Class if (Validator.isNotNull(_className)) { sb.append("class=\""); sb.append(_className); sb.append("\" "); } // HREF sb.append("href=\""); sb.append(_protocol); sb.append(Http.PROTOCOL_DELIMITER); int pos = _url.indexOf(CharPool.QUESTION); if (pos == -1) { sb.append(_url); } else { sb.append(_url.substring(0, pos)); sb.append(StringPool.QUESTION); Company company = PortalUtil.getCompany((HttpServletRequest) pageContext.getRequest()); Key key = company.getKeyObj(); StringTokenizer st = new StringTokenizer(_url.substring(pos + 1, _url.length()), StringPool.AMPERSAND); while (st.hasMoreTokens()) { String paramAndValue = st.nextToken(); int x = paramAndValue.indexOf(CharPool.EQUAL); String param = paramAndValue.substring(0, x); String value = paramAndValue.substring(x + 1, paramAndValue.length()); sb.append(param).append(StringPool.EQUAL); if (_unencryptedParamsSet.contains(param)) { sb.append(HttpUtil.encodeURL(value)); } else { try { sb.append(HttpUtil.encodeURL(Encryptor.encrypt(key, value))); } catch (EncryptorException ee) { _log.error(ee.getMessage()); } if (st.hasMoreTokens()) { sb.append(StringPool.AMPERSAND); } } } sb.append("&shuo=1"); } sb.append("\" "); // Style if (Validator.isNotNull(_style)) { sb.append("style=\""); sb.append(_style); sb.append("\" "); } // Target if (Validator.isNotNull(_target)) { sb.append("target=\"" + _target + "\""); } // Close anchor sb.append(">"); JspWriter jspWriter = pageContext.getOut(); jspWriter.write(sb.toString()); return EVAL_BODY_INCLUDE; } catch (Exception e) { throw new JspException(e); } }
From source file:com.liferay.util.bridges.php.PHPServletRequest.java
License:Open Source License
@Override public String getRequestURI() { return _path + StringPool.QUESTION + _queryString; }
From source file:com.liferay.wiki.service.impl.WikiPageServiceImpl.java
License:Open Source License
protected String exportToRSS(String name, String description, String type, double version, String displayStyle, String feedURL, String entryURL, String attachmentURLPrefix, List<WikiPage> pages, boolean diff, Locale locale) throws PortalException { SyndFeed syndFeed = new SyndFeedImpl(); syndFeed.setDescription(description); List<SyndEntry> syndEntries = new ArrayList<>(); syndFeed.setEntries(syndEntries);//from ww w . j ava2 s . co m WikiPage latestPage = null; StringBundler sb = new StringBundler(6); for (WikiPage page : pages) { SyndEntry syndEntry = new SyndEntryImpl(); String author = PortalUtil.getUserName(page); syndEntry.setAuthor(author); SyndContent syndContent = new SyndContentImpl(); syndContent.setType(RSSUtil.ENTRY_TYPE_DEFAULT); sb.setIndex(0); sb.append(entryURL); if (entryURL.endsWith(StringPool.SLASH)) { sb.append(HttpUtil.encodeURL(page.getTitle())); } if (diff) { if ((latestPage != null) || (pages.size() == 1)) { sb.append(StringPool.QUESTION); sb.append(PortalUtil.getPortletNamespace(WikiPortletKeys.WIKI)); sb.append("version="); sb.append(page.getVersion()); String value = null; if (latestPage == null) { value = wikiEngineRenderer.convert(page, null, null, attachmentURLPrefix); } else { try { value = wikiEngineRenderer.diffHtml(latestPage, page, null, null, attachmentURLPrefix); } catch (PortalException pe) { throw pe; } catch (SystemException se) { throw se; } catch (Exception e) { throw new SystemException(e); } } syndContent.setValue(value); syndEntry.setDescription(syndContent); syndEntries.add(syndEntry); } } else { String value = null; WikiGroupServiceOverriddenConfiguration wikiGroupServiceOverriddenConfiguration = configurationProvider .getConfiguration(WikiGroupServiceOverriddenConfiguration.class, new GroupServiceSettingsLocator(page.getGroupId(), WikiConstants.SERVICE_NAME)); if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_ABSTRACT)) { value = StringUtil.shorten(HtmlUtil.extractText(page.getContent()), wikiGroupServiceOverriddenConfiguration.rssAbstractLength(), StringPool.BLANK); } else if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_TITLE)) { value = StringPool.BLANK; } else { value = wikiEngineRenderer.convert(page, null, null, attachmentURLPrefix); } syndContent.setValue(value); syndEntry.setDescription(syndContent); syndEntries.add(syndEntry); } syndEntry.setLink(sb.toString()); syndEntry.setPublishedDate(page.getCreateDate()); String title = page.getTitle() + StringPool.SPACE + page.getVersion(); if (page.isMinorEdit()) { title += StringPool.SPACE + StringPool.OPEN_PARENTHESIS + LanguageUtil.get(locale, "minor-edit") + StringPool.CLOSE_PARENTHESIS; } syndEntry.setTitle(title); syndEntry.setUpdatedDate(page.getModifiedDate()); syndEntry.setUri(sb.toString()); latestPage = page; } syndFeed.setFeedType(RSSUtil.getFeedType(type, version)); List<SyndLink> syndLinks = new ArrayList<>(); syndFeed.setLinks(syndLinks); SyndLink syndLinkSelf = new SyndLinkImpl(); syndLinks.add(syndLinkSelf); syndLinkSelf.setHref(feedURL); syndLinkSelf.setRel("self"); syndFeed.setPublishedDate(new Date()); syndFeed.setTitle(name); syndFeed.setUri(feedURL); try { return RSSUtil.export(syndFeed); } catch (FeedException fe) { throw new SystemException(fe); } }
From source file:com.liferay.wsrp.bind.MarkupServiceImpl.java
License:Open Source License
protected String getURL(String lifecycle, String resourceId, MimeRequest mimeRequest, PortletContext portletContext, WSRPProducer wsrpProducer) throws Exception { StringBuilder sb = new StringBuilder(); sb.append(getWidgetPath());/*from w w w . jav a2s . c o m*/ sb.append(StringPool.QUESTION); String propertiesAuthenticatonTokenSharedSecret = Encryptor .digest(PropsUtil.get(PropsKeys.AUTH_TOKEN_SHARED_SECRET)); sb.append("p_auth_secret="); sb.append(HttpUtil.encodeURL(propertiesAuthenticatonTokenSharedSecret)); Layout layout = getLayout(portletContext, wsrpProducer); sb.append("&p_l_id="); sb.append(layout.getPlid()); NavigationalContext navigationalContext = mimeRequest.getNavigationalContext(); String portletId = getPortletId(portletContext, navigationalContext); sb.append("&p_p_id="); sb.append(HttpUtil.encodeURL(portletId)); sb.append("&p_p_lifecycle="); sb.append(lifecycle); String windowState = getWindowState(mimeRequest); sb.append("&p_p_state="); sb.append(HttpUtil.encodeURL(windowState)); String portletMode = getPortletMode(mimeRequest); sb.append("&p_p_mode="); sb.append(HttpUtil.encodeURL(portletMode)); if (lifecycle.equals("2") && Validator.isNotNull(resourceId)) { sb.append("&p_p_resource_id="); sb.append(resourceId); } sb.append("&p_p_isolated=1"); String opaqueValue = null; if (navigationalContext != null) { opaqueValue = navigationalContext.getOpaqueValue(); } if (Validator.isNotNull(opaqueValue)) { sb.append(StringPool.AMPERSAND); sb.append(opaqueValue); } if (lifecycle.equals("0")) { MessageElement[] formParameters = ExtensionUtil.getMessageElements(mimeRequest.getExtensions()); if (formParameters != null) { String namespace = PortalUtil.getPortletNamespace(portletId); for (MessageElement formParameter : formParameters) { sb.append(StringPool.AMPERSAND); sb.append(namespace + formParameter.getName()); sb.append(StringPool.EQUAL); sb.append(HttpUtil.encodeURL(formParameter.getValue())); } } } if (windowState.equals(LiferayWindowState.EXCLUSIVE.toString())) { sb.append("&ensureContentLength=1"); } sb.append("&wsrp=1"); if (_log.isInfoEnabled()) { _log.info("URL " + sb.toString()); } return sb.toString(); }
From source file:com.liferay.wsrp.bind.V2MarkupServiceImpl.java
License:Open Source License
protected String getURL(String lifecycle, String resourceID, MimeRequest mimeRequest, PortletContext portletContext, WSRPProducer wsrpProducer) throws Exception { StringBundler sb = new StringBundler(); String[] locales = mimeRequest.getLocales(); if (locales.length > 0) { sb.append(getWidgetPath(locales[0])); } else {/*from ww w . j a va 2 s .c om*/ sb.append(getWidgetPath()); } sb.append(StringPool.QUESTION); String propertiesAuthenticatonTokenSharedSecret = Encryptor .digest(PropsUtil.get(PropsKeys.AUTH_TOKEN_SHARED_SECRET)); sb.append("p_auth_secret="); sb.append(HttpUtil.encodeURL(propertiesAuthenticatonTokenSharedSecret)); Layout layout = getLayout(portletContext, wsrpProducer); sb.append("&p_l_id="); sb.append(layout.getPlid()); NavigationalContext navigationalContext = mimeRequest.getNavigationalContext(); String portletId = getPortletId(portletContext, navigationalContext); sb.append("&p_p_id="); sb.append(HttpUtil.encodeURL(portletId)); sb.append("&p_p_lifecycle="); sb.append(lifecycle); String windowState = getWindowState(mimeRequest); sb.append("&p_p_state="); sb.append(HttpUtil.encodeURL(windowState)); String portletMode = getPortletMode(mimeRequest); sb.append("&p_p_mode="); sb.append(HttpUtil.encodeURL(portletMode)); if (lifecycle.equals("2") && Validator.isNotNull(resourceID)) { sb.append("&p_p_resource_id="); sb.append(resourceID); } sb.append("&p_p_isolated=1"); String opaqueValue = null; if (navigationalContext != null) { opaqueValue = navigationalContext.getOpaqueValue(); } if (Validator.isNotNull(opaqueValue)) { sb.append(StringPool.AMPERSAND); opaqueValue = new String(Base64.decode(Base64.fromURLSafe(opaqueValue)), StringPool.UTF8); sb.append(opaqueValue); } if (lifecycle.equals("0")) { MessageElement[] formParameters = ExtensionHelperUtil.getMessageElements(mimeRequest.getExtensions()); if (formParameters != null) { String namespace = PortalUtil.getPortletNamespace(portletId); for (MessageElement formParameter : formParameters) { sb.append(StringPool.AMPERSAND); String name = namespace.concat(ExtensionHelperUtil.getNameAttribute(formParameter)); sb.append(name); sb.append(StringPool.EQUAL); sb.append(HttpUtil.encodeURL(formParameter.getValue())); } } } if (windowState.equals(LiferayWindowState.EXCLUSIVE.toString())) { sb.append("&ensureContentLength=1"); } sb.append("&wsrp=1"); if (_log.isInfoEnabled()) { _log.info("URL " + sb.toString()); } return sb.toString(); }
From source file:com.rivetlogic.ecommerce.paypal.PaypalUtil.java
License:Open Source License
public static String getPaypalRedirect(ActionRequest request, ActionResponse response, ShoppingOrder shoppingOrder) {//from w ww .ja v a2 s . co m ShoppingCartPrefsBean prefsBean = new ShoppingCartPrefsBean(request); if (prefsBean.isPaypalEnabled()) { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); String portalUrl = themeDisplay.getPortalURL(); String returnUrl = portalUrl + request.getParameter(WebKeys.REDIRECT); String notifyUrl = portalUrl + PaypalConstants.NOTIFY_ACTION_PATH; String paypalEmail = prefsBean.getPaypalEmail(); String orderId = Long.toString(shoppingOrder.getOrderId()); double orderTotal = shoppingOrder.getTotal(); String[] names = shoppingOrder.getCustomerName().split(StringPool.SPACE); String firstName = names[0]; String lastName = names.length > 1 ? names[1] : StringPool.BLANK; StringBuilder sb = new StringBuilder(); sb.append(PaypalConstants.PAYPAL_ENDPOINT).append(StringPool.QUESTION); formatParam(sb, PaypalConstants.PARAM_CMD, PaypalConstants.CMD_XCLICK); formatParam(sb, PaypalConstants.PARAM_BUSINESS, paypalEmail); formatParam(sb, PaypalConstants.PARAM_ITEM_NAME, orderId); formatParam(sb, PaypalConstants.PARAM_ITEM_NUMBER, orderId); formatParam(sb, PaypalConstants.PARAM_INVOICE, orderId); formatParam(sb, PaypalConstants.PARAM_AMOUNT, orderTotal); formatParam(sb, PaypalConstants.PARAM_RETURN, returnUrl); formatParam(sb, PaypalConstants.PARAM_NOTIFY_URL, notifyUrl); formatParam(sb, PaypalConstants.PARAM_FIRST_NAME, firstName); formatParam(sb, PaypalConstants.PARAM_LAST_NAME, lastName); formatParam(sb, PaypalConstants.PARAM_EMAIL, shoppingOrder.getCustomerEmail()); formatParam(sb, PaypalConstants.PARAM_ADDRESS1, shoppingOrder.getShippingAddress1()); formatParam(sb, PaypalConstants.PARAM_CITY, shoppingOrder.getShippingCity()); formatParam(sb, PaypalConstants.PARAM_STATE, shoppingOrder.getShippingStateProvince()); formatParam(sb, PaypalConstants.PARAM_ZIP, shoppingOrder.getShippingPostalCode()); formatParam(sb, PaypalConstants.PARAM_NO_NOTE, "1"); formatParam(sb, PaypalConstants.PARAM_CURRENCY, PaypalConstants.CURRENCY_USD); if (LOG.isDebugEnabled()) LOG.debug("Paypal URL: " + sb); return sb.toString(); } else { return null; } }
From source file:com.rivetlogic.ecommerce.paypal.PaypalUtil.java
License:Open Source License
private static void formatParam(StringBuilder sb, String name, Object value) { if (!StringPool.QUESTION.equals(sb.subSequence(sb.length() - 1, sb.length() - 1))) sb.append(StringPool.AMPERSAND); sb.append(String.format("%s=%s", name, HttpUtil.encodeURL(value.toString()))); }
From source file:com.stoxx.portlet.controller.RegistrationController.java
@RenderMapping public String handleRenderRequest(RenderRequest renderRequest, RenderResponse renderResponse, Model model, @ModelAttribute(REGISTRATION_BEAN) RegistrationBean registrationBean) { log.info("STOXXRegistrationController.handleRenderRequest()"); ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); Boolean isExistingUser = Boolean.FALSE; Boolean isDeletedUser = Boolean.FALSE; try {/* w w w .ja va2 s . c om*/ log.info("the action parameter is " + renderRequest.getParameter(ACTION)); String portalUrl = PortalUtil.getCurrentURL(renderRequest); log.info("current Portal url>>>> " + portalUrl); String businessEmailAddressEncrypted = null; registrationBean = getListDetails(registrationBean, themeDisplay); registrationBean.setCompanyId(themeDisplay.getCompanyId()); registrationBean.setIsExistingUser(isExistingUser); registrationBean.setIsDeletedUser(isDeletedUser); if (null != renderRequest.getParameter(ACTION) && renderRequest.getParameter(ACTION).equalsIgnoreCase("setupProfileTRANSLATOR")) { log.info("for Translator and the email address is $$$$" + businessEmailAddress + AND_BEAN_EMAIL_IS + registrationBean.getBusinessEmailAddress()); if (Validator.isNotNull(businessEmailAddress)) { registrationBean.setBusinessEmailAddress(businessEmailAddress); } log.info("user type is" + registrationBean.getUserType()); if (registrationBean.getUserType().equalsIgnoreCase(STOXXConstants.STOXX_VENDOR_USER)) { registrationBean = registrationDelegator.fetchFromStoxxUser(registrationBean); log.info("Company Name >>>>> is" + registrationBean.getCompanyName()); log.info("Translator agency ID >>>>> is" + registrationBean.getTranslatorAgencyId()); } if (registrationBean.getUserType().equalsIgnoreCase(STOXXConstants.STOXX_STAFF_USER)) { registrationBean.setCompanyName(RegistrationConstants.STAFF_COMPANY); log.info("Company Name >>>>> is" + registrationBean.getCompanyName()); } if (registrationDelegator.checkIfRegistered(registrationBean.getBusinessEmailAddress())) { registrationBean = registrationDelegator.fetchFromStoxxUser(registrationBean); if (null != registrationBean.getUserType() && registrationBean.getUserType() .equalsIgnoreCase(STOXXConstants.STOXX_REGISTERED_USER)) { String packageDetails = registrationDelegator .getPackageDetails(registrationBean.getSalesEntryId()); log.info(THE_PACKAGE_DETAILS + packageDetails); registrationBean.setPackageDetails(packageDetails); } } registrationBean = getListDetails(registrationBean, themeDisplay); registrationBean.setIsExistingUser(isExistingUser); registrationBean.setIsDeletedUser(isDeletedUser); model.addAttribute(REGISTRATION_BEAN, registrationBean); return RegistrationConstants.SETUP_PROFILE; } else if (null != renderRequest.getParameter(ACTION) && renderRequest.getParameter(ACTION).equalsIgnoreCase("userExists") || null != renderRequest.getParameter(ACTION) && renderRequest.getParameter(ACTION).equalsIgnoreCase("invalidEmail") || null != renderRequest.getParameter(ACTION) && renderRequest.getParameter(ACTION).equalsIgnoreCase("setupProfileGENERALLICENSED") || null != renderRequest.getParameter(ACTION) && renderRequest.getParameter(ACTION).equalsIgnoreCase("setupProfileSTAFF") || null != renderRequest.getParameter(ACTION) && renderRequest.getParameter(ACTION).equalsIgnoreCase("setupProfileGENERAL") || null != renderRequest.getParameter(ACTION) && renderRequest.getParameter(ACTION).equalsIgnoreCase("linkAlreadysent")) { log.info("email address is $$$$" + businessEmailAddress + AND_BEAN_EMAIL_IS + registrationBean.getBusinessEmailAddress()); businessEmailAddress = registrationBean.getBusinessEmailAddress(); model.addAttribute(REGISTRATION_BEAN, registrationBean); return RegistrationConstants.INITIATE_REGISTRATION; } else if (null != renderRequest.getParameter(ACTION) && renderRequest.getParameter(ACTION).equalsIgnoreCase("CaptchaException")) { log.info("email address is $$$$" + businessEmailAddress + AND_BEAN_EMAIL_IS + registrationBean.getBusinessEmailAddress()); model.addAttribute(REGISTRATION_BEAN, registrationBean); return RegistrationConstants.SETUP_PROFILE; } else if (portalUrl.contains(StringPool.QUESTION) && portalUrl.contains(StringPool.DOLLAR)) { log.info("inside registration link validation with dollar and questionmark"); getUserTypeandEmalaIdfromEncrptedUrl(model, registrationBean, portalUrl); model.addAttribute(REGISTRATION_BEAN, registrationBean); if (Validator.isNotNull(businessEmailAddress) && !registrationBean.getIsExistingUser()) { log.info("businessEmailAddress>>>>>>>>>>>>>>>>>>>>>>>>>>" + businessEmailAddress); log.info("USER_>>>>>>>>>>>>>>>" + registrationDelegator .checkIfUserExistsInLiferayDB(registrationBean, businessEmailAddress)); registrationBean.setCompanyId(themeDisplay.getCompanyId()); boolean isUserExistInCustomDB = registrationDelegator .checkIfUserExistsInLiferay(registrationBean, businessEmailAddress); log.info("STOXX_USER" + isUserExistInCustomDB); if (registrationDelegator.checkIfUserExistsInLiferayDB(registrationBean, businessEmailAddress) && registrationDelegator.checkIfUserExistsInLiferay(registrationBean, businessEmailAddress) && Validator.isNotNull(registrationBean.getIsDeletedUser()) && !registrationBean.getIsDeletedUser()) { log.info("inside dupplicate registration block with dollar an questionmark"); SessionErrors.add(renderRequest, USER_EXISTS_KEY); } else { if (Validator.isNotNull(registrationBean.getIsDeletedUser()) && registrationBean.getIsDeletedUser()) { return RegistrationConstants.INITIATE_REGISTRATION; } if (!isUserExistInCustomDB) { SessionErrors.add(renderRequest, USER_DELETED_KEY); } else { log.info("inside registration block for new registration with dollar an questionmark"); if (fetchActivationLinkCreateDateDiff(registrationBean.getBusinessEmailAddress())) { SessionErrors.add(renderRequest, RegistrationConstants.REGISTRATION_LINK_EXPIRED); } if (registrationDelegator.checkIfUserExistsInLiferay(registrationBean) && registrationBean.getUserType() .equalsIgnoreCase(STOXXConstants.STOXX_STAFF_USER) && registrationBean.getUserType() .equalsIgnoreCase(STOXXConstants.STOXX_GENERAL_USER)) { SessionMessages.add(renderRequest, "user-activation-link-already-sent"); } } } } SessionMessages.add(renderRequest, "user-validation-done"); return RegistrationConstants.INITIATE_REGISTRATION; } else if (null != renderRequest.getParameter(ACTION) && renderRequest.getParameter(ACTION).equalsIgnoreCase(EXISTING_USER)) { log.info("FOR EXISTING USER STEO 1 >>>>> email address is $$$$" + businessEmailAddress + AND_BEAN_EMAIL_IS + registrationBean.getBusinessEmailAddress()); registrationBean = registrationDelegator.fetchFromStoxxUser(registrationBean); if (Validator.isNotNull(registrationBean) && Validator.isNotNull(registrationBean.getStatus()) && registrationBean.getStatus() == 3) { isExistingUser = Boolean.TRUE; registrationBean.setIsExistingUser(isExistingUser); registrationBean.setIsDeletedUser(isDeletedUser); } model.addAttribute(REGISTRATION_BEAN, registrationBean); SessionMessages.add(renderRequest, EXISTING_USER); return RegistrationConstants.INITIATE_REGISTRATION; } else if (null != renderRequest.getParameter(ACTION) && renderRequest.getParameter(ACTION).equalsIgnoreCase(CUST_USER_EXCEEDED)) { log.info("FOR EXCEEDING CUSTOMER USER STEO 1 >>>>> email address is $$$$" + registrationBean.getBusinessEmailAddress()); model.addAttribute(REGISTRATION_BEAN, registrationBean); SessionMessages.add(renderRequest, CUST_USER_EXCEEDED); return RegistrationConstants.INITIATE_REGISTRATION; } else if (portalUrl.contains(StringPool.QUESTION + EXISTING)) { log.info("new existing logic"); registrationBean = registrationDelegator.fetchFromStoxxUser(registrationBean); if (Validator.isNotNull(registrationBean) && Validator.isNotNull(registrationBean.getStatus()) && registrationBean.getStatus() == 3) { isExistingUser = Boolean.TRUE; registrationBean.setIsExistingUser(isExistingUser); } model.addAttribute(REGISTRATION_BEAN, registrationBean); SessionErrors.add(renderRequest, USER_EXISTS_MIGRATION_KEY); return RegistrationConstants.INITIATE_REGISTRATION; } else if (null != renderRequest.getParameter(ACTION) && renderRequest.getParameter(ACTION).equalsIgnoreCase("existingUserStep2") || null != renderRequest.getParameter(ACTION) && renderRequest.getParameter(ACTION).equalsIgnoreCase(DELETED_USER)) { log.info("FOR EXISTING USER STEP 2 >>>>> email address is $$$$" + businessEmailAddress + AND_BEAN_EMAIL_IS + registrationBean.getBusinessEmailAddress()); registrationBean = registrationDelegator.fetchFromStoxxUser(registrationBean, businessEmailAddress); log.info("Sales entry id is >>>>>>>>>" + registrationBean.getSalesEntryId() + " and the usertype is >>>>>>" + registrationBean.getUserType()); if (Validator.isNotNull(registrationBean.getStatus()) && registrationBean.getStatus() == 4 && registrationBean.getUserType().equalsIgnoreCase(STOXXConstants.STOXX_REGISTERED_USER) && !Validator.isNotNull(registrationBean.getSalesEntryId())) { registrationDelegator.updateUserType(registrationBean.getBusinessEmailAddress(), STOXXConstants.STOXX_GENERAL_USER); registrationBean.setUserType(STOXXConstants.STOXX_GENERAL_USER); } User liferayStoxxUser = UserLocalServiceUtil.fetchUserByEmailAddress(themeDisplay.getCompanyId(), businessEmailAddress); if (Validator.isNotNull(registrationBean) && Validator.isNotNull(registrationBean.getStatus()) && registrationBean.getStatus() == 3) { isExistingUser = Boolean.TRUE; registrationBean.setIsExistingUser(isExistingUser); registrationBean.setIsDeletedUser(isDeletedUser); if (Validator.isNotNull(liferayStoxxUser)) { registrationBean = populateFields(registrationBean, themeDisplay, liferayStoxxUser); } if (Validator.isNotNull(registrationBean.getSalesEntryId()) && registrationBean.getUserType() .equalsIgnoreCase(STOXXConstants.STOXX_REGISTERED_USER)) { String packageDetails = registrationDelegator .getPackageDetails(registrationBean.getSalesEntryId()); log.info(THE_PACKAGE_DETAILS + packageDetails); registrationBean.setPackageDetails(packageDetails); } getListDetails(registrationBean, themeDisplay); } if (Validator.isNotNull(registrationBean) && Validator.isNotNull(registrationBean.getStatus()) && registrationBean.getStatus() == 4) { isDeletedUser = Boolean.TRUE; isExistingUser = Boolean.FALSE; registrationBean.setIsDeletedUser(isDeletedUser); registrationBean.setIsExistingUser(isExistingUser); if (Validator.isNotNull(registrationBean.getSalesEntryId()) && registrationBean.getUserType() .equalsIgnoreCase(STOXXConstants.STOXX_REGISTERED_USER)) { String packageDetails = registrationDelegator .getPackageDetails(registrationBean.getSalesEntryId()); log.info(THE_PACKAGE_DETAILS + packageDetails); registrationBean.setPackageDetails(packageDetails); } User liferayDeletedUser = UserLocalServiceUtil.fetchUserByEmailAddress( themeDisplay.getCompanyId(), registrationBean.getBusinessEmailAddress()); if (Validator.isNotNull(liferayDeletedUser)) { registrationBean = populateFields(registrationBean, themeDisplay, liferayStoxxUser); } registrationBean = getListDetails(registrationBean, themeDisplay); registrationBean = registrationDelegator .getUserPreferenceDetails(registrationBean.getBusinessEmailAddress(), registrationBean); } if (!Validator.isNotNull(registrationBean.getStatus()) && liferayStoxxUser.getStatus() == 1 && Validator.isNotNull(registrationBean.getSalesEntryId())) { log.info("For customer who are going to add by admin into application after deletion."); isDeletedUser = Boolean.TRUE; isExistingUser = Boolean.FALSE; registrationBean.setIsDeletedUser(isDeletedUser); registrationBean.setIsExistingUser(isExistingUser); if (Validator.isNotNull(registrationBean.getSalesEntryId()) && registrationBean.getUserType() .equalsIgnoreCase(STOXXConstants.STOXX_REGISTERED_USER)) { String packageDetails = registrationDelegator .getPackageDetails(registrationBean.getSalesEntryId()); log.info(THE_PACKAGE_DETAILS + packageDetails); registrationBean.setPackageDetails(packageDetails); } getListDetails(registrationBean, themeDisplay); } registrationBean.setIsExistingUser(isExistingUser); registrationBean.setIsDeletedUser(isDeletedUser); model.addAttribute(REGISTRATION_BEAN, registrationBean); return RegistrationConstants.SETUP_PROFILE; } else if (portalUrl.contains(StringPool.QUESTION)) { SessionMessages.add(renderRequest, "user-validation-done"); registrationBean = new RegistrationBean(); businessEmailAddressEncrypted = portalUrl.split(StringPool.BACK_SLASH + StringPool.QUESTION)[1]; log.info("businessEmailAddress value>>>> " + businessEmailAddressEncrypted); businessEmailAddress = STOXXEncrypter.decrypt(businessEmailAddressEncrypted, ENCRYPTION_KEY); log.info("decrypted email id is>>> " + businessEmailAddress); RegistrationBean registrationBean2 = registrationDelegator.fetchFromStoxxUser(registrationBean, businessEmailAddress); if (Validator.isNotNull(registrationBean2) && Validator.isNotNull(registrationBean2.getStatus()) && registrationBean2.getStatus() == 3) { log.info("<<<<<<<<<the user is an eisting user>>>>>>>>"); isExistingUser = Boolean.TRUE; isDeletedUser = Boolean.FALSE; } registrationBean.setIsExistingUser(isExistingUser); registrationBean.setIsDeletedUser(isDeletedUser); log.info("inside registration link validation with questionmark"); registrationBean.setCompanyId(themeDisplay.getCompanyId()); if (Validator.isNotNull(registrationBean2) && Validator.isNotNull(registrationBean2.getStatus()) && registrationBean2.getStatus() == 4 && registrationDelegator .isInactiveUser(registrationBean.getCompanyId(), businessEmailAddress)) { log.info("<<<<<<<<< the user has been deleted previously >>>>>>>>"); isDeletedUser = Boolean.TRUE; isExistingUser = Boolean.FALSE; } log.info("registrationBean.getIsDeletedUser() " + isDeletedUser); if (Validator.isNotNull(businessEmailAddress) && !registrationBean.getIsExistingUser()) { if (registrationDelegator.checkIfUserExistsInLiferayDB(registrationBean, businessEmailAddress) && registrationDelegator.checkIfUserExistsInLiferay(registrationBean, businessEmailAddress) && !isDeletedUser) { log.info("inside dupplicate registration block with questionmark"); SessionErrors.add(renderRequest, USER_EXISTS_KEY); } else { boolean isUserExistInCustomDB = registrationDelegator .checkIfUserExistsInLiferay(registrationBean, businessEmailAddress); log.info("isUserExistInCustomDB : " + isUserExistInCustomDB); if (!isUserExistInCustomDB && !isDeletedUser) { SessionErrors.add(renderRequest, USER_DELETED_KEY); } else { log.info("inside registration block for new registration with questionmark"); registrationBean.setBusinessEmailAddress(businessEmailAddress); registrationBean = registrationDelegator.fetchFromStoxxUser(registrationBean); registrationBean.setBusinessEmailAddress(businessEmailAddress); log.info( "registartion bean email address" + registrationBean.getBusinessEmailAddress()); log.info("the user type is " + registrationBean.getUserType()); if (fetchActivationLinkCreateDateDiff(registrationBean.getBusinessEmailAddress())) { SessionErrors.add(renderRequest, RegistrationConstants.REGISTRATION_LINK_EXPIRED); } if (registrationDelegator.checkIfUserExistsInLiferay(registrationBean) && registrationBean.getUserType() .equalsIgnoreCase(STOXXConstants.STOXX_STAFF_USER) && registrationBean.getUserType() .equalsIgnoreCase(STOXXConstants.STOXX_GENERAL_USER)) { SessionMessages.add(renderRequest, "user-activation-link-already-sent"); } } } } registrationBean.setIsDeletedUser(isDeletedUser); } registrationBean.setIsExistingUser(isExistingUser); registrationBean.setIsDeletedUser(isDeletedUser); log.info("registrationBean.toString() : " + registrationBean.toString()); model.addAttribute(REGISTRATION_BEAN, registrationBean); } catch (STOXXException e) { log.error("STOXXException in handleRenderRequest", e); } catch (Exception e) { log.error("Exception in handleRenderRequest", e); } registrationBean.setIsExistingUser(isExistingUser); registrationBean.setIsDeletedUser(isDeletedUser); return RegistrationConstants.INITIATE_REGISTRATION; }
From source file:com.stoxx.portlet.controller.RegistrationController.java
private void getUserTypeandEmalaIdfromEncrptedUrl(Model model, RegistrationBean registrationBean, String portalUrl) {/* w w w . ja va2 s. co m*/ String businessEmailAddressEncrypted; String userTypEncrypted; Boolean isExistingUser = Boolean.FALSE; Boolean isDeletedUser = Boolean.FALSE; try { businessEmailAddressEncrypted = portalUrl.substring(portalUrl.indexOf(StringPool.QUESTION) + 1, portalUrl.indexOf(StringPool.DOLLAR)); businessEmailAddress = STOXXEncrypter.decrypt(businessEmailAddressEncrypted, ENCRYPTION_KEY); log.info("decrypted email id is&&&&& " + businessEmailAddress); registrationBean.setBusinessEmailAddress(businessEmailAddress); log.info("registartion bean email address" + registrationBean.getBusinessEmailAddress()); userTypEncrypted = portalUrl.split(StringPool.BACK_SLASH + StringPool.DOLLAR)[1]; userType = STOXXEncrypter.decrypt(userTypEncrypted, ENCRYPTION_KEY); registrationBean.setUserType(userType); RegistrationBean registrationBean2 = registrationDelegator.fetchFromStoxxUser(registrationBean); if (Validator.isNotNull(registrationBean2) && Validator.isNotNull(registrationBean2.getStatus()) && registrationBean2.getStatus() == 3) { log.info("<<<<<<<<<the user is an eisting user>>>>>>>>"); isExistingUser = Boolean.TRUE; } if (Validator.isNotNull(registrationBean2) && Validator.isNotNull(registrationBean2.getStatus()) && registrationBean2.getStatus() == 4) { log.info("<<<<<<<<<the user has been deleted previously>>>>>>>>"); isDeletedUser = Boolean.TRUE; } registrationBean.setIsExistingUser(isExistingUser); registrationBean.setIsDeletedUser(isDeletedUser); } catch (STOXXException e) { log.error("STOXXException ", e); } catch (Exception e) { log.error("Exception", e); } log.info("the user type is " + registrationBean.getUserType()); model.addAttribute(REGISTRATION_BEAN, registrationBean); }
From source file:com.twelve.capital.external.feed.util.HttpImpl.java
License:Open Source License
@Override public String addParameter(String url, String name, String value) { if (url == null) { return null; }// w w w .j a v a2 s . com String[] urlArray = PortalUtil.stripURLAnchor(url, StringPool.POUND); url = urlArray[0]; String anchor = urlArray[1]; StringBundler sb = new StringBundler(7); sb.append(url); if (url.indexOf(CharPool.QUESTION) == -1) { sb.append(StringPool.QUESTION); } else if (!url.endsWith(StringPool.QUESTION) && !url.endsWith(StringPool.AMPERSAND)) { sb.append(StringPool.AMPERSAND); } sb.append(name); sb.append(StringPool.EQUAL); sb.append(encodeURL(value)); sb.append(anchor); return sb.toString(); }