ilscipio/scipio-erp

View on GitHub
framework/service/src/org/ofbiz/service/ModelService.java

Summary

Maintainability
F
4 days
Test Coverage

ModelService has 123 methods (exceeds 20 allowed). Consider refactoring.
Open

@SuppressWarnings("serial")
public class ModelService extends AbstractMap<String, Object> implements Serializable {

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

Severity: Major
Found in framework/service/src/org/ofbiz/service/ModelService.java - About 2 days to fix

    Avoid deeply nested control flow statements.
    Open

                                if (Debug.verboseOn())
                                    Debug.logVerbose("Adding service [" + sm.getName() + "] as interface of: [" + this.name + "]", module);
    Severity: Major
    Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if (overrideParam.overrideOptional) {
                                      existingParam.optional = overrideParam.optional;
                                  }
      Severity: Major
      Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (msg == null) {
                                        msg = "The following parameter failed validation: [" + model.name + "." + key + "]";
                                    }
        Severity: Major
        Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if (UtilValidate.isNotEmpty(overrideParam.formLabel)) {
                                          existingParam.formLabel = overrideParam.formLabel;
                                      }
          Severity: Major
          Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if (!model.properties.isEmpty()) {
                                            Map<String, Object> newProperties = new LinkedHashMap<>(model.properties);
                                            newProperties.putAll(this.properties);
                                            this.properties = Collections.unmodifiableMap(newProperties);
                                            if (Debug.verboseOn() && newProperties.size() > 0) {
            Severity: Major
            Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (UtilValidate.isNotEmpty(overrideParam.type)) {
                                              existingParam.type = overrideParam.type;
                                          }
              Severity: Major
              Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if (UtilValidate.isNotEmpty(overrideParam.entityName)) {
                                                existingParam.entityName = overrideParam.entityName;
                                            }
                Severity: Major
                Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if (!found) {
                                                  throw new IllegalArgumentException("simple-method with name '" + invoke + "' not found");
                                              }
                  Severity: Major
                  Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if (UtilValidate.isNotEmpty(overrideParam.mode)) {
                                                    existingParam.mode = overrideParam.mode;
                                                }
                    Severity: Major
                    Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (UtilValidate.isNotEmpty(overrideParam.fieldName)) {
                                                      existingParam.fieldName = overrideParam.fieldName;
                                                  }
                      Severity: Major
                      Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if (overrideParam.overrideFormDisplay) {
                                                        existingParam.formDisplay = overrideParam.formDisplay;
                                                    }
                        Severity: Major
                        Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                      for (Element simpleMethodElement : UtilXml.childElementList(document.getDocumentElement(), "simple-method")) {
                                                          String simpleMethodName = simpleMethodElement.getAttribute("method-name");
                                                          if (invoke.equals(simpleMethodName)) {
                                                              found = true;
                                                              break;
                          Severity: Major
                          Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                        if (!typeValidate(val, testObject)) {
                                                            String msg = val.getFailMessage(locale);
                                                            if (msg == null) {
                                                                msg = "The following parameter failed validation: [" + model.name + "." + key + "]";
                                                            }
                            Severity: Major
                            Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if (UtilValidate.isNotEmpty(overrideParam.allowHtml)) {
                                                              existingParam.allowHtml = overrideParam.allowHtml;
                                                          }
                              Severity: Major
                              Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                            for (ModelParam newParam : model.contextParamList) {
                                                                ModelParam existingParam = this.contextInfo.get(newParam.name);
                                                                if (existingParam != null) {
                                                                    // if the existing param is not INOUT and the newParam.mode is different from existingParam.mode, make the existing param optional and INOUT
                                                                    // TODO: this is another case where having different optional/required settings for IN and OUT would be quite valuable...
                                Severity: Major
                                Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

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

                                      public Map<String, Object> makeValid(Map<String, ?> source, String mode, boolean includeInternal, List<Object> errorMessages, TimeZone timeZone, Locale locale) {
                                  Severity: Minor
                                  Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                                if (overrideParam.getDefaultValue() != null) {
                                                                    existingParam.copyDefaultValue(overrideParam);
                                                                }
                                    Severity: Major
                                    Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

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

                                          public static void validate(Map<String, String> info, Map<String, ?> test, boolean reverse, ModelService model, String mode, Locale locale) throws ServiceValidationException {
                                      Severity: Minor
                                      Found in framework/service/src/org/ofbiz/service/ModelService.java - About 45 mins to fix

                                        Consider simplifying this complex logical expression.
                                        Open

                                                        if (context.get(modelParam.name) != null && ("String".equals(modelParam.type) || "java.lang.String".equals(modelParam.type))
                                                                && !"any".equals(modelParam.allowHtml) && (IN_OUT_PARAM.equals(modelParam.mode) || IN_PARAM.equals(modelParam.mode))) {
                                                            String value = (String) context.get(modelParam.name);
                                                            UtilCodec.checkStringForHtmlStrictNone(modelParam.name, value, errorMessageList);
                                                        }
                                        Severity: Major
                                        Found in framework/service/src/org/ofbiz/service/ModelService.java - About 40 mins to fix

                                          Consider simplifying this complex logical expression.
                                          Open

                                                      if ((param.mode.equals(mode) || param.mode.equals(IN_OUT_PARAM)) &&
                                                              ((param.internal && includeInternal) || (!param.internal && includeStandard))) {
                                                          // SCIPIO: 3.0.0: Added src/dst prefix
                                                          String srcKey = StringUtil.prefixFieldNameCamelCase(param.name, namePrefix);
                                                          String dstKey = StringUtil.prefixFieldNameCamelCase(param.name, toNamePrefix);
                                          Severity: Major
                                          Found in framework/service/src/org/ofbiz/service/ModelService.java - About 40 mins to fix

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

                                                public Map<String, Object> makeValid(Map<String, ?> source, String mode, boolean includeInternal, List<Object> errorMessages, Locale locale) {
                                            Severity: Minor
                                            Found in framework/service/src/org/ofbiz/service/ModelService.java - About 35 mins to fix

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

                                                  public void applyTypeConvert(Map<String, Object> context, String mode, Locale locale, TimeZone timeZone, List<? super String> errorMessages) {
                                              Severity: Minor
                                              Found in framework/service/src/org/ofbiz/service/ModelService.java - About 35 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                        return result;
                                                Severity: Major
                                                Found in framework/service/src/org/ofbiz/service/ModelService.java - About 30 mins to fix

                                                  There are no issues that match your filters.

                                                  Category
                                                  Status