List of usage examples for com.liferay.portal.kernel.util PrefsPropsUtil getBoolean
public static boolean getBoolean(String name, boolean defaultValue)
From source file:com.liferay.trash.internal.TrashHelperImpl.java
License:Open Source License
@Override public boolean isTrashEnabled(Group group) { boolean companyTrashEnabled = PrefsPropsUtil.getBoolean(group.getCompanyId(), PropsKeys.TRASH_ENABLED); if (!companyTrashEnabled) { return false; }//from ww w.j a va 2 s . com UnicodeProperties typeSettingsProperties = group.getParentLiveGroupTypeSettingsProperties(); return GetterUtil.getBoolean(typeSettingsProperties.getProperty("trashEnabled"), true); }
From source file:com.slemarchand.peoplepublisher.util.PeoplePublisherImpl.java
License:Open Source License
@Override public boolean isScopeIdSelectable(PermissionChecker permissionChecker, String scopeId, long companyGroupId, Layout layout) throws PortalException, SystemException { long groupId = getGroupIdFromScopeId(scopeId, layout.getGroupId(), layout.isPrivateLayout()); if (scopeId.startsWith(SCOPE_ID_CHILD_GROUP_PREFIX)) { Group group = GroupLocalServiceUtil.getGroup(groupId); if (!group.hasAncestor(layout.getGroupId())) { return false; }/*from w w w. jav a 2 s . co m*/ } else if (scopeId.startsWith(SCOPE_ID_PARENT_GROUP_PREFIX)) { Group siteGroup = layout.getGroup(); if (!siteGroup.hasAncestor(groupId)) { return false; } Group group = GroupLocalServiceUtil.getGroup(groupId); if (SitesUtil.isContentSharingWithChildrenEnabled(group)) { return true; } if (!PrefsPropsUtil.getBoolean(layout.getCompanyId(), PropsKeys.SITES_CONTENT_SHARING_THROUGH_ADMINISTRATORS_ENABLED)) { return false; } return GroupPermissionUtil.contains(permissionChecker, groupId, ActionKeys.UPDATE); } else if (groupId != companyGroupId) { return GroupPermissionUtil.contains(permissionChecker, groupId, ActionKeys.UPDATE); } return true; }
From source file:fi.javaguru.akismet.mb.hook.action.EditMessageAction.java
License:Open Source License
public void processAction(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { long companyId = PortalUtil.getCompanyId(actionRequest); boolean enabled = PrefsPropsUtil.getBoolean(companyId, "akismet.enabled"); String cmd = actionRequest.getParameter("cmd"); String redirect = ParamUtil.getString(actionRequest, "redirect"); if (enabled && Validator.isNotNull(cmd) && (cmd.equals("SPAM") || cmd.equals("HAM"))) { try {/*from w ww . j av a2 s . c o m*/ updateStatus(actionRequest, actionResponse); SessionMessages.add(actionRequest, "request_processed", null); } catch (Exception e) { SessionErrors.add(actionRequest, e.getClass().getName()); } redirect = PortalUtil.escapeRedirect(redirect); actionResponse.sendRedirect(redirect); } else { originalStrutsPortletAction.processAction(portletConfig, actionRequest, actionResponse); } }
From source file:fi.javaguru.akismet.mb.hook.service.AkismetMBMessageLocalServiceImpl.java
License:Open Source License
protected boolean isEnabled(long companyId) throws SystemException { return PrefsPropsUtil.getBoolean(companyId, "akismet.enabled"); }
From source file:it.sysdata.mqtt.service.impl.MqttLocalServiceImpl.java
License:Open Source License
@Override public void messageArrived(String topic, MqttMessage message) throws Exception { Message mb = new Message(); mb.put("topic", topic); mb.put("qos", message.getQos()); mb.put("retained", message.isRetained()); String payload = new String(message.getPayload()); mb.setPayload(payload);/*from w w w . j av a2 s . c o m*/ MessageBusUtil.sendMessage(PortletPropsValues.MQTT_MESSAGES_DESTINATION, mb); boolean logInfo = PrefsPropsUtil.getBoolean(PortletPropsKeys.MQTT_EVENTS_LOGINFO, PortletPropsValues.MQTT_EVENTS_LOGINFO); if (logInfo) { _log.info(String.format("arrived [%s,%s,%s] %s", topic, message.getQos(), message.isRetained() ? "R" : "", payload)); } }
From source file:it.sysdata.mqtt.service.impl.MqttLocalServiceImpl.java
License:Open Source License
@Override public void publish(String topic, byte[] payload, int qos) throws MqttException, SystemException { _getInstance().publish(topic, payload, qos, false); boolean logInfo = PrefsPropsUtil.getBoolean(PortletPropsKeys.MQTT_EVENTS_LOGINFO, PortletPropsValues.MQTT_EVENTS_LOGINFO); if (logInfo) { _log.info(String.format("send [%s,%s] %s", topic, qos, payload)); }//from w w w.ja v a 2 s. co m }
From source file:it.sysdata.mqtt.service.impl.MqttLocalServiceImpl.java
License:Open Source License
@Override public void subscribe(String topic, int qos) throws MqttException, SystemException { _getInstance().subscribe(topic, qos); boolean logInfo = PrefsPropsUtil.getBoolean(PortletPropsKeys.MQTT_EVENTS_LOGINFO, PortletPropsValues.MQTT_EVENTS_LOGINFO); if (logInfo) { _log.info("subscribe " + topic); }/* w ww . j av a 2s. co m*/ }
From source file:org.opencps.util.MessageBusUtil.java
License:Open Source License
public static void sendEmailActiveAccount(User user, String password, ServiceContext serviceContext) throws SystemException { if (!PrefsPropsUtil.getBoolean(user.getCompanyId(), PropsKeys.ADMIN_EMAIL_USER_ADDED_ENABLED)) { return;/*ww w . j a v a 2 s . c o m*/ } String fromName = PrefsPropsUtil.getString(user.getCompanyId(), PropsKeys.ADMIN_EMAIL_FROM_NAME); String fromAddress = PrefsPropsUtil.getString(user.getCompanyId(), PropsKeys.ADMIN_EMAIL_FROM_ADDRESS); String toName = user.getFullName(); String toAddress = user.getEmailAddress(); String subject = PrefsPropsUtil.getContent(user.getCompanyId(), PropsKeys.ADMIN_EMAIL_USER_ADDED_SUBJECT); String body = null; if (Validator.isNotNull(password)) { body = PrefsPropsUtil.getContent(user.getCompanyId(), PropsKeys.ADMIN_EMAIL_USER_ADDED_BODY); } else { body = PrefsPropsUtil.getContent(user.getCompanyId(), PropsKeys.ADMIN_EMAIL_USER_ADDED_NO_PASSWORD_BODY); } SubscriptionSender subscriptionSender = new SubscriptionSender(); subscriptionSender.setBody(body); subscriptionSender.setCompanyId(user.getCompanyId()); subscriptionSender.setContextAttributes("[$USER_ID$]", user.getUserId(), "[$USER_PASSWORD$]", password, "[$USER_SCREENNAME$]", user.getScreenName()); subscriptionSender.setFrom(fromAddress, fromName); subscriptionSender.setHtmlFormat(true); subscriptionSender.setMailId("user", user.getUserId(), System.currentTimeMillis(), PwdGenerator.getPassword()); subscriptionSender.setServiceContext(serviceContext); subscriptionSender.setSubject(subject); subscriptionSender.setUserId(user.getUserId()); subscriptionSender.addRuntimeSubscribers(toAddress, toName); subscriptionSender.flushNotificationsAsync(); }