Class UICartService


  • @Component
    public class UICartService
    extends java.lang.Object
    Service for handling all aspects of interaction with the Cart.
    • Method Detail

      • addSamplesToCart

        public CartUpdateResponse addSamplesToCart​(AddToCartRequest request,
                                                   java.util.Locale locale)
        Add samples from a project to the cart.
        Parameters:
        request - Information about the project and samples to add to the cart
        locale - Current users locale
        Returns:
        CartUpdateResponse contain information about what was added to the cart
      • getNumberOfSamplesInCart

        public int getNumberOfSamplesInCart()
        Get the number of samples in the cart
        Returns:
        number of total samples in the cart
      • emptyCart

        public void emptyCart()
        Remove all samples from the cart
      • removeSample

        public CartUpdateResponse removeSample​(java.lang.Long sampleId,
                                               java.util.Locale locale)
        Remove a specific sample from the cart.
        Parameters:
        sampleId - identifier for the sample to remove from the cart
        locale - Current users locale
        Returns:
        number of total samples in the cart
      • removeProject

        public CartUpdateResponse removeProject​(java.lang.Long id,
                                                java.util.Locale locale)
        Remove all samples from a specific project from the cart.
        Parameters:
        id - identifier for the project to remove from the cart.
        locale - Current users locale
        Returns:
        number of total samples in the cart
      • getProjectIdsInCart

        public java.util.Set<java.lang.Long> getProjectIdsInCart()
        Get a set of identifiers for Projects in the cart
        Returns:
        Set of Project identifiers
      • getSamplesForProjects

        public java.util.List<CartProjectModel> getSamplesForProjects()
        Get a list of sample in the cart belonging to a list of projects
        Returns:
        List of CartProjectModels containing project and sample information for items in the cart.
      • getCartSampleIds

        public java.util.List<java.lang.Long> getCartSampleIds()
        Get a list of sample ids in the cart
        Returns:
        List of Longs containing sample ids of samples in cart
      • getFullCart

        public java.util.Map<Project,​java.util.List<Sample>> getFullCart()
        Get the entire cart flushed out into Projects with their Samples
        Returns:
        All projects and samples in the part
      • isCartEmpty

        public java.lang.Boolean isCartEmpty()
        Determine if the cart is empty
        Returns:
        Boolean if the cart is empty
      • isSampleInCart

        public java.lang.Long isSampleInCart​(java.lang.Long sampleId)
        Determine if a sample is in the cart.
        Parameters:
        sampleId - identifier for a sample
        Returns:
        the project identifier if the sample is in the cart
      • getCartSamplesForNewProject

        public CartSamplesByUserPermissions getCartSamplesForNewProject()
        Get a list of samples that are currently loaded into the cart that can be added to a new project This requires a special method because the user can only add samples to the new project that they already can modify.
        Returns:
        CartSamplesByUserPermissions