final Specification filterSpecification = specificationFromRequest(request, persistentEntity);
if (isPredicateScope(scope)) {
final PredicateScopeMetadata predicateScope = (PredicateScopeMetadata) scope;
final Page page = findBySpecificationAndPredicate(repositoryInvoker, filterSpecification, predicateScope.predicate(), pageable);
Object resources = resultToResources(page, assembler);
return new ResponseEntity(resources, HttpStatus.OK);
}
if (isSpecificationScope(scope)) {
final Specification scopeSpecification = ((ScopeMetadataUtils.SpecificationScopeMetadata) scope).specification();
Page page = findItemsBySpecification(repositoryInvoker, and(scopeSpecification, filterSpecification), pageable);
Object resources = resultToResources(page, assembler);
return new ResponseEntity(resources, HttpStatus.OK);
}
Page page = findItemsBySpecification(repositoryInvoker, filterSpecification, pageable);
Object resources = resultToResources(page, assembler);
return new ResponseEntity(resources, HttpStatus.OK);
}