public UntypedExampleMatcher withIgnorePaths(String... ignoredPaths) { return new UntypedExampleMatcher(delegate.withIgnorePaths(ignoredPaths)); }
public UntypedExampleMatcher withIgnorePaths(String... ignoredPaths) { return new UntypedExampleMatcher(delegate.withIgnorePaths(ignoredPaths)); }
/** * Generates a list of {@link Scope} from a request. * * @param apiId The {@link Api} Id * @param scopeDTO The {@link ScopeDTO} * @return The List of {@link Scope} */ public List<Scope> list(final Long apiId, final ScopeDTO scopeDTO) { Api api = apiService.find(apiId); Scope scope = GenericConverter.mapper(scopeDTO, Scope.class); scope.setApi(api); Example<Scope> example = Example.of(scope, ExampleMatcher.matching().withIgnorePaths("api.creationDate").withIgnoreCase().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING)); List<Scope> scopes = scopeRepository.findAll(example); scopes.sort(Comparator.comparing(Scope::getId)); return scopes; }
/** * Generates a list of {@link Provider} from a request * * @param providerDTO The {@link ProviderDTO} * @return The list of {@link Provider} */ public List<Provider> listWithFilter(ProviderDTO providerDTO) { Provider provider = GenericConverter.mapper(providerDTO, Provider.class); Example<Provider> example = Example.of(provider, ExampleMatcher.matching().withIgnorePaths("providerDefault").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING)); return this.providerRepository.findAll(example); }
/** * Generates a list of {@link Operation} from a request. * * @param apiId The {@link br.com.conductor.heimdall.core.entity.Api} Id * @param resourceId The {@link Resource} Id * @param operationDTO The {@link OperationDTO} * @return The list of {@link Operation} */ @Transactional(readOnly = true) public List<Operation> list(Long apiId, Long resourceId, OperationDTO operationDTO) { Resource resource = resourceRepository.findByApiIdAndId(apiId, resourceId); HeimdallException.checkThrow(isBlank(resource), GLOBAL_RESOURCE_NOT_FOUND); Operation operation = GenericConverter.mapper(operationDTO, Operation.class); operation.setResource(resource); Example<Operation> example = Example.of(operation, ExampleMatcher.matching().withIgnorePaths("resource.api").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING)); return operationRepository.findAll(example); }
/** * Generates a paged list of {@link Provider} from a request * * @param providerDTO The {@link ProviderDTO} * @param pageableDTO The {@link PageableDTO} * @return The paged {@link Provider} list as a {@link ProviderPage} object */ public ProviderPage listWithPageableAndFilter(ProviderDTO providerDTO, PageableDTO pageableDTO) { Provider provider = GenericConverter.mapper(providerDTO, Provider.class); Example<Provider> example = Example.of(provider, ExampleMatcher.matching().withIgnorePaths("providerDefault").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING)); Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit()); Page<Provider> page = this.providerRepository.findAll(example, pageable); return new ProviderPage(PageDTO.build(page)); }
/** * Generates a list of {@link Resource} from a request. * * @param apiId The {@link Api} Id * @param resourceDTO The {@link ResourceDTO} * @return The List of {@link Resource} * @throws NotFoundException Resource not found */ public List<Resource> list(Long apiId, ResourceDTO resourceDTO) { Api api = apiRepository.findOne(apiId); HeimdallException.checkThrow(isBlank(api), GLOBAL_RESOURCE_NOT_FOUND); Resource resource = GenericConverter.mapper(resourceDTO, Resource.class); resource.setApi(api); Example<Resource> example = Example.of(resource, ExampleMatcher.matching().withIgnorePaths("api.creationDate").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING)); List<Resource> resources = resourceRepository.findAll(example); return resources; }
/** * Generates a paged list of {@link Operation} from a request. * * @param apiId The {@link br.com.conductor.heimdall.core.entity.Api} Id * @param resourceId The {@link Resource} Id * @param operationDTO The {@link OperationDTO} * @param pageableDTO The {@link PageableDTO} * @return The paged {@link Operation} list as a {@link OperationPage} object */ @Transactional(readOnly = true) public OperationPage list(Long apiId, Long resourceId, OperationDTO operationDTO, PageableDTO pageableDTO) { Resource resource = resourceRepository.findByApiIdAndId(apiId, resourceId); HeimdallException.checkThrow(isBlank(resource), GLOBAL_RESOURCE_NOT_FOUND); Operation operation = GenericConverter.mapper(operationDTO, Operation.class); operation.setResource(resource); Example<Operation> example = Example.of(operation, ExampleMatcher.matching().withIgnorePaths("resource.api").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING)); Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit()); Page<Operation> page = operationRepository.findAll(example, pageable); return new OperationPage(PageDTO.build(page)); }
/** * Generates a paged list of {@link Scope} from a request. * * @param apiId The {@link Api} Id * @param scopeDTO The {@link ScopeDTO} * @param pageableDTO The {@link PageableDTO} * @return The paged {@link Scope} list as a {@link ScopePage} object */ public ScopePage list(final Long apiId, final ScopeDTO scopeDTO, final PageableDTO pageableDTO) { Api api = apiService.find(apiId); Scope scope = GenericConverter.mapper(scopeDTO, Scope.class); scope.setApi(api); Example<Scope> example = Example.of(scope, ExampleMatcher.matching().withIgnorePaths("api.creationDate").withIgnoreCase().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING)); Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit(), new Sort(Sort.Direction.ASC, "id")); Page<Scope> page = scopeRepository.findAll(example, pageable); return new ScopePage(PageDTO.build(page)); }
/** * Generates a paged list of {@link Resource} from a request. * * @param apiId The {@link Api} Id * @param resourceDTO The {@link ResourceDTO} * @param pageableDTO The {@link PageableDTO} * @return The paged {@link Resource} list as a {@link ResourcePage} object * @throws NotFoundException Resource not found */ public ResourcePage list(Long apiId, ResourceDTO resourceDTO, PageableDTO pageableDTO) { Api api = apiRepository.findOne(apiId); HeimdallException.checkThrow(isBlank(api), GLOBAL_RESOURCE_NOT_FOUND); Resource resource = GenericConverter.mapper(resourceDTO, Resource.class); resource.setApi(api); Example<Resource> example = Example.of(resource, ExampleMatcher.matching().withIgnorePaths("api.creationDate").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING)); Pageable pageable = Pageable.setPageable(pageableDTO.getOffset(), pageableDTO.getLimit()); Page<Resource> page = resourceRepository.findAll(example, pageable); ResourcePage resourcePage = new ResourcePage(PageDTO.build(page)); return resourcePage; }