org.springframework.http.ResponseEntity.notFound()

Here are the examples of the java api org.springframework.http.ResponseEntity.notFound() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

360 Examples 7

19 Source : FileUploadController.java
with Apache License 2.0
from xiaop1ng

@ExceptionHandler(FileNotFoundException.clreplaced)
public ResponseEnreplacedy<?> handleStorageFileNotFound(FileNotFoundException exc) {
    return ResponseEnreplacedy.notFound().build();
}

19 Source : ModulesController.java
with GNU General Public License v3.0
from voyages-sncf-technologies

@ApiOperation("Search for a single module")
@GetMapping("/search")
public ResponseEnreplacedy<ModuleIO> searchSingle(@ApiParam(value = "Format: name (+ version) (+ true|false)", required = true) @RequestParam final String terms) {
    return moduleUseCases.searchSingle(terms).map(ModuleIO::new).map(ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

19 Source : MovieController.java
with Apache License 2.0
from toedter

@GetMapping("/movies/{id}")
public ResponseEnreplacedy<? extends RepresentationModel<?>> findOne(@PathVariable Long id, @RequestParam(value = "fields[movies]", required = false) String[] filterMovies) {
    return movieRepository.findById(id).map(movie -> movieModelreplacedembler.toJsonApiModel(movie, filterMovies)).map(ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

19 Source : GoodsController.java
with Apache License 2.0
from tiancixiong

/**
 * 通过spu_id查询SPU详情
 *
 * @param spuId
 * @return
 */
@GetMapping("/spu/detail/{spuId}")
public ResponseEnreplacedy<SpuDetail> querySpuDetailBySpuId(@PathVariable("spuId") Long spuId) {
    SpuDetail spuDetail = this.goodsService.querySpuDetailBySpuId(spuId);
    if (spuDetail == null) {
        return ResponseEnreplacedy.notFound().build();
    }
    return ResponseEnreplacedy.ok(spuDetail);
}

19 Source : InventoryController.java
with Apache License 2.0
from teixeira-fernando

@ApiResponses(value = { @ApiResponse(code = 200, message = "Product deleted", response = Product.clreplaced), @ApiResponse(code = 404, message = "The product referenced was not found", response = Error.clreplaced), @ApiResponse(code = 500, message = "unexpected server error", response = Error.clreplaced) })
@DeleteMapping("/product/{id}")
public ResponseEnreplacedy<?> deleteProduct(@PathVariable String id) {
    logger.info("Deleting product with id: {}", id);
    try {
        inventoryService.deleteProduct(id);
        return ResponseEnreplacedy.ok().build();
    } catch (NoSuchElementException e) {
        return ResponseEnreplacedy.notFound().build();
    }
}

19 Source : ManagerController.java
with Apache License 2.0
from spring-projects

/**
 * Look up a single {@link Manager} and transform it into a REST resource using
 * {@link ManagerRepresentationModelreplacedembler#toModel(Object)}. Then return it through Spring Web's
 * {@link ResponseEnreplacedy} fluent API.
 *
 * @param id
 */
@GetMapping("/managers/{id}")
ResponseEnreplacedy<EnreplacedyModel<Manager>> findOne(@PathVariable long id) {
    return // 
    repository.findById(id).map(// 
    replacedembler::toModel).map(// 
    ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

19 Source : EmployeeController.java
with Apache License 2.0
from spring-projects

@PostMapping("/employees")
public ResponseEnreplacedy<EnreplacedyModel<Employee>> newEmployee(@RequestBody Employee employee) {
    Employee savedEmployee = repository.save(employee);
    return // 
    savedEmployee.getId().map(id -> // 
    ResponseEnreplacedy.created(linkTo(methodOn(EmployeeController.clreplaced).findOne(id)).toUri()).body(replacedembler.toModel(savedEmployee))).orElse(ResponseEnreplacedy.notFound().build());
}

19 Source : MessageController.java
with Apache License 2.0
from SpartaSystems

protected ResponseEnreplacedy serveContent(Object data, MediaType mediaType) {
    if (data == null) {
        return ResponseEnreplacedy.notFound().build();
    }
    return ResponseEnreplacedy.ok().contentType(mediaType).body(data);
}

19 Source : AbstractRestController.java
with GNU Affero General Public License v3.0
from spacious-team

/**
 * Get the enreplacedy.
 * If enreplacedy not exists NOT_FOUND http status will be returned.
 */
public ResponseEnreplacedy<Pojo> get(ID id) {
    return getById(id).map(converter::fromEnreplacedy).map(ResponseEnreplacedy::ok).orElseGet(() -> ResponseEnreplacedy.notFound().build());
}

19 Source : PivnetController.java
with Apache License 2.0
from pacphi

@GetMapping("/store/product/catalog")
public Mono<ResponseEnreplacedy<Products>> getProductList() {
    return util.getHeaders().map(h -> new ResponseEnreplacedy<>(cache.getProducts(), h, HttpStatus.OK)).defaultIfEmpty(ResponseEnreplacedy.notFound().build());
}

19 Source : DemographicsController.java
with Apache License 2.0
from pacphi

@GetMapping("/snapshot/demographics")
public Mono<ResponseEnreplacedy<Demographics>> getDemographics() {
    return util.getHeaders().flatMap(h -> demoService.getDemographics().map(d -> new ResponseEnreplacedy<>(d, h, HttpStatus.OK))).defaultIfEmpty(ResponseEnreplacedy.notFound().build());
}

19 Source : TodoController.java
with MIT License
from nielsutrecht

@RequestMapping(value = "/me/{todo}", method = RequestMethod.GET, produces = "application/json")
public Callable<ResponseEnreplacedy<TodoList>> todoList(@RequestHeader("user-id") final UUID userId, @PathVariable("todo") final String todoList) {
    log.info("GET todo {} for user {}", todoList, userId);
    return () -> repository.get(userId, todoList).map(ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

19 Source : LiveController.java
with GNU General Public License v3.0
from jerryshell

@GetMapping("/live/material/{materialId}")
public ResponseEnreplacedy<Resource> downloadLiveMaterial(@PathVariable("materialId") String materialId) throws MalformedURLException {
    LiveMaterial liveMaterial = liveMaterialService.findById(materialId);
    if (liveMaterial == null) {
        return ResponseEnreplacedy.notFound().build();
    }
    String filename = liveMaterial.getId() + "." + liveMaterial.getFileType();
    return ResponseEnreplacedy.ok().header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + filename + "\"").body(new UrlResource("file://" + liveConfig.getMaterialFilePath() + "/" + filename));
}

19 Source : FolderController.java
with MIT License
from hmcts

@GetMapping("{id}")
@ApiOperation("Retrieves JSON representation of a Folder.")
public ResponseEnreplacedy<?> get(@PathVariable UUID id) {
    return folderService.findById(id).map(FolderHalResource::new).map(ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

19 Source : GoodsController.java
with MIT License
from GitHubWxw

/**
 *  购物车
 */
@GetMapping("sku/{skuId}")
@ApiOperation("根据skuId查询SKU商品信息")
public ResponseEnreplacedy<Sku> querySkuBySkuId(@PathVariable("skuId") Long skuId) {
    Sku sku = this.goodsService.querySkuBySkuId(skuId);
    if (sku == null) {
        return ResponseEnreplacedy.notFound().build();
    }
    return ResponseEnreplacedy.ok(sku);
}

19 Source : SearchController.java
with MIT License
from GitHubWxw

@ApiOperation("基本搜索入口")
@PostMapping("page")
public ResponseEnreplacedy<SearchResult> search(@RequestBody SearchRequest searchRequest) {
    SearchResult result = this.searchService.search(searchRequest);
    if (result == null || CollectionUtils.isEmpty(result.gereplacedems())) {
        return ResponseEnreplacedy.notFound().build();
    }
    return ResponseEnreplacedy.ok(result);
}

19 Source : GameGetterRestEntryPoint.java
with MIT License
from gbzarelli

@GetMapping(value = "/{uuid}")
public ResponseEnreplacedy<GameDTO> getGameByUUIDEndpoint(@PathVariable final String uuid) {
    return getGameByUUID(UUID.fromString(uuid)).map(ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

19 Source : ApiController.java
with GNU Affero General Public License v3.0
from dedica-team

@CrossOrigin(methods = RequestMethod.GET)
@RequestMapping(path = "/landscape/{identifier}/facets", method = RequestMethod.GET, produces = "application/json")
public ResponseEnreplacedy<List<FacetResult>> facets(@PathVariable String identifier) {
    Landscape landscape = landscapeRepository.findDistinctByIdentifier(identifier).orElse(null);
    if (landscape == null) {
        return ResponseEnreplacedy.notFound().build();
    }
    return new ResponseEnreplacedy<>(landscape.getSearchIndex().facets(), HttpStatus.OK);
}

19 Source : ApiController.java
with GNU Affero General Public License v3.0
from dedica-team

/**
 * This resource serves a landscape DTO and can be addressed by using a {@link FullyQualifiedIdentifier}
 *
 * @return response enreplacedy of landscape
 */
@CrossOrigin(methods = RequestMethod.GET)
@RequestMapping(path = "/{landscapeIdentifier}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEnreplacedy<Landscape> landscape(@PathVariable String landscapeIdentifier) {
    Landscape landscape = landscapeRepository.findDistinctByIdentifier(landscapeIdentifier).orElse(null);
    if (landscape == null) {
        return ResponseEnreplacedy.notFound().build();
    }
    // TODO this modifies the landscape components by adding SELF links
    linkFactory.setLandscapeLinksRecursive(landscape);
    return new ResponseEnreplacedy<>(landscape, HttpStatus.OK);
}

19 Source : ApiController.java
with GNU Affero General Public License v3.0
from dedica-team

@CrossOrigin(methods = RequestMethod.GET)
@RequestMapping(path = "/landscape/{identifier}/log", method = RequestMethod.GET)
public ResponseEnreplacedy<ProcessLog> log(@PathVariable String identifier) {
    Landscape landscape = landscapeRepository.findDistinctByIdentifier(identifier).orElse(null);
    if (landscape == null) {
        return ResponseEnreplacedy.notFound().build();
    }
    return new ResponseEnreplacedy<>(landscape.getLog(), HttpStatus.OK);
}

19 Source : UserController.java
with The Unlicense
from bmstefanski

@GetMapping("/by-name/{name}")
public ResponseEnreplacedy<UserEnreplacedyImpl> getUserByName(@PathVariable String name) {
    return this.userRepository.findByName(name).map(ResponseEnreplacedy::ok).orElseGet(() -> ResponseEnreplacedy.notFound().build());
}

19 Source : PiisConsentSpiImplTest.java
with Apache License 2.0
from adorsys

@Test
void getSelectMethodResponse_badRequest() {
    GlobalScaResponseTO globalScaResponseTO = new GlobalScaResponseTO();
    globalScaResponseTO.setAuthorisationId(AUTHORISATION_ID);
    when(redirectScaRestClient.selectMethod(AUTHORISATION_ID, AUTHENTICATION_METHOD_ID)).thenReturn(ResponseEnreplacedy.notFound().build());
    ResponseEnreplacedy<GlobalScaResponseTO> actual = piisConsentSpi.getSelectMethodResponse(AUTHENTICATION_METHOD_ID, globalScaResponseTO);
    replacedertEquals(HttpStatus.BAD_REQUEST, actual.getStatusCode());
    replacedertNull(actual.getBody());
}

18 Source : AttendanceDownloadController.java
with Apache License 2.0
from zhcet-amu

private ResponseEnreplacedy<InputStreamResource> downloadAttendance(String context, String suffix, List<CourseRegistration> courseRegistrations) {
    try {
        InputStream stream = attendanceDownloadService.getAttendanceStream(suffix, context, courseRegistrations);
        String lastModified = getLastModifiedDate(courseRegistrations).map(localDateTime -> "_" + localDateTime.format(DateTimeFormatter.ISO_DATE_TIME)).orElse("");
        return ResponseEnreplacedy.ok().contentType(MediaType.parseMediaType("text/csv")).header("Content-disposition", "attachment;filename=attendance_" + suffix + lastModified + ".csv").body(new InputStreamResource(stream));
    } catch (IOException e) {
        log.error("Attendance Download Error", e);
        return ResponseEnreplacedy.notFound().build();
    }
}

18 Source : DynamicRouteService.java
with Apache License 2.0
from zhangdaiscott

/**
 * 删除路由
 *
 * @param id
 * @return
 */
public synchronized Mono<ResponseEnreplacedy<Object>> delete(String id) {
    return this.repository.delete(Mono.just(id)).then(Mono.defer(() -> {
        return Mono.just(ResponseEnreplacedy.ok().build());
    })).onErrorResume((t) -> {
        return t instanceof NotFoundException;
    }, (t) -> {
        return Mono.just(ResponseEnreplacedy.notFound().build());
    });
}

18 Source : DynamicRouteServiceImpl.java
with MIT License
from xk11961677

/**
 * 删除路由
 *
 * @param id
 * @return
 */
public Mono<ResponseEnreplacedy<Object>> delete(String id) {
    return this.routeDefinitionWriter.delete(Mono.just(id)).then(Mono.defer(() -> Mono.just(ResponseEnreplacedy.ok().build()))).onErrorResume(t -> t instanceof NotFoundException, t -> Mono.just(ResponseEnreplacedy.notFound().build()));
}

18 Source : RouteService.java
with MIT License
from xiuhuai

// 删除路由
public Mono<ResponseEnreplacedy<Object>> delete(String id) {
    return this.routeDefinitionWriter.delete(Mono.just(id)).then(Mono.defer(() -> {
        return Mono.just(ResponseEnreplacedy.ok().build());
    })).onErrorResume((t) -> {
        return t instanceof NotFoundException;
    }, (t) -> {
        return Mono.just(ResponseEnreplacedy.notFound().build());
    });
}

18 Source : UserController.java
with Apache License 2.0
from xiuhuai

@GetMapping("/{id}")
public Mono<ResponseEnreplacedy<User>> getUser(@PathVariable String id) {
    return userRepository.findById(id).map(getUser -> ResponseEnreplacedy.ok(getUser)).defaultIfEmpty(ResponseEnreplacedy.notFound().build());
}

18 Source : DynamicRouteService.java
with MIT License
from wells2333

/**
 * 删除路由
 *
 * @param id id
 * @return Mono
 */
public Mono<ResponseEnreplacedy<Object>> delete(Long id) {
    return this.routeDefinitionWriter.delete(Mono.just(String.valueOf(id))).then(Mono.defer(() -> Mono.just(ResponseEnreplacedy.ok().build()))).onErrorResume(t -> t instanceof NotFoundException, t -> Mono.just(ResponseEnreplacedy.notFound().build()));
}

18 Source : VaadinConnectController.java
with Apache License 2.0
from vaadin

/**
 * Captures and processes the Vaadin Connect requests.
 * <p>
 * Matches the service name and a method name with the corresponding Java
 * clreplaced and a public method in the clreplaced. Extracts parameters from a request
 * body if the Java method requires any and applies in the same order. After
 * the method call, serializes the Java method execution result and sends it
 * back.
 * <p>
 * If an issue occurs during the request processing, an error response is
 * returned instead of the serialized Java method return value.
 *
 * @param serviceName
 *          the name of a service to address the calls to, not case sensitive
 * @param methodName
 *          the method name to execute on a service, not case sensitive
 * @param body
 *          optional request body, that should be specified if the method
 *          called has parameters
 * @return execution result as a JSON string or an error message string
 */
@PostMapping(path = "/{service}/{method}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEnreplacedy<String> serveVaadinService(@PathVariable("service") String serviceName, @PathVariable("method") String methodName, @RequestBody(required = false) ObjectNode body) {
    getLogger().debug("Service: {}, method: {}, request body: {}", serviceName, methodName, body);
    VaadinServiceData vaadinServiceData = vaadinServices.get(serviceName.toLowerCase(Locale.ENGLISH));
    if (vaadinServiceData == null) {
        getLogger().debug("Service '{}' not found", serviceName);
        return ResponseEnreplacedy.notFound().build();
    }
    Method methodToInvoke = vaadinServiceData.getMethod(methodName.toLowerCase(Locale.ENGLISH)).orElse(null);
    if (methodToInvoke == null) {
        getLogger().debug("Method '{}' not found in service '{}'", methodName, serviceName);
        return ResponseEnreplacedy.notFound().build();
    }
    try {
        return invokeVaadinServiceMethod(serviceName, methodName, methodToInvoke, body, vaadinServiceData);
    } catch (JsonProcessingException e) {
        String errorMessage = String.format("Failed to serialize service '%s' method '%s' response. " + "Double check method's return type or specify a custom mapper bean with qualifier '%s'", serviceName, methodName, VAADIN_SERVICE_MAPPER_BEAN_QUALIFIER);
        getLogger().error(errorMessage, e);
        try {
            return ResponseEnreplacedy.status(HttpStatus.INTERNAL_SERVER_ERROR).body(createResponseErrorObject(errorMessage));
        } catch (JsonProcessingException unexpected) {
            throw new IllegalStateException(String.format("Unexpected: Failed to serialize a plain Java string '%s' into a JSON. " + "Double check the provided mapper's configuration.", errorMessage), unexpected);
        }
    }
}

18 Source : FileUploadController.java
with Apache License 2.0
from usdot-jpo-ode

@ExceptionHandler(StorageFileNotFoundException.clreplaced)
public ResponseEnreplacedy<Void> handleStorageFileNotFound(StorageFileNotFoundException exc) {
    return ResponseEnreplacedy.notFound().build();
}

18 Source : MottoController.java
with MIT License
from TrainingByPackt

@GetMapping("/{id}")
public ResponseEnreplacedy<Message> retrieveById(@PathVariable int id) {
    if (id < 1 || id > motto.size()) {
        return ResponseEnreplacedy.notFound().build();
    } else {
        return ResponseEnreplacedy.ok(motto.get(id - 1));
    }
}

18 Source : MovieController.java
with Apache License 2.0
from toedter

@GetMapping("/movies/{id}/directors")
public ResponseEnreplacedy<? extends RepresentationModel<?>> findDirectors(@PathVariable Long id) {
    return movieRepository.findById(id).map(movieModelreplacedembler::directorsToJsonApiModel).map(ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

18 Source : DirectorController.java
with Apache License 2.0
from toedter

@GetMapping("/directors/{id}")
public ResponseEnreplacedy<? extends RepresentationModel<?>> findOne(@PathVariable Long id, @RequestParam(value = "fields[directors]", required = false) String[] fieldsDirectors) {
    return repository.findById(id).map(director -> directorModelreplacedembler.toJsonApiModel(director, fieldsDirectors)).map(ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

18 Source : SpecificationController.java
with Apache License 2.0
from tiancixiong

/**
 * 通过商品分类id查询分组
 *
 * @param cid
 * @return
 */
@GetMapping("/groups/{cid}")
public ResponseEnreplacedy<List<SpecGroup>> queryGroupsByCid(@PathVariable("cid") Long cid) {
    List<SpecGroup> groups = this.specificationService.queryGroupsByCid(cid);
    if (CollectionUtils.isEmpty(groups)) {
        return ResponseEnreplacedy.notFound().build();
    }
    return ResponseEnreplacedy.ok(groups);
}

18 Source : SpecificationController.java
with Apache License 2.0
from tiancixiong

/**
 * 根据条件查询规格参数
 *
 * @param gid
 * @param cid
 * @param generic
 * @param searching
 * @return
 */
@GetMapping("/params")
public ResponseEnreplacedy<List<SpecParam>> querySpecParam(@RequestParam(value = "gid", required = false) Long gid, @RequestParam(value = "cid", required = false) Long cid, @RequestParam(value = "generic", required = false) Boolean generic, @RequestParam(value = "searching", required = false) Boolean searching) {
    List<SpecParam> params = this.specificationService.querySpecParams(gid, cid, generic, searching);
    if (CollectionUtils.isEmpty(params)) {
        return ResponseEnreplacedy.notFound().build();
    }
    return ResponseEnreplacedy.ok(params);
}

18 Source : GoodsController.java
with Apache License 2.0
from tiancixiong

/**
 * 根据spu_id查询sku的集合
 *
 * @param spuId
 * @return
 */
@GetMapping("/sku/list")
public ResponseEnreplacedy<List<Sku>> querySkusBySpuId(@RequestParam("id") Long spuId) {
    List<Sku> skus = this.goodsService.querySkusBySpuId(spuId);
    if (CollectionUtils.isEmpty(skus)) {
        return ResponseEnreplacedy.notFound().build();
    }
    return ResponseEnreplacedy.ok(skus);
}

18 Source : GoodsController.java
with Apache License 2.0
from tiancixiong

/**
 * 分页查询商品
 *
 * @param page
 * @param rows
 * @param key
 * @param saleable
 * @return
 */
@GetMapping("/spu/page")
public ResponseEnreplacedy<PageResult<SpuBo>> querySpuBoByPage(@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "rows", defaultValue = "5") Integer rows, @RequestParam(value = "key", required = false) String key, @RequestParam(value = "saleable", required = false) Boolean saleable) {
    // 分页查询spu信息
    PageResult<SpuBo> result = this.goodsService.querySpuByPageAndSort(page, rows, key, saleable);
    if (result == null || result.gereplacedems().size() == 0) {
        return ResponseEnreplacedy.notFound().build();
    }
    return ResponseEnreplacedy.ok(result);
}

18 Source : GoodsController.java
with Apache License 2.0
from tiancixiong

/**
 * 根据spu_id查询spu
 *
 * @param id
 * @return
 */
@GetMapping("/spu/{id}")
public ResponseEnreplacedy<Spu> querySpuById(@PathVariable("id") Long id) {
    Spu spu = this.goodsService.querySpuById(id);
    if (spu == null) {
        return ResponseEnreplacedy.notFound().build();
    }
    return ResponseEnreplacedy.ok(spu);
}

18 Source : BrandController.java
with Apache License 2.0
from tiancixiong

/**
 * 根据分类id查询品牌
 *
 * @param cid
 * @return
 */
@GetMapping("/cid/{cid}")
public ResponseEnreplacedy<List<Brand>> queryBrandsByCid(@PathVariable("cid") Long cid) {
    List<Brand> list = this.brandService.queryBrandsByCid(cid);
    if (CollectionUtils.isEmpty(list)) {
        return ResponseEnreplacedy.notFound().build();
    }
    return ResponseEnreplacedy.ok(list);
}

18 Source : BrandController.java
with Apache License 2.0
from tiancixiong

/**
 * 通过ids查询品牌
 *
 * @param ids
 * @return
 */
@GetMapping("/list")
public ResponseEnreplacedy<List<Brand>> queryBrandByIds(@RequestParam("ids") List<Long> ids) {
    List<Brand> list = this.brandService.queryBrandByIds(ids);
    if (list == null) {
        return ResponseEnreplacedy.notFound().build();
    }
    return ResponseEnreplacedy.ok(list);
}

18 Source : BrandController.java
with Apache License 2.0
from tiancixiong

/**
 * 通过id查询品牌
 *
 * @param id
 * @return
 */
@GetMapping("/{id}")
public ResponseEnreplacedy<Brand> queryBrandById(@PathVariable("id") Long id) {
    Brand brand = this.brandService.queryBrandById(id);
    if (brand == null) {
        return ResponseEnreplacedy.notFound().build();
    }
    return ResponseEnreplacedy.ok(brand);
}

18 Source : CustomerController.java
with Apache License 2.0
from testingisdocumenting

@PutMapping("/customers/{id}")
public ResponseEnreplacedy<Customer> updateCustomer(@RequestBody Customer customer, @PathVariable long id) {
    Customer existing = customerRepository.findOne(id);
    if (existing == null) {
        return ResponseEnreplacedy.notFound().build();
    }
    customer.setId(id);
    customerRepository.save(customer);
    return ResponseEnreplacedy.status(HttpStatus.OK).body(customer);
}

18 Source : BananaController.java
with MIT License
from stelligent

/**
 * Handle the DELETE method by deleting a specific Banana by id.
 *
 * @param id the Banana to update
 * @return a ResponseEnreplacedy with 200 if deleted or 404 if not found
 */
@RequestMapping(path = "/{id}", method = RequestMethod.DELETE)
public ResponseEnreplacedy delete(@PathVariable long id) {
    Banana banana = bananaRepository.findOne(id);
    if (Objects.isNull(banana)) {
        return ResponseEnreplacedy.notFound().build();
    }
    bananaRepository.delete(banana);
    return ResponseEnreplacedy.ok().build();
}

18 Source : EmployeeController.java
with Apache License 2.0
from springdoc

/**
 * Look up a single {@link Employee} and transform it into a REST resource. Then return it through Spring Web's
 * {@link ResponseEnreplacedy} fluent API.
 *
 * @param id
 */
@GetMapping("/employees/{id}")
ResponseEnreplacedy<EnreplacedyModel<Employee>> findOne(@PathVariable long id) {
    return // 
    repository.findById(id).map(employee -> new // 
    EnreplacedyModel<>(// 
    employee, // 
    linkTo(methodOn(EmployeeController.clreplaced).findOne(employee.getId())).withSelfRel(), // 
    linkTo(methodOn(EmployeeController.clreplaced).findAll()).withRel("employees"))).map(// 
    ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

18 Source : ApplicationsController.java
with Apache License 2.0
from SpringCloud

@GetMapping(path = "/applications/{name}", produces = MediaType.APPLICATION_JSON_VALUE)
public Mono<ResponseEnreplacedy<Application>> application(@PathVariable("name") String name) {
    return this.toApplication(name, registry.getInstances(name).filter(Instance::isRegistered)).filter(a -> !a.getInstances().isEmpty()).map(ResponseEnreplacedy::ok).defaultIfEmpty(ResponseEnreplacedy.notFound().build());
}

18 Source : NotificationFilterController.java
with Apache License 2.0
from SpringCloud

@DeleteMapping(path = "/notifications/filters/{id}")
public ResponseEnreplacedy<Void> deleteFilter(@PathVariable("id") String id) {
    NotificationFilter deleted = filteringNotifier.removeFilter(id);
    if (deleted != null) {
        return ResponseEnreplacedy.ok().build();
    } else {
        return ResponseEnreplacedy.notFound().build();
    }
}

18 Source : EmployeeController.java
with Apache License 2.0
from spring-projects

@GetMapping("/employees/{id}/detailed")
public ResponseEnreplacedy<EnreplacedyModel<EmployeeWithManager>> findDetailedEmployee(@PathVariable Long id) {
    return // 
    repository.findById(id).map(// 
    EmployeeWithManager::new).map(// 
    employeeWithManagerResourcereplacedembler::toModel).map(// 
    ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

18 Source : EmployeeController.java
with Apache License 2.0
from spring-projects

/**
 * Look up a single {@link Employee} and transform it into a REST resource using
 * {@link EmployeeRepresentationModelreplacedembler#toModel(Object)}. Then return it through Spring Web's
 * {@link ResponseEnreplacedy} fluent API.
 *
 * @param id
 */
@GetMapping("/employees/{id}")
public ResponseEnreplacedy<EnreplacedyModel<Employee>> findOne(@PathVariable long id) {
    return // 
    repository.findById(id).map(// 
    replacedembler::toModel).map(// 
    ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

18 Source : EmployeeController.java
with Apache License 2.0
from spring-projects

/**
 * Look up a single {@link Employee} and transform it into a REST resource using
 * {@link EmployeeRepresentationModelreplacedembler#toModel(Object)}. Then return it through Spring Web's
 * {@link ResponseEnreplacedy} fluent API.
 *
 * @param id
 */
@GetMapping("/employees/{id}")
public ResponseEnreplacedy<EnreplacedyModel<Employee>> findOne(@PathVariable long id) {
    return // 
    this.repository.findById(id).map(// 
    this.replacedembler::toModel).map(// 
    ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

18 Source : EmployeeController.java
with Apache License 2.0
from spring-projects

@GetMapping("/employees/{id}")
public ResponseEnreplacedy<EnreplacedyModel<Employee>> findOne(@PathVariable Long id) {
    return // 
    repository.findById(id).map(// 
    replacedembler::toModel).map(// 
    ResponseEnreplacedy::ok).orElse(ResponseEnreplacedy.notFound().build());
}

See More Examples