ilscipio/scipio-erp

View on GitHub
applications/product/src/com/ilscipio/scipio/product/seo/SeoCatalogUrlWorker.java

Summary

Maintainability
F
1 wk
Test Coverage

SeoCatalogUrlWorker has 125 methods (exceeds 20 allowed). Consider refactoring.
Open

@SuppressWarnings("serial")
public class SeoCatalogUrlWorker implements Serializable {

    private static final Debug.OfbizLogger module = Debug.getOfbizLogger(java.lang.invoke.MethodHandles.lookup().lookupClass());

    PathSegmentEntities has 33 methods (exceeds 20 allowed). Consider refactoring.
    Open

        public static class PathSegmentEntities implements List<PathSegmentEntity>, Serializable {
            private final CatalogUrlType entityType;
            private final String pathSegment;
            private final List<PathSegmentEntity> entities;
            private final Timestamp moment;

      PathSegmentEntity has 27 methods (exceeds 20 allowed). Consider refactoring.
      Open

          public static class PathSegmentEntity implements Serializable {
              protected final CatalogUrlType entityType;
              protected final String id;
              protected final String pathSegment;
              protected final PathSegmentMatchOptions matchOptions;

        PathMatch has 26 methods (exceeds 20 allowed). Consider refactoring.
        Open

            public static class PathMatch implements Serializable {
        
                protected PathEntity pathEntity;
                protected String path;
                protected List<String> pathSegments; // path segments (after mount-point, if any)

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

