Example usage for com.liferay.portal.util PropsValues DISCUSSION_MAX_COMMENTS

List of usage examples for com.liferay.portal.util PropsValues DISCUSSION_MAX_COMMENTS

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues DISCUSSION_MAX_COMMENTS.

Prototype

int DISCUSSION_MAX_COMMENTS

To view the source code for com.liferay.portal.util PropsValues DISCUSSION_MAX_COMMENTS.

Click Source Link

Usage

From source file:com.liferay.message.boards.internal.service.MBDiscussionMBMessageLocalServiceWrapper.java

License:Open Source License

protected void validateDiscussionMaxComments(String className, long classPK) throws PortalException {

    if (PropsValues.DISCUSSION_MAX_COMMENTS <= 0) {
        return;//from  www  .  ja v  a  2 s  .  c o m
    }

    int count = getDiscussionMessagesCount(className, classPK, WorkflowConstants.STATUS_APPROVED);

    if (count >= PropsValues.DISCUSSION_MAX_COMMENTS) {
        int max = PropsValues.DISCUSSION_MAX_COMMENTS - 1;

        throw new DiscussionMaxCommentsException(count + " exceeds " + max);
    }
}