Class CartAjaxController


  • @RestController
    @RequestMapping("/ajax/cart")
    public class CartAjaxController
    extends java.lang.Object
    AJAX controller for cart functionality
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.http.ResponseEntity<CartUpdateResponse> addSamplesToCart​(AddToCartRequest request, java.util.Locale locale)
      Add a set of samples to the cart from a particular project
      void emptyCart()
      Completely empty the cart
      org.springframework.http.ResponseEntity<AjaxResponse> getAllSamplesInCart()
      Get a list of all samples in the cart, these will be separated out into samples that the user can and cannot modify.
      org.springframework.http.ResponseEntity<java.util.List<java.lang.Long>> getCartSampleIds()
      Get the sample ids of samples that are in the cart
      org.springframework.http.ResponseEntity<java.util.List<CartProjectModel>> getCartSamplesForProjects()
      Get the samples that are in the cart for a specific project
      org.springframework.http.ResponseEntity<java.lang.Integer> getNumberOfSamplesInCart()
      Get the number of samples from all projects that are currently in the cart
      org.springframework.http.ResponseEntity<java.util.Set<java.lang.Long>> getProjectIdsInCart()
      Get a list of project identifiers for projects that have samples in the cart.
      org.springframework.http.ResponseEntity<CartUpdateResponse> removeProject​(java.lang.Long id, java.util.Locale locale)
      Remove all samples from a specific project from the cart
      org.springframework.http.ResponseEntity<CartUpdateResponse> removeSample​(java.lang.Long sampleId, java.util.Locale locale)
      Remove a sample from the cart
      • Methods inherited from class java.lang.Object

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

      • CartAjaxController

        @Autowired
        public CartAjaxController​(UICartService service)
    • Method Detail

      • addSamplesToCart

        @PostMapping("")
        public org.springframework.http.ResponseEntity<CartUpdateResponse> addSamplesToCart​(@RequestBody
                                                                                            AddToCartRequest request,
                                                                                            java.util.Locale locale)
        Add a set of samples to the cart from a particular project
        Parameters:
        request - Request to add sample to the cart
        locale - Currently logged in users set locale
        Returns:
        the number of samples currently in the cart
      • getNumberOfSamplesInCart

        @GetMapping("/count")
        public org.springframework.http.ResponseEntity<java.lang.Integer> getNumberOfSamplesInCart()
        Get the number of samples from all projects that are currently in the cart
        Returns:
        the number of samples currently in the cart
      • removeSample

        @DeleteMapping("/sample")
        public org.springframework.http.ResponseEntity<CartUpdateResponse> removeSample​(@RequestParam
                                                                                        java.lang.Long sampleId,
                                                                                        java.util.Locale locale)
        Remove a sample from the cart
        Parameters:
        sampleId - Request to move a sample from the cart
        locale - Current users locale
        Returns:
        the number of samples currently in the cart
      • removeProject

        @DeleteMapping("/project")
        public org.springframework.http.ResponseEntity<CartUpdateResponse> removeProject​(@RequestParam
                                                                                         java.lang.Long id,
                                                                                         java.util.Locale locale)
        Remove all samples from a specific project from the cart
        Parameters:
        id - for a project
        locale - Current users locale
        Returns:
        the number of samples currently in the cart
      • emptyCart

        @DeleteMapping("")
        public void emptyCart()
        Completely empty the cart
      • getProjectIdsInCart

        @GetMapping("/ids")
        public org.springframework.http.ResponseEntity<java.util.Set<java.lang.Long>> getProjectIdsInCart()
        Get a list of project identifiers for projects that have samples in the cart.
        Returns:
        list of project identifiers
      • getCartSamplesForProjects

        @GetMapping("/samples")
        public org.springframework.http.ResponseEntity<java.util.List<CartProjectModel>> getCartSamplesForProjects()
        Get the samples that are in the cart for a specific project
        Returns:
        Samples that are currently in the cart for specific projects
      • getCartSampleIds

        @GetMapping("/sample-ids")
        public org.springframework.http.ResponseEntity<java.util.List<java.lang.Long>> getCartSampleIds()
        Get the sample ids of samples that are in the cart
        Returns:
        Sample ids of samples that are currently in the cart
      • getAllSamplesInCart

        @RequestMapping("/all-samples")
        public org.springframework.http.ResponseEntity<AjaxResponse> getAllSamplesInCart()
        Get a list of all samples in the cart, these will be separated out into samples that the user can and cannot modify.
        Returns:
        list of samples that are in the cart.