              protected String makeCategoryUrlImpl(Delegator delegator, LocalDispatcher dispatcher, Locale locale, List<String> trail, FullWebappInfo targetWebappInfo,
                                            String currentCatalogId, String previousCategoryId, String productCategoryId, String productId, String viewSize, String viewIndex, String viewSort, String searchString, boolean useCache) {

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

                public String makeCategoryUrl(Delegator delegator, LocalDispatcher dispatcher, Locale locale, List<String> currentTrail, FullWebappInfo targetWebappInfo,
                                              String currentCatalogId, String previousCategoryId, String productCategoryId, String productId, String viewSize, String viewIndex, String viewSort, String searchString) {

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

                  protected static String getCategoryCacheKey(Delegator delegator, FullWebappInfo targetWebappInfo, String type, Locale locale, String previousCategoryId, String productCategoryId, String productId,
                                                              String viewSize, String viewIndex, String viewSort, String searchString, String currentCatalogId, List<String> trail) {

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

                        public String makeCategoryAltUrl(Delegator delegator, LocalDispatcher dispatcher, Locale locale, List<String> trail,
                                FullWebappInfo targetWebappInfo, String currentCatalogId, String previousCategoryId, String productCategoryId, String productId,
                                String viewSize, String viewIndex, String viewSort, String searchString) {

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

                      protected PathSegmentEntity addPathSegmentEntity(Map<String, PathSegmentEntity> results, Delegator delegator, CatalogUrlType entityType, String id, String pathSegment, PathSegmentMatchOptions matchOptions, Timestamp moment, PathSegmentMatchType matchType, String name, String localeString, GenericValue record) {

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

                        public PathMatch makePathMatch(Delegator delegator, PathEntity pathEntity, String path, List<String> pathSegments,
                                                       String contextPath, String webSiteId, String currentCatalogId,
                                                       boolean explicitProductRequest, boolean explicitCategoryRequest, Locale explicitLocale, Timestamp moment) {

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

                          public PathMatch makePathMatchIfValidRequest(Delegator delegator, PathEntity pathEntity, String path, List<String> pathSegments,
                                                                       String contextPath, String webSiteId, String currentCatalogId,
                                                                       boolean explicitProductRequest, boolean explicitCategoryRequest, Locale explicitLocale, Timestamp moment) {

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

                            protected String makeProductUrlImpl(Delegator delegator, LocalDispatcher dispatcher, Locale locale, List<String> trail, FullWebappInfo targetWebappInfo,
                                                         String currentCatalogId, String previousCategoryId, String productCategoryId, String productId, boolean useCache) {

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

                              public PathSegmentEntity makePathSegmentEntity(Delegator delegator, CatalogUrlType entityType, String id, String pathSegment, PathSegmentMatchOptions matchOptions, Timestamp moment, PathSegmentMatchType matchType, String name, String localeString, GenericValue record) {

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

                                protected List<String> getCategoryTrailPathSegments(Delegator delegator, LocalDispatcher dispatcher, Locale locale, List<GenericValue> trailEntities, GenericValue targetCategory,
                                                                                    SeoConfig.TrailFormat trailFormat, SeoConfig.TrailFormat targetCategoryFormat, CatalogUrlType urlType, CatalogAltUrlSanitizer.SanitizeContext targetSanitizeCtx, boolean useCache) {

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

                                      public String makeProductAltUrl(Delegator delegator, LocalDispatcher dispatcher, Locale locale, List<String> trail,
                                              FullWebappInfo targetWebappInfo, String currentCatalogId, String previousCategoryId, String productCategoryId, String productId) {

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

                                    public String makeProductUrl(Delegator delegator, LocalDispatcher dispatcher, Locale locale, List<String> currentTrail, FullWebappInfo targetWebappInfo,
                                                                 String currentCatalogId, String previousCategoryId, String productCategoryId, String productId) {

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

                                          public String makeCategoryAltUrl(HttpServletRequest request, Locale locale, String previousCategoryId,
                                                  String productCategoryId, String productId, String viewSize, String viewIndex, String viewSort,
                                                  String searchString) {

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

                                        public String makeCategoryUrl(HttpServletRequest request, Locale locale, String previousCategoryId, String productCategoryId, String productId, String viewSize, String viewIndex, String viewSort, String searchString) {

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

                                          public StringBuilder makeProductUrlCore(Delegator delegator, LocalDispatcher dispatcher, Locale locale, GenericValue product,
                                                                                  String currentCatalogId, String previousCategoryId, List<GenericValue> trailEntities, FullWebappInfo targetWebappInfo, boolean useCache) {

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

                                                public String makeCatalogUrl(Delegator delegator, LocalDispatcher dispatcher, Locale locale, FullWebappInfo targetWebappInfo, String currentCatalogId, List<String> crumb, String productId,
                                                        String currentCategoryId, String previousCategoryId) {

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

                                              protected static String getProductUrlCacheKey(Delegator delegator, FullWebappInfo targetWebappInfo, String type, Locale locale, String previousCategoryId, String productCategoryId, String productId, String currentCatalogId, List<String> trail) {

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

                                                public StringBuilder makeCategoryUrlCore(Delegator delegator, LocalDispatcher dispatcher, Locale locale, GenericValue productCategory,
                                                                                         String currentCatalogId, String previousCategoryId, List<GenericValue> trailEntities, FullWebappInfo targetWebappInfo, boolean useCache) {

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

                                                  protected PathEntity matchBestProductAndTrail(Delegator delegator, PathSegmentEntities products, PathSegmentEntities lastSegmentProducts, List<String> pathSegments, String currentCatalogId, String webSiteId, Locale expectedLocale, Timestamp moment) throws GenericEntityException {

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

                                                    protected PathEntity matchBestCategoryAndTrail(Delegator delegator, PathSegmentEntities categories, PathSegmentEntities lastSegmentCategories, List<String> pathSegments, String currentCatalogId, String webSiteId, Locale expectedLocale, Timestamp moment) throws GenericEntityException {

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

                                                      public StringBuilder makeCategoryUrlPath(Delegator delegator, LocalDispatcher dispatcher, Locale locale,
                                                                                               GenericValue productCategory, List<String> trailNames, String contextPath, CatalogAltUrlSanitizer.SanitizeContext sanitizeCtx, boolean useCache) {

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

                                                        protected PathEntity matchBestEntityAndTrail(Delegator delegator, PathSegmentEntities targetEntities, PathSegmentEntities lastSegmentEntities,
                                                                                                     List<String> pathSegments, String currentCatalogId, String webSiteId, Locale expectedLocale, Timestamp moment) throws GenericEntityException {

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

                                                          public StringBuilder makeProductUrlPath(Delegator delegator, LocalDispatcher dispatcher, Locale locale, GenericValue product, List<String> trailNames, String contextPath, CatalogAltUrlSanitizer.SanitizeContext sanitizeCtx, boolean useCache) {

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

                                                            private void matchPathSegmentAltUrl(Delegator delegator, String pathSegment, List<GenericValue> values, String idField,
                                                                                                CatalogUrlType entityType, PathSegmentMatchOptions matchOptions, Timestamp moment, Map<String, PathSegmentEntity> results) {

                                                          Consider simplifying this complex logical expression.
                                                          Open

                                                                                  if (bestEntity == null || bestTrail == null || bestTrailMatchType.comparePriorityTo(trailMatchType) < 0 ||
                                                                                          (bestTrailMatchType.comparePriorityTo(trailMatchType) == 0 &&
                                                                                              (trail.size() < bestTrail.size() ||
                                                                                                  (trail.size() == bestTrail.size() && isFirstTrailBetterMatchThanSecondTopCatPrecision(entity, trail, bestEntity, bestTrail, topCategoryIds))))) {
                                                                                      trailEntities = resolvePathSegmentEntityTrail(trail, requestedTrailEntities);

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

                                                                public StringBuilder makeCategoryUrlPath(Delegator delegator, LocalDispatcher dispatcher, Locale locale,
                                                                                                         GenericValue productCategory, List<String> trailNames, String contextPath, boolean useCache) {

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

                                                                  protected String getCategoryPathName(Delegator delegator, LocalDispatcher dispatcher, Locale locale, GenericValue productCategory, SeoConfig.TrailFormat format, CatalogAltUrlSanitizer.SanitizeContext sanitizeCtx, boolean useCache) {

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

                                                                    public String getCategoryPathSegment(Delegator delegator, LocalDispatcher dispatcher, Locale locale, GenericValue productCategory, SeoConfig.TrailFormat format, CatalogAltUrlSanitizer.SanitizeContext sanitizeCtx, boolean useCache) {

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

                                                                      public StringBuilder makeProductUrlPath(Delegator delegator, LocalDispatcher dispatcher, Locale locale, GenericValue product, List<String> trailNames, String contextPath, boolean useCache) {

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

                                                                        protected String getProductPathSegment(Delegator delegator, LocalDispatcher dispatcher, Locale locale, GenericValue product, CatalogAltUrlSanitizer.SanitizeContext sanitizeCtx, boolean useCache) {

                                                                      Avoid deeply nested control flow statements.
                                                                      Open

                                                                                              if (firstTopCatId.equals(topCatId)) {
                                                                                                  return true;
                                                                                              } else if (secondTopCatId.equals(topCatId)) {
                                                                                                  return false;
                                                                                              }

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

                                                                            protected String getProductPathName(Delegator delegator, LocalDispatcher dispatcher, Locale locale, GenericValue product, CatalogAltUrlSanitizer.SanitizeContext sanitizeCtx, boolean useCache) {

                                                                          Avoid deeply nested control flow statements.
                                                                          Open

                                                                                                      if (newResults == null) {
                                                                                                          newResults = makePathSegmentEntity(this, matchOptions, false);
                                                                                                      }

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

                                                                                protected String getCategoryAltUrl(Delegator delegator, LocalDispatcher dispatcher, Locale locale, GenericValue productCategory, CatalogAltUrlSanitizer.SanitizeContext sanitizeCtx, boolean useCache) {

                                                                              Avoid deeply nested control flow statements.
                                                                              Open

                                                                                                      if (isCategoryEntity) {
                                                                                                          trail.remove(trail.size() - 1);
                                                                                                      }

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

                                                                                    public String matchReplaceOutboundSeoTranslatableUrl(HttpServletRequest request, Delegator delegator, String url, String productReqPath, String categoryReqPath, String contextRoot) {

                                                                                  Avoid deeply nested control flow statements.
                                                                                  Open

                                                                                                          if (bestEntity == null || bestTrail == null || bestTrailMatchType.comparePriorityTo(trailMatchType) < 0 ||
                                                                                                                  (bestTrailMatchType.comparePriorityTo(trailMatchType) == 0 &&
                                                                                                                      (trail.size() < bestTrail.size() ||
                                                                                                                          (trail.size() == bestTrail.size() && isFirstTrailBetterMatchThanSecondTopCatPrecision(entity, trail, bestEntity, bestTrail, topCategoryIds))))) {
                                                                                                              trailEntities = resolvePathSegmentEntityTrail(trail, requestedTrailEntities);

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

                                                                                        protected String getProductAltUrl(Delegator delegator, LocalDispatcher dispatcher, Locale locale, GenericValue product, CatalogAltUrlSanitizer.SanitizeContext sanitizeCtx, boolean useCache) {

                                                                                      Avoid deeply nested control flow statements.
                                                                                      Open

                                                                                                              if (pathInfo.length() > productReqPath.length()) {
                                                                                                                  Map<String, String> params = extractParamsFromRest(pathInfo, productReqPath.length());
                                                                                                                  if (params == null) return null;
                                                                                                                  String productId = params.remove("product_id");
                                                                                                                  if (productId == null) {

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

                                                                                                public String makeProductAltUrl(HttpServletRequest request, Locale locale, String previousCategoryId, String productCategoryId,
                                                                                                        String productId) {

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

                                                                                              protected List<String> mapCategoryUrlTrail(Delegator delegator, List<String> hintTrail, String productCategoryId, String webSiteId, String currentCatalogId) {

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

                                                                                                protected void matchPathSegmentCategoryById(Delegator delegator, String pathSegment, PathSegmentMatchOptions matchOptions, Timestamp moment, Map<String, PathSegmentEntity> results) throws GenericEntityException {

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

                                                                                                  private boolean isFirstTrailBetterMatchThanSecondTopCatPrecision(PathSegmentEntity firstMatch, List<String> firstTrail, PathSegmentEntity secondMatch, List<String> secondTrail, Set<String> topCategoryIds) {

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

                                                                                                    protected List<GenericValue> getCategoriesFromIdList(Delegator delegator, LocalDispatcher dispatcher, Locale locale, List<String> categoryIdList, boolean useCache) {

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

                                                                                                      protected void matchPathSegmentCategoryByAltUrl(Delegator delegator, String pathSegment, PathSegmentMatchOptions matchOptions, Timestamp moment, Map<String, PathSegmentEntity> results) throws GenericEntityException {

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

                                                                                                        public String makeProductUrl(HttpServletRequest request, Locale locale, String previousCategoryId, String productCategoryId, String productId) {

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

                                                                                                          public PathMatch matchInboundSeoCatalogUrl(Delegator delegator, String path, String contextPath, String webSiteId, String currentCatalogId) {

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

                                                                                                            protected void matchPathSegmentProductImpl(Delegator delegator, String pathSegment, PathSegmentMatchOptions matchOptions, Timestamp moment, Map<String, PathSegmentEntity> results) throws GenericEntityException {

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

                                                                                                                  public String makeCatalogUrl(HttpServletRequest request, Locale locale, String productId, String currentCategoryId,
                                                                                                                          String previousCategoryId) {

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

                                                                                                                protected List<String> mapProductUrlTrail(Delegator delegator, List<String> hintTrail, String productId, String webSiteId, String currentCatalogId) {

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

                                                                                                                  protected void matchPathSegmentCategoryImpl(Delegator delegator, String pathSegment, PathSegmentMatchOptions matchOptions, Timestamp moment, Map<String, PathSegmentEntity> results) throws GenericEntityException {

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

                                                                                                                    protected void matchPathSegmentProductByAltUrl(Delegator delegator, String pathSegment, PathSegmentMatchOptions matchOptions, Timestamp moment, Map<String, PathSegmentEntity> results) throws GenericEntityException {

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

                                                                                                                      protected void matchPathSegmentProductById(Delegator delegator, String pathSegment, PathSegmentMatchOptions matchOptions, Timestamp moment, Map<String, PathSegmentEntity> results) throws GenericEntityException {

                                                                                                                    Avoid too many return statements within this method.
                                                                                                                    Open

                                                                                                                                                    if (newUrl == null) return null;

                                                                                                                      Avoid too many return statements within this method.
                                                                                                                      Open

                                                                                                                              return null;

                                                                                                                        Avoid too many return statements within this method.
                                                                                                                        Open

                                                                                                                                return makePathMatchIfValidRequest(delegator, pathEntity, path, allPathSegments, contextPath, webSiteId, currentCatalogId, explicitProductRequest, explicitCategoryRequest, explicitLocale, moment);

                                                                                                                          Avoid too many return statements within this method.
                                                                                                                          Open

                                                                                                                                                          return absPrefix + newUrl + colonString + remainingParams;

                                                                                                                            Avoid too many return statements within this method.
                                                                                                                            Open

                                                                                                                                    return firstMatch.isMorePreciseThan(secondMatch);

                                                                                                                              Avoid too many return statements within this method.
                                                                                                                              Open

                                                                                                                                      return null;

                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                Open

                                                                                                                                                            if (params == null) return null;

                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                  Open

                                                                                                                                              return null;

                                                                                                                                    There are no issues that match your filters.

                                                                                                                                    Category
                                                                                                                                    Status