org.springframework.data.rest.webmvc.PersistentEntityResource Java Examples
The following examples show how to use
org.springframework.data.rest.webmvc.PersistentEntityResource.
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: DataRestRequestBuilder.java From springdoc-openapi with Apache License 2.0 | 5 votes |
/** * Build common parameters. * * @param domainType the domain type * @param openAPI the open api * @param requestMethod the request method * @param methodAttributes the method attributes * @param operation the operation * @param pNames the p names * @param parameters the parameters */ public void buildCommonParameters(Class<?> domainType, OpenAPI openAPI, RequestMethod requestMethod, MethodAttributes methodAttributes, Operation operation, String[] pNames, MethodParameter[] parameters) { parameters = DelegatingMethodParameter.customize(pNames, parameters); for (MethodParameter methodParameter : parameters) { final String pName = methodParameter.getParameterName(); ParameterInfo parameterInfo = new ParameterInfo(pName, methodParameter); if (isParamToIgnore(methodParameter)) { if (PersistentEntityResource.class.equals(methodParameter.getParameterType())) { Schema<?> schema = SpringDocAnnotationsUtils.resolveSchemaFromType(domainType, openAPI.getComponents(), null, methodParameter.getParameterAnnotations()); parameterInfo.setParameterModel(new Parameter().schema(schema)); } else if (methodParameter.getParameterAnnotation(BackendId.class) != null) { parameterInfo.setParameterModel(new Parameter().name("id").in(ParameterIn.PATH.toString()).schema(new StringSchema())); } Parameter parameter; io.swagger.v3.oas.annotations.Parameter parameterDoc = AnnotatedElementUtils.findMergedAnnotation( AnnotatedElementUtils.forAnnotations(methodParameter.getParameterAnnotations()), io.swagger.v3.oas.annotations.Parameter.class); if (parameterDoc != null) { if (parameterDoc.hidden() || parameterDoc.schema().hidden()) continue; parameter = parameterBuilder.buildParameterFromDoc(parameterDoc, openAPI.getComponents(), methodAttributes.getJsonViewAnnotation()); parameterInfo.setParameterModel(parameter); } parameter = requestBuilder.buildParams(parameterInfo, openAPI.getComponents(), requestMethod, null); addParameters(openAPI, requestMethod, methodAttributes, operation, methodParameter, parameterInfo, parameter); } } }
Example #2
Source File: HypermediaConfiguration.java From spring-content with Apache License 2.0 | 4 votes |
@Bean public ResourceProcessor<PersistentEntityResource> contentLinksProcessor(Repositories repos, ContentStoreService stores, RestConfiguration config, RepositoryResourceMappings mappings) { return new ContentLinksResourceProcessor(repos, stores, config, mappings); }
Example #3
Source File: AdResourceController.java From spring-rest-black-market with MIT License | 4 votes |
@ResponseBody @RequestMapping(value = "/ads/{id}/publishing", method = RequestMethod.PUT, produces = "application/hal+json") public PersistentEntityResource publish(@PathVariable("id") Long id, PersistentEntityResourceAssembler assembler) throws InvalidAdStateTransitionException { return assembler.toFullResource(adService.publish(id)); }
Example #4
Source File: AdResourceController.java From spring-rest-black-market with MIT License | 4 votes |
@ResponseBody @RequestMapping(value = "/ads/{id}/expiration", method = RequestMethod.PUT, produces = "application/hal+json") public PersistentEntityResource expire(@PathVariable("id") Long id, PersistentEntityResourceAssembler assembler) throws InvalidAdStateTransitionException { return assembler.toFullResource(adService.expire(id)); }