Class AbstractRestController<E extends PersistentObject,​D extends GenericHibernateDao<E,​java.lang.Integer>,​S extends AbstractCrudService<E,​D>>

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractRestController​(java.lang.Class<E> entityClass)
      Constructor that sets the concrete entity class for the controller.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.http.ResponseEntity<E> delete​(int id)
      Deletes an entity by id.
      org.springframework.http.ResponseEntity<java.util.List<E>> findAll​(org.springframework.util.MultiValueMap<java.lang.String,​java.lang.String> requestParams)
      Find all entities.
      org.springframework.http.ResponseEntity<E> findById​(java.lang.Integer id)
      Get an entity by id.
      org.springframework.http.ResponseEntity<java.util.List<E>> findBySimpleFilter​(org.springframework.util.MultiValueMap<java.lang.String,​java.lang.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • objectMapper

        @Autowired
        protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • Constructor Detail

      • AbstractRestController

        protected AbstractRestController​(java.lang.Class<E> entityClass)
        Constructor that sets the concrete entity class for the controller. Subclasses MUST call this constructor.
    • Method Detail

      • findAll

        @RequestMapping(method=GET)
        public org.springframework.http.ResponseEntity<java.util.List<E>> findAll​(@RequestParam
                                                                                  org.springframework.util.MultiValueMap<java.lang.String,​java.lang.String> requestParams)
        Find all entities.
      • findBySimpleFilter

        @RequestMapping(value="/filter",
                        method=GET)
        public org.springframework.http.ResponseEntity<java.util.List<E>> findBySimpleFilter​(@RequestParam
                                                                                             org.springframework.util.MultiValueMap<java.lang.String,​java.lang.String> requestParams)
        Find all entities that match the conditions from the query string.

        The requestParams MultiValueMap contains all information from the query String @see RequestParam

      • findById

        @RequestMapping(value="/{id}",
                        method=GET)
        public org.springframework.http.ResponseEntity<E> findById​(@PathVariable
                                                                   java.lang.Integer id)
        Get an entity by id.
        Parameters:
        id -
      • save

        @RequestMapping(method=POST)
        public org.springframework.http.ResponseEntity<E> save​(javax.servlet.http.HttpServletRequest request)
        Create/save an entity.
      • update

        @RequestMapping(value="/{id}",
                        method=PUT)
        public org.springframework.http.ResponseEntity<E> update​(@PathVariable
                                                                 int id,
                                                                 javax.servlet.http.HttpServletRequest request)
        Updates an entity by id.
        Parameters:
        id -
      • delete

        @RequestMapping(value="/{id}",
                        method=DELETE)
        public org.springframework.http.ResponseEntity<E> delete​(@PathVariable
                                                                 int id)
        Deletes an entity by id.
        Parameters:
        id -