This is an automated email from the ASF dual-hosted git repository.
surajk pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 33f05c1 Improved: Corrected all redundant modifiers occurences in framework component. Also, fixed some other checkstyle line formatting and spacing issues. (OFBIZ-11925) 33f05c1 is described below commit 33f05c168417177c5475183144ded535cc5cadba Author: Suraj Khurana <[hidden email]> AuthorDate: Thu Aug 6 18:53:13 2020 +0530 Improved: Corrected all redundant modifiers occurences in framework component. Also, fixed some other checkstyle line formatting and spacing issues. (OFBIZ-11925) --- .../ofbiz/product/inventory/InventoryWorker.java | 9 +- .../ofbiz/base/component/ComponentConfig.java | 4 +- .../ofbiz/base/concurrent/ExecutionPool.java | 2 +- .../base/conversion/CollectionConverters.java | 2 +- .../apache/ofbiz/base/conversion/Converter.java | 10 +- .../ofbiz/base/conversion/ConverterCreator.java | 2 +- .../ofbiz/base/conversion/ConverterLoader.java | 2 +- .../ofbiz/base/conversion/DateTimeConverters.java | 2 +- .../ofbiz/base/conversion/MiscConverters.java | 2 +- .../ofbiz/base/conversion/NumberConverters.java | 6 +- .../ofbiz/base/html/SanitizerCustomPolicy.java | 2 +- .../ofbiz/base/location/LocationResolver.java | 2 +- .../java/org/apache/ofbiz/base/util/FileUtil.java | 2 +- .../org/apache/ofbiz/base/util/ScriptUtil.java | 16 +- .../java/org/apache/ofbiz/base/util/UtilCodec.java | 68 ++++-- .../java/org/apache/ofbiz/base/util/UtilIO.java | 20 +- .../java/org/apache/ofbiz/base/util/UtilMisc.java | 6 +- .../base/util/collections/FlexibleMapAccessor.java | 2 +- .../base/util/string/FlexibleStringExpander.java | 4 +- .../ofbiz/base/util/string/NodeELResolver.java | 2 +- .../apache/ofbiz/common/DataModelConstants.java | 2 +- .../org/apache/ofbiz/common/UrlServletHelper.java | 10 +- .../apache/ofbiz/common/email/EmailServices.java | 9 +- .../apache/ofbiz/common/qrcode/QRCodeServices.java | 45 ++-- .../org/apache/ofbiz/entity/GenericEntity.java | 2 +- .../ofbiz/entity/condition/EntityCondition.java | 8 +- .../ofbiz/entity/condition/EntityFunction.java | 52 +++-- .../ofbiz/entity/condition/EntityOperator.java | 4 +- .../ofbiz/entity/finder/EntityFinderUtil.java | 39 ++-- .../org/apache/ofbiz/entity/jdbc/DatabaseUtil.java | 10 +- .../apache/ofbiz/entity/model/ModelViewEntity.java | 8 +- .../apache/ofbiz/entity/test/EntityTestSuite.java | 14 +- .../ofbiz/entity/transaction/TransactionUtil.java | 2 +- .../org/apache/ofbiz/entity/util/EntityCrypto.java | 2 +- .../org/apache/ofbiz/entity/util/EntityQuery.java | 8 +- .../ofbiz/entityext/data/EntityDataServices.java | 6 +- .../synchronization/EntitySyncContext.java | 2 +- .../minilang/method/entityops/EntityCondition.java | 6 +- .../ofbiz/minilang/method/envops/SetOperation.java | 11 +- .../java/org/apache/ofbiz/security/Security.java | 26 +-- .../java/org/apache/ofbiz/service/ModelParam.java | 2 +- .../java/org/apache/ofbiz/service/job/Job.java | 2 +- .../ofbiz/service/mail/JavaMailContainer.java | 2 +- .../ofbiz/service/mail/MimeMessageWrapper.java | 3 +- .../apache/ofbiz/service/mail/ServiceMcaUtil.java | 6 +- .../apache/ofbiz/service/rmi/RemoteDispatcher.java | 124 +++++----- .../ofbiz/base/start/StartupCommandUtil.java | 17 +- .../apache/ofbiz/testtools/TestRunContainer.java | 2 +- .../org/apache/ofbiz/webtools/UtilCacheEvents.java | 2 +- .../apache/ofbiz/webtools/WebToolsServices.java | 249 ++++++++++++--------- .../widget/content/ContentWorkerInterface.java | 23 +- .../content/DataResourceWorkerInterface.java | 2 +- .../ofbiz/widget/model/AbstractModelAction.java | 13 +- .../org/apache/ofbiz/widget/model/ModelForm.java | 2 +- .../apache/ofbiz/widget/model/ModelFormAction.java | 2 +- .../apache/ofbiz/widget/model/ModelFormField.java | 4 +- .../org/apache/ofbiz/widget/model/ModelTheme.java | 4 +- .../ofbiz/widget/model/ModelWidgetCondition.java | 4 +- .../ofbiz/widget/renderer/MenuStringRenderer.java | 16 +- .../widget/renderer/macro/MacroFormRenderer.java | 2 +- 60 files changed, 525 insertions(+), 387 deletions(-) diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryWorker.java index 910a7fb..01357b3 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryWorker.java @@ -51,7 +51,8 @@ public final class InventoryWorker { */ public static List<GenericValue> getOutstandingPurchaseOrders(String productId, Delegator delegator) { try { - List<EntityCondition> purchaseOrderConditions = UtilMisc.<EntityCondition>toList(EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"), + List<EntityCondition> purchaseOrderConditions = + UtilMisc.<EntityCondition>toList(EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"), EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"), EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED"), @@ -65,7 +66,8 @@ public final class InventoryWorker { .queryList(); return purchaseOrders; } catch (GenericEntityException ex) { - Debug.logError("Unable to find outstanding purchase orders for product [" + productId + "] due to " + ex.getMessage() + " - returning null", MODULE); + Debug.logError("Unable to find outstanding purchase orders for product [" + productId + "] due to " + ex.getMessage() + + " - returning null", MODULE); return null; } } @@ -125,7 +127,8 @@ public final class InventoryWorker { Map<String, BigDecimal> results = new HashMap<>(); try { - List<GenericValue> orderedProducts = EntityQuery.use(delegator).select(fieldsToSelect).from("OrderItemQuantityReportGroupByProduct").where(conditions).queryList(); + List<GenericValue> orderedProducts = EntityQuery.use(delegator).select(fieldsToSelect).from("OrderItemQuantityReportGroupByProduct") + .where(conditions).queryList(); for (GenericValue value: orderedProducts) { results.put(value.getString("productId"), value.getBigDecimal("quantityOpen")); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java index a8ec716..f197695 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java @@ -667,7 +667,7 @@ public final class ComponentConfig { return componentConfig.rootLocation().resolve(location); } - public static enum Type { + public enum Type { DIR, JAR; private static Type of(String type) { @@ -834,7 +834,7 @@ public final class ComponentConfig { } } - public static abstract class ResourceInfo { + public abstract static class ResourceInfo { private final ComponentConfig componentConfig; private final String loader; private final String location; diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/concurrent/ExecutionPool.java b/framework/base/src/main/java/org/apache/ofbiz/base/concurrent/ExecutionPool.java index 27192cd..6d6c8c4 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/concurrent/ExecutionPool.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/concurrent/ExecutionPool.java @@ -119,7 +119,7 @@ public final class ExecutionPool { } } - public static abstract class Pulse implements Delayed, Runnable { + public abstract static class Pulse implements Delayed, Runnable { protected final long expireTimeNanos; protected final long loadTimeNanos; diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/CollectionConverters.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/CollectionConverters.java index 86466ee..5ad4de2 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/CollectionConverters.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/CollectionConverters.java @@ -54,7 +54,7 @@ public class CollectionConverters implements ConverterLoader { } private static class ArrayClassToList<S, T> extends AbstractConverter<S, T> { - public ArrayClassToList(Class<S> sourceClass, Class<T> targetClass) { + ArrayClassToList(Class<S> sourceClass, Class<T> targetClass) { super(sourceClass, targetClass); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converter.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converter.java index d14f616..37d2a6f 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converter.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converter.java @@ -35,7 +35,7 @@ public interface Converter<S, T> { * @return <code>true</code> if this object can convert * <code>sourceClass</code> to <code>targetClass</code>. */ - public boolean canConvert(Class<?> sourceClass, Class<?> targetClass); + boolean canConvert(Class<?> sourceClass, Class<?> targetClass); /** Converts <code>obj</code> to <code>T</code>. * @@ -43,7 +43,7 @@ public interface Converter<S, T> { * @return The converted <code>Object</code> * @throws ConversionException */ - public T convert(S obj) throws ConversionException; + T convert(S obj) throws ConversionException; /** Converts <code>obj</code> to <code>T</code>. * @@ -52,17 +52,17 @@ public interface Converter<S, T> { * @return The converted <code>Object</code> * @throws ConversionException */ - public T convert(Class<? extends T> targetClass, S obj) throws ConversionException; + T convert(Class<? extends T> targetClass, S obj) throws ConversionException; /** Returns the source <code>Class</code> for this converter. * * @return The source <code>Class</code> for this converter */ - public Class<?> getSourceClass(); + Class<?> getSourceClass(); /** Returns the target <code>Class</code> for this converter. * * @return The target <code>Class</code> for this converter */ - public Class<?> getTargetClass(); + Class<?> getTargetClass(); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/ConverterCreator.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/ConverterCreator.java index 589261e..510115d 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/ConverterCreator.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/ConverterCreator.java @@ -30,5 +30,5 @@ public interface ConverterCreator { * @param targetClass The target <code>Class</code> to convert to * @return a converter that can convert <code>Object</code>s */ - public <S, T> Converter<S, T> createConverter(Class<S> sourceClass, Class<T> targetClass); + <S, T> Converter<S, T> createConverter(Class<S> sourceClass, Class<T> targetClass); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/ConverterLoader.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/ConverterLoader.java index d9564f8..ac3b6a4 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/ConverterLoader.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/ConverterLoader.java @@ -31,5 +31,5 @@ public interface ConverterLoader { * with the <code>Converter</code> instance. * */ - public void loadConverters(); + void loadConverters(); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/DateTimeConverters.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/DateTimeConverters.java index f813562..d4fc222 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/DateTimeConverters.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/DateTimeConverters.java @@ -254,7 +254,7 @@ public class DateTimeConverters implements ConverterLoader { } } - public static abstract class GenericLocalizedConverter<S, T> extends AbstractLocalizedConverter<S, T> { + public abstract static class GenericLocalizedConverter<S, T> extends AbstractLocalizedConverter<S, T> { protected GenericLocalizedConverter(Class<S> sourceClass, Class<T> targetClass) { super(sourceClass, targetClass); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/MiscConverters.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/MiscConverters.java index 39abccf..64c66e9 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/MiscConverters.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/MiscConverters.java @@ -176,7 +176,7 @@ public class MiscConverters implements ConverterLoader { } private static class StringToEnum<E extends Enum<E>> extends AbstractConverter<String, E> { - public StringToEnum() { + StringToEnum() { super(String.class, Enum.class); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/NumberConverters.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/NumberConverters.java index ead7458..2125b0c 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/NumberConverters.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/NumberConverters.java @@ -43,7 +43,7 @@ public class NumberConverters implements ConverterLoader { } } - public static abstract class AbstractStringToNumberConverter<N extends Number> extends AbstractNumberConverter<String, N> { + public abstract static class AbstractStringToNumberConverter<N extends Number> extends AbstractNumberConverter<String, N> { public AbstractStringToNumberConverter(Class<N> targetClass) { super(String.class, targetClass); } @@ -60,7 +60,7 @@ public class NumberConverters implements ConverterLoader { protected abstract N convert(Number number) throws ConversionException; } - public static abstract class AbstractNumberConverter<S, T> extends AbstractLocalizedConverter<S, T> { + public abstract static class AbstractNumberConverter<S, T> extends AbstractLocalizedConverter<S, T> { protected AbstractNumberConverter(Class<S> sourceClass, Class<T> targetClass) { super(sourceClass, targetClass); } @@ -71,7 +71,7 @@ public class NumberConverters implements ConverterLoader { } } - public static abstract class AbstractNumberToStringConverter<N extends Number> extends AbstractNumberConverter<N, String> { + public abstract static class AbstractNumberToStringConverter<N extends Number> extends AbstractNumberConverter<N, String> { public AbstractNumberToStringConverter(Class<N> sourceClass) { super(sourceClass, String.class); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/html/SanitizerCustomPolicy.java b/framework/base/src/main/java/org/apache/ofbiz/base/html/SanitizerCustomPolicy.java index 159d03d..6a8446a 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/html/SanitizerCustomPolicy.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/html/SanitizerCustomPolicy.java @@ -30,7 +30,7 @@ import org.owasp.html.PolicyFactory; */ public interface SanitizerCustomPolicy { - public static final PolicyFactory POLICY_DEFINITION = new HtmlPolicyBuilder().toFactory(); + PolicyFactory POLICY_DEFINITION = new HtmlPolicyBuilder().toFactory(); /** * Used for getting the policy from the custom class which implements this diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/location/LocationResolver.java b/framework/base/src/main/java/org/apache/ofbiz/base/location/LocationResolver.java index 1f3a871..14cca67 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/location/LocationResolver.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/location/LocationResolver.java @@ -27,5 +27,5 @@ import java.net.URL; */ public interface LocationResolver { - public URL resolveLocation(String location) throws MalformedURLException; + URL resolveLocation(String location) throws MalformedURLException; } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java index 6495c17..dac6300 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java @@ -444,7 +444,7 @@ public final class FileUtil { Set<String> stringsToFindInFile = new HashSet<>(); Set<String> stringsToFindInPath = new HashSet<>(); - public SearchTextFilesFilter(String fileExtension, Set<String> stringsToFindInPath, Set<String> stringsToFindInFile) { + SearchTextFilesFilter(String fileExtension, Set<String> stringsToFindInPath, Set<String> stringsToFindInFile) { this.fileExtension = fileExtension; if (stringsToFindInPath != null) { this.stringsToFindInPath.addAll(stringsToFindInPath); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java index ea47e78..8141565 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java @@ -46,7 +46,6 @@ import javax.script.SimpleScriptContext; import org.apache.ofbiz.base.location.FlexibleLocation; import org.apache.ofbiz.base.util.cache.UtilCache; -import org.apache.ofbiz.base.util.ScriptHelper; import org.apache.ofbiz.common.scripting.ScriptHelperImpl; import org.codehaus.groovy.runtime.InvokerHelper; @@ -69,7 +68,7 @@ public final class ScriptUtil { public static final String RESULT_KEY = "result"; /** The <code>ScriptHelper</code> key. */ public static final String SCRIPT_HELPER_KEY = "ofbiz"; - private static final UtilCache<String, CompiledScript> parsedScripts = UtilCache.createUtilCache("script.ParsedScripts", 0, 0, false); + private static final UtilCache<String, CompiledScript> PARSED_SCRIPTS = UtilCache.createUtilCache("script.ParsedScripts", 0, 0, false); private static final Object[] EMPTY_ARGS = {}; /** A set of script names - derived from the JSR-223 scripting engines. */ public static final Set<String> SCRIPT_NAMES; @@ -117,7 +116,7 @@ public final class ScriptUtil { */ public static CompiledScript compileScriptFile(String filePath) throws ScriptException, IOException { Assert.notNull("filePath", filePath); - CompiledScript script = parsedScripts.get(filePath); + CompiledScript script = PARSED_SCRIPTS.get(filePath); if (script == null) { ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByExtension(getFileExtension(filePath)); @@ -138,7 +137,7 @@ public final class ScriptUtil { } } if (script != null) { - parsedScripts.putIfAbsent(filePath, script); + PARSED_SCRIPTS.putIfAbsent(filePath, script); } } return script; @@ -156,7 +155,7 @@ public final class ScriptUtil { public static CompiledScript compileScriptString(String language, String script) throws ScriptException { Assert.notNull("language", language, "script", script); String cacheKey = language.concat("://").concat(script); - CompiledScript compiledScript = parsedScripts.get(cacheKey); + CompiledScript compiledScript = PARSED_SCRIPTS.get(cacheKey); if (compiledScript == null) { ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName(language); @@ -175,7 +174,7 @@ public final class ScriptUtil { } } if (compiledScript != null) { - parsedScripts.putIfAbsent(cacheKey, compiledScript); + PARSED_SCRIPTS.putIfAbsent(cacheKey, compiledScript); } } return compiledScript; @@ -271,7 +270,8 @@ public final class ScriptUtil { * @return The script result. * @throws IllegalArgumentException */ - public static Object executeScript(CompiledScript script, String functionName, ScriptContext scriptContext, Object[] args) throws ScriptException, NoSuchMethodException { + public static Object executeScript(CompiledScript script, String functionName, ScriptContext scriptContext, Object[] args) + throws ScriptException, NoSuchMethodException { Assert.notNull("script", script, "scriptContext", scriptContext); Object result = script.eval(scriptContext); if (UtilValidate.isNotEmpty(functionName)) { @@ -299,7 +299,7 @@ public final class ScriptUtil { * @throws IllegalArgumentException */ public static Object executeScript(String filePath, String functionName, Map<String, Object> context) { - return executeScript(filePath, functionName, context, new Object[] { context }); + return executeScript(filePath, functionName, context, new Object[] {context }); } /** diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java index 3fb3f17..4a99b8e 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java @@ -84,18 +84,18 @@ public class UtilCodec { } } - public static interface SimpleEncoder { - public String encode(String original); + public interface SimpleEncoder { + String encode(String original); /** * @deprecated Use {@link #sanitize(String, String)} instead */ @Deprecated - public String sanitize(String outString); // Only really useful with HTML, else it simply calls encode() method - public String sanitize(String outString, String contentTypeId); // Only really useful with HTML, else it simply calls encode() method + String sanitize(String outString); // Only really useful with HTML, else it simply calls encode() method + String sanitize(String outString, String contentTypeId); // Only really useful with HTML, else it simply calls encode() method } - public static interface SimpleDecoder { - public String decode(String original); + public interface SimpleDecoder { + String decode(String original); } public static class HtmlEncoder implements SimpleEncoder { @@ -530,13 +530,21 @@ public class UtilCodec { } @Override - public int size() { return this.internalMap.size(); } + public int size() { + return this.internalMap.size(); + } @Override - public boolean isEmpty() { return this.internalMap.isEmpty(); } + public boolean isEmpty() { + return this.internalMap.isEmpty(); + } @Override - public boolean containsKey(Object key) { return this.internalMap.containsKey(key); } + public boolean containsKey(Object key) { + return this.internalMap.containsKey(key); + } @Override - public boolean containsValue(Object value) { return this.internalMap.containsValue(value); } + public boolean containsValue(Object value) { + return this.internalMap.containsValue(value); + } @Override public Object get(Object key) { Object theObject = this.internalMap.get(key); @@ -550,22 +558,46 @@ public class UtilCodec { } return theObject; } + @Override - public Object put(K key, Object value) { return this.internalMap.put(key, value); } + public Object put(K key, Object value) { + return this.internalMap.put(key, value); + } + @Override - public Object remove(Object key) { return this.internalMap.remove(key); } + public Object remove(Object key) { + return this.internalMap.remove(key); + } + @Override - public void putAll(Map<? extends K, ? extends Object> arg0) { this.internalMap.putAll(arg0); } + public void putAll(Map<? extends K, ? extends Object> arg0) { + this.internalMap.putAll(arg0); + } + @Override - public void clear() { this.internalMap.clear(); } + public void clear() { + this.internalMap.clear(); + } + @Override - public Set<K> keySet() { return this.internalMap.keySet(); } + public Set<K> keySet() { + return this.internalMap.keySet(); + } + @Override - public Collection<Object> values() { return this.internalMap.values(); } + public Collection<Object> values() { + return this.internalMap.values(); + } + @Override - public Set<Map.Entry<K, Object>> entrySet() { return this.internalMap.entrySet(); } + public Set<Map.Entry<K, Object>> entrySet() { + return this.internalMap.entrySet(); + } + @Override - public String toString() { return this.internalMap.toString(); } + public String toString() { + return this.internalMap.toString(); + } } } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java index b46be75..ca11135 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java @@ -60,7 +60,7 @@ public final class UtilIO { * @return the converted string, with platform line endings converted * to \n */ - public static final String readString(byte[] bytes) { + public static String readString(byte[] bytes) { return readString(bytes, 0, bytes.length, StandardCharsets.UTF_8); } @@ -74,7 +74,7 @@ public final class UtilIO { * @return the converted string, with platform line endings converted * to \n */ - public static final String readString(byte[] bytes, int offset, int length) { + public static String readString(byte[] bytes, int offset, int length) { return readString(bytes, offset, length, StandardCharsets.UTF_8); } @@ -87,7 +87,7 @@ public final class UtilIO { * @return the converted string, with platform line endings converted * to \n */ - public static final String readString(byte[] bytes, String charset) { + public static String readString(byte[] bytes, String charset) { return readString(bytes, 0, bytes.length, Charset.forName(charset)); } @@ -103,7 +103,7 @@ public final class UtilIO { * @return the converted string, with platform line endings converted * to \n */ - public static final String readString(byte[] bytes, int offset, int length, String charset) { + public static String readString(byte[] bytes, int offset, int length, String charset) { return readString(bytes, 0, bytes.length, Charset.forName(charset)); } @@ -115,7 +115,7 @@ public final class UtilIO { * @return the converted string, with platform line endings converted * to \n */ - public static final String readString(byte[] bytes, Charset charset) { + public static String readString(byte[] bytes, Charset charset) { return readString(bytes, 0, bytes.length, charset); } @@ -131,7 +131,7 @@ public final class UtilIO { * @return the converted string, with platform line endings converted * to \n */ - public static final String readString(byte[] bytes, int offset, int length, Charset charset) { + public static String readString(byte[] bytes, int offset, int length, Charset charset) { ByteBuffer buf = ByteBuffer.allocate(length); buf.put(bytes, offset, length); buf.flip(); @@ -145,7 +145,7 @@ public final class UtilIO { * @return the converted string, with platform line endings converted * to \n */ - public static final String readString(InputStream stream) throws IOException { + public static String readString(InputStream stream) throws IOException { return readString(stream, StandardCharsets.UTF_8); } @@ -157,7 +157,7 @@ public final class UtilIO { * @return the converted string, with platform line endings converted * to \n */ - public static final String readString(InputStream stream, String charset) throws IOException { + public static String readString(InputStream stream, String charset) throws IOException { return readString(stream, Charset.forName(charset)); } @@ -169,7 +169,7 @@ public final class UtilIO { * @return the converted string, with platform line endings converted * to \n */ - public static final String readString(InputStream stream, Charset charset) throws IOException { + public static String readString(InputStream stream, Charset charset) throws IOException { return readString(new InputStreamReader(new BufferedInputStream(stream), charset)); } @@ -180,7 +180,7 @@ public final class UtilIO { * @return the converted string, with platform line endings converted * to \n */ - public static final String readString(Reader reader) throws IOException { + public static String readString(Reader reader) throws IOException { try { StringBuilder sb = new StringBuilder(); char[] buf = new char[4096]; diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java index 1c1b95d..8bc9636 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java @@ -64,7 +64,7 @@ public final class UtilMisc { private UtilMisc() { } - public static final <T extends Throwable> T initCause(T throwable, Throwable cause) { + public static <T extends Throwable> T initCause(T throwable, Throwable cause) { throwable.initCause(cause); return throwable; } @@ -135,12 +135,12 @@ public final class UtilMisc { } if (kvs.length % 2 == 1) { IllegalArgumentException e = new IllegalArgumentException( - "You must pass an even sized array to the toMap method (size = " + kvs.length + ")"); + "You must pass an even sized array to the toMap method (size = " + kvs.length + ")"); Debug.logInfo(e, MODULE); throw e; } Map<K, V> map = constructor.get(); - for (int i = 0; i < kvs.length; ) { + for (int i = 0; i < kvs.length;) { map.put((K) kvs[i++], (V) kvs[i++]); } return map; diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleMapAccessor.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleMapAccessor.java index bafedbe..8701992 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleMapAccessor.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleMapAccessor.java @@ -115,7 +115,7 @@ public final class FlexibleMapAccessor<T> implements Serializable, IsEmpty { @Override public boolean isEmpty() { - return this.isEmpty; + return this.isEmpty; } /** Given the name based information in this accessor, get the value from the passed in Map. diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java index 098ae39..2dc63bb 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java @@ -238,7 +238,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty { return fse; } - private static abstract class Key { + private abstract static class Key { @Override public final boolean equals(Object o) { // No class test here, nor null, as this class is only used @@ -515,7 +515,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty { return this.getOriginal(); } - protected static abstract class ArrayOffsetString extends FlexibleStringExpander { + protected abstract static class ArrayOffsetString extends FlexibleStringExpander { protected final int offset; protected final int length; diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/NodeELResolver.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/NodeELResolver.java index 3674a81..6e212c3 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/NodeELResolver.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/NodeELResolver.java @@ -137,7 +137,7 @@ public class NodeELResolver extends ELResolver { } } - private static final boolean isResolvable(Object base) { + private static boolean isResolvable(Object base) { return base != null && (base instanceof Node || base instanceof NodeImpl); } diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/DataModelConstants.java b/framework/common/src/main/java/org/apache/ofbiz/common/DataModelConstants.java index 45887c4..f19d1ba 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/DataModelConstants.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/DataModelConstants.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. *******************************************************************************/ - package org.apache.ofbiz.common; +package org.apache.ofbiz.common; /** * Data Model Constants diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/UrlServletHelper.java b/framework/common/src/main/java/org/apache/ofbiz/common/UrlServletHelper.java index eff506c..c277b30 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/UrlServletHelper.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/UrlServletHelper.java @@ -170,7 +170,7 @@ public final class UrlServletHelper { String contentId = pathAlias.getString("contentId"); if (contentId == null && UtilValidate.isNotEmpty(alias)) { if (!alias.startsWith("/")) { - alias = "/" + alias; + alias = "/" + alias; } RequestDispatcher rd = request.getRequestDispatcher(alias); @@ -265,14 +265,14 @@ public final class UrlServletHelper { str = str.replace("‘", "-"); str = str.replace("?", "-"); str = str.replace("–", ""); - while(str.startsWith("-")) { + while (str.startsWith("-")) { str = str.substring(1); } - while(str.endsWith("-")) { + while (str.endsWith("-")) { str = str.substring(0, str.length() - 1); } - while(str.indexOf("--") != -1) { - str = str.replace("--","-"); + while (str.indexOf("--") != -1) { + str = str.replace("--", "-"); } return str; } diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java index 6de0771..3ec2941 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java @@ -502,7 +502,7 @@ public class EmailServices { try { screenStringRenderer = new MacroScreenRenderer(visualTheme.getModelTheme(), "screen"); } catch (TemplateException | IOException e) { - Debug.logError(e, "Error rendering screen for email: " + e.toString(), MODULE); + Debug.logError("Error rendering screen for email: " + e.toString(), MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "CommonEmailSendRenderingScreenEmailError", UtilMisc.toMap("errorString", e.toString()), locale)); } ScreenRenderer screens = new ScreenRenderer(bodyWriter, screenContext, screenStringRenderer); @@ -569,9 +569,10 @@ public class EmailServices { // store in the list of maps for sendmail.... bodyParts.add(UtilMisc.<String, Object>toMap("content", baos.toByteArray(), "type", attachmentType, "filename", attachmentName)); - } catch (GeneralException|IOException|SAXException|ParserConfigurationException |TemplateException ge) { - Debug.logError(ge, "Error rendering PDF attachment for email: " + ge.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "CommonEmailSendRenderingScreenPdfError", UtilMisc.toMap("errorString", ge.toString()), locale)); + } catch (GeneralException | IOException | SAXException | ParserConfigurationException | TemplateException ge) { + Debug.logError("Error rendering PDF attachment for email: " + ge.toString(), MODULE); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "CommonEmailSendRenderingScreenPdfError", + UtilMisc.toMap("errorString", ge.toString()), locale)); } serviceContext.put("bodyParts", bodyParts); diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java index a3189b4..b5fb960 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java @@ -61,17 +61,16 @@ import freemarker.template.utility.StringUtil; */ public class QRCodeServices { - private static final String MODULE = QRCodeServices.class.getName(); - public static final int MIN_SIZE = 20; - public static final int MAX_SIZE = 500; - + private static final String MODULE = QRCodeServices.class.getName(); private static final int BLACK = 0xFF000000; private static final int WHITE = 0xFFFFFFFF; - /** Streams QR Code to the result. */ + /** + * Streams QR Code to the result. + */ public static Map<String, Object> generateQRCodeImage(DispatchContext ctx, Map<String, Object> context) { Locale locale = (Locale) context.get("locale"); String message = (String) context.get("message"); @@ -86,20 +85,21 @@ public class QRCodeServices { Delegator delegator = ctx.getDelegator(); if (UtilValidate.isEmpty(message)) { - return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "ParameterCannotEmpty", new Object[] {"message" }, locale)); + return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "ParameterCannotEmpty", new Object[]{"message"}, locale)); } if (width == null) { width = Integer.parseInt(EntityUtilProperties.getPropertyValue("qrcode", "qrcode.default.width", "200", delegator)); } if (width < MIN_SIZE || width > MAX_SIZE) { - return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "SizeOutOfBorderError", new Object[] {"width", String.valueOf(width), String.valueOf(MIN_SIZE), String.valueOf(MAX_SIZE)}, locale)); + return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "SizeOutOfBorderError", + new Object[]{"width", String.valueOf(width), String.valueOf(MIN_SIZE), String.valueOf(MAX_SIZE)}, locale)); } if (height == null) { height = Integer.parseInt(EntityUtilProperties.getPropertyValue("qrcode", "qrcode.default.height", "200", delegator)); } if (height < MIN_SIZE || height > MAX_SIZE) { return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "SizeOutOfBorderError", - new Object[] {"height", String.valueOf(height), String.valueOf(MIN_SIZE), String.valueOf(MAX_SIZE) }, locale)); + new Object[]{"height", String.valueOf(height), String.valueOf(MIN_SIZE), String.valueOf(MAX_SIZE)}, locale)); } if (UtilValidate.isEmpty(format)) { format = EntityUtilProperties.getPropertyValue("qrcode", "qrcode.default.format", "jpg", delegator); @@ -108,7 +108,7 @@ public class QRCodeServices { String[] formatNames = StringUtil.split(qrCodeFormatSupported, '|'); List<String> formatsSupported = Arrays.asList(formatNames); if (!formatsSupported.contains(format)) { - return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "ErrorFormatNotSupported", new Object[] { format }, locale)); + return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "ErrorFormatNotSupported", new Object[]{format}, locale)); } Map<EncodeHintType, Object> encodeHints = null; if (UtilValidate.isNotEmpty(encoding)) { @@ -134,10 +134,12 @@ public class QRCodeServices { BufferedImage defaultLogoImage = null; if (UtilValidate.isNotEmpty(qrCodeDefaultLogoImage)) { try { - Map<String, Object> logoImageResult = ImageTransform.getBufferedImage(FileUtil.getFile(qrCodeDefaultLogoImage).getAbsolutePath(), locale); + Map<String, Object> logoImageResult = + ImageTransform.getBufferedImage(FileUtil.getFile(qrCodeDefaultLogoImage).getAbsolutePath(), locale); defaultLogoImage = (BufferedImage) logoImageResult.get("bufferedImage"); if (UtilValidate.isEmpty(defaultLogoImage)) { - Debug.logError("Your logo image file(" + qrCodeDefaultLogoImage + ") cannot be read by javax.imageio.ImageIO. Please use png, jpeg formats instead of ico and etc.", MODULE); + Debug.logError("Your logo image file(" + qrCodeDefaultLogoImage + + ") cannot be read by javax.imageio.ImageIO. Please use png, jpeg formats instead of ico and etc.", MODULE); } } catch (IllegalArgumentException | IOException e) { defaultLogoImage = null; @@ -147,7 +149,8 @@ public class QRCodeServices { } BufferedImage newBufferedImage = null; if (UtilValidate.isNotEmpty(logoBufferedImage)) { - if (UtilValidate.isNotEmpty(logoImageMaxWidth) && UtilValidate.isNotEmpty(logoImageMaxHeight) && (logoBufferedImage.getWidth() > logoImageMaxWidth || logoBufferedImage.getHeight() > logoImageMaxHeight)) { + if (UtilValidate.isNotEmpty(logoImageMaxWidth) && UtilValidate.isNotEmpty(logoImageMaxHeight) + && (logoBufferedImage.getWidth() > logoImageMaxWidth || logoBufferedImage.getHeight() > logoImageMaxHeight)) { Map<String, String> typeMap = new HashMap<>(); typeMap.put("width", logoImageMaxWidth.toString()); typeMap.put("height", logoImageMaxHeight.toString()); @@ -161,7 +164,9 @@ public class QRCodeServices { BitMatrix newBitMatrix = bitMatrix.clone(); newBufferedImage = toBufferedImage(newBitMatrix, format, locale); Graphics2D graphics = newBufferedImage.createGraphics(); - graphics.drawImage(logoBufferedImage, new AffineTransformOp(AffineTransform.getTranslateInstance(1, 1), null), (newBufferedImage.getWidth() - logoBufferedImage.getWidth())/2, (newBufferedImage.getHeight() - logoBufferedImage.getHeight())/2); + graphics.drawImage(logoBufferedImage, new AffineTransformOp(AffineTransform.getTranslateInstance(1, 1), null), ( + newBufferedImage.getWidth() - logoBufferedImage.getWidth()) / 2, (newBufferedImage.getHeight() + - logoBufferedImage.getHeight()) / 2); graphics.dispose(); } if (UtilValidate.isNotEmpty(verifyOutput) && verifyOutput) { @@ -185,7 +190,8 @@ public class QRCodeServices { detectorResult = new Detector(bitMatrix).detect(decodeHints); result = decoder.decode(detectorResult.getBits(), decodeHints); if (!result.getText().equals(message)) { - return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "GeneratedTextNotMatchOriginal", new Object[]{result.getText(), message}, locale)); + return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "GeneratedTextNotMatchOriginal", + new Object[]{result.getText(), message}, locale)); } } else { bufferedImage = newBufferedImage; @@ -194,7 +200,8 @@ public class QRCodeServices { detectorResult = new Detector(bitMatrix).detect(decodeHints); DecoderResult result = decoder.decode(detectorResult.getBits(), decodeHints); if (!result.getText().equals(message)) { - return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "GeneratedTextNotMatchOriginal", new Object[]{result.getText(), message}, locale)); + return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "GeneratedTextNotMatchOriginal", + new Object[]{result.getText(), message}, locale)); } } } else if (UtilValidate.isNotEmpty(newBufferedImage)) { @@ -205,9 +212,9 @@ public class QRCodeServices { result.put("bufferedImage", bufferedImage); return result; } catch (WriterException e) { - return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "ErrorGenerateQRCode", new Object[] {e.toString() }, locale)); + return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "ErrorGenerateQRCode", new Object[]{e.toString()}, locale)); } catch (ChecksumException | FormatException | NotFoundException e) { - return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "ErrorVerifyQRCode", new Object[] {e.toString() }, locale)); + return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "ErrorVerifyQRCode", new Object[]{e.toString()}, locale)); } } @@ -248,8 +255,8 @@ public class QRCodeServices { for (int x = 0; x < width; x++) { int pixel = pixels[y * width + x]; int luminance = (306 * ((pixel >> 16) & 0xFF) - + 601 * ((pixel >> 8) & 0xFF) - + 117 * (pixel & 0xFF)) >> 10; + + 601 * ((pixel >> 8) & 0xFF) + + 117 * (pixel & 0xFF)) >> 10; if (luminance <= 0x7F) { matrix.set(x, y); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java index a07978c..9f58b83 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java @@ -1657,7 +1657,7 @@ public class GenericEntity implements Map<String, Object>, LocalizedMap<Object>, return true; } - public static interface NULL { + public interface NULL { } public static class NullGenericEntity extends GenericEntity implements NULL { diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityCondition.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityCondition.java index 54ce0f6..4fe0dda 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityCondition.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityCondition.java @@ -45,7 +45,7 @@ import org.apache.ofbiz.entity.model.ModelEntity; */ public interface EntityCondition extends IsEmpty, Serializable { - static final long serialVersionUID = -7601205800717391212L; + long serialVersionUID = -7601205800717391212L; /** * Constructs a condition expression to represent a comparison between two elements. @@ -91,7 +91,7 @@ public interface EntityCondition extends IsEmpty, Serializable { */ @SafeVarargs static <R extends EntityCondition, T extends R> - EntityConditionList<R> makeCondition(EntityJoinOperator operator, T... conditionList) { + EntityConditionList<R> makeCondition(EntityJoinOperator operator, T... conditionList) { return new EntityConditionList<>(Arrays.asList(conditionList), operator); } @@ -103,7 +103,7 @@ public interface EntityCondition extends IsEmpty, Serializable { */ @SafeVarargs static <R extends EntityCondition, T extends R> - EntityConditionList<R> makeCondition(T... conditionList) { + EntityConditionList<R> makeCondition(T... conditionList) { return new EntityConditionList<>(Arrays.asList(conditionList), EntityOperator.AND); } @@ -115,7 +115,7 @@ public interface EntityCondition extends IsEmpty, Serializable { * @return a condition expression representing a combination of condition expressions. */ static <T extends EntityCondition> - EntityConditionList<T> makeCondition(List<? extends T> conditionList, EntityJoinOperator operator) { + EntityConditionList<T> makeCondition(List<? extends T> conditionList, EntityJoinOperator operator) { return new EntityConditionList<>(conditionList, operator); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFunction.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFunction.java index 35d9e30..542ae32 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFunction.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFunction.java @@ -37,11 +37,11 @@ import org.apache.ofbiz.entity.model.ModelField; @SuppressWarnings("serial") public abstract class EntityFunction<T extends Comparable<?>> extends EntityConditionValue { - public static interface Fetcher<T> { + public interface Fetcher<T> { T getValue(Object value); } - public static enum SQLFunction { + public enum SQLFunction { LENGTH, TRIM, UPPER, LOWER; } @@ -50,15 +50,41 @@ public abstract class EntityFunction<T extends Comparable<?>> extends EntityCond public static final int ID_UPPER = SQLFunction.UPPER.ordinal(); public static final int ID_LOWER = SQLFunction.LOWER.ordinal(); - public static EntityFunction<Integer> LENGTH(EntityConditionValue nested) { return new LENGTH(nested); } - public static EntityFunction<Integer> LENGTH(Object value) { return new LENGTH(value); } - public static EntityFunction<String> TRIM(EntityConditionValue nested) { return new TRIM(nested); } - public static EntityFunction<String> TRIM(Object value) { return new TRIM(value); } - public static EntityFunction<String> UPPER(EntityConditionValue nested) { return new UPPER(nested); } - public static EntityFunction<String> UPPER(Object value) { return new UPPER(value); } - public static EntityFunction<String> UPPER_FIELD(String fieldName) { return new UPPER(EntityFieldValue.makeFieldValue(fieldName)); } - public static EntityFunction<String> LOWER(EntityConditionValue nested) { return new LOWER(nested); } - public static EntityFunction<String> LOWER(Object value) { return new LOWER(value); } + public static EntityFunction<Integer> LENGTH(EntityConditionValue nested) { + return new LENGTH(nested); + } + + public static EntityFunction<Integer> LENGTH(Object value) { + return new LENGTH(value); + } + + public static EntityFunction<String> TRIM(EntityConditionValue nested) { + return new TRIM(nested); + } + + public static EntityFunction<String> TRIM(Object value) { + return new TRIM(value); + } + + public static EntityFunction<String> UPPER(EntityConditionValue nested) { + return new UPPER(nested); + } + + public static EntityFunction<String> UPPER(Object value) { + return new UPPER(value); + } + + public static EntityFunction<String> UPPER_FIELD(String fieldName) { + return new UPPER(EntityFieldValue.makeFieldValue(fieldName)); + } + + public static EntityFunction<String> LOWER(EntityConditionValue nested) { + return new LOWER(nested); + } + + public static EntityFunction<String> LOWER(Object value) { + return new LOWER(value); + } /** * Length() entity function. @@ -108,13 +134,13 @@ public abstract class EntityFunction<T extends Comparable<?>> extends EntityCond } } - public static abstract class EntityFunctionSingle<T extends Comparable<?>> extends EntityFunction<T> { + public abstract static class EntityFunctionSingle<T extends Comparable<?>> extends EntityFunction<T> { protected EntityFunctionSingle(Fetcher<T> fetcher, SQLFunction function, Object value) { super(fetcher, function, value); } } - public static abstract class EntityFunctionNested<T extends Comparable<?>> extends EntityFunction<T> { + public abstract static class EntityFunctionNested<T extends Comparable<?>> extends EntityFunction<T> { protected EntityFunctionNested(Fetcher<T> fetcher, SQLFunction function, EntityConditionValue nested) { super(fetcher, function, nested); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityOperator.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityOperator.java index 4cca281..ef33691 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityOperator.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityOperator.java @@ -361,7 +361,7 @@ public abstract class EntityOperator<L, R> implements Serializable { * * @param <E> */ - public static abstract class CollectionEntityComparisonOperator<E> extends EntityComparisonOperator<Comparable<E>, Collection<Comparable<E>>> { + public abstract static class CollectionEntityComparisonOperator<E> extends EntityComparisonOperator<Comparable<E>, Collection<Comparable<E>>> { public CollectionEntityComparisonOperator(int id, String code) { super(id, code); } @@ -372,7 +372,7 @@ public abstract class EntityOperator<L, R> implements Serializable { * * @param <E> */ - public static abstract class ComparableEntityComparisonOperator<E> extends EntityComparisonOperator<Comparable<E>, E> { + public abstract static class ComparableEntityComparisonOperator<E> extends EntityComparisonOperator<Comparable<E>, E> { public ComparableEntityComparisonOperator(int id, String code) { super(id, code); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java index 03b81de..64676e6 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java @@ -95,7 +95,8 @@ public final class EntityFinderUtil { return fieldMap; } - public static void expandFieldMapToContext(Map<FlexibleMapAccessor<Object>, Object> fieldMap, Map<String, Object> context, Map<String, Object> outContext) { + public static void expandFieldMapToContext(Map<FlexibleMapAccessor<Object>, Object> fieldMap, Map<String, Object> context, Map<String, Object> + outContext) { if (fieldMap != null) { for (Map.Entry<FlexibleMapAccessor<Object>, Object> entry: fieldMap.entrySet()) { FlexibleMapAccessor<Object> serviceContextFieldAcsr = entry.getKey(); @@ -106,7 +107,7 @@ public final class EntityFinderUtil { } else if (valueSrc instanceof FlexibleStringExpander) { FlexibleStringExpander valueExdr = (FlexibleStringExpander) valueSrc; serviceContextFieldAcsr.put(outContext, valueExdr.expandString(context)); - } else { + //} else { // hmmmm... } } @@ -147,8 +148,8 @@ public final class EntityFinderUtil { return orderByFields; } - public static interface Condition extends Serializable { - public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader); + public interface Condition extends Serializable { + EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader); } @SuppressWarnings("serial") @@ -189,12 +190,14 @@ public final class EntityFinderUtil { } @Override - public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) { + public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader + modelFieldTypeReader) { if ("true".equals(this.ignoreExdr.expandString(context))) { return null; } if (modelEntity.getField(fieldName) == null) { - throw new IllegalArgumentException("Error in Entity Find: could not find field [" + fieldName + "] in entity with name [" + modelEntity.getEntityName() + "]"); + throw new IllegalArgumentException("Error in Entity Find: could not find field [" + fieldName + "] in entity with name [" + + modelEntity.getEntityName() + "]"); } Object value = envNameAcsr.get(context); @@ -236,10 +239,12 @@ public final class EntityFinderUtil { if (operator == EntityOperator.NOT_EQUAL && value != null) { // since some databases don't consider nulls in != comparisons, explicitly include them - // this makes more sense logically, but if anyone ever needs it to not behave this way we should add an "or-null" attribute that is true by default + // this makes more sense logically, but if anyone ever needs it to not behave this way we should add an "or-null" attribute + // that is true by default if (ignoreCase) { return EntityCondition.makeCondition( - EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName), UtilGenerics.<EntityComparisonOperator<?, ?>>cast(operator), EntityFunction.UPPER(value)), + EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName), + UtilGenerics.<EntityComparisonOperator<?, ?>>cast(operator), EntityFunction.UPPER(value)), EntityOperator.OR, EntityCondition.makeCondition(fieldName, EntityOperator.EQUALS, null)); } @@ -250,7 +255,8 @@ public final class EntityFinderUtil { } if (ignoreCase) { // use the stuff to upper case both sides - return EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName), UtilGenerics.<EntityComparisonOperator<?, ?>>cast(operator), EntityFunction.UPPER(value)); + return EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName), + UtilGenerics.<EntityComparisonOperator<?, ?>>cast(operator), EntityFunction.UPPER(value)); } return EntityCondition.makeCondition(fieldName, UtilGenerics.<EntityComparisonOperator<?, ?>>cast(operator), value); } @@ -283,7 +289,8 @@ public final class EntityFinderUtil { } else if ("condition-object".equals(subElement.getNodeName())) { conditionList.add(new ConditionObject(subElement)); } else { - throw new IllegalArgumentException("Invalid element with name [" + subElement.getNodeName() + "] found under a condition-list element."); + throw new IllegalArgumentException("Invalid element with name [" + subElement.getNodeName() + + "] found under a condition-list element."); } } this.conditionList = Collections.unmodifiableList(conditionList); @@ -291,7 +298,8 @@ public final class EntityFinderUtil { } @Override - public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) { + public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader + modelFieldTypeReader) { if (this.conditionList == null) { return null; } @@ -323,14 +331,15 @@ public final class EntityFinderUtil { } @Override - public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) { + public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader + modelFieldTypeReader) { return (EntityCondition) fieldNameAcsr.get(context); } } - public static interface OutputHandler extends Serializable { - public void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr); - public void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr); + public interface OutputHandler extends Serializable { + void handleOutput(EntityListIterator eli, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr); + void handleOutput(List<GenericValue> results, Map<String, Object> context, FlexibleMapAccessor<Object> listAcsr); } @SuppressWarnings("serial") diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java index 4d7843a..c46ac6b 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java @@ -1014,11 +1014,11 @@ public class DatabaseUtil { String tableType = tableSet.getString("TABLE_TYPE"); // only allow certain table types if (tableType != null - && !"TABLE".equalsIgnoreCase(tableType) - && !"VIEW".equalsIgnoreCase(tableType) - && !"ALIAS".equalsIgnoreCase(tableType) - && !"SYNONYM".equalsIgnoreCase(tableType) - && !"BASE TABLE".equalsIgnoreCase(tableType)) { + && !"TABLE".equalsIgnoreCase(tableType) + && !"VIEW".equalsIgnoreCase(tableType) + && !"ALIAS".equalsIgnoreCase(tableType) + && !"SYNONYM".equalsIgnoreCase(tableType) + && !"BASE TABLE".equalsIgnoreCase(tableType)) { continue; } // String remarks = tableSet.getString("REMARKS"); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelViewEntity.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelViewEntity.java index 4e4b308..63a8cec 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelViewEntity.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelViewEntity.java @@ -972,8 +972,8 @@ public class ModelViewEntity extends ModelEntity { } } - public static interface ComplexAliasMember extends Serializable { - public void makeAliasColName(StringBuilder colNameBuffer, StringBuilder fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader); + public interface ComplexAliasMember extends Serializable { + void makeAliasColName(StringBuilder colNameBuffer, StringBuilder fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader); } public static final class ComplexAlias implements ComplexAliasMember { @@ -1324,8 +1324,8 @@ public class ModelViewEntity extends ModelEntity { } } - public static interface ViewCondition extends Serializable { - public EntityCondition createCondition(ModelFieldTypeReader modelFieldTypeReader, List<String> entityAliasStack); + public interface ViewCondition extends Serializable { + EntityCondition createCondition(ModelFieldTypeReader modelFieldTypeReader, List<String> entityAliasStack); } public static final class ViewConditionExpr implements ViewCondition { diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java index ed3513e..d94c823 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java @@ -642,9 +642,9 @@ public class EntityTestSuite extends EntityTestCase { // delete them their primary key // EntityCondition isRoot = EntityCondition.makeCondition( - EntityCondition.makeCondition("description", EntityOperator.LIKE, "remove-by-pk:%"), - EntityOperator.AND, - EntityCondition.makeCondition("primaryParentNodeId", EntityOperator.NOT_EQUAL, GenericEntity.NULL_FIELD)); + EntityCondition.makeCondition("description", EntityOperator.LIKE, "remove-by-pk:%"), + EntityOperator.AND, + EntityCondition.makeCondition("primaryParentNodeId", EntityOperator.NOT_EQUAL, GenericEntity.NULL_FIELD)); List<GenericValue> rootValues = EntityQuery.use(delegator).select("testingNodeId").from("TestingNode").where(isRoot).queryList(); for (GenericValue value: rootValues) { @@ -926,16 +926,16 @@ public class EntityTestSuite extends EntityTestCase { private static String getTestId(String strTestBase, int iNum) { StringBuilder strBufTemp = new StringBuilder(strTestBase); if (iNum < 10000) { - strBufTemp.append("0"); + strBufTemp.append("0"); } if (iNum < 1000) { - strBufTemp.append("0"); + strBufTemp.append("0"); } if (iNum < 100) { - strBufTemp.append("0"); + strBufTemp.append("0"); } if (iNum < 10) { - strBufTemp.append("0"); + strBufTemp.append("0"); } strBufTemp.append(iNum); return strBufTemp.toString(); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/transaction/TransactionUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/transaction/TransactionUtil.java index bd73d99..1e89b49 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/transaction/TransactionUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/transaction/TransactionUtil.java @@ -769,7 +769,7 @@ public final class TransactionUtil implements Status { protected String causeMessage; protected Throwable causeThrowable; - public RollbackOnlyCause(String causeMessage, Throwable causeThrowable) { + RollbackOnlyCause(String causeMessage, Throwable causeThrowable) { this.causeMessage = causeMessage; this.causeThrowable = causeThrowable; } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java index 1a94995..2bf0557 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java @@ -294,7 +294,7 @@ public final class EntityCrypto { } } - protected static abstract class LegacyStorageHandler extends StorageHandler { + protected abstract static class LegacyStorageHandler extends StorageHandler { @Override protected Key generateNewKey() throws EntityCryptoException { try { diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java index dca71a6..6d9222d 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java @@ -39,7 +39,6 @@ import org.apache.ofbiz.entity.GenericPK; import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.condition.EntityCondition; import org.apache.ofbiz.entity.model.DynamicViewEntity; -import org.apache.ofbiz.entity.util.EntityBatchIterator; /** * Used to setup various options for and subsequently execute entity queries. @@ -389,10 +388,12 @@ public class EntityQuery { if (dynamicViewEntity == null) { return delegator.find(entityName, makeWhereCondition(false), havingEntityCondition, fieldsToSelect, orderBy, makeEntityFindOptions()); } else { - return delegator.findListIteratorByCondition(dynamicViewEntity, makeWhereCondition(false), havingEntityCondition, fieldsToSelect, orderBy, makeEntityFindOptions()); + return delegator.findListIteratorByCondition(dynamicViewEntity, makeWhereCondition(false), havingEntityCondition, fieldsToSelect, + orderBy, makeEntityFindOptions()); } } + /** query batch iterator */ public EntityBatchIterator queryBatchIterator() { return new EntityBatchIterator(this); } @@ -541,8 +542,7 @@ public class EntityQuery { } } return new ArrayList<>(distinctSet); - } - else { + } else { List<T> fieldList = new LinkedList<>(); GenericValue value = null; while ((value = genericValueEli.next()) != null) { diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java index 2c93935..9f5ada4 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java @@ -78,7 +78,7 @@ public class EntityDataServices { Locale locale = (Locale) context.get("locale"); // check permission - GenericValue userLogin = (GenericValue) context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); if (!security.hasPermission("ENTITY_MAINT", userLogin)) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityExtServicePermissionNotGranted", locale)); } @@ -131,7 +131,7 @@ public class EntityDataServices { Locale locale = (Locale) context.get("locale"); // check permission - GenericValue userLogin = (GenericValue) context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); if (!security.hasPermission("ENTITY_MAINT", userLogin)) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityExtServicePermissionNotGranted", locale)); } @@ -329,7 +329,7 @@ public class EntityDataServices { Locale locale = (Locale) context.get("locale"); // check permission - GenericValue userLogin = (GenericValue) context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); if (!security.hasPermission("ENTITY_MAINT", userLogin)) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityExtServicePermissionNotGranted", locale)); } diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java index 16ec26a..3ec1ec7 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java @@ -1171,7 +1171,7 @@ public class EntitySyncContext { } @SuppressWarnings("serial") - public static abstract class SyncErrorException extends GeneralServiceException { + public abstract static class SyncErrorException extends GeneralServiceException { public SyncErrorException() { super(); } public SyncErrorException(String str) { super(str); } public SyncErrorException(String str, Throwable nested) { super(str, nested); } diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/EntityCondition.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/EntityCondition.java index ca39388..25deb5c 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/EntityCondition.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/EntityCondition.java @@ -42,10 +42,12 @@ public final class EntityCondition extends EntityOperation { public EntityCondition(Element element, SimpleMethod simpleMethod) throws MiniLangException { super(element, simpleMethod); if (MiniLangValidate.validationOn()) { - MiniLangValidate.attributeNames(simpleMethod, element, "entity-name", "use-cache", "filter-by-date", "list", "distinct", "delegator-name"); + MiniLangValidate.attributeNames(simpleMethod, element, "entity-name", "use-cache", "filter-by-date", "list", "distinct", + "delegator-name"); MiniLangValidate.requiredAttributes(simpleMethod, element, "entity-name", "list"); MiniLangValidate.expressionAttributes(simpleMethod, element, "list", "delegator-name"); - MiniLangValidate.childElements(simpleMethod, element, "condition-expr", "condition-list", "condition-object", "having-condition-list", "select-field", "order-by", "limit-range", "limit-view", "use-iterator"); + MiniLangValidate.childElements(simpleMethod, element, "condition-expr", "condition-list", "condition-object", "having-condition-list", + "select-field", "order-by", "limit-range", "limit-view", "use-iterator"); MiniLangValidate.requireAnyChildElement(simpleMethod, element, "condition-expr", "condition-list", "condition-object"); } this.finder = new ByConditionFinder(element); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetOperation.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetOperation.java index c8a4864..2d8e010 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetOperation.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetOperation.java @@ -144,7 +144,7 @@ public final class SetOperation extends MethodOperation { } else if (!this.fromFma.isEmpty()) { newValue = this.fromFma.get(methodContext.getEnvMap()); if (Debug.verboseOn()) { - Debug.logVerbose("In screen getting value for field from [" + this.fromFma.toString() + "]: " + newValue, MODULE); + Debug.logVerbose("In screen getting value for field from [" + this.fromFma.toString() + "]: " + newValue, MODULE); } } else if (!this.valueFse.isEmpty()) { newValue = this.valueFse.expand(methodContext.getEnvMap()); @@ -157,13 +157,15 @@ public final class SetOperation extends MethodOperation { } if (!setIfNull && newValue == null && !"NewMap".equals(this.type) && !"NewList".equals(this.type)) { if (Debug.verboseOn()) { - Debug.logVerbose("Field value not found (null) with name [" + fromFma + "] and value [" + valueFse + "], and there was not default value, not setting field", MODULE); + Debug.logVerbose("Field value not found (null) with name [" + fromFma + "] and value [" + valueFse + + "], and there was not default value, not setting field", MODULE); } return true; } if (!setIfEmpty && ObjectType.isEmpty(newValue)) { if (Debug.verboseOn()) { - Debug.logVerbose("Field value not found (empty) with name [" + fromFma + "] and value [" + valueFse + "], and there was not default value, not setting field", MODULE); + Debug.logVerbose("Field value not found (empty) with name [" + fromFma + "] and value [" + valueFse + + "], and there was not default value, not setting field", MODULE); } return true; } @@ -189,7 +191,8 @@ public final class SetOperation extends MethodOperation { newValue = MiniLangUtil.convertType(newValue, targetClass, methodContext.getLocale(), methodContext.getTimeZone(), format); } } catch (Exception e) { - String errMsg = "Could not convert field value for the field: [" + this.fieldFma.toString() + "] to the [" + this.type + "] type for the value [" + newValue + "]: " + e.getMessage(); + String errMsg = "Could not convert field value for the field: [" + this.fieldFma.toString() + "] to the [" + this.type + + "] type for the value [" + newValue + "]: " + e.getMessage(); Debug.logWarning(e, errMsg, MODULE); this.simpleMethod.addErrorMessage(methodContext, errMsg); return false; diff --git a/framework/security/src/main/java/org/apache/ofbiz/security/Security.java b/framework/security/src/main/java/org/apache/ofbiz/security/Security.java index ed7179d..345e9c9 100644 --- a/framework/security/src/main/java/org/apache/ofbiz/security/Security.java +++ b/framework/security/src/main/java/org/apache/ofbiz/security/Security.java @@ -37,10 +37,10 @@ import org.apache.ofbiz.entity.GenericValue; public interface Security { @Deprecated - public Delegator getDelegator(); + Delegator getDelegator(); @Deprecated - public void setDelegator(Delegator delegator); + void setDelegator(Delegator delegator); /** * Uses userLoginSecurityGroupByUserLoginId cache to speed up the finding of the userLogin's security group list. @@ -50,7 +50,7 @@ public interface Security { * UserLoginSecurityGroup Delegator. */ @Deprecated - public Iterator<GenericValue> findUserLoginSecurityGroupByUserLoginId(String userLoginId); + Iterator<GenericValue> findUserLoginSecurityGroupByUserLoginId(String userLoginId); /** * Finds whether or not a SecurityGroupPermission row exists given a groupId and permission. @@ -62,7 +62,7 @@ public interface Security { * @return boolean specifying whether or not a SecurityGroupPermission row exists */ @Deprecated - public boolean securityGroupPermissionExists(String groupId, String permission); + boolean securityGroupPermissionExists(String groupId, String permission); /** * Checks to see if the currently logged in userLogin has the passed permission. @@ -71,7 +71,7 @@ public interface Security { * @param session The current HTTP session, contains the logged in userLogin as an attribute. * @return Returns true if the currently logged in userLogin has the specified permission, otherwise returns false. */ - public boolean hasPermission(String permission, HttpSession session); + boolean hasPermission(String permission, HttpSession session); /** * Checks to see if the userLogin has the passed permission. @@ -80,7 +80,7 @@ public interface Security { * @param userLogin The userLogin object for user to check against. * @return Returns true if the currently logged in userLogin has the specified permission, otherwise returns false. */ - public boolean hasPermission(String permission, GenericValue userLogin); + boolean hasPermission(String permission, GenericValue userLogin); /** * Like hasPermission above, except it has functionality specific to Entity permissions. Checks the entity for the @@ -91,7 +91,7 @@ public interface Security { * @param session The current HTTP session, contains the logged in userLogin as an attribute. * @return Returns true if the currently logged in userLogin has the specified permission, otherwise returns false. */ - public boolean hasEntityPermission(String entity, String action, HttpSession session); + boolean hasEntityPermission(String entity, String action, HttpSession session); /** * Like hasPermission above, except it has functionality specific to Entity permissions. Checks the entity for the @@ -102,7 +102,7 @@ public interface Security { * @param userLogin The userLogin object for user to check against. * @return Returns true if the currently logged in userLogin has the specified permission, otherwise returns false. */ - public boolean hasEntityPermission(String entity, String action, GenericValue userLogin); + boolean hasEntityPermission(String entity, String action, GenericValue userLogin); /** * Like hasEntityPermission above, this checks the specified action, as well as for "_ADMIN" to allow for simplified @@ -116,7 +116,7 @@ public interface Security { * @param session The current HTTP session, contains the logged in userLogin as an attribute. * @return Returns true if the currently logged in userLogin has the specified permission, otherwise returns false. */ - public boolean hasRolePermission(String application, String action, String primaryKey, String role, HttpSession session); + boolean hasRolePermission(String application, String action, String primaryKey, String role, HttpSession session); /** * Like hasEntityPermission above, this checks the specified action, as well as for "_ADMIN" to allow for simplified @@ -130,7 +130,7 @@ public interface Security { * @param userLogin The userLogin object for user to check against. * @return Returns true if the currently logged in userLogin has the specified permission, otherwise returns false. */ - public boolean hasRolePermission(String application, String action, String primaryKey, String role, GenericValue userLogin); + boolean hasRolePermission(String application, String action, String primaryKey, String role, GenericValue userLogin); /** * Like hasEntityPermission above, this checks the specified action, as well as for "_ADMIN" to allow for simplified @@ -144,7 +144,7 @@ public interface Security { * @param userLogin The userLogin object for user to check against. * @return Returns true if the currently logged in userLogin has the specified permission, otherwise returns false. */ - public boolean hasRolePermission(String application, String action, String primaryKey, List<String> roles, GenericValue userLogin); + boolean hasRolePermission(String application, String action, String primaryKey, List<String> roles, GenericValue userLogin); /** * Like hasEntityPermission above, this checks the specified action, as well as for "_ADMIN" to allow for simplified @@ -158,12 +158,12 @@ public interface Security { * @param session The current HTTP session, contains the logged in userLogin as an attribute. * @return Returns true if the currently logged in userLogin has the specified permission, otherwise returns false. */ - public boolean hasRolePermission(String application, String action, String primaryKey, List<String> roles, HttpSession session); + boolean hasRolePermission(String application, String action, String primaryKey, List<String> roles, HttpSession session); /** Clears any user-related cached data. This method is called by the framework * to indicate a user has logged out. Implementations should clear any cached * data related to the user. * @param userLogin The user login to be cleared */ - public void clearUserData(GenericValue userLogin); + void clearUserData(GenericValue userLogin); } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/ModelParam.java b/framework/service/src/main/java/org/apache/ofbiz/service/ModelParam.java index 87f0910..846f9e8 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/ModelParam.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/ModelParam.java @@ -317,7 +317,7 @@ public class ModelParam implements Serializable { protected String failResource; protected String failProperty; - public ModelParamValidator(String className, String methodName, String failMessage, String failResource, String failProperty) { + ModelParamValidator(String className, String methodName, String failMessage, String failResource, String failProperty) { this.className = className; this.methodName = methodName; this.failMessage = failMessage; diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/job/Job.java b/framework/service/src/main/java/org/apache/ofbiz/service/job/Job.java index e59d4bb..f012654 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/job/Job.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/job/Job.java @@ -29,7 +29,7 @@ import java.util.Date; */ public interface Job extends Runnable { - public static enum State { CREATED, QUEUED, RUNNING, FINISHED, FAILED } + enum State { CREATED, QUEUED, RUNNING, FINISHED, FAILED } /** * Returns the current state of this job. diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java b/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java index ba9219d..58e2cf1 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java @@ -276,7 +276,7 @@ public class JavaMailContainer implements Container { LocalDispatcher dispatcher; GenericValue userLogin; - public PollerTask(LocalDispatcher dispatcher, GenericValue userLogin) { + PollerTask(LocalDispatcher dispatcher, GenericValue userLogin) { this.dispatcher = dispatcher; this.userLogin = userLogin; } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/mail/MimeMessageWrapper.java b/framework/service/src/main/java/org/apache/ofbiz/service/mail/MimeMessageWrapper.java index 6b56abd..2d43f6d 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/mail/MimeMessageWrapper.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/mail/MimeMessageWrapper.java @@ -523,10 +523,9 @@ public class MimeMessageWrapper implements java.io.Serializable { /** * Convert MimeMessageWrapper to String. This is used when sending emails. - * */ private static class MimeMessageToString extends AbstractConverter<MimeMessageWrapper, String> { - public MimeMessageToString() { + MimeMessageToString() { super(MimeMessageWrapper.class, String.class); } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/mail/ServiceMcaUtil.java b/framework/service/src/main/java/org/apache/ofbiz/service/mail/ServiceMcaUtil.java index d432426..67c7a3e 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/mail/ServiceMcaUtil.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/mail/ServiceMcaUtil.java @@ -82,9 +82,9 @@ public final class ServiceMcaUtil { } public static Collection<ServiceMcaRule> getServiceMcaRules() { - if (mcaCache.size() == 0) { - readConfig(); - } + if (mcaCache.size() == 0) { + readConfig(); + } return mcaCache.values(); } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RemoteDispatcher.java b/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RemoteDispatcher.java index a93ff07..f53422e 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RemoteDispatcher.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RemoteDispatcher.java @@ -34,166 +34,176 @@ public interface RemoteDispatcher extends Remote { /** * Run the service synchronously and return the result. * @param serviceName Name of the service to run. - * @param context Map of name, value pairs composing the context. + * @param context Map of name, value pairs composing the context. * @return Map of name, value pairs composing the result. * @throws GenericServiceException * @throws RemoteException */ - public Map<String, Object> runSync(String serviceName, Map<String, ? extends Object> context) throws GenericServiceException, RemoteException; + Map<String, Object> runSync(String serviceName, Map<String, ? extends Object> context) throws GenericServiceException, RemoteException; /** * Run the service synchronously with a specified timeout and return the result. - * @param serviceName Name of the service to run. - * @param context Map of name, value pairs composing the context. - * @param transactionTimeout the overriding timeout for the transaction (if we started it). + * @param serviceName Name of the service to run. + * @param context Map of name, value pairs composing the context. + * @param transactionTimeout the overriding timeout for the transaction (if we started it). * @param requireNewTransaction if true we will suspend and create a new transaction so we are sure to start. * @return Map of name, value pairs composing the result. * @throws GenericServiceException */ - public Map<String, Object> runSync(String serviceName, Map<String, ? extends Object> context, int transactionTimeout, boolean requireNewTransaction) throws GenericServiceException, RemoteException; + Map<String, Object> runSync(String serviceName, Map<String, ? extends Object> context, int transactionTimeout, boolean requireNewTransaction) + throws GenericServiceException, RemoteException; /** * Run the service synchronously and IGNORE the result. * @param serviceName Name of the service to run. - * @param context Map of name, value pairs composing the context. + * @param context Map of name, value pairs composing the context. * @throws GenericServiceException * @throws RemoteException */ - public void runSyncIgnore(String serviceName, Map<String, ? extends Object> context) throws GenericServiceException, RemoteException; + void runSyncIgnore(String serviceName, Map<String, ? extends Object> context) throws GenericServiceException, RemoteException; /** * Run the service synchronously with a specified timeout and IGNORE the result. - * @param serviceName Name of the service to run. - * @param context Map of name, value pairs composing the context. - * @param transactionTimeout the overriding timeout for the transaction (if we started it). + * @param serviceName Name of the service to run. + * @param context Map of name, value pairs composing the context. + * @param transactionTimeout the overriding timeout for the transaction (if we started it). * @param requireNewTransaction if true we will suspend and create a new transaction so we are sure to start. * @throws GenericServiceException */ - public void runSyncIgnore(String serviceName, Map<String, ? extends Object> context, int transactionTimeout, boolean requireNewTransaction) throws GenericServiceException, RemoteException; + void runSyncIgnore(String serviceName, Map<String, ? extends Object> context, int transactionTimeout, boolean requireNewTransaction) + throws GenericServiceException, RemoteException; /** * Run the service asynchronously, passing an instance of GenericRequester that will receive the result. - * @param serviceName Name of the service to run. - * @param context Map of name, value pairs composing the context. - * @param requester Object implementing GenericRequester interface which will receive the result. - * @param persist True for store/run; False for run. - * @param transactionTimeout the overriding timeout for the transaction (if we started it). + * @param serviceName Name of the service to run. + * @param context Map of name, value pairs composing the context. + * @param requester Object implementing GenericRequester interface which will receive the result. + * @param persist True for store/run; False for run. + * @param transactionTimeout the overriding timeout for the transaction (if we started it). * @param requireNewTransaction if true we will suspend and create a new transaction so we are sure to start. * @throws GenericServiceException */ - public void runAsync(String serviceName, Map<String, ? extends Object> context, GenericRequester requester, boolean persist, int transactionTimeout, boolean requireNewTransaction) throws GenericServiceException, RemoteException; + void runAsync(String serviceName, Map<String, ? extends Object> context, GenericRequester requester, boolean persist, int transactionTimeout, + boolean requireNewTransaction) throws GenericServiceException, RemoteException; /** * Run the service asynchronously, passing an instance of GenericRequester that will receive the result. + * * @param serviceName Name of the service to run. - * @param context Map of name, value pairs composing the context. - * @param requester Object implementing GenericRequester interface which will receive the result. - * @param persist True for store/run; False for run. + * @param context Map of name, value pairs composing the context. + * @param requester Object implementing GenericRequester interface which will receive the result. + * @param persist True for store/run; False for run. * @throws GenericServiceException * @throws RemoteException */ - public void runAsync(String serviceName, Map<String, ? extends Object> context, GenericRequester requester, boolean persist) throws GenericServiceException, RemoteException; + void runAsync(String serviceName, Map<String, ? extends Object> context, GenericRequester requester, boolean persist) throws GenericServiceException, RemoteException; /** * Run the service asynchronously, passing an instance of GenericRequester that will receive the result. * This method WILL persist the job. * @param serviceName Name of the service to run. - * @param context Map of name, value pairs composing the context. - * @param requester Object implementing GenericRequester interface which will receive the result. + * @param context Map of name, value pairs composing the context. + * @param requester Object implementing GenericRequester interface which will receive the result. * @throws GenericServiceException * @throws RemoteException */ - public void runAsync(String serviceName, Map<String, ? extends Object> context, GenericRequester requester) throws GenericServiceException, RemoteException; + void runAsync(String serviceName, Map<String, ? extends Object> context, GenericRequester requester) + throws GenericServiceException, RemoteException; /** * Run the service asynchronously and IGNORE the result. * @param serviceName Name of the service to run. - * @param context Map of name, value pairs composing the context. - * @param persist True for store/run; False for run. + * @param context Map of name, value pairs composing the context. + * @param persist True for store/run; False for run. * @throws GenericServiceException * @throws RemoteException */ - public void runAsync(String serviceName, Map<String, ? extends Object> context, boolean persist) throws GenericServiceException, RemoteException; + void runAsync(String serviceName, Map<String, ? extends Object> context, boolean persist) throws GenericServiceException, RemoteException; /** * Run the service asynchronously and IGNORE the result. This method WILL persist the job. * @param serviceName Name of the service to run. - * @param context Map of name, value pairs composing the context. + * @param context Map of name, value pairs composing the context. * @throws GenericServiceException * @throws RemoteException */ - public void runAsync(String serviceName, Map<String, ? extends Object> context) throws GenericServiceException, RemoteException; + void runAsync(String serviceName, Map<String, ? extends Object> context) throws GenericServiceException, RemoteException; /** * Run the service asynchronously. + * * @param serviceName Name of the service to run. - * @param context Map of name, value pairs composing the context. - * @param persist True for store/run; False for run. + * @param context Map of name, value pairs composing the context. + * @param persist True for store/run; False for run. * @return A new GenericRequester object. * @throws GenericServiceException * @throws RemoteException */ - public GenericResultWaiter runAsyncWait(String serviceName, Map<String, ? extends Object> context, boolean persist) throws GenericServiceException, RemoteException; + GenericResultWaiter runAsyncWait(String serviceName, Map<String, ? extends Object> context, boolean persist) + throws GenericServiceException, RemoteException; /** * Run the service asynchronously. This method WILL persist the job. * @param serviceName Name of the service to run. - * @param context Map of name, value pairs composing the context. + * @param context Map of name, value pairs composing the context. * @return A new GenericRequester object. * @throws GenericServiceException * @throws RemoteException */ - public GenericResultWaiter runAsyncWait(String serviceName, Map<String, ? extends Object> context) throws GenericServiceException, RemoteException; + GenericResultWaiter runAsyncWait(String serviceName, Map<String, ? extends Object> context) throws GenericServiceException, RemoteException; /** * Schedule a service to run asynchronously at a specific start time. * @param serviceName Name of the service to invoke. - * @param context The name/value pairs composing the context. - * @param startTime The time to run this service. - * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc). - * @param interval The interval of the frequency recurrence. - * @param count The number of times to repeat. - * @param endTime The time in milliseconds the service should expire + * @param context The name/value pairs composing the context. + * @param startTime The time to run this service. + * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc). + * @param interval The interval of the frequency recurrence. + * @param count The number of times to repeat. + * @param endTime The time in milliseconds the service should expire * @throws GenericServiceException * @throws RemoteException */ - public void schedule(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count, long endTime) throws GenericServiceException, RemoteException; + void schedule(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count, long endTime) + throws GenericServiceException, RemoteException; /** * Schedule a service to run asynchronously at a specific start time. * @param serviceName Name of the service to invoke. - * @param context The name/value pairs composing the context. - * @param startTime The time to run this service. - * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc). - * @param interval The interval of the frequency recurrence. - * @param count The number of times to repeat. + * @param context The name/value pairs composing the context. + * @param startTime The time to run this service. + * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc). + * @param interval The interval of the frequency recurrence. + * @param count The number of times to repeat. * @throws GenericServiceException * @throws RemoteException */ - public void schedule(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count) throws GenericServiceException, RemoteException; + void schedule(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count) + throws GenericServiceException, RemoteException; /** * Schedule a service to run asynchronously at a specific start time. * @param serviceName Name of the service to invoke. - * @param context The name/value pairs composing the context. - * @param startTime The time to run this service. - * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc). - * @param interval The interval of the frequency recurrence. - * @param endTime The time in milliseconds the service should expire + * @param context The name/value pairs composing the context. + * @param startTime The time to run this service. + * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc). + * @param interval The interval of the frequency recurrence. + * @param endTime The time in milliseconds the service should expire * @throws GenericServiceException * @throws RemoteException */ - public void schedule(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, long endTime) throws GenericServiceException, RemoteException; + void schedule(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, long endTime) + throws GenericServiceException, RemoteException; /** * Schedule a service to run asynchronously at a specific start time. * @param serviceName Name of the service to invoke. - * @param context The name/value pairs composing the context. - * @param startTime The time to run this service. + * @param context The name/value pairs composing the context. + * @param startTime The time to run this service. * @throws GenericServiceException * @throws RemoteException */ - public void schedule(String serviceName, Map<String, ? extends Object> context, long startTime) throws GenericServiceException, RemoteException; + void schedule(String serviceName, Map<String, ? extends Object> context, long startTime) throws GenericServiceException, RemoteException; } diff --git a/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupCommandUtil.java b/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupCommandUtil.java index fb38e34..d1ad73f 100644 --- a/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupCommandUtil.java +++ b/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupCommandUtil.java @@ -49,6 +49,7 @@ import org.apache.commons.cli.ParseException; */ public final class StartupCommandUtil { + private StartupCommandUtil() { } /* * Make sure of defining the same set of values in: * @@ -71,7 +72,7 @@ public final class StartupCommandUtil { TEST("test"); private String name; - private StartupOption(String name) { + StartupOption(String name) { this.name = name; } public String getName() { @@ -162,7 +163,7 @@ public final class StartupCommandUtil { .argName("key=value") .build(); - static final List<StartupCommand> parseOfbizCommands(final String[] args) throws StartupException { + static List<StartupCommand> parseOfbizCommands(final String[] args) throws StartupException { CommandLine commandLine = null; CommandLineParser parser = new DefaultParser(); try { @@ -174,7 +175,7 @@ public final class StartupCommandUtil { return mapCommonsCliOptionsToStartupCommands(commandLine); } - static final void printOfbizStartupHelp(final PrintStream printStream) { + static void printOfbizStartupHelp(final PrintStream printStream) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp( new PrintWriter(new OutputStreamWriter(printStream, StandardCharsets.UTF_8), true), @@ -192,7 +193,7 @@ public final class StartupCommandUtil { true); } - static final void highlightAndPrintErrorMessage(String errorMessage) { + static void highlightAndPrintErrorMessage(String errorMessage) { System.err.println( "===============================================================================" + System.lineSeparator() @@ -201,7 +202,7 @@ public final class StartupCommandUtil { + "==============================================================================="); } - private static final Options getOfbizStartupOptions() { + private static Options getOfbizStartupOptions() { OptionGroup ofbizCommandOptions = new OptionGroup(); ofbizCommandOptions.addOption(HELP); ofbizCommandOptions.addOption(LOAD_DATA); @@ -216,7 +217,7 @@ public final class StartupCommandUtil { return options; } - private static final List<StartupCommand> mapCommonsCliOptionsToStartupCommands(final CommandLine commandLine) { + private static List<StartupCommand> mapCommonsCliOptionsToStartupCommands(final CommandLine commandLine) { Set<Option> uniqueOptions = new HashSet<>(Arrays.asList(commandLine.getOptions())); return uniqueOptions.stream() .map(option -> new StartupCommand.Builder(option.getLongOpt()) @@ -225,13 +226,13 @@ public final class StartupCommandUtil { .collect(Collectors.toList()); } - private static final Map<String, String> populateMapFromProperties(final Properties properties) { + private static Map<String, String> populateMapFromProperties(final Properties properties) { return properties.entrySet().stream().collect(Collectors.toMap( entry -> String.valueOf(entry.getKey()), entry -> String.valueOf(entry.getValue()))); } - private static final void validateAllCommandArguments(CommandLine commandLine) throws StartupException { + private static void validateAllCommandArguments(CommandLine commandLine) throws StartupException { // Make sure no extra options are passed if (!commandLine.getArgList().isEmpty()) { throw new StartupException("unrecognized options / properties: " + commandLine.getArgList()); diff --git a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java index 92a6d24..89f91da 100644 --- a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java +++ b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java @@ -175,7 +175,7 @@ public class TestRunContainer implements Container { Map<String, Long> startTimes = new HashMap<>(); - public JunitXmlListener(OutputStream out) { + JunitXmlListener(OutputStream out) { this.setOutput(out); } diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/UtilCacheEvents.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/UtilCacheEvents.java index 17b964b..1c9847c 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/UtilCacheEvents.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/UtilCacheEvents.java @@ -203,7 +203,7 @@ public final class UtilCacheEvents { continue; } - String name = request.getParameter("cacheName"+suffix); + String name = request.getParameter("cacheName" + suffix); if (name == null) { errMsg = UtilProperties.getMessage(ERR_RESOURCE, "utilCache.couldNotClearCache", locale) + "."; diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java index 452f3af..5161a27 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java @@ -134,9 +134,11 @@ public class WebToolsServices { try { url = isUrl ? FlexibleLocation.resolveLocation(filename) : UtilURL.fromFilename(filename); } catch (MalformedURLException mue) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsInvalidFileName", UtilMisc.toMap("filename", filename, "errorString", mue.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsInvalidFileName", + UtilMisc.toMap("filename", filename, "errorString", mue.getMessage()), locale)); } catch (Exception exc) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsErrorReadingFileName", UtilMisc.toMap("filename", filename, "errorString", exc.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsErrorReadingFileName", + UtilMisc.toMap("filename", filename, "errorString", exc.getMessage()), locale)); } } @@ -146,7 +148,8 @@ public class WebToolsServices { if (UtilValidate.isNotEmpty(fmfilename) && (UtilValidate.isNotEmpty(fulltext) || url != null)) { File fmFile = new File(fmfilename); if (!fmFile.exists()) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsErrorReadingTemplateFile", UtilMisc.toMap("filename", fmfilename, "errorString", "Template file not found."), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsErrorReadingTemplateFile", + UtilMisc.toMap("filename", fmfilename, "errorString", "Template file not found."), locale)); } try { DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); @@ -168,7 +171,8 @@ public class WebToolsServices { FreeMarkerWorker.renderTemplate(fmFile.toURI().toURL().toString(), fmcontext, outWriter); fulltext = outWriter.toString(); } catch (Exception ex) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsErrorProcessingTemplateFile", UtilMisc.toMap("filename", fmfilename, "errorString", ex.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsErrorProcessingTemplateFile", + UtilMisc.toMap("filename", fmfilename, "errorString", ex.getMessage()), locale)); } } @@ -178,12 +182,12 @@ public class WebToolsServices { if (fulltext != null || url != null) { try { Map<String, Object> inputMap = UtilMisc.toMap("onlyInserts", onlyInserts, - "createDummyFks", createDummyFks, - "checkDataOnly", checkDataOnly, - "maintainTimeStamps", maintainTimeStamps, - "txTimeout", txTimeout, - "placeholderValues", placeholderValues, - "userLogin", userLogin); + "createDummyFks", createDummyFks, + "checkDataOnly", checkDataOnly, + "maintainTimeStamps", maintainTimeStamps, + "txTimeout", txTimeout, + "placeholderValues", placeholderValues, + "userLogin", userLogin); if (fulltext != null) { inputMap.put("xmltext", fulltext); } else { @@ -191,13 +195,16 @@ public class WebToolsServices { } Map<String, Object> outputMap = dispatcher.runSync("parseEntityXmlFile", inputMap); if (ServiceUtil.isError(outputMap)) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsErrorParsingFile", UtilMisc.toMap("errorString", ServiceUtil.getErrorMessage(outputMap)), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsErrorParsingFile", + UtilMisc.toMap("errorString", ServiceUtil.getErrorMessage(outputMap)), locale)); } else { Long numberRead = (Long) outputMap.get("rowProcessed"); - messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportRowProcessed", UtilMisc.toMap("numberRead", numberRead.toString()), locale)); + messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportRowProcessed", + UtilMisc.toMap("numberRead", numberRead.toString()), locale)); } } catch (GenericServiceException gsex) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityImportParsingError", UtilMisc.toMap("errorString", gsex.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityImportParsingError", + UtilMisc.toMap("errorString", gsex.getMessage()), locale)); } } else { messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportNoXmlFileSpecified", locale)); @@ -239,7 +246,7 @@ public class WebToolsServices { if (baseDir.isDirectory() && baseDir.canRead()) { File[] fileArray = baseDir.listFiles(); List<File> files = new LinkedList<>(); - for (File file: fileArray) { + for (File file : fileArray) { if (file.getName().toUpperCase().endsWith("XML")) { files.add(file); } @@ -253,7 +260,7 @@ public class WebToolsServices { && files.size() != lastUnprocessedFilesCount) { lastUnprocessedFilesCount = files.size(); unprocessedFiles = new LinkedList<>(); - for (File f: files) { + for (File f : files) { Map<String, Object> parseEntityXmlFileArgs = UtilMisc.toMap("onlyInserts", onlyInserts, "createDummyFks", createDummyFks, "checkDataOnly", checkDataOnly, @@ -267,14 +274,17 @@ public class WebToolsServices { parseEntityXmlFileArgs.put("url", furl); Map<String, Object> outputMap = dispatcher.runSync("parseEntityXmlFile", parseEntityXmlFileArgs); Long numberRead = (Long) outputMap.get("rowProcessed"); - messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportNumberOfEntityToBeProcessed", UtilMisc.toMap("numberRead", numberRead.toString(), "fileName", f.getName()), locale)); + messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportNumberOfEntityToBeProcessed", + UtilMisc.toMap("numberRead", numberRead.toString(), "fileName", f.getName()), locale)); if (deleteFiles) { - messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportDeletFile", UtilMisc.toMap("fileName", f.getName()), locale)); + messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportDeletFile", UtilMisc.toMap("fileName", f.getName()), + locale)); f.delete(); } } catch (Exception e) { unprocessedFiles.add(f); - messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportFailedFile", UtilMisc.toMap("fileName", f.getName()), locale)); + messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportFailedFile", UtilMisc.toMap("fileName", f.getName()), + locale)); } // pause in between files if (pauseLong > 0) { @@ -291,13 +301,15 @@ public class WebToolsServices { messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportPassedFile", UtilMisc.toMap("passes", passes), locale)); Debug.logInfo("Pass " + passes + " complete", MODULE); } - lastUnprocessedFilesCount=unprocessedFiles.size(); + lastUnprocessedFilesCount = unprocessedFiles.size(); messages.add("---------------------------------------"); - messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportSucceededNumberFile", UtilMisc.toMap("succeeded", (initialListSize-lastUnprocessedFilesCount), "total", initialListSize), locale)); - messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportFailedNumberFile", UtilMisc.toMap("failed", lastUnprocessedFilesCount, "total", initialListSize), locale)); + messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportSucceededNumberFile", UtilMisc.toMap("succeeded", + (initialListSize - lastUnprocessedFilesCount), "total", initialListSize), locale)); + messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportFailedNumberFile", UtilMisc.toMap("failed", + lastUnprocessedFilesCount, "total", initialListSize), locale)); messages.add("---------------------------------------"); messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportFailedFileList", locale)); - for (File file: unprocessedFiles) { + for (File file : unprocessedFiles) { messages.add(file.toString()); } } else { @@ -346,7 +358,8 @@ public class WebToolsServices { String helperName = delegator.getGroupHelperName(groupNameToUse); if (helperName == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityImportNoDataSourceSpecified", UtilMisc.toMap("groupNameToUse", groupNameToUse), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityImportNoDataSourceSpecified", + UtilMisc.toMap("groupNameToUse", groupNameToUse), locale)); } // get the reader name URLs first @@ -372,13 +385,13 @@ public class WebToolsServices { int totalRowsChanged = 0; if (UtilValidate.isNotEmpty(urlList)) { messages.add("=-=-=-=-=-=-= Doing a data " + (checkDataOnly ? "check" : "load") + " with the following files:"); - for (URL dataUrl: urlList) { + for (URL dataUrl : urlList) { messages.add(dataUrl.toExternalForm()); } messages.add("=-=-=-=-=-=-= Starting the data " + (checkDataOnly ? "check" : "load") + "..."); - for (URL dataUrl: urlList) { + for (URL dataUrl : urlList) { try { int rowsChanged = 0; if (checkDataOnly) { @@ -389,10 +402,12 @@ public class WebToolsServices { errorMessages.add("Error checking data in [" + dataUrl.toExternalForm() + "]: " + e.toString()); } } else { - rowsChanged = EntityDataLoader.loadData(dataUrl, helperName, delegator, errorMessages, txTimeout, useDummyFks, maintainTxs, tryInserts); + rowsChanged = EntityDataLoader.loadData(dataUrl, helperName, delegator, errorMessages, txTimeout, useDummyFks, maintainTxs, + tryInserts); } totalRowsChanged += rowsChanged; - infoMessages.add(changedFormat.format(rowsChanged) + " of " + changedFormat.format(totalRowsChanged) + " from " + dataUrl.toExternalForm()); + infoMessages.add(changedFormat.format(rowsChanged) + " of " + changedFormat.format(totalRowsChanged) + " from " + + dataUrl.toExternalForm()); } catch (GenericEntityException e) { Debug.logError(e, "Error loading data file: " + dataUrl.toExternalForm(), MODULE); } @@ -411,7 +426,8 @@ public class WebToolsServices { messages.addAll(errorMessages); } - messages.add("=-=-=-=-=-=-= Finished the data " + (checkDataOnly ? "check" : "load") + " with " + totalRowsChanged + " rows " + (checkDataOnly ? "checked" : "changed") + "."); + messages.add("=-=-=-=-=-=-= Finished the data " + (checkDataOnly ? "check" : "load") + " with " + totalRowsChanged + " rows " + + (checkDataOnly ? "checked" : "changed") + "."); Map<String, Object> resultMap = ServiceUtil.returnSuccess(); resultMap.put("messages", messages); @@ -451,7 +467,8 @@ public class WebToolsServices { long numberRead = (url != null ? reader.parse(url) : reader.parse(xmltext)); rowProcessed = numberRead; } catch (Exception ex) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityImportParsingError", UtilMisc.toMap("errorString", ex.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityImportParsingError", UtilMisc.toMap("errorString", + ex.toString()), locale)); } // send the notification Map<String, Object> resp = UtilMisc.<String, Object>toMap("rowProcessed", rowProcessed); @@ -486,11 +503,11 @@ public class WebToolsServices { } int fileNumber = 1; - for (String curEntityName: passedEntityNames) { + for (String curEntityName : passedEntityNames) { long numberWritten = 0; ModelEntity me = delegator.getModelEntity(curEntityName); if (me instanceof ModelViewEntity) { - results.add("[" + fileNumber +"] [vvv] " + curEntityName + " skipping view entity"); + results.add("[" + fileNumber + "] [vvv] " + curEntityName + " skipping view entity"); continue; } List<EntityCondition> conds = new LinkedList<>(); @@ -501,12 +518,13 @@ public class WebToolsServices { try { boolean beganTx = TransactionUtil.begin(); - // some databases don't support cursors, or other problems may happen, so if there is an error here log it and move on to get as much as possible - //Don't bother writing the file if there's nothing to put into it + // some databases don't support cursors, or other problems may happen, so if there is an error here log it and + // move on to get as much as possible. Don't bother writing the file if there's nothing to put into it try (EntityListIterator values = eq.queryIterator()) { GenericValue value = values.next(); if (value != null) { - try (PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outdir, curEntityName +".xml")), "UTF-8")))) { + try (PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream( + new File(outdir, curEntityName + ".xml")), "UTF-8")))) { writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); writer.println("<entity-engine-xml>"); do { @@ -519,15 +537,15 @@ public class WebToolsServices { } while ((value = values.next()) != null); writer.println("</entity-engine-xml>"); } catch (UnsupportedEncodingException | FileNotFoundException e) { - results.add("[" + fileNumber +"] [xxx] Error when writing " + curEntityName + ": " + e); + results.add("[" + fileNumber + "] [xxx] Error when writing " + curEntityName + ": " + e); } - results.add("[" + fileNumber +"] [" + numberWritten + "] " + curEntityName + " wrote " + numberWritten + " records"); + results.add("[" + fileNumber + "] [" + numberWritten + "] " + curEntityName + " wrote " + numberWritten + " records"); } else { - results.add("[" + fileNumber +"] [---] " + curEntityName + " has no records, not writing file"); + results.add("[" + fileNumber + "] [---] " + curEntityName + " has no records, not writing file"); } TransactionUtil.commit(beganTx); } catch (GenericEntityException entityEx) { - results.add("[" + fileNumber +"] [xxx] Error when writing " + curEntityName + ": " + entityEx); + results.add("[" + fileNumber + "] [xxx] Error when writing " + curEntityName + ": " + entityEx); continue; } fileNumber++; @@ -547,58 +565,59 @@ public class WebToolsServices { return resp; } - /** Get entity reference data. Returns the number of entities in + /** + * Get entity reference data. Returns the number of entities in * <code>numberOfEntities</code> and a List of Maps - * <code>packagesList</code>. * Each Map contains:<br> * <ul><li><code>packageName</code> - the entity package name</li> * <li><code>entitiesList</code> - a list of Maps: - <ul> - <li><code>entityName</code></li> - <li><code>helperName</code></li> - <li><code>groupName</code></li> - <li><code>plainTableName</code></li> - <li><code>title</code></li> - <li><code>description</code></li> - <!-- <li><code>location</code></li> --> - <li><code>javaNameList</code> - list of Maps: - <ul> - <li><code>isPk</code></li> - <li><code>name</code></li> - <li><code>colName</code></li> - <li><code>description</code></li> - <li><code>type</code></li> - <li><code>javaType</code></li> - <li><code>sqlType</code></li> - </ul> - </li> - <li><code>relationsList</code> - list of Maps: - <ul> - <li><code>title</code></li> - <!-- <li><code>description</code></li> --> - <li><code>relEntity</code></li> - <li><code>fkName</code></li> - <li><code>type</code></li> - <li><code>length</code></li> - <li><code>keysList</code> - list of Maps: - <ul> - <li><code>row</code></li> - <li><code>fieldName</code></li> - <li><code>relFieldName</code></li> - </ul> - </li> - </ul> - </li> - <li><code>indexList</code> - list of Maps: - <ul> - <li><code>name</code></li> - <!-- <li><code>description</code></li> --> - <li><code>fieldNameList</code> - list of Strings</li> - </ul> - </li> - </ul> - </li></ul> - * */ + * <ul> + * <li><code>entityName</code></li> + * <li><code>helperName</code></li> + * <li><code>groupName</code></li> + * <li><code>plainTableName</code></li> + * <li><code>title</code></li> + * <li><code>description</code></li> + * <!-- <li><code>location</code></li> --> + * <li><code>javaNameList</code> - list of Maps: + * <ul> + * <li><code>isPk</code></li> + * <li><code>name</code></li> + * <li><code>colName</code></li> + * <li><code>description</code></li> + * <li><code>type</code></li> + * <li><code>javaType</code></li> + * <li><code>sqlType</code></li> + * </ul> + * </li> + * <li><code>relationsList</code> - list of Maps: + * <ul> + * <li><code>title</code></li> + * <!-- <li><code>description</code></li> --> + * <li><code>relEntity</code></li> + * <li><code>fkName</code></li> + * <li><code>type</code></li> + * <li><code>length</code></li> + * <li><code>keysList</code> - list of Maps: + * <ul> + * <li><code>row</code></li> + * <li><code>fieldName</code></li> + * <li><code>relFieldName</code></li> + * </ul> + * </li> + * </ul> + * </li> + * <li><code>indexList</code> - list of Maps: + * <ul> + * <li><code>name</code></li> + * <!-- <li><code>description</code></li> --> + * <li><code>fieldNameList</code> - list of Strings</li> + * </ul> + * </li> + * </ul> + * </li></ul> + */ public static Map<String, Object> getEntityRefData(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); @@ -614,7 +633,7 @@ public class WebToolsServices { try { Collection<String> ec = reader.getEntityNames(); resultMap.put("numberOfEntities", ec.size()); - for (String eName: ec) { + for (String eName : ec) { ModelEntity ent = reader.getModelEntity(eName); //make sure the table name is in the list of all table names, if not null if (UtilValidate.isNotEmpty(ent.getPlainTableName())) { @@ -629,7 +648,8 @@ public class WebToolsServices { entities.add(eName); } } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityImportErrorRetrievingEntityNames", locale) + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityImportErrorRetrievingEntityNames", locale) + + e.getMessage()); } String search = (String) context.get("search"); @@ -639,7 +659,7 @@ public class WebToolsServices { Map<String, Object> packageMap = new HashMap<>(); TreeSet<String> entities = entitiesByPackage.get(pName); List<Map<String, Object>> entitiesList = new LinkedList<>(); - for (String entityName: entities) { + for (String entityName : entities) { Map<String, Object> entityMap = new HashMap<>(); String helperName = delegator.getEntityHelperName(entityName); String groupName = delegator.getEntityGroupName(entityName); @@ -688,7 +708,7 @@ public class WebToolsServices { } if (UtilValidate.isEmpty(fieldDescription) && bundle != null) { try { - fieldDescription = bundle.getString("FieldDescription." + field.getName()); + fieldDescription = bundle.getString("FieldDescription." + field.getName()); } catch (Exception exception) { Debug.logWarning("FieldDescription for field " + field.getName() + " is missing", MODULE); } @@ -776,7 +796,8 @@ public class WebToolsServices { packagesList.add(packageMap); } } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityImportErrorRetrievingEntityNames", locale) + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "EntityImportErrorRetrievingEntityNames", locale) + + e.getMessage()); } resultMap.put("packagesList", packagesList); @@ -804,10 +825,12 @@ public class WebToolsServices { outdir.mkdir(); } if (!outdir.isDirectory()) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelFullPathIsNotADirectory", UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelFullPathIsNotADirectory", + UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale)); } if (!outdir.canWrite()) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelFullPathIsNotWriteable", UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelFullPathIsNotWriteable", + UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale)); } Set<String> entityNames = new TreeSet<>(); @@ -818,7 +841,7 @@ public class WebToolsServices { Debug.logInfo("Exporting with entityPackageNameSet: " + entityPackageNameSet, MODULE); Map<String, TreeSet<String>> entitiesByPackage = reader.getEntitiesByPackage(entityPackageNameSet, null); - for (Map.Entry<String, TreeSet<String>> entitiesByPackageMapEntry: entitiesByPackage.entrySet()) { + for (Map.Entry<String, TreeSet<String>> entitiesByPackageMapEntry : entitiesByPackage.entrySet()) { entityNames.addAll(entitiesByPackageMapEntry.getValue()); } } else if (UtilValidate.isNotEmpty(entityGroupId)) { @@ -844,7 +867,7 @@ public class WebToolsServices { topLevelMap.put("EOModelVersion", "\"2.1\""); List<Map<String, Object>> entitiesMapList = new LinkedList<>(); topLevelMap.put("entities", entitiesMapList); - for (String entityName: entityNames) { + for (String entityName : entityNames) { Map<String, Object> entitiesMap = new HashMap<>(); entitiesMapList.add(entitiesMap); entitiesMap.put("className", "EOGenericRecord"); @@ -853,24 +876,31 @@ public class WebToolsServices { UtilPlist.writePlistFile(topLevelMap, eomodeldFullPath, "index.eomodeld", true); // write each <EntityName>.plist file - for (String curEntityName: entityNames) { + for (String curEntityName : entityNames) { ModelEntity modelEntity = reader.getModelEntity(curEntityName); - UtilPlist.writePlistFile(modelEntity.createEoModelMap(entityNamePrefix, datasourceName, entityNames, reader), eomodeldFullPath, curEntityName +".plist", true); + UtilPlist.writePlistFile(modelEntity.createEoModelMap(entityNamePrefix, datasourceName, entityNames, reader), eomodeldFullPath, + curEntityName + ".plist", true); } Integer entityNamesSize = entityNames.size(); - return ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelExported", UtilMisc.toMap("entityNamesSize", entityNamesSize.toString(), "eomodeldFullPath", eomodeldFullPath), locale)); + return ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelExported", + UtilMisc.toMap("entityNamesSize", entityNamesSize.toString(), "eomodeldFullPath", eomodeldFullPath), locale)); } catch (UnsupportedEncodingException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelSavingFileError", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelSavingFileError", + UtilMisc.toMap("errorString", e.toString()), locale)); } catch (FileNotFoundException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelFileOrDirectoryNotFound", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelFileOrDirectoryNotFound", + UtilMisc.toMap("errorString", e.toString()), locale)); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelErrorGettingEntityNames", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelErrorGettingEntityNames", + UtilMisc.toMap("errorString", e.toString()), locale)); } } - /** Performs an entity maintenance security check. Returns hasPermission=true + /** + * Performs an entity maintenance security check. Returns hasPermission=true * if the user has the ENTITY_MAINT permission. - * @param dctx the dispatch context + * + * @param dctx the dispatch context * @param context the context * @return return the result of the service execution */ @@ -908,10 +938,12 @@ public class WebToolsServices { outdir.mkdir(); } if (!outdir.isDirectory()) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelFullPathIsNotADirectory", UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelFullPathIsNotADirectory", + UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale)); } if (!outdir.canWrite()) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelFullPathIsNotWriteable", UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelFullPathIsNotWriteable", + UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale)); } try { @@ -920,11 +952,14 @@ public class WebToolsServices { serviceInfo.writeServiceCallGraphEoModel(eomodeldFullPath); } catch (GeneralException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelErrorGettingEntityNames", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelErrorGettingEntityNames", + UtilMisc.toMap("errorString", e.toString()), locale)); } catch (UnsupportedEncodingException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelSavingFileError", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelSavingFileError", + UtilMisc.toMap("errorString", e.toString()), locale)); } catch (FileNotFoundException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelFileOrDirectoryNotFound", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsEomodelFileOrDirectoryNotFound", + UtilMisc.toMap("errorString", e.toString()), locale)); } return ServiceUtil.returnSuccess(); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/content/ContentWorkerInterface.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/content/ContentWorkerInterface.java index 034ab11..ac40027 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/content/ContentWorkerInterface.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/content/ContentWorkerInterface.java @@ -35,14 +35,23 @@ import org.apache.ofbiz.service.LocalDispatcher; public interface ContentWorkerInterface { // helper methods - public GenericValue getCurrentContentExt(Delegator delegator, List<Map<String, ? extends Object>> trail, GenericValue userLogin, Map<String, Object> ctx, Boolean nullThruDatesOnly, String contentAssocPredicateId) throws GeneralException; - public GenericValue getWebSitePublishPointExt(Delegator delegator, String contentId, boolean ignoreCache) throws GenericEntityException; - public String getMimeTypeIdExt(Delegator delegator, GenericValue view, Map<String, Object> ctx); + GenericValue getCurrentContentExt(Delegator delegator, List<Map<String, ? extends Object>> trail, GenericValue userLogin, + Map<String, Object> ctx, Boolean nullThruDatesOnly, String contentAssocPredicateId) throws GeneralException; + + GenericValue getWebSitePublishPointExt(Delegator delegator, String contentId, boolean ignoreCache) throws GenericEntityException; + + String getMimeTypeIdExt(Delegator delegator, GenericValue view, Map<String, Object> ctx); // new rendering methods - public void renderContentAsTextExt(LocalDispatcher dispatcher, String contentId, Appendable out, Map<String, Object> templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException; - public String renderContentAsTextExt(LocalDispatcher dispatcher, String contentId, Map<String, Object> templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException; + void renderContentAsTextExt(LocalDispatcher dispatcher, String contentId, Appendable out, Map<String, Object> templateContext, Locale locale, + String mimeTypeId, boolean cache) throws GeneralException, IOException; + + String renderContentAsTextExt(LocalDispatcher dispatcher, String contentId, Map<String, Object> templateContext, Locale locale, + String mimeTypeId, boolean cache) throws GeneralException, IOException; + + void renderSubContentAsTextExt(LocalDispatcher dispatcher, String contentId, Appendable out, String mapKey, Map<String, Object> templateContext, + Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException; - public void renderSubContentAsTextExt(LocalDispatcher dispatcher, String contentId, Appendable out, String mapKey, Map<String, Object> templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException; - public String renderSubContentAsTextExt(LocalDispatcher dispatcher, String contentId, String mapKey, Map<String, Object> templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException; + String renderSubContentAsTextExt(LocalDispatcher dispatcher, String contentId, String mapKey, Map<String, Object> templateContext, + Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException; } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/content/DataResourceWorkerInterface.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/content/DataResourceWorkerInterface.java index 3d521f1..beabf85 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/content/DataResourceWorkerInterface.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/content/DataResourceWorkerInterface.java @@ -29,6 +29,6 @@ import org.apache.ofbiz.entity.Delegator; * ContentWorkerInterface */ public interface DataResourceWorkerInterface { - public String renderDataResourceAsTextExt(Delegator delegator, String dataResourceId, Map<String, Object> templateContext, + String renderDataResourceAsTextExt(Delegator delegator, String dataResourceId, Map<String, Object> templateContext, Locale locale, String targetMimeTypeId, boolean cache) throws GeneralException, IOException; } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java index c11fce1..0905fed 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java @@ -812,7 +812,7 @@ public abstract class AbstractModelAction implements Serializable, ModelAction { HttpSession session = (HttpSession) context.get("session"); newValue = getInMemoryPersistedFromField(session, context); if (Debug.verboseOn()) { - Debug.logVerbose("In user getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, MODULE); + Debug.logVerbose("In user getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, MODULE); } } else if (!this.valueExdr.isEmpty()) { newValue = this.valueExdr.expand(context); @@ -822,7 +822,8 @@ public abstract class AbstractModelAction implements Serializable, ModelAction { ServletContext servletContext = (ServletContext) context.get("application"); newValue = getInMemoryPersistedFromField(servletContext, context); if (Debug.verboseOn()) { - Debug.logVerbose("In application getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, MODULE); + Debug.logVerbose("In application getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, + MODULE); } } else if (!this.valueExdr.isEmpty()) { newValue = this.valueExdr.expandString(context); @@ -831,7 +832,7 @@ public abstract class AbstractModelAction implements Serializable, ModelAction { if (!this.fromField.isEmpty()) { newValue = this.fromField.get(context); if (Debug.verboseOn()) { - Debug.logVerbose("Getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, MODULE); + Debug.logVerbose("Getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, MODULE); } } else if (!this.valueExdr.isEmpty()) { newValue = this.valueExdr.expand(context); @@ -885,7 +886,7 @@ public abstract class AbstractModelAction implements Serializable, ModelAction { HttpSession session = (HttpSession) context.get("session"); session.setAttribute(newKey, newValue); if (Debug.verboseOn()) { - Debug.logVerbose("In user setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, MODULE); + Debug.logVerbose("In user setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, MODULE); } } else if (this.toScope != null && "application".equals(this.toScope)) { String originalName = this.field.getOriginalName(); @@ -902,13 +903,13 @@ public abstract class AbstractModelAction implements Serializable, ModelAction { ServletContext servletContext = (ServletContext) context.get("application"); servletContext.setAttribute(newKey, newValue); if (Debug.verboseOn()) { - Debug.logVerbose("In application setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, MODULE); + Debug.logVerbose("In application setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, MODULE); } } else { // only do this if it is not global, if global ONLY put it in the global context if (!global) { if (Debug.verboseOn()) { - Debug.logVerbose("Setting field [" + this.field.getOriginalName() + "] to value: " + newValue, MODULE); + Debug.logVerbose("Setting field [" + this.field.getOriginalName() + "] to value: " + newValue, MODULE); } this.field.put(context, newValue); } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java index 453ca55..ffeddcd 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java @@ -1653,7 +1653,7 @@ public abstract class ModelForm extends ModelWidget { } } - public static interface FieldGroupBase { + public interface FieldGroupBase { } public static class SortField { diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormAction.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormAction.java index efb3caa..cd53b20 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormAction.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormAction.java @@ -115,7 +115,7 @@ public abstract class ModelFormAction { } } - protected static enum ActionsKind { + protected enum ActionsKind { ACTIONS, ROW_ACTIONS } } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java index 394c16e..fde2183 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java @@ -2115,7 +2115,7 @@ public class ModelFormField { } } - public static abstract class FieldInfoWithOptions extends FieldInfo { + public abstract static class FieldInfoWithOptions extends FieldInfo { public static String getDescriptionForOptionKey(String key, List<OptionValue> allOptionValues) { if (UtilValidate.isEmpty(key)) { @@ -3358,7 +3358,7 @@ public class ModelFormField { } } - public static abstract class OptionSource { + public abstract static class OptionSource { private final ModelFormField modelFormField; diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java index 1fdc54e..0ee9088 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java @@ -453,7 +453,7 @@ public class ModelTheme implements Serializable { * Constructor to initialize a ModelTemplate class from xml definition * @param template */ - public ModelTemplate(Element template) { + ModelTemplate(Element template) { this.name = template.getAttribute("name"); this.type = template.getAttribute("type"); this.compress = template.getAttribute("compress"); @@ -497,7 +497,7 @@ public class ModelTheme implements Serializable { * @param currentModelTemplate * @param originModelTemplate */ - public ModelTemplate(ModelTemplate currentModelTemplate, ModelTemplate originModelTemplate) { + ModelTemplate(ModelTemplate currentModelTemplate, ModelTemplate originModelTemplate) { boolean exist = currentModelTemplate != null; this.name = exist ? currentModelTemplate.name : originModelTemplate.name; this.type = exist ? currentModelTemplate.type : originModelTemplate.type; diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java index c87c466..0e7bb70 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java @@ -126,7 +126,7 @@ public abstract class ModelWidgetCondition implements Serializable { } } - public static interface Condition { + public interface Condition { boolean eval(Map<String, Object> context); } @@ -134,7 +134,7 @@ public abstract class ModelWidgetCondition implements Serializable { * A factory for <code>Condition</code> instances. * */ - public static interface ConditionFactory { + public interface ConditionFactory { /** * Returns a new <code>Condition</code> instance built from <code>conditionElement</code>. * diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuStringRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuStringRenderer.java index 2507618..8c8bdda 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuStringRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuStringRenderer.java @@ -30,12 +30,12 @@ import org.apache.ofbiz.widget.model.ModelMenuItem; * Widget Library - Form String Renderer interface */ public interface MenuStringRenderer { - public void renderMenuItem(Appendable writer, Map<String, Object> context, ModelMenuItem menuItem) throws IOException; - public void renderMenuOpen(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException; - public void renderMenuClose(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException; - public void renderFormatSimpleWrapperOpen(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException; - public void renderFormatSimpleWrapperClose(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException; - public void renderFormatSimpleWrapperRows(Appendable writer, Map<String, Object> context, Object menu) throws IOException; - public void renderLink(Appendable writer, Map<String, Object> context, ModelMenuItem.MenuLink link) throws IOException; - public void renderImage(Appendable writer, Map<String, Object> context, Image image) throws IOException; + void renderMenuItem(Appendable writer, Map<String, Object> context, ModelMenuItem menuItem) throws IOException; + void renderMenuOpen(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException; + void renderMenuClose(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException; + void renderFormatSimpleWrapperOpen(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException; + void renderFormatSimpleWrapperClose(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException; + void renderFormatSimpleWrapperRows(Appendable writer, Map<String, Object> context, Object menu) throws IOException; + void renderLink(Appendable writer, Map<String, Object> context, ModelMenuItem.MenuLink link) throws IOException; + void renderImage(Appendable writer, Map<String, Object> context, Image image) throws IOException; } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java index 2c1642f..e464731 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java @@ -563,7 +563,7 @@ public final class MacroFormRenderer implements FormStringRenderer { Debug.logWarning("Invalid value for step property for field[" + paramName + "] with input-method=\"time-dropdown\" " + " Found Value [" + stepString + "] " + e.getMessage(), MODULE); } timeValues.append("["); - for (int i = 0; i <= 59; ) { + for (int i = 0; i <= 59;) { if (i != 0) { timeValues.append(", "); } |
Free forum by Nabble | Edit this page |