List of usage examples for com.liferay.portal.kernel.util PropsUtil get
public static String get(String key)
From source file:com.liferay.testlog.portlet.TestLogPortlet.java
License:Open Source License
@Override public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException { PrintWriter printWriter = renderResponse.getWriter(); if (_log.isInfoEnabled()) { printWriter.write("Log#isEnabled=PASSED\n"); } else {/*from w ww .j ava 2s. c o m*/ printWriter.write("Log#isEnabled=FAILED\n"); } File file = new File(PropsUtil.get(PropsKeys.LIFERAY_HOME) + "/logs/test-log-portlet." + _format.format(new Date()) + ".log"); if (file.exists()) { printWriter.write(file + "=PASSED\n"); } else { printWriter.write(file + "=FAILED\n"); } printWriter.close(); }
From source file:com.liferay.testpacl.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }// www .j av a2 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, "test-pacl-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("test-pacl-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 = "test-pacl-portlet"; } return _servletContextName; } }
From source file:com.liferay.testtransaction.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }// w ww.ja v a 2s. 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, "test-transaction-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("test-transaction-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 = "test-transaction-portlet"; } return _servletContextName; } }
From source file:com.liferay.timemanagement.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }/*from w w w . j a v a2s . 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, "timemanagement-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("timemanagement-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 = "timemanagement-portlet"; } return _servletContextName; } }
From source file:com.liferay.timesheet.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }// w w w . j av 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, "timesheet-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("timesheet-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 = "timesheet-portlet"; } return _servletContextName; } }
From source file:com.liferay.timetracking.activities.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }//from ww w. ja v a 2s.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, "time-tracking-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("time-tracking-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 = "time-tracking-portlet"; } return _servletContextName; } }
From source file:com.liferay.training.amf2.builder.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }//from w w w . jav a2s .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, "custom-signup-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("custom-signup-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 = "custom-signup-portlet"; } return _servletContextName; } }
From source file:com.liferay.training.newsletter.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }/* w w w . j a v a2s . 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, "newsletter-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("newsletter-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 = "newsletter-portlet"; } return _servletContextName; } }
From source file:com.liferay.training.parts.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }/*w w w . j a v a 2s.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, "parts-inventory-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("parts-inventory-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 = "parts-inventory-portlet"; } return _servletContextName; } }
From source file:com.liferay.twitter.CreateAccountAction.java
License:Open Source License
protected void addUser(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest); HttpSession session = request.getSession(); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); Company company = themeDisplay.getCompany(); long creatorUserId = 0; long facebookId = ParamUtil.getLong(actionRequest, "facebookId"); boolean autoPassword = true; boolean autoScreenName = false; boolean male = ParamUtil.getBoolean(actionRequest, "male", true); boolean sendEmail = true; String twitterId = ParamUtil.getString(actionRequest, "twitterId"); String emailAddress = ParamUtil.getString(actionRequest, "emailAddress"); String screenName = ParamUtil.getString(actionRequest, "screenName"); String firstName = ParamUtil.getString(actionRequest, "firstName"); String lastName = ParamUtil.getString(actionRequest, "lastName"); String middleName = ParamUtil.getString(actionRequest, "middleName"); String password1 = StringPool.BLANK; String password2 = StringPool.BLANK; String jobTitle = ParamUtil.getString(actionRequest, "jobTitle"); String openId = StringPool.BLANK; int birthdayMonth = ParamUtil.getInteger(actionRequest, "birthdayMonth"); int birthdayDay = ParamUtil.getInteger(actionRequest, "birthdayDay"); int birthdayYear = ParamUtil.getInteger(actionRequest, "birthdayYear"); int prefixId = ParamUtil.getInteger(actionRequest, "prefixId"); int suffixId = ParamUtil.getInteger(actionRequest, "suffixId"); Locale locale = themeDisplay.getLocale(); long[] groupIds = null; long[] organizationIds = null; long[] roleIds = null; long[] userGroupIds = null; if (GetterUtil.getBoolean(PropsUtil.get(PropsKeys.LOGIN_CREATE_ACCOUNT_ALLOW_CUSTOM_PASSWORD))) { autoPassword = false;// w w w . ja v a 2 s. c om password1 = ParamUtil.getString(actionRequest, "password1"); password2 = ParamUtil.getString(actionRequest, "password2"); } ServiceContext serviceContext = new ServiceContext(); User user = UserLocalServiceUtil.addUser(creatorUserId, company.getCompanyId(), autoPassword, password1, password2, autoScreenName, screenName, emailAddress, facebookId, openId, locale, firstName, middleName, lastName, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext); user = UserLocalServiceUtil.updateLastLogin(user.getUserId(), user.getLoginIP()); user = UserLocalServiceUtil.updatePasswordReset(user.getUserId(), false); user = UserLocalServiceUtil.updateEmailAddressVerified(user.getUserId(), false); ExpandoValueLocalServiceUtil.addValue(company.getCompanyId(), User.class.getName(), ExpandoTableConstants.DEFAULT_TABLE_NAME, "twitterId", user.getUserId(), twitterId); session.setAttribute(TwitterConstants.TWITTER_ID_LOGIN, new Long(user.getUserId())); session.removeAttribute(TwitterConstants.TWITTER_LOGIN_PENDING); PortletURL portletURL = PortletURLFactoryUtil.create(request, PortletKeys.FAST_LOGIN, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); portletURL.setWindowState(LiferayWindowState.POP_UP); portletURL.setParameter("struts_action", "/login/login_redirect"); actionResponse.sendRedirect(portletURL.toString()); }