Search in sources :

Example 1 with CompanyMaxUsersException

use of com.liferay.portal.CompanyMaxUsersException in project liferay-ide by liferay.

the class UserLocalServiceImpl method validateCompanyMaxUsers.

protected void validateCompanyMaxUsers(long companyId) throws PortalException, SystemException {
    Company company = companyPersistence.findByPrimaryKey(companyId);
    if (company.isSystem() || (company.getMaxUsers() == 0)) {
        return;
    }
    int userCount = searchCount(companyId, null, WorkflowConstants.STATUS_APPROVED, null);
    if (userCount >= company.getMaxUsers()) {
        throw new CompanyMaxUsersException();
    }
}
Also used : Company(com.liferay.portal.model.Company) CompanyMaxUsersException(com.liferay.portal.CompanyMaxUsersException)

Aggregations

CompanyMaxUsersException (com.liferay.portal.CompanyMaxUsersException)1 Company (com.liferay.portal.model.Company)1