@RequestMapping(value="/rest") public abstract class AbstractRestController<E extends PersistentObject,D extends GenericHibernateDao<E,Integer>,S extends AbstractCrudService<E,D>> extends AbstractWebController<E,D,S>
| Modifier and Type | Field and Description |
|---|---|
protected com.fasterxml.jackson.databind.ObjectMapper |
objectMapper |
logger, service| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRestController(Class<E> entityClass)
Constructor that sets the concrete entity class for the controller.
|
| Modifier and Type | Method and Description |
|---|---|
org.springframework.http.ResponseEntity<E> |
delete(int id)
Deletes an entity by id.
|
org.springframework.http.ResponseEntity<List<E>> |
findAll(org.springframework.util.MultiValueMap<String,String> requestParams)
Find all entities.
|
org.springframework.http.ResponseEntity<E> |
findById(Integer id)
Get an entity by id.
|
org.springframework.http.ResponseEntity<List<E>> |
findBySimpleFilter(org.springframework.util.MultiValueMap<String,String> requestParams)
Find all entities that match the conditions from the query string.
|
org.springframework.http.ResponseEntity<E> |
save(javax.servlet.http.HttpServletRequest request)
Create/save an entity.
|
org.springframework.http.ResponseEntity<E> |
update(int id,
javax.servlet.http.HttpServletRequest request)
Updates an entity by id.
|
getEntityClass, getService, setService@Autowired protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
@RequestMapping(method=GET,
produces="application/json;charset=UTF-8")
public org.springframework.http.ResponseEntity<List<E>> findAll(@RequestParam
org.springframework.util.MultiValueMap<String,String> requestParams)
@RequestMapping(value="/filter",
method=GET,
produces="application/json;charset=UTF-8")
public org.springframework.http.ResponseEntity<List<E>> findBySimpleFilter(@RequestParam
org.springframework.util.MultiValueMap<String,String> requestParams)
The requestParams MultiValueMap contains all information from the query String @see RequestParam
@RequestMapping(value="/{id}",
method=GET,
produces="application/json;charset=UTF-8")
public org.springframework.http.ResponseEntity<E> findById(@PathVariable
Integer id)
id - @RequestMapping(method=POST,
produces="application/json;charset=UTF-8")
public org.springframework.http.ResponseEntity<E> save(javax.servlet.http.HttpServletRequest request)
@RequestMapping(value="/{id}",
method=PUT,
produces="application/json;charset=UTF-8")
public org.springframework.http.ResponseEntity<E> update(@PathVariable
int id,
javax.servlet.http.HttpServletRequest request)
id - @RequestMapping(value="/{id}",
method=DELETE)
public org.springframework.http.ResponseEntity<E> delete(@PathVariable
int id)
id - Copyright © 2020 terrestris GmbH & Co. KG. All rights reserved.