Example usage for com.liferay.portal.kernel.comment DiscussionPermission hasDeletePermission

List of usage examples for com.liferay.portal.kernel.comment DiscussionPermission hasDeletePermission

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.comment DiscussionPermission hasDeletePermission.

Prototype

public boolean hasDeletePermission(long commentId) throws PortalException;

Source Link

Usage

From source file:com.liferay.screens.service.impl.ScreensCommentServiceImpl.java

License:Open Source License

protected JSONObject toJSONObject(Comment comment, DiscussionPermission discussionPermission)
        throws PortalException {

    JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

    jsonObject.put("body", comment.getBody());
    jsonObject.put("commentId", Long.valueOf(comment.getCommentId()));

    Date createDate = comment.getCreateDate();

    jsonObject.put("createDate", Long.valueOf(createDate.getTime()));

    jsonObject.put("deletePermission", discussionPermission.hasDeletePermission(comment.getCommentId()));

    Date modifiedDate = comment.getModifiedDate();

    jsonObject.put("modifiedDate", Long.valueOf(modifiedDate.getTime()));

    jsonObject.put("updatePermission", discussionPermission.hasUpdatePermission(comment.getCommentId()));
    jsonObject.put("userId", Long.valueOf(comment.getUserId()));
    jsonObject.put("userName", comment.getUserName());

    return jsonObject;
}