本文整理汇总了Java中io.github.jhipster.web.util.ResponseUtil.wrapOrNotFound方法的典型用法代码示例。如果您正苦于以下问题:Java ResponseUtil.wrapOrNotFound方法的具体用法?Java ResponseUtil.wrapOrNotFound怎么用?Java ResponseUtil.wrapOrNotFound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.github.jhipster.web.util.ResponseUtil
的用法示例。
在下文中一共展示了ResponseUtil.wrapOrNotFound方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProgram
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /programs/:id : get the "id" program.
*
* @param id the id of the programDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the programDTO, or with status 404 (Not Found)
*/
@GetMapping("/programs/{id}")
@Timed
public ResponseEntity<ProgramDTO> getProgram(@PathVariable Long id) {
log.debug("REST request to get Program : {}", id);
ProgramDTO programDTO = programService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(programDTO));
}
示例2: getUser
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /users/:login : get the "login" user.
*
* @param login the login of the user to find
* @return the ResponseEntity with status 200 (OK) and with body the "login" user, or with status 404 (Not Found)
*/
@GetMapping("/users/{login:" + Constants.LOGIN_REGEX + "}")
@Timed
public ResponseEntity<UserDTO> getUser(@PathVariable String login) {
log.debug("REST request to get User : {}", login);
return ResponseUtil.wrapOrNotFound(
userService.getUserWithAuthoritiesByLogin(login)
.map(UserDTO::new));
}
示例3: getUser
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /users/:login : get the "login" user.
*
* @param login the login of the user to find
* @return the ResponseEntity with status 200 (OK) and with body the "login" user, or with status 404 (Not Found)
*/
@GetMapping("/users/{login:" + Constants.LOGIN_REGEX + "}")
@Timed
public ResponseEntity<UserDTO> getUser(@PathVariable String login) {
log.debug("REST request to get User : {}", login);
return ResponseUtil.wrapOrNotFound(
userService.getUserWithAuthoritiesByLogin(login)
.map(UserDTO::new));
}
示例4: updateUser
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* PUT /users : Updates an existing User.
*
* @param user the user to update
* @return the ResponseEntity with status 200 (OK) and with body the updated user
*/
@PutMapping("/users")
@Timed
@Secured(AuthoritiesConstants.ADMIN)
public ResponseEntity<UserDTO> updateUser(@Valid @RequestBody UserDTO user) {
Optional<UserDTO> updatedUser = userService.updateUser(user);
updatedUser.ifPresent(userDTO -> produceEvent(userDTO, Constants.UPDATE_PROFILE_EVENT_TYPE));
return ResponseUtil.wrapOrNotFound(updatedUser,
HeaderUtil.createAlert("userManagement.updated", user.getUserKey()));
}
示例5: getWidget
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /widgets/:id : get the "id" widget.
*
* @param id the id of the widget to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the widget, or with status 404 (Not Found)
*/
@GetMapping("/widgets/{id}")
@Timed
public ResponseEntity<Widget> getWidget(@PathVariable Long id) {
log.debug("REST request to get Widget : {}", id);
Widget widget = widgetService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(widget));
}
示例6: getUser
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /users/:userKey : get the "userKey" user.
*
* @param userKey the userKey of the user to find
* @return the ResponseEntity with status 200 (OK) and with body the "userKey" user, or with status 404 (Not Found)
*/
@GetMapping("/users/{userKey}")
@Timed
public ResponseEntity<UserDTO> getUser(@PathVariable String userKey) {
return ResponseUtil.wrapOrNotFound(
userService.findOneWithAuthoritiesAndLoginsByUserKey(userKey)
.map(UserDTO::new));
}
示例7: getTask
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /tasks/:id : get the "id" task.
*
* @param id the id of the taskDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the taskDTO, or with status 404 (Not Found)
*/
@GetMapping("/tasks/{id}")
@Timed
public ResponseEntity<TaskDTO> getTask(@PathVariable Long id) {
log.debug("REST request to get Task : {}", id);
TaskDTO taskDTO = taskService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(taskDTO));
}
示例8: getResource
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /resources/:id : get the "id" resource.
*
* @param id the id of the resourceDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the resourceDTO, or with status 404 (Not Found)
*/
@GetMapping("/resources/{id}")
@Timed
public ResponseEntity<ResourceDTO> getResource(@PathVariable Long id) {
log.debug("REST request to get Resource : {}", id);
ResourceDTO resourceDTO = resourceService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(resourceDTO));
}
示例9: getLesson
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /lessons/:id : get the "id" lesson.
*
* @param id the id of the lessonDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the lessonDTO, or with status 404 (Not Found)
*/
@GetMapping("/lessons/{id}")
@Timed
public ResponseEntity<LessonDTO> getLesson(@PathVariable Long id) {
log.debug("REST request to get Lesson : {}", id);
LessonDTO lessonDTO = lessonService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(lessonDTO));
}
示例10: getCatalog
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /catalogs/:id : get the "id" catalog.
*
* @param id the id of the catalog to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the catalog, or with status 404 (Not Found)
*/
@GetMapping("/catalogs/{id}")
@Timed
public ResponseEntity<Catalog> getCatalog(@PathVariable String id) {
log.debug("REST request to get Catalog : {}", id);
Catalog catalog = catalogService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(catalog));
}
示例11: getBlog
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /blogs/:id : get the "id" blog.
*
* @param id the id of the blog to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the blog, or with status 404 (Not Found)
*/
@GetMapping("/blogs/{id}")
@Timed
public ResponseEntity<Blog> getBlog(@PathVariable Long id) {
log.debug("REST request to get Blog : {}", id);
Blog blog = blogRepository.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(blog));
}
示例12: getLease
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /leases/:id : get the "id" lease.
*
* @param id the id of the leaseDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the leaseDTO, or with status 404 (Not Found)
*/
@GetMapping("/leases/{id}")
@Timed
public ResponseEntity<LeaseDTO> getLease(@PathVariable Long id) {
log.debug("REST request to get Lease : {}", id);
Lease lease = leaseRepository.findOne(id);
LeaseDTO leaseDTO = leaseMapper.toDto(lease);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(leaseDTO));
}
示例13: getCategory
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /categories/:id : get the "id" category.
*
* @param id the id of the category to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the category, or with status 404 (Not Found)
*/
@GetMapping("/categories/{id}")
@Timed
public ResponseEntity<Category> getCategory(@PathVariable Long id) {
log.debug("REST request to get Category : {}", id);
Category category = categoryService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(category));
}
示例14: getPocket
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /pockets/:id : get the "id" pocket.
*
* @param id the id of the pocket to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the pocket, or with status 404 (Not Found)
*/
@GetMapping("/pockets/{id}")
@Timed
public ResponseEntity<Pocket> getPocket(@PathVariable Long id) {
log.debug("REST request to get Pocket : {}", id);
Pocket pocket = pocketService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(pocket));
}
示例15: getResultat
import io.github.jhipster.web.util.ResponseUtil; //导入方法依赖的package包/类
/**
* GET /resultats/:id : get the "id" resultat.
*
* @param id the id of the resultat to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the resultat, or with status 404 (Not Found)
*/
@GetMapping("/resultats/{id}")
@Timed
public ResponseEntity<Resultat> getResultat(@PathVariable Long id) {
log.debug("REST request to get Resultat : {}", id);
Resultat resultat = resultatService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(resultat));
}