Example usage for com.liferay.portal.kernel.comment CommentManagerUtil addComment

List of usage examples for com.liferay.portal.kernel.comment CommentManagerUtil addComment

Introduction

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

Prototype

public static long addComment(long userId, String className, long classPK, String userName,
            long parentCommentId, String subject, String body,
            Function<String, ServiceContext> serviceContextFunction) throws PortalException 

Source Link

Usage

From source file:com.liferay.exportimport.test.util.lar.BaseStagedModelDataHandlerTestCase.java

License:Open Source License

protected void addComments(StagedModel stagedModel) throws Exception {
    if (!isCommentableStagedModel()) {
        return;//  w  w  w.  j  a  v a2 s . com
    }

    User user = TestPropsValues.getUser();
    String className = ExportImportClassedModelUtil.getClassName(stagedModel);
    long classPK = ExportImportClassedModelUtil.getClassPK(stagedModel);

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(stagingGroup.getGroupId(),
            user.getUserId());

    CommentManagerUtil.addComment(user.getUserId(), stagingGroup.getGroupId(), className, classPK,
            user.getFullName(), RandomTestUtil.randomString(), RandomTestUtil.randomString(50),
            new IdentityServiceContextFunction(serviceContext));
}