Class UICartService
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.ria.web.services.UICartService
-
@Component public class UICartService extends java.lang.Object
Service for handling all aspects of interaction with the Cart.
-
-
Constructor Summary
Constructors Constructor Description UICartService(Cart cart, ProjectService projectService, SampleService sampleService, UpdateSamplePermission updateSamplePermission, org.springframework.context.MessageSource messageSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CartUpdateResponse
addSamplesToCart(AddToCartRequest request, java.util.Locale locale)
Add samples from a project to the cart.void
emptyCart()
Remove all samples from the cartjava.util.List<java.lang.Long>
getCartSampleIds()
Get a list of sample ids in the cartCartSamplesByUserPermissions
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.java.util.Map<Project,java.util.List<Sample>>
getFullCart()
int
getNumberOfSamplesInCart()
Get the number of samples in the cartjava.util.Set<java.lang.Long>
getProjectIdsInCart()
Get a set of identifiers forProject
s in the cartjava.util.List<CartProjectModel>
getSamplesForProjects()
Get a list of sample in the cart belonging to a list of projectsjava.lang.Boolean
isCartEmpty()
Determine if the cart is emptyjava.lang.Long
isSampleInCart(java.lang.Long sampleId)
Determine if a sample is in the cart.CartUpdateResponse
removeProject(java.lang.Long id, java.util.Locale locale)
Remove all samples from a specific project from the cart.CartUpdateResponse
removeSample(java.lang.Long sampleId, java.util.Locale locale)
Remove a specific sample from the cart.
-
-
-
Constructor Detail
-
UICartService
@Autowired public UICartService(Cart cart, ProjectService projectService, SampleService sampleService, UpdateSamplePermission updateSamplePermission, org.springframework.context.MessageSource messageSource)
-
-
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 cartlocale
- 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 cartlocale
- 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 forProject
s in the cart- Returns:
Set
ofProject
identifiers
-
getSamplesForProjects
public java.util.List<CartProjectModel> getSamplesForProjects()
Get a list of sample in the cart belonging to a list of projects- Returns:
List
ofCartProjectModel
s 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
ofLong
s containing sample ids of samples in cart
-
getFullCart
public java.util.Map<Project,java.util.List<Sample>> getFullCart()
- 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
-
-