ilscipio/scipio-erp

View on GitHub
applications/product/src/org/ofbiz/product/product/ProductWorker.java

Summary

Maintainability
F
6 days
Test Coverage

ProductWorker has 124 methods (exceeds 20 allowed). Consider refactoring.
Open

public final class ProductWorker {

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

Severity: Major
Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 2 days to fix

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

        public static <C extends Collection<String>> C getAnyRelatedCategoryIdsForProduct(C outCategoryIds, Collection<String> outVisitedProductIds, Collection<String> outCatCheckedProductIds, Delegator delegator, String productId, GenericValue product, Collection<GenericValue> productVariantAssocs,
                                                                                          List<GenericValue> productAssocFromList, List<GenericValue> productAssocToList, boolean firstFoundOnly, Timestamp moment, boolean ordered, boolean useCache) throws GenericEntityException {

      Method getCategoryIdsForProduct has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static <C extends Collection<String>> C getCategoryIdsForProduct(C outCategoryIds, Delegator delegator, String productId, GenericValue product, Collection<GenericValue> productVariantAssocs,
                                                                                  Timestamp moment, boolean ordered, boolean useCache) throws GenericEntityException {

        Method getVirtualProductIdsDeepDfs has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private static List<String> getVirtualProductIdsDeepDfs(Delegator delegator, LocalDispatcher dispatcher,
                                                                    String productId, List<String> orderBy, Integer maxPerLevel, Timestamp moment, boolean useCache, List<String> virtualProductIds) throws GeneralException {

          Method getTotalIndividualProductStock has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private static BigDecimal getTotalIndividualProductStock(Delegator delegator, LocalDispatcher dispatcher,
                      GenericValue product, Timestamp moment, boolean useCache, String productId, boolean isMarketingPackage, List<GenericValue> productFacilities) throws GeneralException {

            Method getAssocCategoryIdsForProduct has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static <C extends Collection<String>> C getAssocCategoryIdsForProduct(C outCategoryIds, Delegator delegator, String productId, GenericValue product, Collection<GenericValue> productVariantAssocs,
                                                                                             Timestamp moment, boolean ordered, boolean useCache) throws GenericEntityException {

              Method getProductStockPerProductStore has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static Map<String, BigDecimal> getProductStockPerProductStore(Delegator delegator, LocalDispatcher dispatcher,
                          GenericValue product, Collection<GenericValue> productStores, boolean useTotal, boolean useVariantStockCalcForTotal,
                          Timestamp moment, boolean useCache) throws GeneralException {

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

                    private static List<String> getVariantProductIdsDeepDfs(Delegator delegator, LocalDispatcher dispatcher,
                                                                            String productId, List<String> orderBy, Timestamp moment, boolean useCache, List<String> variantProductIds) throws GeneralException {
                Severity: Major
                Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 50 mins to fix

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

                      public static List<GenericValue> getVirtualProducts(Delegator delegator, LocalDispatcher dispatcher,
                              GenericValue product, List<String> orderBy, Integer maxResults, Timestamp moment, boolean useCache) throws GeneralException {
                  Severity: Major
                  Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 50 mins to fix

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

                        public static List<String> getVirtualProductIds(Delegator delegator, LocalDispatcher dispatcher,
                                                                        String productId, List<String> orderBy, Integer maxResults, Timestamp moment, boolean useCache) throws GeneralException {
                    Severity: Major
                    Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 50 mins to fix

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

                          private static Collection<GenericValue> checkVariantAssocListForAssocCategoryIds(Delegator delegator, String productId, GenericValue product, Collection<GenericValue> productVariantAssocs,
                                                                                                           Timestamp moment, boolean ordered, boolean useCache) throws GenericEntityException {
                      Severity: Major
                      Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 50 mins to fix

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

                            public static Map<String, BigDecimal> getIndividualProductStockPerProductStore(Delegator delegator, LocalDispatcher dispatcher,
                                    GenericValue product, Collection<GenericValue> productStores, boolean useTotal, Timestamp moment, boolean useCache) throws GeneralException {
                        Severity: Major
                        Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 50 mins to fix

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

                              public static List<String> getVirtualProductIdsDeepDfs(Delegator delegator, LocalDispatcher dispatcher,
                                                                                     String productId, List<String> orderBy, Integer maxPerLevel, Timestamp moment, boolean useCache) throws GeneralException {
                          Severity: Major
                          Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 50 mins to fix

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

                                public static <C extends Collection<String>> C getOwnCategoryIdsForProduct(C outCategoryIds, Delegator delegator, String productId, GenericValue product, Timestamp moment, boolean ordered, boolean useCache) throws GenericEntityException {
                            Severity: Major
                            Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 50 mins to fix

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

                                  public static List<GenericValue> getVirtualProductsDeepDfs(Delegator delegator, LocalDispatcher dispatcher,
                                          GenericValue product, List<String> orderBy, Integer maxPerLevel, Timestamp moment, boolean useCache) throws GeneralException {
                              Severity: Major
                              Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 50 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if ("_total_".equals(entry.getKey())) {
                                                            totalInventory = totalInventory.add(entry.getValue());
                                                        } else {
                                                            BigDecimal storeInventory = countMap.get(entry.getKey());
                                                            if (storeInventory == null) storeInventory = BigDecimal.ZERO;
                                Severity: Major
                                Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

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

                                      public static List<GenericValue> getProductCategoryMembers(Delegator delegator, String productId, GenericValue product, Timestamp moment, boolean ordered, boolean useCache) throws GenericEntityException {
                                  Severity: Minor
                                  Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                                if (productFeatureType != null) {
                                                                    nameBuf.append(productFeatureType.get("description", locale));
                                                                    nameBuf.append(":");
                                                                }
                                    Severity: Major
                                    Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if (availableInventory != null) {
                                                                  storeInventory = storeInventory.add(availableInventory);
                                                              }
                                      Severity: Major
                                      Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

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

                                            public static Map<String, List<GenericValue>> getProductContentLocalizedSimpleTextViews(Delegator delegator, LocalDispatcher dispatcher,
                                                    String productId, Collection<String> productContentTypeIdList, java.sql.Timestamp filterByDate, boolean useCache) throws GenericEntityException {
                                        Severity: Minor
                                        Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

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

                                              public static List<String> getVariantProductIds(Delegator delegator, LocalDispatcher dispatcher,
                                                                                              String productId, List<String> orderBy, Timestamp moment, boolean useCache) throws GeneralException {
                                          Severity: Minor
                                          Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                        if (nameBuf.length() > 0) {
                                                                            nameBuf.append(", ");
                                                                        }
                                            Severity: Major
                                            Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

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

                                                  public static List<String> getVariantProductIdsDeepDfs(Delegator delegator, LocalDispatcher dispatcher,
                                                                                                         String productId, List<String> orderBy, Timestamp moment, boolean useCache) throws GeneralException {
                                              Severity: Minor
                                              Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                            if (featurTo.equals(paramValueTo)) {
                                                                                found = true;
                                                                                break;
                                                                            }
                                                Severity: Major
                                                Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

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

                                                      public static List<GenericValue> getVariantProducts(Delegator delegator, LocalDispatcher dispatcher,
                                                              GenericValue product, List<String> orderBy, Timestamp moment, boolean useCache) throws GeneralException {
                                                  Severity: Minor
                                                  Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                                if (productFeaturePrice != null) {
                                                                                    productPrice.put("price", productPrice.getBigDecimal("price").add(productFeaturePrice.getBigDecimal("price")));
                                                                                }
                                                    Severity: Major
                                                    Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                              if (!ServiceUtil.isSuccess(resultOutput)) {
                                                                                  Debug.logWarning("Error getting available marketing package.", module);
                                                                              }
                                                      Severity: Major
                                                      Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

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

                                                            public static List<GenericValue> getVariantProductsDeepDfs(Delegator delegator, LocalDispatcher dispatcher,
                                                                    GenericValue product, List<String> orderBy, Timestamp moment, boolean useCache) throws GeneralException {
                                                        Severity: Minor
                                                        Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

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

                                                              public static List<GenericValue> filterOrderAdjustments(List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) {
                                                          Severity: Minor
                                                          Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

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

                                                                public static BigDecimal getProductStockForProductStore(Delegator delegator, LocalDispatcher dispatcher,
                                                                                                                        GenericValue product, GenericValue productStore,
                                                                                                                        Timestamp moment, boolean useCache) throws GeneralException {
                                                            Severity: Minor
                                                            Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                                          if (featurTo.equals(paramValueTo)) {
                                                                                              Debug.logWarning("Incompatible features", module);
                                                                                              return null;
                                                                                          }
                                                              Severity: Major
                                                              Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 45 mins to fix

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

                                                                    public static BigDecimal getAverageProductRating(GenericValue product, List<GenericValue> reviews, String productStoreId, BigDecimal defaultRating, boolean useCache) { // SCIPIO: Added defaultRating, useCache
                                                                Severity: Minor
                                                                Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 35 mins to fix

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

                                                                      public static List<GenericValue> getProductCategoryMembersSafe(Delegator delegator, String productId, Timestamp moment, boolean ordered, boolean useCache) {
                                                                  Severity: Minor
                                                                  Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 35 mins to fix

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

                                                                        public static BigDecimal getTotalIndividualProductStock(Delegator delegator, LocalDispatcher dispatcher,
                                                                                GenericValue product, Timestamp moment, boolean useCache) throws GeneralException {
                                                                    Severity: Minor
                                                                    Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 35 mins to fix

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

                                                                          public static List<GenericValue> getProductCategoryMembers(Delegator delegator, String productId, Timestamp moment, boolean ordered, boolean useCache) throws GenericEntityException {
                                                                      Severity: Minor
                                                                      Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 35 mins to fix

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

                                                                            public static List<GenericValue> getVariantProductsForStockCalc(Delegator delegator, LocalDispatcher dispatcher,
                                                                                    GenericValue product, Timestamp moment, boolean useCache) throws GeneralException {
                                                                        Severity: Minor
                                                                        Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 35 mins to fix

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

                                                                              public static <C extends Collection<String>> C getAssocCategoryIdsForProduct(C outCategoryIds, GenericValue product,
                                                                                                                                                           Timestamp moment, boolean ordered, boolean useCache) throws GenericEntityException {
                                                                          Severity: Minor
                                                                          Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 35 mins to fix

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

                                                                                public static <C extends Collection<String>> C getOwnCategoryIdsForProduct(C outCategoryIds, GenericValue product, Timestamp moment, boolean ordered, boolean useCache) throws GenericEntityException {
                                                                            Severity: Minor
                                                                            Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 35 mins to fix

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

                                                                                  public static List<GenericValue> findProductsById(Delegator delegator,
                                                                                          String idToFind, String goodIdentificationTypeId,
                                                                                          boolean searchProductFirst, boolean searchAllId) throws GenericEntityException {
                                                                              Severity: Minor
                                                                              Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 35 mins to fix

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

                                                                                    public static BigDecimal calcOrderAdjustments(List<GenericValue> orderHeaderAdjustments, BigDecimal subTotal, boolean includeOther, boolean includeTax, boolean includeShipping) {
                                                                                Severity: Minor
                                                                                Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 35 mins to fix

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

                                                                                      public static <C extends Collection<String>> C getOwnCategoryIdsForProduct(C outCategoryIds, Delegator delegator, String productId, GenericValue product, List<GenericValue> productCategoryMembers) throws GenericEntityException {
                                                                                  Severity: Minor
                                                                                  Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 35 mins to fix

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

                                                                                        public static <C extends Collection<String>> C getCategoryIdsForProduct(C outCategoryIds, GenericValue product, Timestamp moment, boolean ordered, boolean useCache) throws GenericEntityException {
                                                                                    Severity: Minor
                                                                                    Found in applications/product/src/org/ofbiz/product/product/ProductWorker.java - About 35 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

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

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

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

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                  return outCategoryIds;
                                                                                          Severity: Major
                                                                                          Found in applications/product/src/org/ofbiz/product/product/ProductWorker.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/product/ProductWorker.java - About 30 mins to fix

                                                                                              There are no issues that match your filters.

                                                                                              Category
                                                                                              Status