List of usage examples for com.liferay.portal.kernel.util PropsUtil get
public static String get(String key)
From source file:ch.inofix.referencemanager.service.impl.ReferenceLocalServiceImpl.java
License:Open Source License
@Indexable(type = IndexableType.REINDEX) public Reference updateReference(long referenceId, long userId, String bibTeX, long[] bibliographyIds, ServiceContext serviceContext) throws PortalException { // Reference// w w w .j a v a 2 s . c o m User user = userPersistence.findByPrimaryKey(userId); Reference reference = referencePersistence.findByPrimaryKey(referenceId); long groupId = serviceContext.getScopeGroupId(); long companyId = user.getCompanyId(); reference.setUuid(serviceContext.getUuid()); reference.setGroupId(groupId); reference.setCompanyId(companyId); reference.setUserId(user.getUserId()); reference.setUserName(user.getFullName()); reference.setExpandoBridgeAttributes(serviceContext); BibTeXEntry bibTeXEntry = BibTeXUtil.getBibTeXEntry(bibTeX); if (bibTeXEntry != null) { Key key = new Key("bibshare-last-modified"); Value value = new StringValue(String.valueOf(new Date().getTime()), Style.QUOTED); bibTeXEntry.addField(key, value); } else { // TODO: raise an error and report to the user that something is // wrong with the bibtex-src. } bibTeX = BibTeXUtil.format(bibTeXEntry); reference.setBibTeX(bibTeX); reference = referencePersistence.update(reference); // Match user and group references against common references long defaultGroupId = GetterUtil.getLong(PropsUtil.get("default.group.id")); if (reference.getGroupId() != defaultGroupId) { match(reference); } // BibRefRelation for (long bibliographyId : bibliographyIds) { Bibliography bibliography = bibliographyLocalService.getBibliography(bibliographyId); long bibRefRelationId = counterLocalService.increment(); BibRefRelation bibRefRelation = bibRefRelationPersistence.create(bibRefRelationId); bibRefRelation.setGroupId(bibliography.getGroupId()); bibRefRelation.setCompanyId(bibliography.getCompanyId()); bibRefRelation.setUserId(bibliography.getUserId()); bibRefRelation.setUserName(bibliography.getUserName()); bibRefRelation.setBibliographyId(bibliography.getBibliographyId()); bibRefRelation.setReferenceId(referenceId); bibRefRelationPersistence.update(bibRefRelation); } // Resources resourceLocalService.addModelResources(reference, serviceContext); // Asset updateAsset(userId, reference, serviceContext.getAssetCategoryIds(), serviceContext.getAssetTagNames(), serviceContext.getAssetLinkEntryIds(), serviceContext.getAssetPriority()); // Social JSONObject extraDataJSONObject = JSONFactoryUtil.createJSONObject(); extraDataJSONObject.put("title", reference.getCitation()); socialActivityLocalService.addActivity(userId, groupId, Reference.class.getName(), referenceId, ReferenceActivityKeys.UPDATE_REFERENCE, extraDataJSONObject.toString(), 0); return reference; }
From source file:cn.zoneco.openplatform.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 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, "service-log-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("service-log-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 = "service-log-portlet"; } return _servletContextName; } }
From source file:com.abubusoft.liferay.linkedin.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 linkedinId = ParamUtil.getString(actionRequest, "linkedinId"); 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;/*from www .j a v a2 s . c o m*/ 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, "linkedinId", user.getUserId(), linkedinId); session.setAttribute(LinkedinConstants.LINKEDIN_ID_LOGIN, new Long(user.getUserId())); session.removeAttribute(LinkedinConstants.LINKEDIN_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()); }
From source file:com.abubusoft.liferay.linkedin.LinkedinOAuth.java
License:Open Source License
@SuppressWarnings("unchecked") protected Map<String, Object> getLinkedinData(OAuth20Service service, OAuth2AccessToken accessToken) throws Exception { String verifyCredentialsURL = PropsUtil.get("linkedin.api.verify.credentials.url"); OAuthRequest authrequest = new OAuthRequest(Verb.GET, verifyCredentialsURL, service); service.signRequest(accessToken, authrequest); String responseData = authrequest.send().getBody(); Map<String, Object> jsonResponseMap = new Gson().fromJson(responseData, Map.class); return jsonResponseMap; }
From source file:com.abubusoft.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;/*from 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, TwitterConstants.TWITTER_ID_COLUMN_NAME, 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()); }
From source file:com.abubusoft.liferay.twitter.TwitterOAuth.java
License:Open Source License
@SuppressWarnings("unchecked") protected Map<String, Object> getTwitterData(OAuth10aService service, OAuth1AccessToken accessToken) throws Exception { String verifyCredentialsURL = PropsUtil.get("twitter.api.verify.credentials.url"); OAuthRequest authrequest = new OAuthRequest(Verb.GET, verifyCredentialsURL, service); service.signRequest(accessToken, authrequest); String responseData = authrequest.send().getBody(); Map<String, Object> jsonResponseMap = new Gson().fromJson(responseData, Map.class); return jsonResponseMap; }
From source file:com.acharles.mobilephones.service.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }//from w ww .j a 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, "ACharles-MobilePhones-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("ACharles-MobilePhones-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 = "ACharles-MobilePhones-portlet"; } return _servletContextName; } }
From source file:com.addfacultypreferences.slayer.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }/*from ww w . ja va2s.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, "addfacultypreferences-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("addfacultypreferences-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 = "addfacultypreferences-portlet"; } return _servletContextName; } }
From source file:com.amf.registration.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }/*from ww w.j a va 2s . 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, "Registration-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("Registration-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 = "Registration-portlet"; } return _servletContextName; } }
From source file:com.amf.user.profile.service.ClpSerializer.java
License:Open Source License
public static String getServletContextName() { if (Validator.isNotNull(_servletContextName)) { return _servletContextName; }//from w ww. j a va2 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, "user-profile-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("user-profile-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 = "user-profile-portlet"; } return _servletContextName; } }