List of usage examples for com.liferay.portal.kernel.util PropsUtil get
public static String get(String key)
From source file:com.ssavr.solr.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }/*from w ww .ja v a2 s . co m*/ synchronized (ClpSerializer.class) { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; } try { ClassLoader classLoader = ClpSerializer.class.getClassLoader(); Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps"); Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class }); String portletPropsServletContextName = (String) getMethod.invoke(null, "liferay-solr-tutorial-portlet-deployment-context"); if (Validator.isNotNull(portletPropsServletContextName)) { _servletContextName = portletPropsServletContextName; } } catch (Throwable t) { if (_log.isWarnEnabled()) { _log.warn("Unable to locate deployment context from portlet properties", t); } } if (Validator.isNull(_servletContextName)) { try { String propsUtilServletContextName = PropsUtil .get("liferay-solr-tutorial-portlet-deployment-context"); if (Validator.isNotNull(propsUtilServletContextName)) { _servletContextName = propsUtilServletContextName; } } catch (Throwable t) { if (_log.isWarnEnabled()) { _log.warn("Unable to locate deployment context from portal properties", t); } } } if (Validator.isNull(_servletContextName)) { _servletContextName = "liferay-solr-tutorial-portlet"; } return _servletContextName; } }
From source file:com.ssde.cfdi.db.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }/*from w ww . ja v a 2 s . c o m*/ synchronized (ClpSerializer.class) { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; } try { ClassLoader classLoader = ClpSerializer.class.getClassLoader(); Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps"); Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class }); String portletPropsServletContextName = (String) getMethod.invoke(null, "ssde-cfdi-facturas-portlet-deployment-context"); if (Validator.isNotNull(portletPropsServletContextName)) { _servletContextName = portletPropsServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portlet properties"); } } if (Validator.isNull(_servletContextName)) { try { String propsUtilServletContextName = PropsUtil .get("ssde-cfdi-facturas-portlet-deployment-context"); if (Validator.isNotNull(propsUtilServletContextName)) { _servletContextName = propsUtilServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portal properties"); } } } if (Validator.isNull(_servletContextName)) { _servletContextName = "ssde-cfdi-facturas-portlet"; } return _servletContextName; } }
From source file:com.ssde.sfe.db.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }//from w w w. j a v a 2s . co m synchronized (ClpSerializer.class) { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; } try { ClassLoader classLoader = ClpSerializer.class.getClassLoader(); Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps"); Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class }); String portletPropsServletContextName = (String) getMethod.invoke(null, "sfe-portlet-deployment-context"); if (Validator.isNotNull(portletPropsServletContextName)) { _servletContextName = portletPropsServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portlet properties"); } } if (Validator.isNull(_servletContextName)) { try { String propsUtilServletContextName = PropsUtil.get("sfe-portlet-deployment-context"); if (Validator.isNotNull(propsUtilServletContextName)) { _servletContextName = propsUtilServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portal properties"); } } } if (Validator.isNull(_servletContextName)) { _servletContextName = "sfe-portlet"; } return _servletContextName; } }
From source file:com.startarget.portlet.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }/*from w w w .ja v a 2 s. co m*/ synchronized (ClpSerializer.class) { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; } try { ClassLoader classLoader = ClpSerializer.class.getClassLoader(); Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps"); Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class }); String portletPropsServletContextName = (String) getMethod.invoke(null, "fund-portlet-deployment-context"); if (Validator.isNotNull(portletPropsServletContextName)) { _servletContextName = portletPropsServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portlet properties"); } } if (Validator.isNull(_servletContextName)) { try { String propsUtilServletContextName = PropsUtil.get("fund-portlet-deployment-context"); if (Validator.isNotNull(propsUtilServletContextName)) { _servletContextName = propsUtilServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portal properties"); } } } if (Validator.isNull(_servletContextName)) { _servletContextName = "fund-portlet"; } return _servletContextName; } }
From source file:com.stickynotes.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }/*from w w w .j av a 2 s. c om*/ synchronized (ClpSerializer.class) { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; } try { ClassLoader classLoader = ClpSerializer.class.getClassLoader(); Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps"); Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class }); String portletPropsServletContextName = (String) getMethod.invoke(null, "stickyNotes-portlet-deployment-context"); if (Validator.isNotNull(portletPropsServletContextName)) { _servletContextName = portletPropsServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portlet properties"); } } if (Validator.isNull(_servletContextName)) { try { String propsUtilServletContextName = PropsUtil.get("stickyNotes-portlet-deployment-context"); if (Validator.isNotNull(propsUtilServletContextName)) { _servletContextName = propsUtilServletContextName; } } catch (Throwable t) { if (_log.isInfoEnabled()) { _log.info("Unable to locate deployment context from portal properties"); } } } if (Validator.isNull(_servletContextName)) { _servletContextName = "stickyNotes-portlet"; } return _servletContextName; } }
From source file:com.stoxx.portlet.accountdetails.controller.AccountDetailsController.java
@RenderMapping public String showHomePage(final RenderRequest request, final RenderResponse response, final Model model) { try {/*from w w w .j av a 2s .c om*/ ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); User user = themeDisplay.getUser(); long stoxxnetGroupId = Long.parseLong(PropsUtil.get("site.stoxxnet.groupid")); log.info("themeDisplay.getUser()>>>>>>>>>>>>>" + themeDisplay.getUser()); accountDetails = accountDetailsDelegate.getSalesForceDetails(user.getEmailAddress()); if (null != accountDetails) { accountDetails.setKeyAccHolderName(user.getFullName()); accountDetails.setContactEmail(user.getEmailAddress()); companyName = accountDetails.getCompanyName(); if (StringUtils.isNotBlank(accountDetails.getPackageName())) { List<PackageModel> packageModels = new ArrayList<PackageModel>(); for (String pkgname : accountDetails.getPackageName().split(StringPool.COMMA)) { PackageModel packageModel = new PackageModel(); String articleId = StringPool.BLANK; JournalArticle journalArticle; log.info("pkgname>>>>>>>>>>>>>" + pkgname); log.info( "accountDetails.getSalesEntryId()>>>>>>>>>>>>>" + accountDetails.getSalesEntryId()); try { journalArticle = JournalArticleLocalServiceUtil.getArticleByUrlTitle( Long.valueOf(PropsUtil.get(SITE_STOXXNET_GROUPID)).longValue(), AccountDetailsUtil.getUrlTitle(pkgname)); String articleText = JournalContentUtil.getContent( Long.valueOf(PropsUtil.get("site.stoxxnet.groupid")), journalArticle.getArticleId(), "VIEW", journalArticle.getUrlTitle(), themeDisplay); articleId = journalArticle.getArticleId(); packageModel.setArticleId(articleId); packageModel.setPackageText(articleText); log.info("articleId>>>>>>>>>>>>>" + articleId); } catch (Exception e) { log.error("Exception is >>>>>>>>>>>>>" + e.getMessage()); } packageModel.setDescription(pkgname); packageModel.setArticleId(articleId); packageModel.setIsBluePackage( packageDetailsService.getPackageCategoryByPackageName(pkgname.trim())); packageModel.setStoxxnetGroupId(stoxxnetGroupId); packageModels.add(packageModel); } accountDetails.setPackageList(packageModels); } } if (Validator.isNotNull(accountDetails)) { accessDetails = accountDetailsDelegate.getLicensedUsers(accountDetails.getSalesEntryId(), user.getEmailAddress()); } if (null != accessDetails && null != accountDetails && accessDetails.size() > 0) { log.info("accountDetails.getSalesEntryId() in side setting accesdetails >>>>>>>>>>>>>" + accountDetails.getSalesEntryId()); if (StringUtils.isNotBlank(accountDetails.getTotalUsers())) { int totalUsers = Integer.valueOf(accountDetails.getTotalUsers()).intValue(); log.info("totalUsers" + totalUsers); int usedUsers = accessDetails.size(); log.info("usedUsers>>>>>>>>>>>>>" + usedUsers); if (usedUsers == totalUsers) { unUsedUsers = 0; log.info("unUsedUsers>>>>>>>>>>>>>" + unUsedUsers); accountDetails.setUnUsedUsers(unUsedUsers + StringPool.BLANK); } else { unUsedUsers = totalUsers - usedUsers; accountDetails.setUnUsedUsers(unUsedUsers + StringPool.BLANK); } } } if (null != accessDetails && null != accountDetails && accessDetails.size() > 0) { model.addAttribute("accountDetails", accountDetails); model.addAttribute("accessDetails", accessDetails); } } catch (STOXXException e) { log.error("STOXXException in AccountDetailsController" + e); } catch (SystemException e) { log.error(e.getMessage() + e); } catch (NumberFormatException e) { log.error(e.getMessage() + e); } return SHOWHOMEPAGE; }
From source file:com.stoxx.portlet.accountdetails.controller.AccountDetailsController.java
@ActionMapping(params = "action=deleteUser") public void deleteUser(final ActionRequest request, final ActionResponse response, @ModelAttribute("accountDetails") AccountDetails accountDetails, final Model model) { Map<String, Object> emailBodyMap = new HashMap<String, Object>(); try {//w w w . j a va2 s. c om ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); String emailTemplateFolder = "templates"; String emailVelocityTemplate = StringPool.BLANK; emailVelocityTemplate = emailTemplateFolder + "/" + "keyAccHolderDeactivationMail.vm"; String deleteEmail = request.getParameter("deleteEmail"); log.info("accountDetails.getKeyAccHolderName()>>>>> " + accountDetails.getKeyAccHolderName()); log.info("deleteEmail>>>>> " + deleteEmail); if (StringUtils.isNotBlank(accountDetails.getKeyAccHolderName()) && StringUtils.isNotBlank(deleteEmail)) { emailBodyMap.put(TO_NAME, deleteEmail); emailBodyMap.put(FROM_NAME, PrefsPropsUtil.getString("stoxx-mail-from-name")); emailBodyMap.put(FROM_ADDRESS, PropsUtil.get(STOXX_MAIL_FROM_ADDRESS)); emailBodyMap.put(PORTAL_URL, PrefsPropsUtil.getString("stoxx-mail-from-url")); emailBodyMap.put(MESSAGE_SECTION, LanguageUtil.get(themeDisplay.getLocale(), "stoxx-accountDetails-delete-licenced-user") + StringPool.SPACE + accountDetails.getKeyAccHolderName()); log.info(emailBodyMap.get(TO_NAME) + " " + emailBodyMap.get(FROM_NAME) + " " + emailBodyMap.get(FROM_ADDRESS) + " " + emailBodyMap.get(PORTAL_URL) + " " + emailBodyMap.get(MESSAGE_SECTION)); accountDetailsDelegate.deleteUserByEmail(themeDisplay.getCompanyId(), deleteEmail, themeDisplay.getUser()); stoxxMailUtil.sendEmailNotification( deleteEmail, PropsUtil.get(STOXX_MAIL_FROM_ADDRESS), emailVelocityTemplate, LanguageUtil .get(themeDisplay.getLocale(), "stoxx-accountDetails-delete-licenced-user-subject"), emailBodyMap); } request.setAttribute("deleteusermsg", "SUCCESS"); } catch (SystemException e) { log.error(e.getMessage() + e); } catch (MessagingException e) { log.error(e.getMessage() + e); } }
From source file:com.stoxx.portlet.accountdetails.controller.AccountDetailsController.java
@ActionMapping(params = "action=addUser") public void saveCustomerAsStoxxUsersByEmail(ActionRequest request, ActionResponse response) { log.info("inside saveCustomerAsStoxxUsers--"); ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); String emailTemplateFolder = "templates"; String emailVelocityTemplate = emailTemplateFolder + "/" + "subUsersActivationEmail.vm"; String userEmail = request.getParameter("memberData"); userEmail = StringUtil.toLowerCase(userEmail); String accountType = request.getParameter("typeData"); log.info("userEmail>>>>> " + userEmail); log.info("accountType>>>>> " + accountType); try {/*from ww w . jav a 2s .c o m*/ log.info("unUsedUsers in adduser >>>>>>>>>>>>>>>>>>>>" + unUsedUsers); if (0 != unUsedUsers) { if (StringUtils.isNotBlank(userEmail) && StringUtils.isNotBlank(accountType)) { if (Validator .isNotNull(StringUtil.trim(ListUtil.toString(accountDetails.getDomains(), "", "")))) { boolean isValidDomain = false; for (String domain : accountDetails.getDomains()) { domain = StringUtil.toLowerCase(domain); if (userEmail.endsWith(domain)) { isValidDomain = true; break; } } if (!isValidDomain) { request.setAttribute(ADDUSERMSG, "INVALID_DOMAIN"); return; } } if (checkCaptcha(request)) { log.info("Answer was entered correctly!"); Map<String, Object> emailBodyMap = new HashMap<String, Object>(); emailBodyMap.put(FROM_NAME, PrefsPropsUtil.getString("stoxx-mail-from-name")); emailBodyMap.put(FROM_ADDRESS, PropsUtil.get(STOXX_MAIL_FROM_ADDRESS)); emailBodyMap.put(PORTAL_URL, PrefsPropsUtil.getString("stoxx-mail-from-url")); log.info("Email addresses>>>>> "); log.info("Email addresses>>>>> " + userEmail); String encryptedEmailId = STOXXEncrypter.encrypt(userEmail, ENCRYPTION_KEY); String activationLink = themeDisplay.getPortalURL() + PrefsPropsUtil.getString("stoxx-pre-reg-admin-acount-registration") + encryptedEmailId; log.info("ADD USER activationlink >>>>>>>>>>>>>>>>>>>>>>>>>>" + activationLink); if (StringUtils.isNotBlank(companyName)) { User userlocal = null; UserProfileDetails profileDetailsLocal = accountDetailsDelegate .getUserProfile(userEmail); boolean isDeletedUser = (profileDetailsLocal != null && Validator.equals(profileDetailsLocal.getStatus(), Integer.valueOf(4))); try { userlocal = UserLocalServiceUtil.getUserByEmailAddress(themeDisplay.getCompanyId(), userEmail); } catch (NoSuchUserException e) { log.error(e.getMessage(), e); } catch (PortalException e) { log.error(e.getMessage(), e); } if (null == userlocal && !(StringUtils.isNotBlank(profileDetailsLocal.getEmailAddress()))) { accountDetailsDelegate.saveStoxxUser( themeDisplay.getUser().getEmailAddress().toLowerCase(), userEmail, activationLink, companyName, accountType); emailBodyMap.put(TO_NAME, userEmail); emailBodyMap.put("userActivationLink", activationLink); stoxxMailUtil.sendEmailNotification(userEmail, PropsUtil.get(STOXX_MAIL_FROM_ADDRESS), emailVelocityTemplate, LanguageUtil.get(themeDisplay.getLocale(), "stoxx-prereg-email-subject"), emailBodyMap); request.setAttribute(ADDUSERMSG, "SUCCESS"); } else { if (isDeletedUser) { accountDetailsDelegate.updateStoxxUser( themeDisplay.getUser().getEmailAddress().toLowerCase(), activationLink, accountType, companyName, profileDetailsLocal); emailBodyMap.put(TO_NAME, userEmail); emailBodyMap.put("userActivationLink", activationLink); stoxxMailUtil.sendEmailNotification(userEmail, PropsUtil.get(STOXX_MAIL_FROM_ADDRESS), emailVelocityTemplate, LanguageUtil.get(themeDisplay.getLocale(), "stoxx-prereg-email-subject"), emailBodyMap); request.setAttribute(ADDUSERMSG, "SUCCESS"); } else if (null != userlocal && (StringUtils.isNotBlank(profileDetailsLocal.getEmailAddress())) && !isDeletedUser) { if (null != profileDetailsLocal.getSalesEntryId()) { request.setAttribute(ADDUSERMSG, "ADDREGISTER"); } else { request.setAttribute(ADDUSERMSG, "ADDREGISTEROTHER"); } } else if (null != userlocal && !(StringUtils.isNotBlank(profileDetailsLocal.getEmailAddress()))) { request.setAttribute(ADDUSERMSG, "EXISTS"); } else if (null == userlocal && (StringUtils.isNotBlank(profileDetailsLocal.getEmailAddress()))) { if (null != profileDetailsLocal.getSalesEntryId()) { request.setAttribute(ADDUSERMSG, "ADD"); } else { request.setAttribute(ADDUSERMSG, "ADDOTHER"); } } } } } else { request.setAttribute(ADDUSERMSG, "WRONGCAPTCHA"); } } } else { request.setAttribute(ADDUSERMSG, "FAILURE"); } } catch (STOXXException e) { log.error("STOXXException in AccountDetailsController", e); } catch (SystemException e) { log.error(e.getMessage(), e); } catch (MessagingException e) { log.error(e.getMessage(), e); } catch (PortletException e) { log.error(e.getMessage(), e); } }
From source file:com.stoxx.portlet.controller.RegistrationController.java
/** * @param registrationBean//from w w w. j a v a 2 s . c om * @param themeDisplay * @param liferayStoxxUser * @throws SystemException * @throws PortalException * @throws STOXXException */ private RegistrationBean populateFields(RegistrationBean registrationBean, ThemeDisplay themeDisplay, User liferayStoxxUser) throws SystemException, PortalException, STOXXException { registrationBean.setFirstName(liferayStoxxUser.getFirstName()); registrationBean.setLastName(liferayStoxxUser.getLastName()); registrationBean.setJobTitle(liferayStoxxUser.getJobTitle()); registrationBean.setCity(liferayStoxxUser.getAddresses().get(0).getCity()); registrationBean.setCountryId(liferayStoxxUser.getAddresses().get(0).getCountryId()); Map<String, Integer> titleList = STOXXUtil.getTitleList(); registrationBean.setTitleList(titleList); String gender = LanguageUtil.get(themeDisplay.getLocale(), "stoxx-registration-female"); if (liferayStoxxUser.isMale()) { gender = LanguageUtil.get(themeDisplay.getLocale(), "stoxx-registration-male"); } registrationBean.setGender(gender); Date dateToConvert = liferayStoxxUser.getBirthday(); String dateOfBirth = STOXXDateUtil.convertDateToStringInStoxxApplicationDateFormat(dateToConvert); String defaultBitrhday = PropsUtil.get("stoxx-registration-default-date-of-birthday"); if (StringUtils.isNotBlank(defaultBitrhday)) { defaultBitrhday = defaultBitrhday.replace(StringPool.COMMA, StringPool.COMMA + StringPool.SPACE); } if (StringUtils.isNotBlank(dateOfBirth)) { if (defaultBitrhday.equalsIgnoreCase(dateOfBirth.trim())) { dateOfBirth = StringPool.BLANK; } else { registrationBean.setDateOfBirth(dateOfBirth); } } else { dateOfBirth = StringPool.BLANK; } log.info("The date of birth is >>>>>>>>" + dateOfBirth); registrationBean.setDateOfBirth(dateOfBirth); if (StringUtils.isNotBlank(dateOfBirth)) { registrationBean.setDateOfBirth(dateOfBirth); } if (Validator.isNotNull(registrationBean) && Validator.isNotNull(registrationBean.isEmailContactPref())) { registrationBean.setEmailContactPref(registrationBean.isEmailContactPref()); } liferayStoxxUser.getAddresses().get(0).getCountry().getName(themeDisplay.getLocale()); registrationBean.setPhoneNumber(liferayStoxxUser.getPhones().get(0).getNumber()); registrationBean.setUserZipCode(liferayStoxxUser.getAddresses().get(0).getZip()); registrationBean.setUserAddress(liferayStoxxUser.getAddresses().get(0).getStreet1()); registrationBean.setUserAddress1(liferayStoxxUser.getAddresses().get(0).getStreet2()); return registrationBean; }
From source file:com.stoxx.portlet.controller.RegistrationController.java
/** * @param registrationBean//from w w w. ja v a2 s . co m * @param themeDisplay * @param emailBodyMap * @param emailTemplateFolder * @throws SystemException * @throws MessagingException */ protected void sendEmailByTemplate(RegistrationBean registrationBean, ThemeDisplay themeDisplay) throws SystemException, MessagingException { Map<String, Object> emailBodyMap = new HashMap<String, Object>(); String emailTemplateFolder = "templates"; try { String emailVelocityTemplate = StringPool.BLANK; emailVelocityTemplate = emailTemplateFolder + "/" + "registrationActivationMail.vm"; emailBodyMap.put("toName", registrationBean.getBusinessEmailAddress()); emailBodyMap.put("activationLink", registrationBean.getActivationLink()); emailBodyMap.put("fromName", PrefsPropsUtil.getString("stoxx-reg-mail-from-name")); emailBodyMap.put("fromAddress", PropsUtil.get("stoxx-reg-mail-from-address")); emailBodyMap.put("portalURL", PrefsPropsUtil.getString("stoxx-reg-mail-from-url")); stoxxMailUtil.sendEmailNotification(registrationBean.getBusinessEmailAddress(), PropsUtil.get("stoxx-reg-mail-from-address"), emailVelocityTemplate, LanguageUtil.get(themeDisplay.getLocale(), "stoxx-reg-email-subject"), emailBodyMap); } catch (MessagingException e) { log.error("Exception in sendEmailByTemplate", e); } }