org.springframework.data.rest.webmvc.RepositoryRestHandlerMapping Java Examples

The following examples show how to use org.springframework.data.rest.webmvc.RepositoryRestHandlerMapping. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringRepositoryRestResourceProvider.java    From springdoc-openapi with Apache License 2.0 6 votes vote down vote up
/**
 * Find search resource mappings.
 *
 * @param openAPI the open api
 * @param routerOperationList the router operation list
 * @param handlerMappingList the handler mapping list
 * @param domainType the domain type
 * @param resourceMetadata the resource metadata
 */
private void findSearchResourceMappings(OpenAPI openAPI, List<RouterOperation> routerOperationList, List<HandlerMapping> handlerMappingList, Class<?> domainType, ResourceMetadata resourceMetadata) {
	for (HandlerMapping handlerMapping : handlerMappingList) {
		if (handlerMapping instanceof RepositoryRestHandlerMapping) {
			RepositoryRestHandlerMapping repositoryRestHandlerMapping = (RepositoryRestHandlerMapping) handlerMapping;
			Map<RequestMappingInfo, HandlerMethod> handlerMethodMap = repositoryRestHandlerMapping.getHandlerMethods();
			Map<RequestMappingInfo, HandlerMethod> handlerMethodMapFiltered = handlerMethodMap.entrySet().stream()
					.filter(requestMappingInfoHandlerMethodEntry -> REPOSITORY_SERACH_CONTROLLER.equals(requestMappingInfoHandlerMethodEntry
							.getValue().getBeanType().getName()))
					.filter(controller -> !AbstractOpenApiResource.isHiddenRestControllers(controller.getValue().getBeanType()))
					.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a1, a2) -> a1));
			ResourceMetadata metadata = associations.getMetadataFor(domainType);
			SearchResourceMappings searchResourceMappings = metadata.getSearchResourceMappings();
			if (searchResourceMappings.isExported()) {
				findSearchControllers(routerOperationList, handlerMethodMapFiltered, resourceMetadata, domainType, openAPI, searchResourceMappings);
			}
		}
	}
}
 
Example #2
Source File: HTTPMonitoringInterceptor.java    From carts with Apache License 2.0 5 votes vote down vote up
private Set<PatternsRequestCondition> getUrlPatterns() {
    if (this.urlPatterns == null) {
        this.urlPatterns = new HashSet<>();
        requestMappingHandlerMapping.getHandlerMethods().forEach((mapping, handlerMethod) ->
                urlPatterns.add(mapping.getPatternsCondition()));
        RepositoryRestHandlerMapping repositoryRestHandlerMapping = new
                RepositoryRestHandlerMapping(mappings, repositoryConfiguration);
        repositoryRestHandlerMapping.setJpaHelper(jpaHelper);
        repositoryRestHandlerMapping.setApplicationContext(applicationContext);
        repositoryRestHandlerMapping.afterPropertiesSet();
        repositoryRestHandlerMapping.getHandlerMethods().forEach((mapping, handlerMethod) ->
                urlPatterns.add(mapping.getPatternsCondition()));
    }
    return this.urlPatterns;
}
 
Example #3
Source File: HTTPMonitoringInterceptor.java    From shipping with Apache License 2.0 5 votes vote down vote up
private Set<PatternsRequestCondition> getUrlPatterns() {
    if (this.urlPatterns == null) {
        this.urlPatterns = new HashSet<>();
        requestMappingHandlerMapping.getHandlerMethods().forEach((mapping, handlerMethod) ->
                urlPatterns.add(mapping.getPatternsCondition()));
        RepositoryRestHandlerMapping repositoryRestHandlerMapping = new
                RepositoryRestHandlerMapping(mappings, repositoryConfiguration);
        repositoryRestHandlerMapping.setJpaHelper(jpaHelper);
        repositoryRestHandlerMapping.setApplicationContext(applicationContext);
        repositoryRestHandlerMapping.afterPropertiesSet();
        repositoryRestHandlerMapping.getHandlerMethods().forEach((mapping, handlerMethod) ->
                urlPatterns.add(mapping.getPatternsCondition()));
    }
    return this.urlPatterns;
}
 
Example #4
Source File: HTTPMonitoringInterceptor.java    From orders with Apache License 2.0 5 votes vote down vote up
private Set<PatternsRequestCondition> getUrlPatterns() {
    if (this.urlPatterns == null) {
        this.urlPatterns = new HashSet<>();
        requestMappingHandlerMapping.getHandlerMethods().forEach((mapping, handlerMethod) ->
                urlPatterns.add(mapping.getPatternsCondition()));
        RepositoryRestHandlerMapping repositoryRestHandlerMapping = new
                RepositoryRestHandlerMapping(mappings, repositoryConfiguration);
        repositoryRestHandlerMapping.setJpaHelper(jpaHelper);
        repositoryRestHandlerMapping.setApplicationContext(applicationContext);
        repositoryRestHandlerMapping.afterPropertiesSet();
        repositoryRestHandlerMapping.getHandlerMethods().forEach((mapping, handlerMethod) ->
                urlPatterns.add(mapping.getPatternsCondition()));
    }
    return this.urlPatterns;
}