Example usage for com.liferay.portal.kernel.comment Comment getUserName

List of usage examples for com.liferay.portal.kernel.comment Comment getUserName

Introduction

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

Prototype

public String getUserName();

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;
}