framework/service/src/org/ofbiz/service/ModelService.java
ModelService
has 123 methods (exceeds 20 allowed). Consider refactoring. Open
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());
Avoid deeply nested control flow statements. Open
Open
if (Debug.verboseOn())
Debug.logVerbose("Adding service [" + sm.getName() + "] as interface of: [" + this.name + "]", module);
Avoid deeply nested control flow statements. Open
Open
if (overrideParam.overrideOptional) {
existingParam.optional = overrideParam.optional;
}
Avoid deeply nested control flow statements. Open
Open
if (msg == null) {
msg = "The following parameter failed validation: [" + model.name + "." + key + "]";
}
Avoid deeply nested control flow statements. Open
Open
if (UtilValidate.isNotEmpty(overrideParam.formLabel)) {
existingParam.formLabel = overrideParam.formLabel;
}
Avoid deeply nested control flow statements. Open
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) {
Avoid deeply nested control flow statements. Open
Open
if (UtilValidate.isNotEmpty(overrideParam.type)) {
existingParam.type = overrideParam.type;
}
Avoid deeply nested control flow statements. Open
Open
if (UtilValidate.isNotEmpty(overrideParam.entityName)) {
existingParam.entityName = overrideParam.entityName;
}
Avoid deeply nested control flow statements. Open
Open
if (!found) {
throw new IllegalArgumentException("simple-method with name '" + invoke + "' not found");
}
Avoid deeply nested control flow statements. Open
Open
if (UtilValidate.isNotEmpty(overrideParam.mode)) {
existingParam.mode = overrideParam.mode;
}
Avoid deeply nested control flow statements. Open
Open
if (UtilValidate.isNotEmpty(overrideParam.fieldName)) {
existingParam.fieldName = overrideParam.fieldName;
}
Avoid deeply nested control flow statements. Open
Open
if (overrideParam.overrideFormDisplay) {
existingParam.formDisplay = overrideParam.formDisplay;
}
Avoid deeply nested control flow statements. Open
Open
for (Element simpleMethodElement : UtilXml.childElementList(document.getDocumentElement(), "simple-method")) {
String simpleMethodName = simpleMethodElement.getAttribute("method-name");
if (invoke.equals(simpleMethodName)) {
found = true;
break;
Avoid deeply nested control flow statements. Open
Open
if (!typeValidate(val, testObject)) {
String msg = val.getFailMessage(locale);
if (msg == null) {
msg = "The following parameter failed validation: [" + model.name + "." + key + "]";
}
Avoid deeply nested control flow statements. Open
Open
if (UtilValidate.isNotEmpty(overrideParam.allowHtml)) {
existingParam.allowHtml = overrideParam.allowHtml;
}
Avoid deeply nested control flow statements. Open
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...
Method makeValid
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public Map<String, Object> makeValid(Map<String, ?> source, String mode, boolean includeInternal, List<Object> errorMessages, TimeZone timeZone, Locale locale) {
Avoid deeply nested control flow statements. Open
Open
if (overrideParam.getDefaultValue() != null) {
existingParam.copyDefaultValue(overrideParam);
}
Method validate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static void validate(Map<String, String> info, Map<String, ?> test, boolean reverse, ModelService model, String mode, Locale locale) throws ServiceValidationException {
Consider simplifying this complex logical expression. Open
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);
}
Consider simplifying this complex logical expression. Open
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);
Method makeValid
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public Map<String, Object> makeValid(Map<String, ?> source, String mode, boolean includeInternal, List<Object> errorMessages, Locale locale) {
Method applyTypeConvert
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public void applyTypeConvert(Map<String, Object> context, String mode, Locale locale, TimeZone timeZone, List<? super String> errorMessages) {
Avoid too many return
statements within this method. Open
Open
return result;