ilscipio/scipio-erp

View on GitHub
applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java

Summary

Maintainability
F
2 wks
Test Coverage

ShoppingCart has 439 methods (exceeds 20 allowed). Consider refactoring.
Open

@SuppressWarnings("serial")
public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {

    private static final Debug.OfbizLogger module = Debug.getOfbizLogger(java.lang.invoke.MethodHandles.lookup().lookupClass());
    public static final String resource_error = "OrderErrorUiLabels";

    CartShipInfo has 38 methods (exceeds 20 allowed). Consider refactoring.
    Open

        public static class CartShipInfo implements Serializable {
            // SCIPIO: 2018-11-22: Defaults moved into constructor
            public Map<ShoppingCartItem, CartShipItemInfo> shipItemInfo;
            public List<GenericValue> shipTaxAdj;
            public String orderTypeId;
    Severity: Minor
    Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 5 hrs to fix

      Method makeItem has 26 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public ShoppingCartItem makeItem(Integer cartLocation, GenericValue product, BigDecimal selectedAmount,
                                           BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,
                                           String accommodationMapId,String accommodationSpotId,
                                           Timestamp shipBeforeDate, Timestamp shipAfterDate, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
                                           String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher,
      Severity: Major
      Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 3 hrs to fix

        Method addItemToEnd has 19 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersonsDbl,String accommodationMapId, String accommodationSpotId, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException {
        Severity: Major
        Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 2 hrs to fix

          Method addOrIncreaseItem has 19 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public int addOrIncreaseItem(String productId, BigDecimal selectedAmount, BigDecimal quantity, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,
                         String accommodationMapId, String accommodationSpotId, Timestamp shipBeforeDate, Timestamp shipAfterDate, Map<String, GenericValue> features, Map<String,Object> attributes,
                         Map<String, String> orderItemAttributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, String itemGroupNumber,
                         String parentProductId, LocalDispatcher dispatcher) throws CartItemModifyException, ItemNotFoundException {
          Severity: Major
          Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 2 hrs to fix

            Method addOrIncreaseItem has 18 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public int addOrIncreaseItem(String productId, BigDecimal selectedAmount, BigDecimal quantity, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,
                           String accommodationMapId, String accommodationSpotId, Timestamp shipBeforeDate, Timestamp shipAfterDate, Map<String, GenericValue> features, Map<String, Object> attributes,
                           String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, String itemGroupNumber, String parentProductId, LocalDispatcher dispatcher) throws CartItemModifyException, ItemNotFoundException {
            Severity: Major
            Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 2 hrs to fix

              Method addItemToEnd has 18 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException {
              Severity: Major
              Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 2 hrs to fix

                Method makePurchaseOrderItem has 17 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public ShoppingCartItem makePurchaseOrderItem(Integer cartLocation, String productId, BigDecimal selectedAmount, BigDecimal quantity,
                                                                         Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup,
                                                                         LocalDispatcher dispatcher, ShoppingCart cart, GenericValue supplierProduct, Timestamp shipBeforeDate, Timestamp shipAfterDate, Timestamp cancelBackOrderDate, ShoppingCartItem.ExtraPurchaseOrderInitArgs extraInitArgs)
                Severity: Major
                Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 2 hrs to fix

                  Method addItemToEnd has 17 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException {
                  Severity: Major
                  Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 2 hrs to fix

                    Method addOrIncreaseItem has 16 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public int addOrIncreaseItem(String productId, BigDecimal selectedAmount, BigDecimal quantity, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,
                                Timestamp shipBeforeDate, Timestamp shipAfterDate, Map<String, GenericValue> features, Map<String, Object> attributes, String prodCatalogId,
                                ProductConfigWrapper configWrapper, String itemType, String itemGroupNumber, String parentProductId, LocalDispatcher dispatcher) throws CartItemModifyException, ItemNotFoundException {
                    Severity: Major
                    Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 2 hrs to fix

                      Method addItemToEnd has 16 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException {
                      Severity: Major
                      Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 2 hrs to fix

                        Method addItemToEnd has 16 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException {
                        Severity: Major
                        Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 2 hrs to fix

                          Method addItemToEnd has 14 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException {

                            Method addItemToEnd has 13 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException {

                              Method makeItem has 13 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public ShoppingCartItem makeItem(Integer cartLocation, String itemType, String itemDescription, String productCategoryId,
                                                                   BigDecimal basePrice, BigDecimal selectedAmount, BigDecimal quantity, Map<String, Object> attributes, String prodCatalogId, ShoppingCart.ShoppingCartItemGroup itemGroup,
                                                                   LocalDispatcher dispatcher, ShoppingCart cart, Boolean triggerExternalOpsBool) throws CartItemModifyException {

                                Method addItemToEnd has 12 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, String itemType, ProductConfigWrapper configWrapper, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException {

                                  Method addItemToEnd has 11 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException {

                                    Consider simplifying this complex logical expression.
                                    Wontfix

                                                        if (ALL == mode || (FILLED_ONLY == mode && UtilValidate.isNotEmpty(value)) || (EMPTY_ONLY == mode && UtilValidate.isEmpty(value))
                                                                || (mode != ALL && mode != FILLED_ONLY && mode != EMPTY_ONLY)) {
                                    
                                                            GenericValue orderItemAttribute = getDelegator().makeValue("OrderItemAttribute");
                                                            if (UtilValidate.isNotEmpty(orderId)) {
                                    Severity: Critical
                                    Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 1 hr to fix

                                      Method newItem has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          public ShoppingCartItem newItem(GenericValue product, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper, Locale locale, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, GenericValue parentProduct) {

                                        Method newItem has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                            public ShoppingCartItem newItem(Delegator delegator, String itemTypeId, String description, String categoryId, BigDecimal basePrice, Map<String, Object> attributes, String prodCatalogId, Locale locale, ShoppingCart.ShoppingCartItemGroup itemGroup) {

                                          Method addNonProductItem has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                              public int addNonProductItem(String itemType, String description, String categoryId, BigDecimal price, BigDecimal quantity,
                                                      Map<String, Object> attributes, String prodCatalogId, String itemGroupNumber, LocalDispatcher dispatcher) throws CartItemModifyException {

                                            Method newItem has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                                public ShoppingCartItem newItem(GenericValue product, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, Locale locale, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup) {
                                            Severity: Major
                                            Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 50 mins to fix

                                              Method addPaymentAmount has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                                  public CartPaymentInfo addPaymentAmount(String id, BigDecimal amount, String refNum, String authCode, boolean isSingleUse, boolean isPresent, boolean replace) {
                                              Severity: Major
                                              Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 50 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                        if (product != null) {
                                                                            if (!ProductWorker.isShippableToAddress(product, shippingAddress)) {
                                                                                throw new IllegalArgumentException("The shipping address is not compatible with ProductGeos rules.");
                                                                            }
                                                                        }
                                                Severity: Major
                                                Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 45 mins to fix

                                                  Method addOrderTerm has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                  Open

                                                      public int addOrderTerm(String termTypeId, String orderItemSeqId,BigDecimal termValue, Long termDays, String textValue, String description) {
                                                  Severity: Minor
                                                  Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                            while (fsppas.hasNext()) {
                                                                                // TODO - fix the free shipping promotions!!
                                                                            }
                                                    Severity: Major
                                                    Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 45 mins to fix

                                                      Method getPaymentInfo has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                      Open

                                                          public CartPaymentInfo getPaymentInfo(String id, String refNum, String authCode, BigDecimal amount, boolean update) {
                                                      Severity: Minor
                                                      Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 35 mins to fix

                                                        Method addProductPromoUse has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                        Open

                                                            public void addProductPromoUse(String productPromoId, String productPromoCodeId, BigDecimal totalDiscountAmount, BigDecimal quantityLeftInActions, Map<ShoppingCartItem,BigDecimal> usageInfoMap) {
                                                        Severity: Minor
                                                        Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 35 mins to fix

                                                          Method positionItemToGroup has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                          Open

                                                              public void positionItemToGroup(ShoppingCartItem item, BigDecimal quantity, int fromIndex, int toIndex, boolean clearEmptyGroups) {
                                                          Severity: Minor
                                                          Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 35 mins to fix

                                                            Method positionItemToGroup has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                            Open

                                                                public void positionItemToGroup(int itemIndex, BigDecimal quantity, int fromIndex, int toIndex, boolean clearEmptyGroups) {
                                                            Severity: Minor
                                                            Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 35 mins to fix

                                                              Method findCartItem has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                              Open

                                                                  public ShoppingCartItem findCartItem(String productId, Map<String, GenericValue> features, Map<String, Object> attributes, String prodCatalogId, BigDecimal selectedAmount) {
                                                              Severity: Minor
                                                              Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 35 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                                return 0;
                                                                Severity: Major
                                                                Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                                  return;
                                                                  Severity: Major
                                                                  Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                            return -1;
                                                                    Severity: Major
                                                                    Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                              return 1;
                                                                      Severity: Major
                                                                      Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                    return null;
                                                                        Severity: Major
                                                                        Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                          return pmCmp;
                                                                          Severity: Major
                                                                          Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                    return newProductId;
                                                                            Severity: Major
                                                                            Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                                  return 0;
                                                                              Severity: Major
                                                                              Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                            return null;
                                                                                Severity: Major
                                                                                Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                                      return null;
                                                                                  Severity: Major
                                                                                  Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                            return;
                                                                                    Severity: Major
                                                                                    Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                  return pmtCmp;
                                                                                      Severity: Major
                                                                                      Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                        return;
                                                                                        Severity: Major
                                                                                        Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                      return null;
                                                                                          Severity: Major
                                                                                          Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                                return 1;
                                                                                            Severity: Major
                                                                                            Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                                      return this.refNum[0].compareTo(that.refNum[0]);
                                                                                              Severity: Major
                                                                                              Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

                                                                                                                return -1;
                                                                                                Severity: Major
                                                                                                Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                                                  Avoid too many return statements within this method.
                                                                                                  Open

                                                                                                                      return -1;
                                                                                                  Severity: Major
                                                                                                  Found in applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java - About 30 mins to fix

                                                                                                    There are no issues that match your filters.

                                                                                                    Category
                                                                                                    Status