Preventing the Deletion of a Security Role: Role Usage Count

The getRoleUsageCount() method is used to prevent the deletion of a security role that is currently referenced by an external user.

/**
 * Return the number of users using a particular role. This
 * method is used to ensure that a role cannot be deleted when
 * it is in use by an external user.
 *
 * @param role The security role name.
 *
 * @return The number of users currently using the
 *         specified role.
 *
 * @throws AppException Generic Exception Signature.
 * @throws InformationalException Generic Exception Signature.
 */
 int getRoleUsageCount(String role)
   throws AppException, InformationalException;

Security roles that are referenced by any user, internal or external, cannot be removed. This method should return a number of 1 or more if any external users reference the specified role.