incubator-nuvem-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r997997 - in /incubator/nuvem/trunk/store-assets/src/main/java/services: ShoppingCartImpl.java ShoppingCartManager.java
Date Fri, 17 Sep 2010 06:50:44 GMT
Author: lresende
Date: Fri Sep 17 06:50:44 2010
New Revision: 997997

URL: http://svn.apache.org/viewvc?rev=997997&view=rev
Log:
Minor change to switch to isEmpty()

Modified:
    incubator/nuvem/trunk/store-assets/src/main/java/services/ShoppingCartImpl.java
    incubator/nuvem/trunk/store-assets/src/main/java/services/ShoppingCartManager.java

Modified: incubator/nuvem/trunk/store-assets/src/main/java/services/ShoppingCartImpl.java
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/store-assets/src/main/java/services/ShoppingCartImpl.java?rev=997997&r1=997996&r2=997997&view=diff
==============================================================================
--- incubator/nuvem/trunk/store-assets/src/main/java/services/ShoppingCartImpl.java (original)
+++ incubator/nuvem/trunk/store-assets/src/main/java/services/ShoppingCartImpl.java Fri Sep
17 06:50:44 2010
@@ -6,15 +6,15 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
- * under the License.    
+ * under the License.
  */
 
 package services;
@@ -34,7 +34,7 @@ import org.oasisopen.sca.annotation.Scop
 public class ShoppingCartImpl implements ShoppingCart {
     private static final Logger log = Logger.getLogger(ShoppingCartImpl.class.getName());
 
-    //private DatastoreDocumentServiceImpl cart = new DatastoreDocumentServiceImpl(); 
+    //private DatastoreDocumentServiceImpl cart = new DatastoreDocumentServiceImpl();
     private Map<String, Item> cart = new HashMap<String, Item>();
 
     public Entry<String, Item>[] getAll() {
@@ -56,7 +56,7 @@ public class ShoppingCartImpl implements
     }
 
     public String post(String key, Item item) {
-        if (key == null || key.length() == 0) {
+        if (key == null || key.isEmpty()) {
             key ="cart-" + UUID.randomUUID().toString();
         }
         cart.put(key, item);
@@ -69,7 +69,7 @@ public class ShoppingCartImpl implements
         }
         cart.put(key, item);
     }
-    
+
     public void delete(String key) throws NotFoundException {
         if (key == null || key.equals("")) {
             cart.clear();
@@ -93,7 +93,7 @@ public class ShoppingCartImpl implements
         }
         return entries.toArray(new Entry[entries.size()]);
     }
-    
+
     public String getTotal() {
         double total = 0;
         String currencySymbol = "";

Modified: incubator/nuvem/trunk/store-assets/src/main/java/services/ShoppingCartManager.java
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/store-assets/src/main/java/services/ShoppingCartManager.java?rev=997997&r1=997996&r2=997997&view=diff
==============================================================================
--- incubator/nuvem/trunk/store-assets/src/main/java/services/ShoppingCartManager.java (original)
+++ incubator/nuvem/trunk/store-assets/src/main/java/services/ShoppingCartManager.java Fri
Sep 17 06:50:44 2010
@@ -6,15 +6,15 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
- * under the License.    
+ * under the License.
  */
 
 package services;
@@ -35,22 +35,22 @@ import org.oasisopen.sca.annotation.Scop
 public class ShoppingCartManager implements ShoppingCart {
     private static final Logger log = Logger.getLogger(ShoppingCartManager.class.getName());
     private static String ANONYMOUS = "anonymous";
-    
+
     private Map<String, ShoppingCart> carts = new HashMap<String, ShoppingCart>();
-    
+
     @Reference
     private UserService userService;
-        
+
     public Entry<String, Item>[] getAll() {
         return getUserShoppingCart().getAll();
     }
- 
+
     public Item get(String key) throws NotFoundException {
         return getUserShoppingCart().get(key);
     }
 
     public String post(String key, Item item) {
-        if (key == null || key.length() == 0) {
+        if (key == null || key.isEmpty()) {
             key = this.generateItemKey();
         }
         return getUserShoppingCart().post(key, item);
@@ -63,7 +63,7 @@ public class ShoppingCartManager impleme
     public Entry<String, Item>[] query(String queryString) {
         return getUserShoppingCart().query(queryString);
     }
-    
+
     public void delete(String key) throws NotFoundException {
         this.getUserShoppingCart().delete(key);
     }
@@ -71,12 +71,10 @@ public class ShoppingCartManager impleme
     public String getTotal() {
         return this.getUserShoppingCart().getTotal();
     }
-    
+
     /**
      * Utility functions
      */
-
-
     private ShoppingCart getUserShoppingCart() {
         String key = getCartKey();
         ShoppingCart userCart = carts.get(key);
@@ -86,7 +84,7 @@ public class ShoppingCartManager impleme
         }
         return userCart;
     }
-    
+
     private String getUserId() {
         String userId = null;
         if(userService != null) {



Mime
View raw message