protected Optional<RegisteredService> determineRegisteredService(final AttributeRepositoryQuery query) {
        val result = Optional.ofNullable(query.getService()).map(servicesManager::findServiceBy).orElseGet(query::getRegisteredService);
        return Optional.ofNullable(result);
    }
This is {@link DefaultAttributeRepositoryResolver}.

@author Misagh Moayyed
@since 7.0.0
support/cas-server-support-person-directory-core/src/main/java/org/apereo/cas/persondir/DefaultAttributeRepositoryResolver.java