ilscipio/scipio-erp

View on GitHub
applications/product/src/org/ofbiz/product/price/PriceServices.java

Summary

Maintainability
D
2 days
Test Coverage

Method calcPriceResultFromRules has 21 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static Map<String, Object> calcPriceResultFromRules(List<GenericValue> productPriceRules, BigDecimal listPrice, BigDecimal defaultPrice, BigDecimal promoPrice,
        BigDecimal wholesalePrice, GenericValue maximumPriceValue, GenericValue minimumPriceValue, boolean validPriceFound,
        GenericValue averageCostValue, String productId, String virtualProductId, String prodCatalogId, String productStoreGroupId,
        String webSiteId, String partyId, BigDecimal quantity, String currencyUomId, Delegator delegator, Timestamp nowTimestamp,
        Locale locale, boolean useCache) throws GenericEntityException {
Severity: Major
Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 2 hrs to fix

    Method calcPriceResultFromRules has 20 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static Map<String, Object> calcPriceResultFromRules(List<GenericValue> productPriceRules, BigDecimal listPrice, BigDecimal defaultPrice, BigDecimal promoPrice,
                BigDecimal wholesalePrice, GenericValue maximumPriceValue, GenericValue minimumPriceValue, boolean validPriceFound,
                GenericValue averageCostValue, String productId, String virtualProductId, String prodCatalogId, String productStoreGroupId,
                String webSiteId, String partyId, BigDecimal quantity, String currencyUomId, Delegator delegator, Timestamp nowTimestamp,
                Locale locale) throws GenericEntityException {
    Severity: Major
    Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 2 hrs to fix

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

          public static boolean checkPriceCondition(GenericValue productPriceCond, String productId, String virtualProductId, String prodCatalogId,
                  String productStoreGroupId, String webSiteId, String partyId, BigDecimal quantity, BigDecimal listPrice,
                  String currencyUomId, Delegator delegator, Timestamp nowTimestamp, boolean useCache) throws GenericEntityException {
      Severity: Major
      Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 1 hr to fix

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

            public static boolean checkPriceCondition(GenericValue productPriceCond, String productId, String virtualProductId, String prodCatalogId,
                    String productStoreGroupId, String webSiteId, String partyId, BigDecimal quantity, BigDecimal listPrice,
                    String currencyUomId, Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException {
        Severity: Major
        Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 1 hr to fix

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

              public static Map<String, Object> addGeneralResults(Map<String, Object> result, GenericValue competitivePriceValue, GenericValue specialPromoPriceValue, GenericValue productStore,
                  String checkIncludeVat, String currencyUomId, String productId, BigDecimal quantity, String partyId, LocalDispatcher dispatcher, Locale locale, boolean useCache) {
          Severity: Major
          Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 1 hr to fix

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

                public static Map<String, Object> addGeneralResults(Map<String, Object> result, GenericValue competitivePriceValue, GenericValue specialPromoPriceValue, GenericValue productStore,
                    String checkIncludeVat, String currencyUomId, String productId, BigDecimal quantity, String partyId, LocalDispatcher dispatcher, Locale locale) {
            Severity: Major
            Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 1 hr to fix

              Method makeProducePriceRuleList has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static List<GenericValue> makeProducePriceRuleList(Delegator delegator, boolean optimizeForLargeRuleSet, String productId, String virtualProductId, String prodCatalogId, String productStoreGroupId, String webSiteId, String partyId, String currencyUomId, boolean useCache) throws GenericEntityException {
              Severity: Major
              Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 1 hr to fix

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

                    public static List<GenericValue> makeProducePriceRuleList(Delegator delegator, boolean optimizeForLargeRuleSet, String productId, String virtualProductId, String prodCatalogId, String productStoreGroupId, String webSiteId, String partyId, String currencyUomId) throws GenericEntityException {
                Severity: Major
                Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (productPriceAction.get("amount") != null) {
                                              modifyAmount = defaultPrice.multiply(productPriceAction.getBigDecimal("amount").movePointLeft(2));
                                              price = defaultPrice;
                                          }
                  Severity: Major
                  Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if (minDefaultPrice == null || curDefaultPrice.compareTo(minDefaultPrice) < 0) {
                                                    // check to see if the product is discontinued for sale before considering it the lowest price
                                                    GenericValue curVariantProduct = EntityQuery.use(delegator).from("Product").where("productId", curVariantProductId).cache(useCache).queryOne();
                                                    if (curVariantProduct != null) {
                                                        Timestamp salesDiscontinuationDate = curVariantProduct.getTimestamp("salesDiscontinuationDate");
                    Severity: Major
                    Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (UtilValidate.isNotEmpty(calculatedDefaultPrice)) {
                                                      defaultPrice = calculatedDefaultPrice;
                                                      validPriceFound = true;
                                                  }
                      Severity: Major
                      Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                switch (entry.getKey()) {
                                                case "basePrice":
                                                    tempPrice = (BigDecimal) entry.getValue();
                                                    break;
                                                case "price":
                        Severity: Major
                        Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if (tempPrice != null && tempPrice != BigDecimal.ZERO) {
                                                      Map<String, Object> priceResults = new HashMap<String, Object>();
                                                      try {
                                                          priceResults = dispatcher.runSync("convertUom", UtilMisc.<String, Object> toMap("uomId", currencyDefaultUomId, "uomIdTo", currencyUomIdTo,
                                                                  "originalValue", tempPrice, "defaultDecimalScale", 2L, "defaultRoundingMode", "HalfUp"));
                          Severity: Major
                          Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 45 mins to fix

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

                                private static int checkConditionPartyHierarchy(Delegator delegator, Timestamp nowTimestamp, String groupPartyId, String partyId, boolean useCache) throws GenericEntityException {
                            Severity: Minor
                            Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 35 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                                  if (errorResult != null) return errorResult;
                              Severity: Major
                              Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                                                        "ProductPriceCannotRetrievePriceRules", UtilMisc.toMap("errorString", e.toString()) , locale));
                                Severity: Major
                                Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              if (errorResult != null) return errorResult;
                                  Severity: Major
                                  Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                if (compare <= 0) return true;
                                    Severity: Major
                                    Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                              if (quantErrorResult != null) return quantErrorResult;
                                      Severity: Major
                                      Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                return result;
                                        Severity: Major
                                        Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                      if (compare > 0) return true;
                                          Severity: Major
                                          Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                                if (errorResult != null) return errorResult;
                                            Severity: Major
                                            Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                          if (compare == 0) return true;
                                              Severity: Major
                                              Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                            if (compare != 0) return true;
                                                Severity: Major
                                                Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                          return false;
                                                  Severity: Major
                                                  Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                if (compare < 0) return true;
                                                    Severity: Major
                                                    Found in applications/product/src/org/ofbiz/product/price/PriceServices.java - About 30 mins to fix

                                                      There are no issues that match your filters.

                                                      Category
                                                      Status