Example usage for com.liferay.portal.kernel.service SubscriptionLocalServiceUtil deleteSubscription

List of usage examples for com.liferay.portal.kernel.service SubscriptionLocalServiceUtil deleteSubscription

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service SubscriptionLocalServiceUtil deleteSubscription.

Prototype

public static void deleteSubscription(long userId, String className, long classPK)
        throws com.liferay.portal.kernel.exception.PortalException 

Source Link

Document

Deletes the user's subscription to the entity.

Usage

From source file:ca.efendi.datafeeds.web.internal.portlet.DatafeedsPortlet.java

License:Apache License

protected void subscribeToComments(final ActionRequest actionRequest, final boolean subscribe)
        throws Exception {
    final ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    final String className = ParamUtil.getString(actionRequest, "className");
    final long classPK = ParamUtil.getLong(actionRequest, "classPK");
    if (subscribe) {
        SubscriptionLocalServiceUtil.addSubscription(themeDisplay.getUserId(), themeDisplay.getScopeGroupId(),
                className, classPK);//from  www  . ja  va2  s  .c om
    } else {
        SubscriptionLocalServiceUtil.deleteSubscription(themeDisplay.getUserId(), className, classPK);
    }
}

From source file:com.liferay.owxp.subscribe.portlet.OWXPSubscribePortlet.java

License:Open Source License

public void subscribe(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException {

    long companyId = GetterUtil.getLong(actionRequest.getParameter("companyId"));
    long subscriberId = GetterUtil.getLong(actionRequest.getParameter("subscriberId"));
    long subscribeToId = GetterUtil.getLong(actionRequest.getParameter("subscribeToId"));

    if (SubscriptionLocalServiceUtil.isSubscribed(companyId, subscriberId, User.class.getName(),
            subscribeToId)) {/*from   w  w w. j  a  v a  2 s  .c om*/

        SubscriptionLocalServiceUtil.deleteSubscription(subscriberId, User.class.getName(), subscribeToId);
    } else {
        SubscriptionLocalServiceUtil.addSubscription(subscriberId, 0, User.class.getName(), subscribeToId,
                "instant");
    }
}