summaryrefslogtreecommitdiffstats
path: root/idrop-web/grails-app/services
diff options
context:
space:
mode:
authorMike Conway <michael.c.conway@gmail.com>2011-11-23 19:11:41 (GMT)
committer Mike Conway <michael.c.conway@gmail.com>2011-11-23 19:11:41 (GMT)
commit198828fe69c1f8e152ab16810781fe1385655b20 (patch)
tree858f608c00bcf20cc146c05e42f53aed5bd6ba12 /idrop-web/grails-app/services
parent35e48adc703ec86a285e98e47bd6f09978f67bec (diff)
downloadQCG-Data-198828fe69c1f8e152ab16810781fe1385655b20.zip
QCG-Data-198828fe69c1f8e152ab16810781fe1385655b20.tar.gz
QCG-Data-198828fe69c1f8e152ab16810781fe1385655b20.tar.bz2
[#535] shopping cart capability in idrop web and idrop lite
Diffstat (limited to 'idrop-web/grails-app/services')
-rw-r--r--idrop-web/grails-app/services/org/irods/mydrop/service/ShoppingCartService.groovy18
1 files changed, 18 insertions, 0 deletions
diff --git a/idrop-web/grails-app/services/org/irods/mydrop/service/ShoppingCartService.groovy b/idrop-web/grails-app/services/org/irods/mydrop/service/ShoppingCartService.groovy
index e730b0a..5025bf2 100644
--- a/idrop-web/grails-app/services/org/irods/mydrop/service/ShoppingCartService.groovy
+++ b/idrop-web/grails-app/services/org/irods/mydrop/service/ShoppingCartService.groovy
@@ -37,6 +37,24 @@ class ShoppingCartService {
}
/**
+ * Clear the files in the cart
+ */
+ public void clearCart() {
+ FileShoppingCart fileShoppingCart = getCartFromSession()
+ if (fileShoppingCart) {
+ fileShoppingCart.clearCart()
+ }
+ }
+
+ public void deleteFromCart(String fileName) {
+ FileShoppingCart shoppingCart = getSession().shoppingCart
+ if (shoppingCart) {
+ log.info("have a shopping cart, delete ${fileName}")
+ shoppingCart.removeAnItem(fileName);
+ }
+ }
+
+ /**
* Get shopping cart from session if present, but don't create one if not present (saves storing unnecesary session state)
* @return {@link FileShoppingCart} if stored in session, or <code>null</code> if not stored
*/