code: protected int getSize(Session session) throws Exception
     {
        long result = usersStorageNode.getNodesCount();
        if (status != UserStatus.ANY)
        {
           StringBuilder statement = new StringBuilder("SELECT * FROM ");
           statement.append(JCROrganizationServiceImpl.JOS_USERS_NODETYPE).append(" WHERE");
           statement.append(" jcr:path LIKE '").append(usersStorageNode.getPath()).append("/%'");
           statement.append(" AND NOT jcr:path LIKE '").append(usersStorageNode.getPath()).append("/%/%'");
           statement.append(" AND ").append(JCROrganizationServiceImpl.JOS_DISABLED);
           if (status == UserStatus.ENABLED)
              statement.append(" IS NOT NULL");
           else
              statement.append(" IS NULL");
  
           // We remove the total amount of disabled users
           result -= session.getWorkspace().getQueryManager()
              .createQuery(statement.toString(), Query.SQL).execute().getNodes().getSize();
        }
        return (int)result;
     }
docs: {@inheritDoc}